135 lines
4.1 KiB
TypeScript
135 lines
4.1 KiB
TypeScript
// Metro module 6572 (f6573).
|
|
import { useRef, useState, useEffect } from "react";
|
|
import IAPStore_android from "../../../../stores/native/IAPStore.android";
|
|
import Logger from "../../../debug/Logger";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import Module12 from "../../../../_bundle/Module12";
|
|
import { loadInAppSkus } from "../../../../actions/native/GPlayActionCreators";
|
|
import { captureBillingException } from "../../../../utils/BillingUtils";
|
|
import { HermesBuiltin } from "../../../../_hermes/prelude";
|
|
let c4231_7, c4231_8, notSupportedReturnVoid;
|
|
const notSupported = function notSupported() {
|
|
throw new Error("Native hook not supported for android");
|
|
};
|
|
notSupportedReturnVoid = function notSupportedReturnVoid() {
|
|
throw new Error("Native hook not supported for android");
|
|
};
|
|
export function useNativeIAPPayments() {
|
|
return c4231_8;
|
|
}
|
|
export function useGoogleSkuIds(a0, a1) {
|
|
let ref;
|
|
const stateFromStores = useStateFromStores([IAPStore_android], () => IAPStore_android.isFetchingGoogleSkus());
|
|
ref = useRef([]);
|
|
let [fetchError, setState] = useState(null);
|
|
useEffect(() => {
|
|
let _fetch2 = function _fetch() {
|
|
const r9 = async () => {
|
|
let c31428_2;
|
|
let c31428_3 = 0;
|
|
let c31968_0, c31968_1;
|
|
let r11 = "Unable to fetch product IDs from google play store: ";
|
|
L18: {
|
|
L17: {
|
|
try {
|
|
c31968_0 = void 0;
|
|
if (a1) {
|
|
ref.current = [];
|
|
}
|
|
const r37 = Module12.difference(a0, ref.current);
|
|
c31968_0 = r37;
|
|
if (stateFromStores) {
|
|
break L18;
|
|
}
|
|
if (a1) {
|
|
break L18;
|
|
}
|
|
if (a0.length === 0) {
|
|
break L18;
|
|
}
|
|
if (r37.length === 0) {
|
|
break L18;
|
|
}
|
|
c31428_3 = 1;
|
|
await loadInAppSkus(r37);
|
|
r11 = "Unable to fetch product IDs from google play store: ";
|
|
ref.current = Module12.union(ref.current, c31968_0);
|
|
(0, setState)(null);
|
|
c31428_3 = 0;
|
|
} catch ($e) {
|
|
const r30 = $e;
|
|
let r7 = r30;
|
|
c31428_2 = r30;
|
|
if (c31428_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r92 = c31428_2;
|
|
c31428_3 = 0;
|
|
c31968_1 = r92;
|
|
c4231_7.error(r11, c31968_1);
|
|
(0, setState)("Unable to fetch");
|
|
captureBillingException(c31968_1);
|
|
break L17;
|
|
} catch (r88) {
|
|
r7 = r88;
|
|
c31428_2 = r88;
|
|
if (c31428_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r7;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
};
|
|
_fetch2 = r9;
|
|
return r9.apply(this, arguments);
|
|
};
|
|
(function() {
|
|
return _fetch2.apply(this, arguments);
|
|
})();
|
|
}, [a1, stateFromStores, a0]);
|
|
return {
|
|
isFetchingGoogleSkus: stateFromStores,
|
|
fetchError
|
|
};
|
|
}
|
|
export function useResubscribeSubscription(a0) {
|
|
return {
|
|
resubscribeSubscription: notSupported,
|
|
nativePaymentsConnected: c4231_8.nativePaymentsConnected
|
|
};
|
|
}
|
|
export function useCancelSubscription(a0, a1) {
|
|
return {
|
|
cancelSubscription: notSupported,
|
|
nativePaymentsConnected: c4231_8.nativePaymentsConnected
|
|
};
|
|
}
|
|
export function useCreateSubscription(a0) {
|
|
if (a0 == null) {
|
|
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
|
|
throw new Error("unreachable");
|
|
}
|
|
return {
|
|
createSubscription: notSupportedReturnVoid,
|
|
nativePaymentsConnected: c4231_8.nativePaymentsConnected
|
|
};
|
|
}
|
|
c4231_7 = new Logger("NativePaymentHooks.android.tsx");
|
|
c4231_8 = {
|
|
nativePaymentsConnected: true,
|
|
storeFront: null
|
|
};
|
|
const r38 = {
|
|
useNativeIAPPayments,
|
|
useGoogleSkuIds,
|
|
useCreateSubscription,
|
|
useCancelSubscription,
|
|
useResubscribeSubscription
|
|
};
|
|
export default r38;
|