decord/source/modules/payments/native/hooks/NativePaymentHooks.ios.tsx

402 lines
13 KiB
TypeScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 7414
// Function ID: 7415
2026-07-20 16:05:17 +00:00
// Name: useNativeIAPPayments
2026-08-08 06:10:11 +00:00
// Dependencies: [5, 32, 19, 5860, 3952, 3953, 5858, 676, 3, 589, 6883, 7415, 3962, 7416, 5716, 698, 7375, 5861, 38, 4623, 7418, 7419, 2]
2026-07-29 08:29:29 +00:00
// Exports: useCancelSubscription, useCreateSubscription, useGoogleSkuIds, useNativeIAPPayments, useResubscribeSubscription
2026-07-20 16:05:17 +00:00
2026-08-08 06:10:11 +00:00
// Module 7414 (useNativeIAPPayments)
2026-07-29 08:29:29 +00:00
import reset from "reset";
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import _deletePaymentSource from "_deletePaymentSource";
import isGenericIapConnected from "isGenericIapConnected";
import addSubscriptionPlan from "addSubscriptionPlan";
import closure_8 from "reset";
import updateProduct from "updateProduct";
2026-07-23 10:11:24 +00:00
import ME from "ME";
2026-07-29 08:29:29 +00:00
let c10;
2026-07-23 10:11:24 +00:00
let closure_12;
2026-07-29 08:29:29 +00:00
let unpackModuleId;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function useNativeIAPPayments() {
2026-07-29 08:29:29 +00:00
const items = [isGenericIapConnected, updateProduct];
const tmp2 = nativePaymentsConnected(nativePaymentsConnected(storeFront[9]).useStateFromStoresArray(items, () => {
const items = [isGenericIapConnected.isGenericIapConnected(), isGenericIapConnected.genericProductsLoaded(), isGenericIapConnected.getStoreFront(), products.getProducts()];
2026-07-20 16:05:17 +00:00
return items;
}), 4);
2026-07-29 08:29:29 +00:00
nativePaymentsConnected = tmp2[0];
const importDefault = tmp4;
storeFront = tmp2[2];
let reset = tmp2[3];
if (nativePaymentsConnected) {
nativePaymentsConnected = tmp4;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (nativePaymentsConnected) {
nativePaymentsConnected = null != storeFront;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const items1 = [tmp2[1]];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-07-29 08:29:29 +00:00
if (!first) {
const products = first(tmp6[10]).loadProducts();
const obj = first(tmp6[10]);
2026-07-20 16:05:17 +00:00
}
}, items1);
2026-07-29 08:29:29 +00:00
importDefault(storeFront[11])(() => {
let tmp = memo;
if (!memo) {
2026-07-23 10:11:24 +00:00
tmp = outer1_15;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
2026-07-23 10:11:24 +00:00
outer1_15 = true;
2026-07-29 08:29:29 +00:00
let obj = first(tmp6[12]);
obj = { tags: null, extra: null };
obj[0] = { alertPriority: "0" };
2026-07-20 16:05:17 +00:00
let mapped;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
mapped = arr.map((identifier) => identifier.identifier);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (mapped == null) {
2026-07-20 16:05:17 +00:00
mapped = [];
}
2026-07-29 08:29:29 +00:00
obj = { loadedProducts: null, connected: null, genericProductsLoaded: null, storeFront: null };
obj[0] = mapped;
obj[1] = first;
obj[2] = first;
obj[3] = first;
obj[1] = obj;
2026-07-20 16:05:17 +00:00
const result = obj.captureBillingMessage("useNativeIAPPayments failed to load required context", obj);
2026-07-29 08:29:29 +00:00
arr = stateFromStores;
2026-07-20 16:05:17 +00:00
}
}, 5000);
2026-07-29 08:29:29 +00:00
return { nativePaymentsConnected, storeFront };
2026-07-20 16:05:17 +00:00
}
function useCreateSubscription(planId) {
planId = planId.planId;
2026-07-29 08:29:29 +00:00
let first = planId;
2026-07-20 16:05:17 +00:00
const skuId = planId.skuId;
2026-07-29 08:29:29 +00:00
let importDefault = skuId;
2026-07-20 16:05:17 +00:00
const applicationId = planId.applicationId;
2026-07-29 08:29:29 +00:00
let dependencyMap = applicationId;
2026-07-20 16:05:17 +00:00
const analyticsLocation = planId.analyticsLocation;
2026-07-29 08:29:29 +00:00
let callback = analyticsLocation;
first = undefined;
let React;
let c6;
callback = undefined;
first = undefined;
importDefault = undefined;
dependencyMap = undefined;
callback = undefined;
first = undefined;
let obj = first(589);
const items = [c6, updateProduct];
const tmp3 = first(obj.useStateFromStoresArray(items, () => {
const items = [isGenericIapConnected.isGenericIapConnected(), isGenericIapConnected.genericProductsLoaded(), isGenericIapConnected.getStoreFront(), products.getProducts()];
return items;
}), 4);
first = tmp3[0];
importDefault = tmp5;
dependencyMap = tmp6;
callback = tmp3[3];
if (first) {
first = tmp5;
}
if (first) {
first = null != tmp6;
}
const items1 = [tmp3[1]];
const effect = React.useEffect(() => {
if (!first) {
const products = first(tmp6[10]).loadProducts();
const obj = first(tmp6[10]);
}
}, items1);
2026-08-08 06:10:11 +00:00
importDefault(7415)(() => {
2026-07-29 08:29:29 +00:00
let tmp = memo;
if (!memo) {
tmp = outer1_15;
}
if (!tmp) {
outer1_15 = true;
let obj = first(tmp6[12]);
obj = { tags: null, extra: null };
obj[0] = { alertPriority: "0" };
let mapped;
if (stateFromStores != null) {
mapped = arr.map((identifier) => identifier.identifier);
}
if (mapped == null) {
mapped = [];
}
obj = { loadedProducts: null, connected: null, genericProductsLoaded: null, storeFront: null };
obj[0] = mapped;
obj[1] = first;
obj[2] = first;
obj[3] = first;
obj[1] = obj;
const result = obj.captureBillingMessage("useNativeIAPPayments failed to load required context", obj);
arr = stateFromStores;
}
}, 5000);
const items2 = [callback];
const items3 = [planId];
const stateFromStores = first(589).useStateFromStores(items2, () => callback.get(first), items3);
2026-08-08 06:10:11 +00:00
const tmp11 = importDefault(7416)(stateFromStores, tmp3[2]);
2026-07-29 08:29:29 +00:00
React = tmp11;
2026-08-08 06:10:11 +00:00
const tmp12 = importDefault(5716)(() => first(_undefined[15]).getNewAnalyticsLoadId());
2026-07-29 08:29:29 +00:00
c6 = tmp12;
const items4 = [tmp12, analyticsLocation, applicationId, planId, skuId];
2026-07-20 16:05:17 +00:00
callback = React.useCallback(() => {
2026-07-29 08:29:29 +00:00
let obj = first(_undefined[16]);
obj = { load_id: c6, payment_type: outer1_10[outer1_11.SUBSCRIPTION], subscription_plan_gateway_plan_id: first(_undefined[17]).ProductIds.GENERIC_SUBSCRIPTION, subscription_type: outer1_12.GUILD, is_gift: false, location: reset, application_id: _undefined, subscription_plan_id: first, sku_id: c1 };
2026-07-20 16:05:17 +00:00
const result = obj.trackPaymentFlowStartedAnalyticsAndCTP(obj);
2026-07-29 08:29:29 +00:00
}, items4);
2026-07-20 16:05:17 +00:00
obj = {
2026-07-29 08:29:29 +00:00
createSubscription: React.useCallback(callback(function*() {
2026-08-04 21:03:28 +00:00
let closure_0 = tmp3;
v0(outer1_2[18])(c4, "cannot connect to IAP API");
v0(outer1_2[18])(null != outer1_5, "plan not found");
let c3 = 1;
yield v0(outer1_2[10]).restoreAndApplyPurchases();
if (1 === tmp7) {
c3 = 0;
outer1_13.error("error consuming pending purchases but we'll try to let user purchase");
outer1_7();
const genericSubscription = outer1_0(outer1_2[10]).createGenericSubscription(outer1_5);
v0 = 2;
c4 = 1;
const obj6 = outer1_0(outer1_2[10]);
} else if (2 === tmp7) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-08-04 21:03:28 +00:00
c4 = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-04 21:03:28 +00:00
c4 = 3;
let obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
obj2 = outer1_0(outer1_2[19]);
v0 = 4;
c4 = 1;
const obj3 = { value: null, done: false };
obj3[0] = obj2.fetchSubscriptions();
return obj3;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
} else if (3 === tmp7) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 !== 2) {
c3 = 0;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
const obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c4 = 3;
2026-08-08 06:10:11 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
c3 = 0;
return arg1;
2026-07-29 08:29:29 +00:00
}), items5),
nativePaymentsConnected: first
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
items5 = [tmp11, first, callback];
2026-07-20 16:05:17 +00:00
return obj;
}
function useCancelSubscription(arg0, arg1) {
2026-07-29 08:29:29 +00:00
let first = arg0;
let importDefault = arg1;
let obj = first(first[9]);
const items = [isGenericIapConnected, updateProduct];
let tmp3 = stateFromStores(obj.useStateFromStoresArray(items, () => {
const items = [isGenericIapConnected.isGenericIapConnected(), isGenericIapConnected.genericProductsLoaded(), isGenericIapConnected.getStoreFront(), products.getProducts()];
return items;
}), 4);
first = tmp3[0];
importDefault = tmp5;
first = tmp6;
let callback = tmp3[3];
if (first) {
first = tmp5;
}
if (first) {
first = null != tmp6;
}
stateFromStores = first;
const items1 = [tmp3[1]];
const effect = memo.useEffect(() => {
if (!first) {
const products = first(tmp6[10]).loadProducts();
const obj = first(tmp6[10]);
}
}, items1);
importDefault(first[11])(() => {
let tmp = memo;
if (!memo) {
tmp = outer1_15;
}
if (!tmp) {
outer1_15 = true;
let obj = first(tmp6[12]);
obj = { tags: null, extra: null };
obj[0] = { alertPriority: "0" };
let mapped;
if (stateFromStores != null) {
mapped = arr.map((identifier) => identifier.identifier);
}
if (mapped == null) {
mapped = [];
}
obj = { loadedProducts: null, connected: null, genericProductsLoaded: null, storeFront: null };
obj[0] = mapped;
obj[1] = first;
obj[2] = first;
obj[3] = first;
obj[1] = obj;
const result = obj.captureBillingMessage("useNativeIAPPayments failed to load required context", obj);
arr = stateFromStores;
}
}, 5000);
callback = tmp6;
const items2 = [closure_8];
const items3 = [arg0];
stateFromStores = first(first[9]).useStateFromStores(items2, () => outer1_8.getSubscriptionById(first), items3);
const items4 = [tmp3[2], stateFromStores];
memo = memo.useMemo(() => {
let tmp3 = null != stateFromStores;
if (tmp3) {
tmp3 = null != tmp2;
}
if (tmp3) {
tmp3 = stateFromStores.currency === tmp2.currency;
}
return tmp3;
}, items4);
const tmp12 = importDefault(first[20])(arg0);
isGenericIapConnected = tmp12;
2026-07-20 16:05:17 +00:00
obj = {
2026-07-29 08:29:29 +00:00
cancelSubscription: memo.useCallback(callback(function*() {
2026-08-04 21:03:28 +00:00
let closure_0 = tmp2;
outer1_1(38)(outer1_5, "Cannot update subscription");
outer1_1(38)(dependencyMap, "Cannot connect to IAP API");
outer1_1(38)(null != outer1_6, "Subscription not found");
2026-08-08 06:10:11 +00:00
closure_0 = yield outer1_0(6883).cancelGenericSubscription(outer1_6.requestIdentifier, outer1_6.subscriptionId, outer1_1);
const obj2 = outer1_0(4623);
2026-08-04 21:03:28 +00:00
yield obj2.fetchSubscriptions();
return closure_0;
2026-07-29 08:29:29 +00:00
}), items5),
nativePaymentsConnected: first
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
items5 = [memo, tmp12, first, arg1];
2026-07-20 16:05:17 +00:00
return obj;
}
function useResubscribeSubscription(arg0) {
2026-07-29 08:29:29 +00:00
let first = arg0;
let obj = first(589);
let items = [isGenericIapConnected, updateProduct];
let tmp3 = memo(obj.useStateFromStoresArray(items, () => {
const items = [isGenericIapConnected.isGenericIapConnected(), isGenericIapConnected.genericProductsLoaded(), isGenericIapConnected.getStoreFront(), products.getProducts()];
return items;
}), 4);
first = tmp3[0];
first = tmp5;
let dependencyMap = tmp6;
let stateFromStores = tmp3[3];
if (first) {
first = tmp5;
}
if (first) {
first = null != tmp6;
}
memo = first;
const items1 = [tmp3[1]];
const effect = React.useEffect(() => {
if (!first) {
const products = first(tmp6[10]).loadProducts();
const obj = first(tmp6[10]);
}
}, items1);
2026-08-08 06:10:11 +00:00
first(7415)(() => {
2026-07-29 08:29:29 +00:00
let tmp = memo;
if (!memo) {
tmp = outer1_15;
}
if (!tmp) {
outer1_15 = true;
let obj = first(tmp6[12]);
obj = { tags: null, extra: null };
obj[0] = { alertPriority: "0" };
let mapped;
if (stateFromStores != null) {
mapped = arr.map((identifier) => identifier.identifier);
}
if (mapped == null) {
mapped = [];
}
obj = { loadedProducts: null, connected: null, genericProductsLoaded: null, storeFront: null };
obj[0] = mapped;
obj[1] = first;
obj[2] = first;
obj[3] = first;
obj[1] = obj;
const result = obj.captureBillingMessage("useNativeIAPPayments failed to load required context", obj);
arr = stateFromStores;
}
}, 5000);
dependencyMap = tmp6;
const items2 = [closure_8];
const items3 = [arg0];
stateFromStores = first(589).useStateFromStores(items2, () => outer1_8.getSubscriptionById(first), items3);
const items4 = [tmp3[2], stateFromStores];
memo = React.useMemo(() => {
let tmp3 = null != stateFromStores;
if (tmp3) {
tmp3 = null != tmp2;
}
if (tmp3) {
tmp3 = stateFromStores.currency === tmp2.currency;
}
return tmp3;
}, items4);
2026-08-08 06:10:11 +00:00
const tmp12 = first(7419)(arg0);
2026-07-29 08:29:29 +00:00
React = tmp12;
2026-07-20 16:05:17 +00:00
obj = {
2026-07-29 08:29:29 +00:00
resubscribeSubscription: React.useCallback(stateFromStores(function*() {
2026-08-04 21:03:28 +00:00
let closure_0 = tmp2;
outer1_1(38)(outer1_4, "Cannot update subscription");
outer1_1(38)(outer1_1, "Cannot connect to IAP API");
outer1_1(38)(null != outer1_5, "Subscription not found");
outer1_1(38)(null != isACOM, "Subscription not found");
2026-08-08 06:10:11 +00:00
closure_0 = yield outer1_0(6883).resubscribeGenericSubscription(outer1_5, isACOM.isACOM);
const obj2 = outer1_0(4623);
2026-08-04 21:03:28 +00:00
yield obj2.fetchSubscriptions();
return closure_0;
2026-07-29 08:29:29 +00:00
}), items5),
nativePaymentsConnected: first
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
items5 = [memo, first, tmp12, stateFromStores];
2026-07-20 16:05:17 +00:00
return obj;
}
function useGoogleSkuIds() {
return closure_14;
}
2026-07-29 08:29:29 +00:00
({ PurchaseTypeToAnalyticsPaymentType: c10, PurchaseTypes: unpackModuleId, SubscriptionTypes: closure_12 } = ME);
2026-07-23 10:11:24 +00:00
let closure_14 = { isFetchingGoogleSkus: false, fetchError: null };
let c15 = false;
2026-07-29 08:29:29 +00:00
let tmp3 = new require("isGenericIapConnected")("NativePaymentHooks.ios.tsx");
let result = require("noop").fileFinishedImporting("modules/payments/native/hooks/NativePaymentHooks.ios.tsx");
2026-07-20 16:05:17 +00:00
export default { useNativeIAPPayments, useGoogleSkuIds, useCreateSubscription, useCancelSubscription, useResubscribeSubscription };
export { useNativeIAPPayments };
export { useCreateSubscription };
export { useCancelSubscription };
export { useResubscribeSubscription };
export { useGoogleSkuIds };