// Metro module 6300 (f6301). import _objectWithoutProperties from "../../_bundle/_objectWithoutProperties"; import _asyncToGenerator from "../../_bundle/_asyncToGenerator"; import { NativeModules } from "react-native"; import { useGPlayAnalyticsStore, deleteGPlayAnalytics } from "../../modules/gplay/native/GPlayAnalyticsStore"; import AuthenticationStore from "../../stores/AuthenticationStore"; import IAPStore_android from "../../stores/native/IAPStore.android"; import { PriceSetAssignmentPurchaseTypes, AnalyticEvents, Endpoints } from "../../Constants"; import { GPlaySkusType, GPlayBillingResult } from "../../modules/gplay/native/Constants"; import { SubscriptionPlanInfo, PremiumSubscriptionSKUs } from "../../modules/premium/PremiumConstants"; import { PaymentGateways } from "../../_bundle/Module505"; import Logger from "../../modules/debug/Logger"; import { getPlanIdForGift, AppStorePremiumProductIdsToPremiumBundledItems, SubscriptionProductIds, IAPProductIds } from "../../modules/premium/native/ProductIds.android"; import { fetchSubscriptionPlansBySKUs } from "../SubscriptionPlanActionCreators"; import { CountryCodes } from "../../_bundle/Module3872"; import Dispatcher from "../../Dispatcher"; import { isGooglePlayBillingSupported } from "../../modules/device/BillingPlatformUtils"; import { captureBillingException, calculateStandardizedUnits } from "../../utils/BillingUtils"; import AlertActionCreators from "../AlertActionCreators"; import { intl, t } from "../../intl/index.native"; import AnalyticsUtils from "../../utils/AnalyticsUtils"; import { HTTP } from "../../_bundle/sendRequest"; import { HermesBuiltin, $createGenerator } from "../../_hermes/prelude"; function $mk78260($env) { return function() { let env25777 = { $parent: $env }; env25777[0] = Array.prototype.slice.call(arguments, 0); env25777[5] = 0; env25777[6] = 0; env25777[4] = 0; const r4 = $createGenerator(function() { let value2; const r0 = env25777[6]; if (r0 === 2) { env25777[6] = 3; HermesBuiltin.throwTypeError("Generator functions may not be called on executing generators"); throw new Error("unreachable"); } const value = arguments[1]; const r3 = arguments[0]; const r15 = env25777.$parent; if (r0 === 3) { if (r3 === 1) { throw value; } if (r3 === 2) { return { value, done: true }; } return { value: void 0, done: true }; } while (true) { L42: { L40: { L35: { L33: { L28: { L10: { try { env25777[6] = 2; const r27 = env25777[5]; if (r27 === 0) { if (r3 === 1) { env25777[6] = 3; throw value; } if (r3 === 2) { env25777[6] = 3; break L42; } let env29717; env25777[2] = r15; const r111 = env29717 = {}; env25777[1] = r111; env29717[0] = env25777[0]; env29717[1] = void 0; env29717[2] = void 0; env29717[3] = void 0; env25777[5] = 1; env25777[6] = 1; break L40; } if (r27 === 1) { if (r3 === 1) { env25777[6] = 3; throw value; } if (r3 === 2) { env25777[6] = 3; break L35; } const r97 = env25777[1]; const r98 = env25777[2]; env25777[4] = 1; value2 = r98[0].apply(void 0, [...r97[0]]); env25777[5] = 3; env25777[6] = 1; break L33; } if (r27 === 2) { const r33 = env25777[1]; const r18 = env25777[2]; const r19 = env25777[3]; env25777[4] = 0; r33[4] = r19; const r35 = r18.$parent[16]; const r44 = [r35.SERVICE_DISCONNECTED, r35.SERVICE_TIMEOUT, r35.SERVICE_UNAVAILABLE, r35.BILLING_UNAVAILABLE, r35.FEATURE_NOT_SUPPORTED, r35.BILLING_CLIENT_NOT_READY].map(String); const code = r33[4]?.code; const r48 = env25777[1]; r48[1] = r44.includes(code); const r50 = r48[4]; const r51 = r50 == null; let r52 = void 0; if (!r51) { const message = r50.message; r52 = message == null ? void 0 : message.includes("max attempts exceeded"); } const r56 = env25777[1]; r56[2] = r52 === true; const r58 = r56[4]; const r59 = r58 == null; let r60 = void 0; if (!r59) { const message2 = r58.message; r60 = message2 == null ? void 0 : message2.includes("returned null"); } const r64 = env25777[1]; r64[3] = r60 === true; if (!r64[1] && (!r64[2] && !r64[3])) { const r70 = env25777[2].$parent; (0, r70[0])(r70[2][16]).captureBillingException(r64[4]); } else if (Math.random() < 0.01) { const r81 = env25777[1]; const r83 = env25777[2].$parent; (0, r83[0])(r83[2][16]).captureBillingException(r81[4]); } if (env25777[2][1]) { throw env25777[1][4]; } env25777[6] = 3; break L28; } if (r3 === 1) { env25777[6] = 3; throw value; } if (r3 === 2) { env25777[4] = 0; env25777[6] = 3; break L10; } env25777[4] = 0; env25777[6] = 3; } catch (r118) { env25777[3] = r118; if (env25777[4] === 0) { env25777[6] = 3; throw r118; } env25777[5] = 2; continue; } return { value, done: true }; } return { value, done: true }; } return { value: void 0, done: true }; } return { value: value2, done: false }; } return { value, done: true }; } return { value: void 0, done: false }; } return { value, done: true }; } }); r4.next(); return r4; }; } function $mk105037($env) { return function fetchDesktopInAppSkus(a0) { const r3 = []; for (const item of a0) { try { getPlanIdForGift(item); r3.push(item); } catch ($e) {} } return r3.length === 0 ? Promise.resolve([]) : (0, fetchDesktopSubscriptionSkus)(r3, PriceSetAssignmentPurchaseTypes.GIFT, true); }; } let fetchDesktopSubscriptionSkus, _excluded, _excluded2, _excluded3, _excluded4, BillingManager, c4015_22, c4016_0, c4016_1, c4015_26, c4017_0, c4017_1, c4015_27, c4018_0, c4018_1, c4020_0, c4020_1, c4015_31; let env4015; let env4016; let env4017; let env4018; let c4019_0; let env4020; const r5 = env4015 = {}; const getPlanIdForProduct = function getPlanIdForProduct(a0, a1) { let planIdForGift; if (a1) { try { planIdForGift = getPlanIdForGift(a0); } catch ($e) { return null; } return planIdForGift; } let r7 = void 0; const r10 = AppStorePremiumProductIdsToPremiumBundledItems[a0]; if (r10 != null) { r7 = r10.basePlanId; } if (r7 == null) { r7 = null; } return r7; }; fetchDesktopSubscriptionSkus = async function fetchDesktopSubscriptionSkus(c25773_0, c25773_1, c25773_2) { let r47, r48, r49, r50, r208; let c25773_3, c25773_4, c25773_5, c25773_6, c25773_7, c25773_8, c25773_9, c25773_10, c25773_11, country_code, name, name2, name3, name4, c25773_19; let c25773_20 = 0; let c29713_1, c29713_2, c29713_0, c29713_3, c29713_4, c29713_5, c29713_6, c29713_7, c29713_8, c29713_9, c29713_10, c29713_11, c29713_12, c29713_13, c29713_14, c29713_15, c29713_16, c29713_17, c29713_18, c29713_19, c29713_20; L72: { try { c29713_1 = void 0; c29713_2 = void 0; c29713_0 = c25773_0; let r61 = c25773_1; if (r61 === void 0) { r61 = PriceSetAssignmentPurchaseTypes.DEFAULT; } c29713_1 = r61; if (c25773_2 !== void 0) { c29713_2 = c25773_2; c29713_3 = void 0; c29713_4 = void 0; c29713_5 = void 0; c29713_6 = void 0; c29713_7 = void 0; c29713_8 = void 0; c29713_9 = void 0; c29713_10 = void 0; c29713_11 = void 0; c29713_12 = void 0; c29713_13 = void 0; c29713_14 = void 0; c29713_15 = void 0; c29713_16 = void 0; c29713_17 = void 0; c29713_18 = void 0; c29713_19 = void 0; c29713_20 = void 0; } else { c29713_2 = false; c29713_3 = void 0; c29713_4 = void 0; c29713_5 = void 0; c29713_6 = void 0; c29713_7 = void 0; c29713_8 = void 0; c29713_9 = void 0; c29713_10 = void 0; c29713_11 = void 0; c29713_12 = void 0; c29713_13 = void 0; c29713_14 = void 0; c29713_15 = void 0; c29713_16 = void 0; c29713_17 = void 0; c29713_18 = void 0; c29713_19 = void 0; c29713_20 = void 0; } await void 0; c29713_3 = []; c29713_4 = new Set(); c29713_5 = {}; const r101 = c29713_0; c25773_4 = r101; const r103 = r101[Symbol.iterator](); c25773_4 = r103.next; c25773_3 = r103; while (true) { const r105 = c25773_4; let r106 = c25773_3; const r107 = r106 === void 0 ? void 0 : (r50 = r105.call(r106)).done ? r106 = void 0 : r50.value; c25773_3 = r106; if (r106 === void 0) { c29713_9 = {}; const subscriptionPlansBySKUs = await fetchSubscriptionPlansBySKUs([...c29713_4]); const r173 = "[fetchDesktopSubscriptionSkus] No price info found"; c29713_10 = subscriptionPlansBySKUs; const r179 = c29713_10; c25773_6 = r179; const r181 = r179[Symbol.iterator](); c25773_6 = r181.next; c25773_5 = r181; loop26: while (true) { const r183 = c25773_6; let r184 = c25773_5; const r185 = r184 === void 0 ? void 0 : (r47 = r183.call(r184)).done ? r184 = void 0 : r47.value; c25773_5 = r184; if (r184 === void 0) { const r187 = c29713_0; c25773_8 = r187; const r189 = r187[Symbol.iterator](); c25773_8 = r189.next; c25773_7 = r189; while (true) { const r204 = c25773_8; let r205 = c25773_7; const r206 = r205 === void 0 ? void 0 : (r49 = r204.call(r205)).done ? r205 = void 0 : r49.value; c25773_7 = r205; if (r205 === void 0) { r208 = c29713_3; break L72; } c25773_20 = 4; c29713_13 = r206; c29713_14 = c29713_5[c29713_13]; if (c29713_14 != null) { c29713_15 = c29713_9[c29713_14]; if (c29713_15 != null) { const prices = c29713_15.prices; c29713_16 = prices == null ? void 0 : prices[c29713_1]?.country_prices; const r240 = c29713_16; const r241 = r240 == null; let r242 = void 0; if (!r241) { const prices2 = r240.prices; r242 = prices2 == null ? void 0 : prices2[0]; } c29713_17 = r242; if (c29713_17 != null) { const currency = c29713_17.currency; const r255 = currency == null ? void 0 : currency.toLowerCase(); c25773_11 = r255; if (r255 == null) { c25773_11 = "usd"; } c29713_18 = c25773_11; c29713_19 = c29713_17.amount; c29713_20 = SubscriptionPlanInfo[c29713_14]; const r274 = c29713_3; const priceString = c29713_17.currency != null ? `${c29713_17.currency} ${(c29713_19 / 100).toFixed(2)}` : ""; country_code = c29713_16?.country_code; if (country_code == null) { country_code = CountryCodes.US; } name2 = c29713_20?.name; if (name2 == null) { name2 = c29713_15.name; } name = name2; if (name2 == null) { name = ""; } const name6 = c29713_20?.name; name4 = name6; if (name6 == null) { name4 = c29713_15.name; } name3 = name4; if (name3 == null) { name3 = ""; } r274.push({ identifier: c29713_13, price: c29713_19, currencySymbol: c29713_17.currency, currencyCode: c29713_18, priceString, countryCode: country_code, downloadable: false, description: name, title: name3, type: c29713_2 ? "inapp" : "subs", subscriptionOffers: [] }); } else { c4015_22.warn(r173, { productId: c29713_13, planId: c29713_14, priceSetAssignmentType: c29713_1 }); } } else { c4015_22.warn("[fetchDesktopSubscriptionSkus] Plan not found", { productId: c29713_13, planId: c29713_14 }); } } else { c4015_22.warn("[fetchDesktopSubscriptionSkus] No plan ID found", { productId: c29713_13 }); } c25773_20 = 0; } } else { c25773_20 = 2; c29713_11 = r185; const r192 = c29713_11; c25773_10 = r192; const r194 = r192[Symbol.iterator](); c25773_10 = r194.next; c25773_9 = r194; while (true) { const r196 = c25773_10; let r197 = c25773_9; const r198 = r197 === void 0 ? void 0 : (r48 = r196.call(r197)).done ? r197 = void 0 : r48.value; c25773_9 = r197; if (r197 === void 0) { c25773_20 = 0; continue loop26; } c25773_20 = 3; c29713_12 = r198; c29713_9[c29713_12.id] = c29713_12; c25773_20 = 2; } } } } else { c25773_20 = 1; c29713_6 = r107; c29713_7 = (0, getPlanIdForProduct)(c29713_6, c29713_2); if (c29713_7 != null) { c29713_8 = SubscriptionPlanInfo[c29713_7]; if (c29713_8?.skuId != null && c29713_8.skuId !== PremiumSubscriptionSKUs.NONE) { c29713_4.add(c29713_8.skuId); c29713_5[c29713_6] = c29713_7; } } c25773_20 = 0; } } } catch ($e) { const r58 = $e; let r8 = r58; c25773_19 = r58; let r59 = c25773_20; if (r59 !== 0) { while (true) { if (r59 === 1) { try { const r350 = c25773_19; c25773_20 = 0; const r352 = c25773_3; if (r352 !== void 0 && typeof r352.return === "function") { try { r352.return(); } catch {} } throw r350; } catch (r349) { r8 = r349; c25773_19 = r349; r59 = c25773_20; if (r59 === 0) { break; } } } else if (r59 === 2) { try { const r344 = c25773_19; c25773_20 = 0; const r346 = c25773_5; if (r346 !== void 0 && typeof r346.return === "function") { try { r346.return(); } catch {} } throw r344; } catch (r343) { r8 = r343; c25773_19 = r343; r59 = c25773_20; if (r59 === 0) { break; } } } else if (r59 === 3) { try { const r338 = c25773_19; c25773_20 = 2; const r340 = c25773_9; if (r340 !== void 0 && typeof r340.return === "function") { try { r340.return(); } catch {} } throw r338; } catch (r337) { r8 = r337; c25773_19 = r337; r59 = c25773_20; if (r59 === 0) { break; } } } else { try { const r332 = c25773_19; c25773_20 = 0; const r334 = c25773_7; if (r334 !== void 0 && typeof r334.return === "function") { try { r334.return(); } catch {} } throw r332; } catch (r331) { r8 = r331; c25773_19 = r331; r59 = c25773_20; if (r59 === 0) { break; } } } } } throw r8; } } return r208; }; _excluded = ["succeededOnlyFields"]; _excluded2 = ["succeededOnlyFields"]; _excluded3 = ["succeededOnlyFields"]; _excluded4 = ["succeededOnlyFields"]; BillingManager = NativeModules.BillingManager; c4015_22 = new Logger("GPlayActionCreators"); const r67 = async function(c15647_0) { let r113; let c15647_3; let c15647_4 = 0; let c25778_0, c25778_1, c25778_2; L20: { try { c25778_0 = void 0; let r15 = c15647_0; if (r15 === void 0) { r15 = SubscriptionProductIds; } c25778_0 = r15; c25778_1 = void 0; await void 0; if (c25778_0 == null) { break L20; } if (c25778_0.length === 0) { break L20; } Dispatcher.dispatch({ type: "GPLAY_FETCH_SUBSCRIPTION_SKUS_START" }); c15647_4 = 1; c25778_1 = isGooglePlayBillingSupported() ? await BillingManager.getSubscriptionSkus(c25778_0) : await (0, fetchDesktopSubscriptionSkus)(c25778_0); Dispatcher.dispatch({ type: "GPLAY_SUBSCRIPTION_SKUS_LOADED", skus: [...c25778_1], skusType: GPlaySkusType.SUBSCRIPTION }); r113 = c25778_1; c15647_4 = 0; } catch ($e) { const r33 = $e; let r7 = r33; c15647_3 = r33; if (c15647_4 !== 0) { while (true) { try { const r138 = c15647_3; c15647_4 = 0; c25778_2 = r138; Dispatcher.dispatch({ type: "GPLAY_FETCH_SUBSCRIPTION_SKUS_FAILED" }); throw c25778_2; } catch (r134) { r7 = r134; c15647_3 = r134; if (c15647_4 === 0) { break; } } } } throw r7; } return r113; } return []; }; const r68 = env4016 = { $parent: r5 }; c4016_0 = r67; c4016_1 = true; c4015_26 = _asyncToGenerator($mk78260(r68)); const r72 = async function(c15648_0) { let r92, r114; let c15648_1, c15648_2, c15648_3; let c15648_4 = 0; const r11 = env4015; L20: { try { let env25779; c15648_2 = r11; const r35 = env25779 = { $parent: r11 }; c15648_1 = r35; env25779[0] = void 0; let r15 = c15648_0; if (r15 === void 0) { r15 = IAPProductIds; } env25779[0] = r15; env25779[1] = void 0; await void 0; if (env25779[0] == null) { break L20; } if (env25779[0].length === 0) { break L20; } Dispatcher.dispatch({ type: "GPLAY_FETCH_IN_APP_SKUS_START" }); c15648_4 = 1; if (isGooglePlayBillingSupported()) { r92 = await BillingManager.getIAPSkus(env25779[0]); } else { const r83 = env25779[0]; r92 = await $mk105037(env4015)(r83); } env25779[1] = r92; Dispatcher.dispatch({ type: "GPLAY_IN_APP_SKUS_LOADED", skus: [...env25779[1]], skusType: GPlaySkusType.IN_APP }); r114 = env25779[1]; c15648_4 = 0; } catch ($e) { const r33 = $e; let r7 = r33; c15648_3 = r33; if (c15648_4 !== 0) { while (true) { try { const r139 = c15648_3; c15648_4 = 0; env25779[2] = r139; Dispatcher.dispatch({ type: "GPLAY_FETCH_IN_APP_SKUS_FAILED" }); throw env25779[2]; } catch (r135) { r7 = r135; c15648_3 = r135; if (c15648_4 === 0) { break; } } } } throw r7; } return r114; } return []; }; const r73 = env4017 = { $parent: r5 }; c4017_0 = r72; c4017_1 = true; c4015_27 = _asyncToGenerator($mk78260(r73)); const r77 = async () => { await Promise.all([c4015_26(), c4015_27()]); }; const r78 = env4018 = { $parent: r5 }; c4018_0 = r77; c4018_1 = false; const r80 = _asyncToGenerator($mk78260(r78)); c4019_0 = void 0; c4019_0 = async (c25780_0, c25780_1) => { let c25780_2, c25780_5; let c25780_6 = 0; let c29718_0, c29718_1, c29718_2, c29718_3, c29718_4; L10: { try { c29718_0 = c25780_0; c29718_1 = void 0; c29718_2 = void 0; c29718_3 = void 0; c29718_1 = useGPlayAnalyticsStore.getState().analyticsByProductId[c25780_0]; c25780_6 = 1; await BillingManager.purchase(c25780_0, c25780_1); c25780_6 = 0; } catch ($e) { const r31 = $e; let r7 = r31; c25780_5 = r31; if (c25780_6 !== 0) { while (true) { try { const r66 = c25780_5; c25780_6 = 0; c29718_4 = r66; captureBillingException(c29718_4, { tags: { productId: c29718_0 } }); AlertActionCreators.show({ title: intl.string(t["U+H+kd"]), body: intl.string(t.LFFx5G) }); const r104 = c29718_1; c25780_2 = r104; if (r104 == null) { c25780_2 = {}; } c29718_2 = c25780_2; c29718_2.succeededOnlyFields; c29718_3 = (0, _objectWithoutProperties)(c29718_2, _excluded); AnalyticsUtils.track(AnalyticEvents.GPLAY_PURCHASE_FAILED, { ...c29718_3, location: "purchase", product_id: c29718_0, error: c29718_4.message }); break L10; } catch (r62) { r7 = r62; c25780_5 = r62; if (c25780_6 === 0) { break; } } } } throw r7; } } }; const r13 = async () => { let userCountry; let c15650_2; let c15650_3 = 0; let c25781_0; const r17 = "[getUserCountry] Quest: Skipping Google Play country lookup"; let r14 = "[getUserCountry] Failed to get user country from Google Play Billing"; L12: { try { if (isGooglePlayBillingSupported()) { c15650_3 = 1; userCountry = await BillingManager.getUserCountry(); r14 = "[getUserCountry] Failed to get user country from Google Play Billing"; c15650_3 = 0; break L12; } c4015_22.info(r17); } catch ($e) { const r31 = $e; let r7 = r31; c15650_2 = r31; if (c15650_3 !== 0) { while (true) { L32: { try { const r74 = c15650_2; c15650_3 = 0; c25781_0 = r74; if (c25781_0?.code !== String(GPlayBillingResult.BILLING_CLIENT_NOT_READY)) { const r89 = c25781_0; const r90 = r89 == null; let r91 = void 0; if (!r90) { const message = r89.message; r91 = message == null ? void 0 : message.includes("max attempts exceeded"); } if (r91 !== true) { const r96 = c25781_0; const r97 = r96 == null; let r98 = void 0; if (!r97) { const message2 = r96.message; r98 = message2 == null ? void 0 : message2.includes("returned null"); } if (r98 !== true) { captureBillingException(c25781_0, { tags: { source: "getUserCountry" } }); break L32; } } } c4015_22.warn(r14, { error: c25781_0?.message }); } catch (r71) { r7 = r71; c15650_2 = r71; if (c15650_3 === 0) { break; } continue; } } return null; } } throw r7; } return null; } return userCountry; }; const r85 = env4020 = { $parent: r5 }; c4020_0 = r13; c4020_1 = true; c4015_31 = _asyncToGenerator($mk78260(r85)); export { c4015_26 as loadSubscriptionSkus }; export { c4015_27 as loadInAppSkus }; export { r80 as loadSkus }; export async function loadUserCountry() { let c29714_0 = await c4015_31(); Dispatcher.dispatch({ type: "GPLAY_SET_USER_COUNTRY", countryCode: c29714_0 }); } export const purchase = function() { const apply = c4019_0.apply; return c4019_0.apply(this, arguments); }; export async function subscribe(c25775_0, c25775_1, c25775_2, c25775_3, c25775_4) { let oldProductId, c25775_8; let c25775_9 = 0; let c29715_0, c29715_1, c29715_2, c29715_3; L10: { try { c29715_0 = c25775_0; c29715_1 = c25775_2; c29715_2 = c25775_4; c25775_9 = 1; await BillingManager.subscribe(c25775_0, c25775_1, c25775_2, c25775_3, c25775_4); c25775_9 = 0; } catch ($e) { const r36 = $e; let r8 = r36; c25775_8 = r36; if (c25775_9 !== 0) { while (true) { try { const r66 = c25775_8; c25775_9 = 0; c29715_3 = r66; const r71 = c29715_3; const r74 = c29715_1; oldProductId = r74; if (r74 == null) { oldProductId = ""; } captureBillingException(r71, { tags: { productId: c29715_0, oldProductId } }); AlertActionCreators.show({ title: intl.string(t["U+H+kd"]), body: intl.string(t.LFFx5G) }); AnalyticsUtils.track(AnalyticEvents.GPLAY_PURCHASE_FAILED, { location: "subscribe", product_id: c29715_0, offer_id: c29715_2, error: c29715_3.message }); break L10; } catch (r62) { r8 = r62; c25775_8 = r62; if (c25775_9 === 0) { break; } } } } throw r8; } } } export async function verifyPurchase(c25776_0, gift_info_options) { let body, one_time_purchase_sku_id, subscription_sku_id; let load_id, c25776_5; let c25776_6 = 0; let c29716_0, c29716_1, c29716_2, c29716_3, c29716_4, c29716_5, c29716_6; try { c29716_0 = c25776_0; c29716_1 = void 0; c29716_2 = void 0; c29716_3 = void 0; c29716_4 = void 0; c29716_5 = void 0; const r19 = useGPlayAnalyticsStore.getState().analyticsByProductId[c25776_0.productId]; c29716_1 = r19; const id = AuthenticationStore.getId(); const r46 = SubscriptionProductIds.includes(c25776_0.productId); let r47 = !r46; c29716_2 = r47; const productId = c25776_0.productId; if (r46) { one_time_purchase_sku_id = null; subscription_sku_id = productId; } else { one_time_purchase_sku_id = productId; subscription_sku_id = null; } if (!r46) { r47 = gift_info_options != null; } if (r47) { r47 = gift_info_options.gift_style == null; } if (r47) { AnalyticsUtils.track(AnalyticEvents.GIFT_INFO_OPTIONS_MISSING, { source: "verifyPurchase", sku_id: c25776_0.productId }); } c25776_6 = 1; load_id = r19?.load_id; if (load_id == null) { load_id = null; } c29716_3 = await HTTP.post({ url: Endpoints.VERIFY_PURCHASE, body: { purchase_token: c25776_0.purchaseToken, user_id: id, package_name: c25776_0.packageName, subscription_sku_id, one_time_purchase_sku_id, gift_info_options, one_time_purchase_options: { consume_on_validate: true }, load_id }, rejectWithError: false }); if (c29716_1 != null) { if (!c29716_2) { c29716_1.succeededOnlyFields; c29716_4 = (0, _objectWithoutProperties)(c29716_1, _excluded3); AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_COMPLETED, c29716_4); (0, deleteGPlayAnalytics)(c29716_0.productId); } } body = c29716_3.body; c25776_6 = 0; } catch ($e) { const r32 = $e; let r8 = r32; c25776_5 = r32; if (c25776_6 !== 0) { while (true) { try { const r127 = c25776_5; c25776_6 = 0; c29716_6 = r127; captureBillingException(c29716_6, { tags: { productId: c29716_0.productId } }); if (c29716_1 != null) { c29716_1.succeededOnlyFields; c29716_5 = (0, _objectWithoutProperties)(c29716_1, _excluded4); AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_FAILED, { ...c29716_5, payment_gateway: PaymentGateways.GOOGLE }); } throw c29716_6; } catch (r123) { r8 = r123; c25776_5 = r123; if (c25776_6 === 0) { break; } } } } throw r8; } return body; } export function sendPaymentCompleteAnalytics(a0) { const r5 = useGPlayAnalyticsStore.getState().analyticsByProductId[a0.productId]; if (r5 != null) { const { succeededOnlyFields, ...rest } = r5; AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_COMPLETED, rest); AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_SUCCEEDED, { ...rest, ...succeededOnlyFields }); (0, deleteGPlayAnalytics)(a0.productId); } } export function updatePendingDowngrade(a0, a1, a2, a3) { const r11 = [IAPStore_android.getProduct(a0), IAPStore_android.getProduct(a1)]; const r14 = r11[0]; const r15 = r11[1]; if (r15 != null && r14 != null) { if (r15 != null && r14 != null && r15.billingPeriod != null && r14.billingPeriod != null && r15.price < r14.price / calculateStandardizedUnits(r15.billingPeriod, r14.billingPeriod)) { return void 0; } Dispatcher.dispatch({ type: "GPLAY_UPDATE_PENDING_DOWNGRADE", pendingDowngrade: { purchaseToken: a2, subscriptionId: a3, newSubscriptionSkuId: r14.identifier } }); } } export function downgradeSubscription(a0) { return HTTP.post({ url: Endpoints.DOWNGRADE_SUBSCRIPTION, body: { purchase_token: a0.purchaseToken, subscription_id: a0.subscriptionId, subscription_sku_id: a0.newSubscriptionSkuId }, rejectWithError: false }); } export { c4015_31 as getUserCountry };