This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,134 @@
// 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;
@@ -0,0 +1,284 @@
// Metro module 6666 (f6667).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useEffect, useCallback, useMemo } from "react";
import GenericIAPStore from "../../../billing/native/GenericIAPStore";
import SubscriptionPlanStore from "../../../../stores/billing/SubscriptionPlanStore";
import SubscriptionStore from "../../../../stores/billing/SubscriptionStore";
import IAPStore_android from "../../../../stores/native/IAPStore.android";
import { PurchaseTypeToAnalyticsPaymentType, PurchaseTypes, SubscriptionTypes } from "../../../../Constants";
import Logger from "../../../debug/Logger";
import { useStateFromStoresArray, useStateFromStores } from "../../../../_bundle/Module589";
import BillingActionCreators, { createGenericSubscription, cancelGenericSubscription, resubscribeGenericSubscription } from "../../../../actions/native/BillingActionCreators";
import useTimeout from "../../../../hooks/useTimeout";
import useCreateSubscriptionParams from "../../../billing/native/subscription/useCreateSubscriptionParams";
import useInitialValue from "../../../../hooks/useInitialValue";
import { getNewAnalyticsLoadId } from "../../../../utils/AnalyticsUtils";
import { trackPaymentFlowStartedAnalyticsAndCTP } from "../../../experiments/trigger_points/PaymentFlowStartedTriggerPoint";
import { ProductIds } from "../../../premium/native/ProductIds.android";
import Module38 from "../../../../_bundle/Module38";
import { fetchSubscriptions } from "../../../billing/actions/BillingActionCreators";
import useCancelSubscriptionParams from "../../../billing/native/subscription/useCancelSubscriptionParams";
import useResubscribeSubscriptionParams from "../../../billing/native/subscription/useResubscribeSubscriptionParams";
function $mk78883($env) {
return () => {
if (!$env[1]) {
const r4 = $env.$parent;
(0, r4[1])(r4[2][10]).loadProducts();
}
};
}
function $mk78884($env) {
return () => {
const r7 = $env;
if (!(r7[4] || $env.$parent[15])) {
const r11 = $env.$parent;
r11[15] = true;
const r6 = (0, r11[0])(r11[2][12]);
const r10 = r7[3];
let loadedProducts = r10 == null ? void 0 : r10.map((item) => item.identifier);
if (loadedProducts == null) {
loadedProducts = [];
}
r6.captureBillingMessage("useNativeIAPPayments failed to load required context", {
tags: {
alertPriority: "0"
},
extra: {
loadedProducts,
connected: r7[0],
genericProductsLoaded: r7[1],
storeFront: r7[2]
}
});
}
};
}
let c4268_13, c4268_14, c4268_15;
let $mk78882 = function() {
return () => [GenericIAPStore.isGenericIapConnected(), GenericIAPStore.genericProductsLoaded(), GenericIAPStore.getStoreFront(), IAPStore_android.getProducts()];
};
let env4268 = {};
export function useNativeIAPPayments() {
let env15829;
const r3 = env15829 = {
$parent: env4268
};
const r18 = _slicedToArray(useStateFromStoresArray([GenericIAPStore, IAPStore_android], $mk78882()), 4);
let nativePaymentsConnected = r18[0];
env15829[0] = nativePaymentsConnected;
const r20 = r18[1];
env15829[1] = r20;
const storeFront = r18[2];
env15829[2] = storeFront;
env15829[3] = r18[3];
if (nativePaymentsConnected) {
nativePaymentsConnected = r20;
}
if (nativePaymentsConnected) {
nativePaymentsConnected = storeFront != null;
}
env15829[4] = nativePaymentsConnected;
useEffect($mk78883(r3), [r20]);
useTimeout($mk78884(r3), 5000);
return {
nativePaymentsConnected,
storeFront
};
}
export function useCreateSubscription({ planId, skuId, applicationId, analyticsLocation }) {
let c15830_5, load_id, callback;
let env15831;
c15830_5 = void 0;
load_id = void 0;
callback = void 0;
const r10 = env15831 = {
$parent: env4268
};
env15831[0] = void 0;
env15831[1] = void 0;
env15831[2] = void 0;
env15831[3] = void 0;
env15831[4] = void 0;
const r25 = _slicedToArray(useStateFromStoresArray([GenericIAPStore, IAPStore_android], $mk78882()), 4);
let nativePaymentsConnected = r25[0];
env15831[0] = nativePaymentsConnected;
const r27 = r25[1];
env15831[1] = r27;
const r28 = r25[2];
env15831[2] = r28;
env15831[3] = r25[3];
if (nativePaymentsConnected) {
nativePaymentsConnected = r27;
}
if (nativePaymentsConnected) {
nativePaymentsConnected = r28 != null;
}
env15831[4] = nativePaymentsConnected;
useEffect($mk78883(r10), [r27]);
useTimeout($mk78884(r10), 5000);
let c15830_4 = nativePaymentsConnected;
const createSubscriptionParams = useCreateSubscriptionParams(useStateFromStores([SubscriptionPlanStore], () => SubscriptionPlanStore.get(planId), [planId]), r28);
c15830_5 = createSubscriptionParams;
load_id = useInitialValue(() => getNewAnalyticsLoadId());
callback = useCallback(() => {
trackPaymentFlowStartedAnalyticsAndCTP({
load_id,
payment_type: PurchaseTypeToAnalyticsPaymentType[PurchaseTypes.SUBSCRIPTION],
subscription_plan_gateway_plan_id: ProductIds.GENERIC_SUBSCRIPTION,
subscription_type: SubscriptionTypes.GUILD,
is_gift: false,
location: analyticsLocation,
application_id: applicationId,
subscription_plan_id: planId,
sku_id: skuId
});
}, [load_id, analyticsLocation, applicationId, planId, skuId]);
return {
createSubscription: useCallback(async () => {
let c25942_3 = 0;
let r10 = "error consuming pending purchases but we'll try to let user purchase";
L13: {
try {
Module38(c15830_4, "cannot connect to IAP API");
Module38(c15830_5 != null, "plan not found");
c25942_3 = 1;
await BillingActionCreators.restoreAndApplyPurchases();
r10 = "error consuming pending purchases but we'll try to let user purchase";
c25942_3 = 0;
(0, callback)();
await createGenericSubscription(c15830_5);
r10 = "error consuming pending purchases but we'll try to let user purchase";
await fetchSubscriptions();
r10 = "error consuming pending purchases but we'll try to let user purchase";
} catch ($e) {
let r7 = $e;
if (c25942_3 !== 0) {
while (true) {
try {
c25942_3 = 0;
c4268_13.error(r10);
(0, callback)();
await createGenericSubscription(c15830_5);
r10 = "error consuming pending purchases but we'll try to let user purchase";
await fetchSubscriptions();
r10 = "error consuming pending purchases but we'll try to let user purchase";
break L13;
} catch ($e) {
r7 = $e;
if (c25942_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
}, [createSubscriptionParams, nativePaymentsConnected, callback]),
nativePaymentsConnected
};
}
export function useCancelSubscription(a0, a1) {
let memo, c15832_6;
let env15833;
const r11 = env15833 = {
$parent: env4268
};
const r22 = _slicedToArray(useStateFromStoresArray([GenericIAPStore, IAPStore_android], $mk78882()), 4);
let nativePaymentsConnected = r22[0];
env15833[0] = nativePaymentsConnected;
const r24 = r22[1];
env15833[1] = r24;
const r14 = r22[2];
env15833[2] = r14;
env15833[3] = r22[3];
if (nativePaymentsConnected) {
nativePaymentsConnected = r24;
}
if (nativePaymentsConnected) {
nativePaymentsConnected = r14 != null;
}
env15833[4] = nativePaymentsConnected;
useEffect($mk78883(r11), [r24]);
useTimeout($mk78884(r11), 5000);
let c15832_2 = nativePaymentsConnected;
let c15832_3 = r14;
const stateFromStores = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getSubscriptionById(a0), [a0]);
memo = useMemo(() => stateFromStores != null && c15832_3 != null && stateFromStores.currency === c15832_3.currency, [r14, stateFromStores]);
const cancelSubscriptionParams = useCancelSubscriptionParams(a0);
c15832_6 = cancelSubscriptionParams;
return {
cancelSubscription: useCallback(async () => {
let c25943_1;
c25943_1 = void 0;
Module38(memo, "Cannot update subscription");
Module38(c15832_2, "Cannot connect to IAP API");
Module38(c15832_6 != null, "Subscription not found");
let c29809_0 = await cancelGenericSubscription(c15832_6.requestIdentifier, c15832_6.subscriptionId, a1);
await fetchSubscriptions();
return c29809_0;
}, [memo, cancelSubscriptionParams, nativePaymentsConnected, a1]),
nativePaymentsConnected
};
}
export function useResubscribeSubscription(a0) {
let memo2, c15834_5;
let env15835;
const r9 = env15835 = {
$parent: env4268
};
const r21 = _slicedToArray(useStateFromStoresArray([GenericIAPStore, IAPStore_android], $mk78882()), 4);
let nativePaymentsConnected = r21[0];
env15835[0] = nativePaymentsConnected;
const r23 = r21[1];
env15835[1] = r23;
const r24 = r21[2];
env15835[2] = r24;
env15835[3] = r21[3];
if (nativePaymentsConnected) {
nativePaymentsConnected = r23;
}
if (nativePaymentsConnected) {
nativePaymentsConnected = r24 != null;
}
env15835[4] = nativePaymentsConnected;
useEffect($mk78883(r9), [r23]);
useTimeout($mk78884(r9), 5000);
let c15834_1 = nativePaymentsConnected;
let c15834_2 = r24;
const stateFromStores2 = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getSubscriptionById(a0), [a0]);
memo2 = useMemo(() => stateFromStores2 != null && c15834_2 != null && stateFromStores2.currency === c15834_2.currency, [r24, stateFromStores2]);
const resubscribeSubscriptionParams = useResubscribeSubscriptionParams(a0);
c15834_5 = resubscribeSubscriptionParams;
return {
resubscribeSubscription: useCallback(async () => {
let c25944_1;
c25944_1 = void 0;
Module38(memo2, "Cannot update subscription");
Module38(c15834_1, "Cannot connect to IAP API");
Module38(c15834_5 != null, "Subscription not found");
Module38(stateFromStores2 != null, "Subscription not found");
let c29810_0 = await resubscribeGenericSubscription(c15834_5, stateFromStores2.isACOM);
await fetchSubscriptions();
return c29810_0;
}, [memo2, nativePaymentsConnected, resubscribeSubscriptionParams, stateFromStores2]),
nativePaymentsConnected
};
}
export function useGoogleSkuIds() {
return c4268_14;
}
c4268_13 = new Logger("NativePaymentHooks.ios.tsx");
c4268_14 = {
isFetchingGoogleSkus: false,
fetchError: null
};
c4268_15 = false;
const r48 = {
useNativeIAPPayments,
useGoogleSkuIds,
useCreateSubscription,
useCancelSubscription,
useResubscribeSubscription
};
export default r48;
@@ -0,0 +1,28 @@
// Metro module 8806 (f8807).
import { useState, useCallback, useMemo } from "react";
export function useOrderContext(a0) {
const [state, setState] = useState(a0);
const callback = useCallback((revision) => {
setState((prevState) => prevState != null ? {
...prevState,
revision
} : prevState);
}, []);
return useMemo(() => {
const id = state?.id;
const r9 = state == null;
let orderLineItemId = void 0;
if (!r9) {
const order_line_items = state.order_line_items;
orderLineItemId = order_line_items == null ? void 0 : order_line_items[0]?.id;
}
return {
order: state,
setOrder: setState,
setRevision: callback,
orderId: id,
orderLineItemId,
revision: state?.revision
};
}, [state, setState, callback]);
}