3164 lines
101 KiB
TypeScript
3164 lines
101 KiB
TypeScript
// Metro module 6331 (f6332).
|
|
import _objectWithoutProperties from "../../_bundle/_objectWithoutProperties";
|
|
import _asyncToGenerator from "../../_bundle/_asyncToGenerator";
|
|
import GenericIAPStore from "../../modules/billing/native/GenericIAPStore";
|
|
import "../../modules/premium/gifting/GiftPromotionStore";
|
|
import { setPaymentSuccess, showOldPaymentFlowSuccess } from "../../modules/premium/native/PremiumPlanPurchasedStore";
|
|
import UserStore from "../../stores/UserStore";
|
|
import SubscriptionStore from "../../stores/billing/SubscriptionStore";
|
|
import IAPStore_android from "../../stores/native/IAPStore.android";
|
|
import { StoreKitErrors, AnalyticEvents, Endpoints, CurrencyCodes, SubscriptionTypes } from "../../Constants";
|
|
import { PaymentGateways } from "../../_bundle/Module505";
|
|
import Logger from "../../modules/debug/Logger";
|
|
import MurmurHashV3 from "../../_bundle/MurmurHashV3";
|
|
import { Storage } from "../../_bundle/Module595";
|
|
import AnalyticsUtils from "../../utils/AnalyticsUtils";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import { captureBillingException } from "../../utils/BillingUtils";
|
|
import * as _BillingActionCreators from "../../modules/billing/actions/BillingActionCreators";
|
|
import { fetchSubscriptions } from "../../modules/billing/actions/BillingActionCreators";
|
|
import { isIOS } from "../../utils/PlatformUtils";
|
|
import IAPUtils, { makeIAPRequest, convertToUUID } from "../../utils/native/IAPUtils";
|
|
import { fetchPremiumSubscriptionPlans } from "../SubscriptionPlanActionCreators";
|
|
import { clearTransactionIOS, finishTransaction, initConnection, ErrorCode } from "../../_bundle/Module6333";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import Module12 from "../../_bundle/Module12";
|
|
import { GenericProductIds, ProductIds } from "../../modules/premium/native/ProductIds.android";
|
|
import { getIsPaymentsBlocked } from "../../modules/billing/experiments/BlockedPaymentsCountryExperiment";
|
|
import openBlockedPaymentsCountryActionSheet from "../../modules/billing/native/openBlockedPaymentsCountryActionSheet";
|
|
import { intl, t } from "../../intl/index.native";
|
|
import { getPaymentFlowCompletedAnalyticsFields } from "../../modules/premium/native/PremiumAnalyticsUtils";
|
|
import AlertActionCreators from "./AlertActionCreators";
|
|
import { isSpendingLimitError, showSpendingLimitReachedAlert } from "../../modules/parent_tools/native/showSpendingLimitReachedAlert";
|
|
import { BillingError } from "../../errors/index";
|
|
import { getUnderlyingIOSError } from "../../utils/ErrorUtils";
|
|
import { ErrorCodes } from "../../errors/BillingError";
|
|
import TrackedHTTPUtils from "../../utils/TrackedHTTPUtils";
|
|
import { NetworkActionNames } from "../../_bundle/Module503";
|
|
import { APBRequestOperations } from "../../_bundle/Module6497";
|
|
import { ACRequestOperations } from "../../_bundle/Module6498";
|
|
import { exact } from "../../_bundle/Module1385";
|
|
import { trackPaymentFlowStartedAnalyticsAndCTP } from "../../modules/experiments/trigger_points/PaymentFlowStartedTriggerPoint";
|
|
import * as _SKUActionCreators from "../SKUActionCreators";
|
|
import { v4 } from "../../_bundle/Module514";
|
|
import { NitroACOMSubscriptionExperiment } from "../../modules/billing/native/ACOMExperiments";
|
|
import { HermesBuiltin, $createGenerator } from "../../_hermes/prelude";
|
|
function $mk114927($env) {
|
|
return function retryPendingPurchases(a0, a1) {
|
|
return $env[43].apply(this, arguments);
|
|
};
|
|
}
|
|
function $mk114930($env) {
|
|
return (a0) => GenericProductIds.includes(a0.identifier);
|
|
}
|
|
function $mk114931($env) {
|
|
return function getTrialOfferSignature() {
|
|
return $env[25].apply(this, arguments);
|
|
};
|
|
}
|
|
function $mk114932($env) {
|
|
return () => {
|
|
AlertActionCreators.openLazy({
|
|
importer: $mk117982($env)
|
|
});
|
|
};
|
|
}
|
|
function $mk114934($env) {
|
|
return function _loop(a0) {
|
|
let env31412 = {
|
|
$parent: $env
|
|
};
|
|
env31412[0] = a0;
|
|
env31412[6] = 0;
|
|
env31412[7] = 0;
|
|
env31412[5] = 0;
|
|
return $createGenerator(function _loop(a0) {
|
|
let value2;
|
|
const r0 = env31412[7];
|
|
if (r0 === 2) {
|
|
env31412[7] = 3;
|
|
HermesBuiltin.throwTypeError("Generator functions may not be called on executing generators");
|
|
throw new Error("unreachable");
|
|
}
|
|
const value = arguments[1];
|
|
const r9 = env31412.$parent;
|
|
const r8 = r9.$parent.$parent;
|
|
if (r0 === 3) {
|
|
if (a0 === 1) {
|
|
throw value;
|
|
}
|
|
if (a0 === 2) {
|
|
return {
|
|
value,
|
|
done: true
|
|
};
|
|
}
|
|
return {
|
|
value: void 0,
|
|
done: true
|
|
};
|
|
}
|
|
while (true) {
|
|
L32: {
|
|
L30: {
|
|
L14: {
|
|
L10: {
|
|
try {
|
|
env31412[7] = 2;
|
|
const r23 = env31412[6];
|
|
if (r23 === 0) {
|
|
if (a0 === 1) {
|
|
env31412[7] = 3;
|
|
throw value;
|
|
}
|
|
if (a0 === 2) {
|
|
env31412[7] = 3;
|
|
break L32;
|
|
}
|
|
let env31957;
|
|
env31412[3] = r9;
|
|
const r40 = env31957 = {
|
|
$parent: r8
|
|
};
|
|
env31412[2] = r40;
|
|
const r41 = env31412[0];
|
|
env31957[0] = r41;
|
|
env31957[1] = void 0;
|
|
env31957[2] = void 0;
|
|
const purchaseResponse = r41.purchaseResponse;
|
|
env31957[1] = purchaseResponse;
|
|
const product = r8[15].getProduct(purchaseResponse.productIdentifier);
|
|
const jwsRepresentation3 = purchaseResponse.jwsRepresentation;
|
|
env31412[1] = jwsRepresentation3;
|
|
if (jwsRepresentation3 == null) {
|
|
env31412[1] = purchaseResponse.transactionReceipt;
|
|
}
|
|
const r18 = env31412[1];
|
|
const r52 = (0, r8[1])(r8[3][13]).v3(r18);
|
|
env31957[2] = r52;
|
|
const giftOptionsForKey = r8[10].getGiftOptionsForKey(r52);
|
|
env31412[5] = 1;
|
|
value2 = r8[24]({
|
|
jwsRepresentation: purchaseResponse.jwsRepresentation,
|
|
encodedReceipt: purchaseResponse.transactionReceipt,
|
|
presentmentCurrency: product?.currencyCode,
|
|
presentmentAmount: product?.price,
|
|
appStoreRegion: product?.countryCode,
|
|
giftInfoOptions: {
|
|
gift_style: giftOptionsForKey?.gift_style,
|
|
reward_sku_ids: giftOptionsForKey?.reward_sku_ids
|
|
},
|
|
source: "restoreSubscription",
|
|
skipDupCheck: r9.$parent[0]
|
|
}).then((result) => {
|
|
const r5 = env31957.$parent;
|
|
const r6 = r5[0];
|
|
const r4 = r5[3];
|
|
const r7 = r6(r4[22]);
|
|
const r9 = env31957[1];
|
|
r7.finishTransaction({
|
|
purchase: {
|
|
productId: r9.productIdentifier,
|
|
transactionDate: r9.transactionDate,
|
|
transactionReceipt: r9.transactionReceipt,
|
|
transactionId: r9.transactionIdentifier.toString()
|
|
}
|
|
});
|
|
if (result != null) {
|
|
(0, r5[1])(r4[23]).dispatch({
|
|
type: "GIFT_PROMOTION_GIFT_OPTIONS_CLEAR_CACHE_ACTION",
|
|
key: env31957[2]
|
|
});
|
|
}
|
|
return result != null ? env31957[0] : null;
|
|
});
|
|
env31412[6] = 2;
|
|
env31412[7] = 1;
|
|
break L30;
|
|
}
|
|
if (r23 === 1) {
|
|
const r31 = env31412[2];
|
|
const r32 = env31412[3];
|
|
const r33 = env31412[4];
|
|
env31412[5] = 0;
|
|
r31[3] = r33;
|
|
r32[3].push(r31[3]);
|
|
} else {
|
|
if (a0 === 1) {
|
|
env31412[7] = 3;
|
|
throw value;
|
|
}
|
|
if (a0 === 2) {
|
|
env31412[5] = 0;
|
|
env31412[7] = 3;
|
|
break L10;
|
|
}
|
|
if (value != null) {
|
|
env31412[3][2].push(env31412[2][1]);
|
|
}
|
|
env31412[5] = 0;
|
|
}
|
|
env31412[7] = 3;
|
|
break L14;
|
|
} catch (r81) {
|
|
env31412[4] = r81;
|
|
if (env31412[5] === 0) {
|
|
env31412[7] = 3;
|
|
throw r81;
|
|
}
|
|
env31412[6] = 1;
|
|
continue;
|
|
}
|
|
}
|
|
return {
|
|
value,
|
|
done: true
|
|
};
|
|
}
|
|
return {
|
|
value: void 0,
|
|
done: true
|
|
};
|
|
}
|
|
return {
|
|
value: value2,
|
|
done: false
|
|
};
|
|
}
|
|
return {
|
|
value,
|
|
done: true
|
|
};
|
|
}
|
|
});
|
|
};
|
|
}
|
|
function $mk114935($env) {
|
|
return (a0) => {
|
|
captureBillingException(a0);
|
|
};
|
|
}
|
|
function $mk117982($env) {
|
|
return () => import("../../components_native/premium/PremiumActivatedAlert").then($mk118763($env));
|
|
}
|
|
function $mk118763($env) {
|
|
return (a0) => {
|
|
let env32123 = {
|
|
$parent: $env
|
|
};
|
|
env32123[0] = a0.default;
|
|
return (a0) => {
|
|
const r1 = env32123.$parent.$parent;
|
|
let env32167 = {
|
|
$parent: r1
|
|
};
|
|
env32167[0] = a0;
|
|
return r1[21](env32123[0], {
|
|
...a0,
|
|
subscription: env32123.$parent[19],
|
|
onClose: () => {
|
|
env32167[0].onClose();
|
|
const r4 = env32167.$parent;
|
|
const r3 = r4[1];
|
|
const r7 = r4[3];
|
|
r3(r7[33]).popWithKey((0, r4[0])(r7[34]).PREMIUM_KEY);
|
|
}
|
|
});
|
|
};
|
|
};
|
|
}
|
|
let preCompletionFailureReason, handlePurchaseException, canMakeIAPRequest, clearAndMakeIAPRequest, getIAPJWTRequestData, updateAppleSubscription, determineProductId, isValidCurrency, _excluded, _excluded2, _excluded3, c4029_22, c4029_23, c4029_26, c4029_39;
|
|
let env4029 = {};
|
|
const applyAppleReceipt = function applyAppleReceipt(a0) {
|
|
let r42;
|
|
const { encodedReceipt, entitlementSkuId, presentmentCurrency, presentmentAmount, appStoreRegion, giftInfoOptions, isGift, retries, jwsRepresentation: jwsRepresentation3 } = a0;
|
|
let jwsRepresentations = a0.jwsRepresentations;
|
|
const { source, skipDupCheck, orderId } = a0;
|
|
if (jwsRepresentations != null && jwsRepresentation3 != null) {
|
|
throw new Error("Can pass either 'jwsRepresentation' or 'jwsRepresentations'. Not both");
|
|
}
|
|
if (jwsRepresentation3 != null) {
|
|
jwsRepresentations = [jwsRepresentation3];
|
|
}
|
|
const r10 = jwsRepresentations != null ? jwsRepresentations[0] : encodedReceipt;
|
|
const r33 = MurmurHashV3.v3(r10);
|
|
let c15657_0 = r33;
|
|
const r38 = Storage.get(c4029_22);
|
|
if (!skipDupCheck && r38 === r33) {
|
|
r42 = Promise.resolve(null);
|
|
} else {
|
|
if (!(isGift !== true || giftInfoOptions != null && giftInfoOptions?.gift_style != null)) {
|
|
AnalyticsUtils.track(AnalyticEvents.GIFT_INFO_OPTIONS_MISSING, {
|
|
source,
|
|
sku_id: entitlementSkuId
|
|
});
|
|
}
|
|
r42 = HTTP.post({
|
|
url: Endpoints.BILLING_APPLY_APPLE_RECEIPT,
|
|
body: {
|
|
encoded_receipt: encodedReceipt,
|
|
entitlement_sku_id: entitlementSkuId,
|
|
presentment_currency: presentmentCurrency,
|
|
presentment_amount: presentmentAmount,
|
|
app_store_region: appStoreRegion,
|
|
gift_info_options: giftInfoOptions,
|
|
is_gift: isGift,
|
|
source,
|
|
jws_representations: jwsRepresentations,
|
|
order_id: orderId
|
|
},
|
|
retries,
|
|
oldFormErrors: true,
|
|
rejectWithError: true
|
|
}).then((result) => {
|
|
Storage.set(c4029_22, c15657_0);
|
|
return result;
|
|
}).catch((error) => {
|
|
captureBillingException(error, {
|
|
tags: {
|
|
source: c4029_23
|
|
}
|
|
});
|
|
throw error;
|
|
});
|
|
}
|
|
return r42;
|
|
};
|
|
env4029[25] = function _getTrialOfferSignature() {
|
|
const r8 = async (product_id, product_offer_id, app_account_token) => {
|
|
let body3;
|
|
let c25783_5;
|
|
let c25783_6 = 0;
|
|
let c29720_0;
|
|
try {
|
|
c25783_6 = 1;
|
|
body3 = (await HTTP.post({
|
|
url: Endpoints.BILLING_GENERATE_APPLE_TRIAL_OFFER_SIGNATURE,
|
|
body: {
|
|
product_id,
|
|
product_offer_id,
|
|
app_account_token
|
|
},
|
|
rejectWithError: false
|
|
})).body;
|
|
c25783_6 = 0;
|
|
} catch ($e) {
|
|
const r25 = $e;
|
|
let r7 = r25;
|
|
c25783_5 = r25;
|
|
if (c25783_6 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r60 = c25783_5;
|
|
c25783_6 = 0;
|
|
c29720_0 = r60;
|
|
captureBillingException(c29720_0);
|
|
} catch (r56) {
|
|
r7 = r56;
|
|
c25783_5 = r56;
|
|
if (c25783_6 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|
|
throw r7;
|
|
}
|
|
return body3;
|
|
};
|
|
env4029[25] = r8;
|
|
return r8.apply(this, arguments);
|
|
};
|
|
preCompletionFailureReason = function preCompletionFailureReason(a0) {
|
|
const r5 = c4029_26.has(a0.code);
|
|
return r5 ? c4029_39.USER_CANCELLED : c4029_39.PURCHASE_INCOMPLETE;
|
|
};
|
|
handlePurchaseException = function handlePurchaseException(a0, a1, hideActionSheet = true) {
|
|
let r16, r54;
|
|
if (!c4029_26.has(a0.code)) {
|
|
if (isSpendingLimitError(a0 instanceof BillingError ? a0 : new BillingError(a0))) {
|
|
showSpendingLimitReachedAlert();
|
|
} else {
|
|
a0.message;
|
|
JSON.stringify(a0);
|
|
const underlyingIOSError = getUnderlyingIOSError(a0);
|
|
if (underlyingIOSError != null) {
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.POsVOt),
|
|
body: underlyingIOSError
|
|
});
|
|
throw a0;
|
|
}
|
|
L13: {
|
|
r54 = intl.string(t.PjfUXe);
|
|
const name = a0.name;
|
|
r16 = r54;
|
|
if (name !== "HTTPResponseError") {
|
|
if ("status" in a0) {
|
|
const r60 = "method" in a0;
|
|
r16 = r54;
|
|
if (r60) {
|
|
break L13;
|
|
}
|
|
}
|
|
r16 = a0.message || r54;
|
|
}
|
|
}
|
|
const body3 = a0.body;
|
|
let body5 = r16;
|
|
if (body3 != null) {
|
|
const body4 = a0.body;
|
|
body5 = body4.apple_error_code != null ? `${r54} (code: ${body4.apple_error_code})` : r16;
|
|
}
|
|
const r73 = a0 instanceof BillingError ? a0 : new BillingError(a0);
|
|
if (body5 === r54 && hideActionSheet && r73.code !== ErrorCodes.UNKNOWN && r73.code !== -1 && r73.message != null) {
|
|
body5 = r73.message;
|
|
}
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.zrhHH3),
|
|
body: body5,
|
|
isDismissable: true,
|
|
hideActionSheet
|
|
});
|
|
captureBillingException(a0, {
|
|
tags: {
|
|
source: c4029_23,
|
|
purchase_type: a1
|
|
}
|
|
});
|
|
if (hideActionSheet) {
|
|
throw a0;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
canMakeIAPRequest = function canMakeIAPRequest() {
|
|
const isBusy = IAPStore_android.isBusy();
|
|
let r0 = !isBusy;
|
|
if (!isBusy) {
|
|
const isPaymentsBlocked = getIsPaymentsBlocked();
|
|
let r1 = !isPaymentsBlocked;
|
|
if (isPaymentsBlocked) {
|
|
openBlockedPaymentsCountryActionSheet();
|
|
r1 = false;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
};
|
|
clearAndMakeIAPRequest = async function clearAndMakeIAPRequest(c25784_0, c25784_1, c25784_2, c25784_3) {
|
|
let r118;
|
|
let original_transaction_id, originalTransactionDate, c25784_8;
|
|
let c25784_9 = 0;
|
|
let c29721_0, c29721_1, c29721_2, c29721_3, c29721_6, c29721_7, c29721_8, c29721_4, c29721_5, c29721_9;
|
|
try {
|
|
c29721_0 = c25784_0;
|
|
c29721_1 = c25784_1;
|
|
c29721_2 = c25784_2;
|
|
c29721_3 = c25784_3;
|
|
c29721_6 = void 0;
|
|
c29721_7 = void 0;
|
|
c29721_8 = void 0;
|
|
c29721_4 = false;
|
|
c29721_5 = null;
|
|
c25784_9 = 2;
|
|
await clearTransactionIOS();
|
|
c29721_6 = await makeIAPRequest(c29721_1, c29721_2, c29721_3);
|
|
c29721_4 = true;
|
|
c29721_7 = c29721_6.purchaseResponse.transactionIdentifier.toString();
|
|
c29721_8 = c29721_6.purchaseResponse.transactionDate;
|
|
const originalTransactionIdentifier = c29721_6.purchaseResponse.originalTransactionIdentifier;
|
|
const r105 = originalTransactionIdentifier == null ? void 0 : originalTransactionIdentifier.toString();
|
|
original_transaction_id = r105;
|
|
if (r105 == null) {
|
|
original_transaction_id = c29721_7;
|
|
}
|
|
const originalTransactionDate2 = c29721_6.purchaseResponse.originalTransactionDate;
|
|
originalTransactionDate = originalTransactionDate2;
|
|
if (originalTransactionDate2 == null) {
|
|
originalTransactionDate = c29721_8;
|
|
}
|
|
c29721_5 = {
|
|
original_transaction_id,
|
|
original_transaction_date: originalTransactionDate,
|
|
transaction_id: c29721_7,
|
|
transaction_date: c29721_8
|
|
};
|
|
r118 = c29721_6;
|
|
c25784_9 = 0;
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_PARTNER_IAP_REQUEST_SENT, {
|
|
request_identifier: c29721_0,
|
|
success: c29721_4,
|
|
...c29721_5
|
|
});
|
|
} catch ($e) {
|
|
const r34 = $e;
|
|
let r8 = r34;
|
|
c25784_8 = r34;
|
|
let r35 = c25784_9;
|
|
if (r35 !== 0) {
|
|
while (true) {
|
|
if (r35 === 1) {
|
|
try {
|
|
const r162 = c25784_8;
|
|
c25784_9 = 0;
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_PARTNER_IAP_REQUEST_SENT, {
|
|
request_identifier: c29721_0,
|
|
success: c29721_4,
|
|
...c29721_5
|
|
});
|
|
throw r162;
|
|
} catch (r159) {
|
|
r8 = r159;
|
|
c25784_8 = r159;
|
|
r35 = c25784_9;
|
|
if (r35 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
try {
|
|
const r139 = c25784_8;
|
|
c25784_9 = 1;
|
|
c29721_9 = r139;
|
|
const code = c29721_9.code;
|
|
c29721_5 = {
|
|
error_code: code == null ? void 0 : code.toString(),
|
|
error_message: getUnderlyingIOSError(c29721_9)
|
|
};
|
|
throw c29721_9;
|
|
} catch (r137) {
|
|
r8 = r137;
|
|
c25784_8 = r137;
|
|
r35 = c25784_9;
|
|
if (r35 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return r118;
|
|
};
|
|
getIAPJWTRequestData = async function getIAPJWTRequestData(body) {
|
|
let env29722;
|
|
const r13 = env29722 = {
|
|
$parent: env4029
|
|
};
|
|
let c25785_1 = r13;
|
|
env29722[0] = body;
|
|
env29722[1] = void 0;
|
|
env29722[1] = await TrackedHTTPUtils.post({
|
|
url: Endpoints.BILLING_CREATE_APPLE_IAP_JWT_TOKEN,
|
|
body,
|
|
oldFormErrors: true,
|
|
trackedActionData: {
|
|
event: NetworkActionNames.APPLE_JWT_TOKEN_CREATE,
|
|
properties: (a0) => {
|
|
let r40;
|
|
L12: {
|
|
const r10 = env29722[0];
|
|
if (r10.operation !== APBRequestOperations.CREATE && r10.operation !== ACRequestOperations.CREATE) {
|
|
if (r10.operation === ACRequestOperations.MODIFY) {
|
|
const { subscription_items, ...rest } = r10;
|
|
r40 = {
|
|
subscription_items_json_string: JSON.stringify(subscription_items),
|
|
...rest
|
|
};
|
|
break L12;
|
|
}
|
|
if (r10.operation !== APBRequestOperations.CHARGE && r10.operation !== ACRequestOperations.CHARGE) {
|
|
r40 = {
|
|
...r10
|
|
};
|
|
break L12;
|
|
}
|
|
const { sku_id, country_code, is_gift, gift_info_options } = r10;
|
|
const r42 = {
|
|
sku_id,
|
|
request_country_code: country_code,
|
|
..._objectWithoutProperties(r10, _excluded3)
|
|
};
|
|
if (gift_info_options != null) {
|
|
r42.gift_info_options = JSON.stringify(gift_info_options);
|
|
}
|
|
r40 = r42;
|
|
if (!is_gift) {
|
|
break L12;
|
|
}
|
|
r42.is_gift = is_gift;
|
|
r40 = r42;
|
|
} else {
|
|
const { items, country_code: country_code2, ...rest2 } = r10;
|
|
r40 = {
|
|
subscription_items_json_string: JSON.stringify(items),
|
|
request_country_code: country_code2,
|
|
...rest2
|
|
};
|
|
}
|
|
}
|
|
let r80 = a0 == null ? void 0 : a0.body?.request_data;
|
|
if (r80 == null) {
|
|
r80 = "";
|
|
}
|
|
return exact({
|
|
jwt_token_exists: r80.length > 0,
|
|
...r40
|
|
});
|
|
}
|
|
},
|
|
rejectWithError: true
|
|
});
|
|
return {
|
|
requestJSONString: JSON.stringify(env29722[1].body.request_data)
|
|
};
|
|
};
|
|
updateAppleSubscription = async function updateAppleSubscription(body2) {
|
|
let c29723_0 = body2;
|
|
await TrackedHTTPUtils.patch({
|
|
url: Endpoints.BILLING_APPLE_SUBSCRIPTION(body2.subscription_id),
|
|
body: body2,
|
|
oldFormErrors: true,
|
|
trackedActionData: {
|
|
event: NetworkActionNames.APPLE_JWT_TOKEN_CREATE,
|
|
properties: (a0) => {
|
|
const r7 = {
|
|
...c29723_0
|
|
};
|
|
let r8 = a0 == null ? void 0 : a0.body?.request_data;
|
|
if (r8 == null) {
|
|
r8 = "";
|
|
}
|
|
return exact({
|
|
jwt_token_exists: r8.length > 0,
|
|
...r7
|
|
});
|
|
}
|
|
},
|
|
rejectWithError: false
|
|
});
|
|
};
|
|
determineProductId = function determineProductId(a0) {
|
|
if (APBRequestOperations.CREATE !== a0 && APBRequestOperations.CANCEL !== a0 && APBRequestOperations.RESUBSCRIBE !== a0 && APBRequestOperations.REACTIVATE !== a0) {
|
|
if (APBRequestOperations.CHARGE === a0) {
|
|
return ProductIds.GENERIC_CONSUMABLE;
|
|
}
|
|
if (ACRequestOperations.CREATE !== a0 && ACRequestOperations.CANCEL !== a0 && ACRequestOperations.REACTIVATE !== a0 && ACRequestOperations.MODIFY !== a0) {
|
|
if (ACRequestOperations.CHARGE === a0) {
|
|
return ProductIds.GENERIC_CONSUMABLE;
|
|
}
|
|
throw new Error("Invalid operation");
|
|
}
|
|
return ProductIds.GENERIC_SUBSCRIPTION;
|
|
}
|
|
return ProductIds.GENERIC_SUBSCRIPTION;
|
|
};
|
|
isValidCurrency = function isValidCurrency(a0) {
|
|
return Object.values(CurrencyCodes).includes(a0);
|
|
};
|
|
env4029[43] = function _retryPendingPurchases() {
|
|
const r8 = async (c25791_0, c25791_1) => {
|
|
let r38;
|
|
let c25791_2, c25791_3, c25791_4, c25791_5, c25791_6;
|
|
let c25791_7 = 0;
|
|
const r16 = env4029;
|
|
L28: {
|
|
L25: {
|
|
L24: {
|
|
try {
|
|
let env29728;
|
|
c25791_5 = r16;
|
|
const r54 = env29728 = {};
|
|
c25791_4 = r54;
|
|
env29728[0] = c25791_0;
|
|
env29728[1] = c25791_1;
|
|
env29728[2] = void 0;
|
|
env29728[3] = void 0;
|
|
env29728[4] = void 0;
|
|
env29728[5] = void 0;
|
|
env29728[6] = void 0;
|
|
env29728[7] = void 0;
|
|
env29728[8] = void 0;
|
|
env29728[2] = await IAPUtils.restorePurchases({
|
|
fullRestore: false
|
|
});
|
|
env29728[3] = [];
|
|
if (env29728[2].length === 0) {
|
|
break L28;
|
|
}
|
|
const r89 = env29728[2];
|
|
c25791_3 = r89;
|
|
const r91 = r89[Symbol.iterator]();
|
|
c25791_3 = r91.next;
|
|
c25791_2 = r91;
|
|
const r93 = c25791_3;
|
|
let r94 = c25791_2;
|
|
const r95 = r94 === void 0 ? void 0 : (r38 = r93.call(r94)).done ? r94 = void 0 : r38.value;
|
|
c25791_2 = r94;
|
|
if (r94 === void 0) {
|
|
if (env29728[3].length > 0) {
|
|
env29728[8] = `Failed to retry pending purchases: ${env29728[3].map((item) => item.message).join(", ")}`;
|
|
captureBillingException(new Error(env29728[8]), {
|
|
tags: {
|
|
pendingPurchaseFailures: env29728[3].length.toString(),
|
|
totalPendingPurchases: env29728[2].length.toString()
|
|
}
|
|
});
|
|
break L25;
|
|
}
|
|
} else {
|
|
c25791_7 = 1;
|
|
env29728[4] = r95;
|
|
env29728[5] = env29728[4].purchaseResponse;
|
|
env29728[6] = env29728[5].productIdentifier;
|
|
env29728[7] = env29728[5].transactionIdentifier.toString();
|
|
c25791_7 = 2;
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_RETRY_PENDING_PURCHASE_STARTED, {
|
|
product_id: env29728[6],
|
|
transaction_id: env29728[7]
|
|
});
|
|
let r125 = (0, applyAppleReceipt)({
|
|
encodedReceipt: env29728[5].transactionReceipt,
|
|
retries: 3,
|
|
presentmentCurrency: env29728[0],
|
|
appStoreRegion: env29728[1],
|
|
jwsRepresentation: env29728[5].jwsRepresentation,
|
|
source: "retryPendingPurchases"
|
|
});
|
|
while (true) {
|
|
await r125;
|
|
await finishTransaction({
|
|
purchase: {
|
|
productId: env29728[6],
|
|
transactionId: env29728[7],
|
|
transactionDate: env29728[5].transactionDate,
|
|
transactionReceipt: env29728[5].transactionReceipt
|
|
}
|
|
});
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_RETRY_PENDING_PURCHASE_SUCCEEDED, {
|
|
product_id: env29728[6],
|
|
transaction_id: env29728[7]
|
|
});
|
|
c25791_7 = 1;
|
|
c25791_7 = 0;
|
|
const r197 = c25791_3;
|
|
let r198 = c25791_2;
|
|
const r199 = r198 === void 0 ? void 0 : (r38 = r197.call(r198)).done ? r198 = void 0 : r38.value;
|
|
c25791_2 = r198;
|
|
if (r198 === void 0) {
|
|
if (env29728[3].length > 0) {
|
|
env29728[8] = `Failed to retry pending purchases: ${env29728[3].map((item) => item.message).join(", ")}`;
|
|
captureBillingException(new Error(env29728[8]), {
|
|
tags: {
|
|
pendingPurchaseFailures: env29728[3].length.toString(),
|
|
totalPendingPurchases: env29728[2].length.toString()
|
|
}
|
|
});
|
|
break L25;
|
|
}
|
|
break;
|
|
}
|
|
c25791_7 = 1;
|
|
env29728[4] = r199;
|
|
env29728[5] = env29728[4].purchaseResponse;
|
|
env29728[6] = env29728[5].productIdentifier;
|
|
env29728[7] = env29728[5].transactionIdentifier.toString();
|
|
c25791_7 = 2;
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_RETRY_PENDING_PURCHASE_STARTED, {
|
|
product_id: env29728[6],
|
|
transaction_id: env29728[7]
|
|
});
|
|
r125 = (0, applyAppleReceipt)({
|
|
encodedReceipt: env29728[5].transactionReceipt,
|
|
retries: 3,
|
|
presentmentCurrency: env29728[0],
|
|
appStoreRegion: env29728[1],
|
|
jwsRepresentation: env29728[5].jwsRepresentation,
|
|
source: "retryPendingPurchases"
|
|
});
|
|
}
|
|
}
|
|
} catch ($e) {
|
|
const r52 = $e;
|
|
let r7 = r52;
|
|
c25791_6 = r52;
|
|
let r53 = c25791_7;
|
|
if (r53 !== 0) {
|
|
while (true) {
|
|
if (r53 === 1) {
|
|
try {
|
|
const r549 = c25791_6;
|
|
c25791_7 = 0;
|
|
const r551 = c25791_2;
|
|
if (r551 !== void 0 && typeof r551.return === "function") {
|
|
try {
|
|
r551.return();
|
|
} catch {}
|
|
}
|
|
throw r549;
|
|
} catch (r548) {
|
|
r7 = r548;
|
|
c25791_6 = r548;
|
|
r53 = c25791_7;
|
|
if (r53 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
try {
|
|
const r306 = c25791_6;
|
|
c25791_7 = 1;
|
|
env29728[9] = r306;
|
|
const APPLE_RETRY_PENDING_PURCHASE_FAILED = AnalyticEvents.APPLE_RETRY_PENDING_PURCHASE_FAILED;
|
|
const code = env29728[9].code;
|
|
AnalyticsUtils.track(APPLE_RETRY_PENDING_PURCHASE_FAILED, {
|
|
product_id: env29728[6],
|
|
transaction_id: env29728[7],
|
|
error_code: code == null ? void 0 : code.toString(),
|
|
error_message: env29728[9].message
|
|
});
|
|
env29728[3].push(env29728[9]);
|
|
c25791_7 = 0;
|
|
const r331 = c25791_3;
|
|
let r332 = c25791_2;
|
|
const r333 = r332 === void 0 ? void 0 : (r38 = r331.call(r332)).done ? r332 = void 0 : r38.value;
|
|
c25791_2 = r332;
|
|
if (r332 === void 0) {
|
|
if (env29728[3].length > 0) {
|
|
env29728[8] = `Failed to retry pending purchases: ${env29728[3].map((item) => item.message).join(", ")}`;
|
|
captureBillingException(new Error(env29728[8]), {
|
|
tags: {
|
|
pendingPurchaseFailures: env29728[3].length.toString(),
|
|
totalPendingPurchases: env29728[2].length.toString()
|
|
}
|
|
});
|
|
break L25;
|
|
}
|
|
break L24;
|
|
}
|
|
c25791_7 = 1;
|
|
env29728[4] = r333;
|
|
env29728[5] = env29728[4].purchaseResponse;
|
|
env29728[6] = env29728[5].productIdentifier;
|
|
env29728[7] = env29728[5].transactionIdentifier.toString();
|
|
c25791_7 = 2;
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_RETRY_PENDING_PURCHASE_STARTED, {
|
|
product_id: env29728[6],
|
|
transaction_id: env29728[7]
|
|
});
|
|
let r367 = (0, applyAppleReceipt)({
|
|
encodedReceipt: env29728[5].transactionReceipt,
|
|
retries: 3,
|
|
presentmentCurrency: env29728[0],
|
|
appStoreRegion: env29728[1],
|
|
jwsRepresentation: env29728[5].jwsRepresentation,
|
|
source: "retryPendingPurchases"
|
|
});
|
|
while (true) {
|
|
await r367;
|
|
await finishTransaction({
|
|
purchase: {
|
|
productId: env29728[6],
|
|
transactionId: env29728[7],
|
|
transactionDate: env29728[5].transactionDate,
|
|
transactionReceipt: env29728[5].transactionReceipt
|
|
}
|
|
});
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_RETRY_PENDING_PURCHASE_SUCCEEDED, {
|
|
product_id: env29728[6],
|
|
transaction_id: env29728[7]
|
|
});
|
|
c25791_7 = 1;
|
|
c25791_7 = 0;
|
|
const r439 = c25791_3;
|
|
let r440 = c25791_2;
|
|
const r441 = r440 === void 0 ? void 0 : (r38 = r439.call(r440)).done ? r440 = void 0 : r38.value;
|
|
c25791_2 = r440;
|
|
if (r440 === void 0) {
|
|
if (env29728[3].length > 0) {
|
|
env29728[8] = `Failed to retry pending purchases: ${env29728[3].map((item) => item.message).join(", ")}`;
|
|
captureBillingException(new Error(env29728[8]), {
|
|
tags: {
|
|
pendingPurchaseFailures: env29728[3].length.toString(),
|
|
totalPendingPurchases: env29728[2].length.toString()
|
|
}
|
|
});
|
|
break L25;
|
|
}
|
|
break L24;
|
|
}
|
|
c25791_7 = 1;
|
|
env29728[4] = r441;
|
|
env29728[5] = env29728[4].purchaseResponse;
|
|
env29728[6] = env29728[5].productIdentifier;
|
|
env29728[7] = env29728[5].transactionIdentifier.toString();
|
|
c25791_7 = 2;
|
|
AnalyticsUtils.track(AnalyticEvents.APPLE_RETRY_PENDING_PURCHASE_STARTED, {
|
|
product_id: env29728[6],
|
|
transaction_id: env29728[7]
|
|
});
|
|
r367 = (0, applyAppleReceipt)({
|
|
encodedReceipt: env29728[5].transactionReceipt,
|
|
retries: 3,
|
|
presentmentCurrency: env29728[0],
|
|
appStoreRegion: env29728[1],
|
|
jwsRepresentation: env29728[5].jwsRepresentation,
|
|
source: "retryPendingPurchases"
|
|
});
|
|
}
|
|
} catch (r303) {
|
|
r7 = r303;
|
|
c25791_6 = r303;
|
|
r53 = c25791_7;
|
|
if (r53 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r7;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
env4029[43] = r8;
|
|
return r8.apply(this, arguments);
|
|
};
|
|
_excluded = ["items", "country_code"];
|
|
_excluded2 = ["subscription_items"];
|
|
_excluded3 = ["sku_id", "country_code", "is_gift", "gift_info_options"];
|
|
c4029_22 = "localAppleReceiptHash";
|
|
c4029_23 = "BILLING";
|
|
new Logger("BillingActionCreators.tsx");
|
|
const r78 = {
|
|
applyAppleReceipt,
|
|
fetchMostRecentSubscription: _BillingActionCreators.fetchMostRecentSubscription,
|
|
fetchIpCountryCode: _BillingActionCreators.fetchIpCountryCode,
|
|
init: async function init() {
|
|
const _this = this;
|
|
let c25794_0;
|
|
let c25794_4 = 0;
|
|
let c29730_0;
|
|
L19: {
|
|
try {
|
|
c25794_4 = 1;
|
|
c29730_0 = null;
|
|
if (isIOS()) {
|
|
c25794_4 = 2;
|
|
c29730_0 = await IAPUtils.fetchStoreFront();
|
|
c25794_4 = 1;
|
|
const r160 = Promise;
|
|
const r188 = [c29730_0 != null ? fetchPremiumSubscriptionPlans(c29730_0.country, void 0, void 0, PaymentGateways.APPLE_ADVANCED_COMMERCE) : fetchPremiumSubscriptionPlans(), , ,];
|
|
const r191 = c29730_0;
|
|
c25794_0 = r191;
|
|
if (r191 == null) {
|
|
c25794_0 = void 0;
|
|
}
|
|
r188[1] = _this.loadProducts(c25794_0);
|
|
r188[2] = fetchSubscriptions();
|
|
await r160.all(r188);
|
|
} else {
|
|
const r20 = Promise;
|
|
const r79 = [c29730_0 != null ? fetchPremiumSubscriptionPlans(c29730_0.country, void 0, void 0, PaymentGateways.APPLE_ADVANCED_COMMERCE) : fetchPremiumSubscriptionPlans(), , ,];
|
|
const r82 = c29730_0;
|
|
c25794_0 = r82;
|
|
if (r82 == null) {
|
|
c25794_0 = void 0;
|
|
}
|
|
r79[1] = _this.loadProducts(c25794_0);
|
|
r79[2] = fetchSubscriptions();
|
|
await r20.all(r79);
|
|
}
|
|
await _this.restoreAndApplyPurchases();
|
|
c25794_4 = 0;
|
|
} catch ($e) {
|
|
let r8 = $e;
|
|
let r46 = c25794_4;
|
|
if (r46 !== 0) {
|
|
while (true) {
|
|
if (r46 === 1) {
|
|
try {
|
|
c25794_4 = 0;
|
|
break L19;
|
|
} catch ($e) {
|
|
r8 = $e;
|
|
r46 = c25794_4;
|
|
if (r46 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
try {
|
|
c25794_4 = 1;
|
|
c29730_0 = null;
|
|
const r230 = Promise;
|
|
const r258 = [c29730_0 != null ? fetchPremiumSubscriptionPlans(c29730_0.country, void 0, void 0, PaymentGateways.APPLE_ADVANCED_COMMERCE) : fetchPremiumSubscriptionPlans(), , ,];
|
|
const r261 = c29730_0;
|
|
c25794_0 = r261;
|
|
if (r261 == null) {
|
|
c25794_0 = void 0;
|
|
}
|
|
r258[1] = _this.loadProducts(c25794_0);
|
|
r258[2] = fetchSubscriptions();
|
|
await r230.all(r258);
|
|
await _this.restoreAndApplyPurchases();
|
|
c25794_4 = 0;
|
|
break L19;
|
|
} catch ($e) {
|
|
r8 = $e;
|
|
r46 = c25794_4;
|
|
if (r46 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
},
|
|
connectGenericIap: async () => {
|
|
let r29, r60;
|
|
let c25795_2;
|
|
let c25795_3 = 0;
|
|
let c29731_0, c29731_1;
|
|
L12: {
|
|
try {
|
|
c29731_0 = void 0;
|
|
c29731_0 = GenericIAPStore.isGenericIapConnected();
|
|
if (c29731_0) {
|
|
r29 = c29731_0;
|
|
break L12;
|
|
}
|
|
c25795_3 = 1;
|
|
c29731_0 = await initConnection();
|
|
Dispatcher.dispatch({
|
|
type: "GENERIC_IAP_INIT_CONNECTION",
|
|
connected: c29731_0
|
|
});
|
|
r60 = c29731_0;
|
|
c25795_3 = 0;
|
|
} catch ($e) {
|
|
const r24 = $e;
|
|
let r8 = r24;
|
|
c25795_2 = r24;
|
|
if (c25795_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r69 = c25795_2;
|
|
c25795_3 = 0;
|
|
c29731_1 = r69;
|
|
captureBillingException(c29731_1);
|
|
Dispatcher.dispatch({
|
|
type: "GENERIC_IAP_INIT_CONNECTION_FAILED"
|
|
});
|
|
} catch (r65) {
|
|
r8 = r65;
|
|
c25795_2 = r65;
|
|
if (c25795_3 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return r60;
|
|
}
|
|
return r29;
|
|
},
|
|
disconnectGenericIap: () => {
|
|
Dispatcher.dispatch({
|
|
type: "GENERIC_IAP_END_CONNECTION"
|
|
});
|
|
},
|
|
loadProducts: async (c15659_0) => {
|
|
let r81;
|
|
let c25796_0, c25796_1, c25796_2, c25796_3;
|
|
let c25796_4 = 0;
|
|
const r13 = void 0;
|
|
const r12 = env4029;
|
|
L16: {
|
|
try {
|
|
let env29732;
|
|
c25796_2 = r13;
|
|
const r33 = env29732 = {
|
|
$parent: r12
|
|
};
|
|
c25796_1 = r33;
|
|
env29732[0] = void 0;
|
|
env29732[1] = void 0;
|
|
env29732[2] = void 0;
|
|
c25796_4 = 1;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_LOAD_PRODUCTS_START"
|
|
});
|
|
env29732[1] = await IAPUtils.loadProducts();
|
|
env29732[2] = Module12.filter(env29732[1], $mk114930(env4029));
|
|
if (c15659_0 == null) {
|
|
const storeFront = await IAPUtils.fetchStoreFront();
|
|
c25796_0 = storeFront;
|
|
if (storeFront == null) {
|
|
c25796_0 = {
|
|
country: "US",
|
|
currency: "usd"
|
|
};
|
|
}
|
|
r81 = c25796_0;
|
|
} else {
|
|
r81 = c15659_0;
|
|
}
|
|
env29732[0] = r81;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_LOAD_PRODUCTS",
|
|
products: env29732[1]
|
|
});
|
|
if (env29732[2].length === GenericProductIds.length) {
|
|
Dispatcher.dispatch({
|
|
type: "IAP_LOAD_GENERIC_PRODUCTS",
|
|
products: env29732[2],
|
|
storeFront: env29732[0]
|
|
});
|
|
} else {
|
|
Dispatcher.dispatch({
|
|
type: "GENERIC_IAP_SET_STORE_FRONT",
|
|
storeFront: env29732[0]
|
|
});
|
|
}
|
|
c25796_4 = 0;
|
|
} catch ($e) {
|
|
const r31 = $e;
|
|
let r8 = r31;
|
|
c25796_3 = r31;
|
|
if (c25796_4 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r149 = c25796_3;
|
|
c25796_4 = 0;
|
|
env29732[3] = r149;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_LOAD_PRODUCTS_FAILED"
|
|
});
|
|
captureBillingException(env29732[3]);
|
|
break L16;
|
|
} catch (r145) {
|
|
r8 = r145;
|
|
c25796_3 = r145;
|
|
if (c25796_4 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
},
|
|
createSubscription: async (c15660_0) => {
|
|
let jwsRepresentation2, c25797_1, c25797_2, c25797_3;
|
|
let c25797_4 = 0;
|
|
const r19 = void 0;
|
|
const r18 = env4029;
|
|
L76: {
|
|
L69: {
|
|
try {
|
|
let env29733;
|
|
c25797_2 = r19;
|
|
const r25 = env29733 = {
|
|
$parent: r18
|
|
};
|
|
c25797_1 = r25;
|
|
env29733[0] = void 0;
|
|
env29733[1] = void 0;
|
|
env29733[2] = void 0;
|
|
env29733[3] = void 0;
|
|
env29733[4] = void 0;
|
|
env29733[5] = void 0;
|
|
env29733[6] = void 0;
|
|
env29733[7] = void 0;
|
|
env29733[8] = void 0;
|
|
env29733[9] = void 0;
|
|
env29733[10] = void 0;
|
|
env29733[11] = void 0;
|
|
env29733[12] = void 0;
|
|
env29733[13] = void 0;
|
|
env29733[14] = void 0;
|
|
env29733[15] = void 0;
|
|
env29733[16] = void 0;
|
|
env29733[17] = void 0;
|
|
env29733[18] = void 0;
|
|
env29733[19] = void 0;
|
|
const productId = c15660_0.productId;
|
|
env29733[0] = productId;
|
|
env29733[1] = c15660_0.isGift;
|
|
env29733[2] = c15660_0.giftInfoOptions;
|
|
env29733[3] = c15660_0.baseAnalyticsData;
|
|
env29733[4] = c15660_0.applicationId;
|
|
env29733[5] = c15660_0.offerId;
|
|
env29733[6] = c15660_0.onPurchaseComplete;
|
|
env29733[7] = c15660_0.onPurchaseError;
|
|
env29733[8] = c15660_0.orderId;
|
|
if (IAPStore_android.isBusy()) {
|
|
break L76;
|
|
}
|
|
if (getIsPaymentsBlocked()) {
|
|
openBlockedPaymentsCountryActionSheet();
|
|
break L76;
|
|
}
|
|
await Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_START",
|
|
productIdentifier: productId
|
|
});
|
|
c25797_4 = 1;
|
|
await IAPUtils.canMakePayments();
|
|
if (SubscriptionStore.hasFetchedSubscriptions()) {
|
|
env29733[9] = UserStore.getCurrentUser();
|
|
if (env29733[9] == null) {
|
|
throw new Error(intl.string(t.PjfUXe));
|
|
}
|
|
env29733[10] = convertToUUID(env29733[9].id);
|
|
env29733[11] = void 0;
|
|
if (env29733[5] != null) {
|
|
const r242 = env29733[0];
|
|
const r243 = env29733[5];
|
|
const r244 = env29733[10];
|
|
env29733[12] = await $mk114931(env4029)(r242, r243, r244);
|
|
if (env29733[12] != null) {
|
|
env29733[11] = {
|
|
identifier: env29733[5],
|
|
keyIdentifier: env29733[12].key_id,
|
|
nonce: env29733[12].nonce,
|
|
signature: env29733[12].signature,
|
|
timestamp: Number(env29733[12].timestamp)
|
|
};
|
|
}
|
|
}
|
|
env29733[13] = await IAPUtils.purchaseProduct(env29733[0], env29733[11], env29733[10]);
|
|
const jwsRepresentation3 = env29733[13].jwsRepresentation;
|
|
jwsRepresentation2 = jwsRepresentation3;
|
|
if (jwsRepresentation3 == null) {
|
|
jwsRepresentation2 = env29733[13].transactionReceipt;
|
|
}
|
|
env29733[14] = jwsRepresentation2;
|
|
env29733[15] = MurmurHashV3.v3(env29733[14]);
|
|
Dispatcher.dispatch({
|
|
type: "GIFT_PROMOTION_GIFT_OPTIONS_CACHE_ACTION",
|
|
key: env29733[15],
|
|
giftOptions: {
|
|
...env29733[2]
|
|
}
|
|
});
|
|
const r312 = env29733[6];
|
|
await (r312 == null ? void 0 : r312());
|
|
env29733[16] = IAPStore_android.getProduct(env29733[0]);
|
|
env29733[17] = env29733[16]?.price;
|
|
env29733[18] = env29733[16]?.currencyCode;
|
|
await applyAppleReceipt({
|
|
encodedReceipt: env29733[13].transactionReceipt,
|
|
retries: 3,
|
|
presentmentCurrency: env29733[18],
|
|
presentmentAmount: env29733[17],
|
|
appStoreRegion: env29733[16]?.countryCode,
|
|
giftInfoOptions: env29733[2],
|
|
jwsRepresentation: env29733[13].jwsRepresentation,
|
|
source: "createSubscription",
|
|
orderId: env29733[8]
|
|
});
|
|
(0, setPaymentSuccess)();
|
|
Dispatcher.dispatch({
|
|
type: "GIFT_PROMOTION_GIFT_OPTIONS_CLEAR_CACHE_ACTION",
|
|
key: env29733[15]
|
|
});
|
|
const PAYMENT_FLOW_COMPLETED = AnalyticEvents.PAYMENT_FLOW_COMPLETED;
|
|
const r30 = env29733[3];
|
|
const r429 = env29733[18];
|
|
AnalyticsUtils.track(PAYMENT_FLOW_COMPLETED, getPaymentFlowCompletedAnalyticsFields(r30, {
|
|
subscription_plan_gateway_plan_id: env29733[0],
|
|
price: env29733[17],
|
|
regular_price: env29733[17],
|
|
currency: r429 == null ? void 0 : r429.toLowerCase(),
|
|
application_id: env29733[4]
|
|
}));
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: env29733[0]
|
|
});
|
|
if (!env29733[1]) {
|
|
c25797_4 = 2;
|
|
await fetchSubscriptions();
|
|
c25797_4 = 1;
|
|
env29733[19] = SubscriptionStore.getPremiumTypeSubscription();
|
|
if (env29733[19] != null) {
|
|
(0, showOldPaymentFlowSuccess)($mk114932(c25797_1));
|
|
}
|
|
}
|
|
c25797_4 = 0;
|
|
break L69;
|
|
}
|
|
await fetchSubscriptions();
|
|
throw new Error(intl.string(t.PjfUXe));
|
|
} catch ($e) {
|
|
const r57 = $e;
|
|
let r8 = r57;
|
|
c25797_3 = r57;
|
|
let r58 = c25797_4;
|
|
if (r58 !== 0) {
|
|
while (true) {
|
|
if (r58 === 1) {
|
|
try {
|
|
const r572 = c25797_3;
|
|
c25797_4 = 0;
|
|
env29733[21] = r572;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_FAILURE",
|
|
productIdentifier: env29733[0]
|
|
});
|
|
const r583 = env29733[7];
|
|
if (r583 != null) {
|
|
r583(env29733[21]);
|
|
}
|
|
(0, handlePurchaseException)(env29733[21], "subscription");
|
|
break L69;
|
|
} catch (r569) {
|
|
r8 = r569;
|
|
c25797_3 = r569;
|
|
r58 = c25797_4;
|
|
if (r58 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
try {
|
|
const r541 = c25797_3;
|
|
c25797_4 = 1;
|
|
env29733[20] = r541;
|
|
captureBillingException(env29733[20], {
|
|
tags: {
|
|
source: "createSubscriptionFetchSubscriptions"
|
|
}
|
|
});
|
|
env29733[19] = SubscriptionStore.getPremiumTypeSubscription();
|
|
if (env29733[19] != null) {
|
|
(0, showOldPaymentFlowSuccess)($mk114932(c25797_1));
|
|
}
|
|
c25797_4 = 0;
|
|
break L69;
|
|
} catch (r538) {
|
|
r8 = r538;
|
|
c25797_3 = r538;
|
|
r58 = c25797_4;
|
|
if (r58 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
restoreAndApplyPurchases: function restoreAndApplyPurchases(r5 = false) {
|
|
let env15661 = {
|
|
$parent: env4029
|
|
};
|
|
env15661[0] = r5;
|
|
env15661[1] = this;
|
|
return _asyncToGenerator(function() {
|
|
let c25798_0, c25798_1, c25798_2, c25798_3, next, c25798_5, c25798_6, c25798_7, c25798_9;
|
|
let c25798_10 = 0;
|
|
let c25798_11 = 0;
|
|
let c25798_8 = 0;
|
|
return $createGenerator(function() {
|
|
let r2, r3, r13, r21, r42, r45, r56, r59, r74, r79, r139, r153, r296, r297, method, method2, method3, value, value2, value3, value4, value5, value6;
|
|
let env29734;
|
|
let $pc = 0, $e;
|
|
while (true) {
|
|
switch ($pc) {
|
|
case 0:
|
|
const r0 = c25798_11;
|
|
r2 = r0;
|
|
if (r0 === 2) {
|
|
$pc = 91;
|
|
continue;
|
|
}
|
|
$pc = 1;
|
|
continue;
|
|
case 1:
|
|
value2 = arguments[1];
|
|
r3 = arguments[0];
|
|
const r26 = r2;
|
|
r21 = env15661;
|
|
r13 = Symbol;
|
|
if (r26 === 3) {
|
|
$pc = 86;
|
|
continue;
|
|
}
|
|
$pc = 2;
|
|
continue;
|
|
case 2:
|
|
try {
|
|
c25798_11 = 2;
|
|
r45 = c25798_10;
|
|
if (r45 === 0) {
|
|
$pc = 67;
|
|
continue;
|
|
}
|
|
$pc = 3;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 3:
|
|
try {
|
|
if (r45 === 1) {
|
|
$pc = 66;
|
|
continue;
|
|
}
|
|
$pc = 4;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 4:
|
|
try {
|
|
if (r45 === 2) {
|
|
$pc = 65;
|
|
continue;
|
|
}
|
|
$pc = 5;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 5:
|
|
try {
|
|
if (r45 === 3) {
|
|
$pc = 58;
|
|
continue;
|
|
}
|
|
$pc = 6;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 6:
|
|
try {
|
|
if (r45 === 4) {
|
|
$pc = 36;
|
|
continue;
|
|
}
|
|
$pc = 7;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 7:
|
|
try {
|
|
if (r45 === 5) {
|
|
$pc = 35;
|
|
continue;
|
|
}
|
|
$pc = 8;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 8:
|
|
try {
|
|
if (r45 === 6) {
|
|
$pc = 23;
|
|
continue;
|
|
}
|
|
$pc = 9;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 9:
|
|
try {
|
|
if (r45 === 7) {
|
|
$pc = 15;
|
|
continue;
|
|
}
|
|
$pc = 10;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 10:
|
|
try {
|
|
if (r3 === 1) {
|
|
$pc = 14;
|
|
continue;
|
|
}
|
|
$pc = 11;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 11:
|
|
try {
|
|
if (r3 !== 2) {
|
|
$pc = 47;
|
|
continue;
|
|
}
|
|
$pc = 12;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 12:
|
|
try {
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
c25798_11 = 3;
|
|
$pc = 13;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 13:
|
|
return {
|
|
value: value2,
|
|
done: true
|
|
};
|
|
case 14:
|
|
try {
|
|
c25798_11 = 3;
|
|
throw value2;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 15:
|
|
try {
|
|
const r32 = c25798_5;
|
|
r56 = c25798_9;
|
|
c25798_8 = 3;
|
|
method2 = HermesBuiltin.getMethod(r32, "throw");
|
|
if (method2 === void 0) {
|
|
$pc = 20;
|
|
continue;
|
|
}
|
|
$pc = 16;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 16:
|
|
try {
|
|
r59 = method2.call(c25798_5, r56);
|
|
HermesBuiltin.ensureObject(r59, "iterator.throw() did not return an object");
|
|
if (r59.done) {
|
|
$pc = 19;
|
|
continue;
|
|
}
|
|
$pc = 17;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 17:
|
|
try {
|
|
c25798_10 = 6;
|
|
c25798_11 = 1;
|
|
$pc = 18;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 18:
|
|
return r59;
|
|
case 19:
|
|
try {
|
|
c25798_3 = r59;
|
|
$pc = 45;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 20:
|
|
try {
|
|
method3 = HermesBuiltin.getMethod(c25798_5, "return");
|
|
if (method3 === void 0) {
|
|
$pc = 22;
|
|
continue;
|
|
}
|
|
$pc = 21;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 21:
|
|
try {
|
|
HermesBuiltin.ensureObject(method3.call(c25798_5), "iterator.return() did not return an object");
|
|
$pc = 22;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 22:
|
|
try {
|
|
HermesBuiltin.throwTypeError("yield* delegate must have a .throw() method");
|
|
$pc = 23;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 23:
|
|
try {
|
|
c25798_8 = 4;
|
|
if (r3 === 1) {
|
|
$pc = 34;
|
|
continue;
|
|
}
|
|
$pc = 24;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 24:
|
|
try {
|
|
c25798_2 = value2;
|
|
if (r3 === 2) {
|
|
$pc = 26;
|
|
continue;
|
|
}
|
|
$pc = 25;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 25:
|
|
try {
|
|
c25798_8 = 3;
|
|
r74 = value2;
|
|
$pc = 42;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 26:
|
|
try {
|
|
c25798_2 = value2;
|
|
c25798_8 = 3;
|
|
method = HermesBuiltin.getMethod(c25798_5, "return");
|
|
if (method === void 0) {
|
|
$pc = 32;
|
|
continue;
|
|
}
|
|
$pc = 27;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 27:
|
|
try {
|
|
r79 = method.call(c25798_5, c25798_2);
|
|
HermesBuiltin.ensureObject(r79, "iterator.return() did not return an object");
|
|
if (r79.done) {
|
|
$pc = 30;
|
|
continue;
|
|
}
|
|
$pc = 28;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 28:
|
|
try {
|
|
c25798_10 = 6;
|
|
c25798_11 = 1;
|
|
$pc = 29;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 29:
|
|
return r79;
|
|
case 30:
|
|
try {
|
|
value = r79.value;
|
|
c25798_8 = 2;
|
|
const r86 = c25798_0;
|
|
if (r86 !== void 0 && typeof r86.return === "function") {
|
|
r86.return();
|
|
}
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
c25798_11 = 3;
|
|
$pc = 31;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 31:
|
|
return {
|
|
value,
|
|
done: true
|
|
};
|
|
case 32:
|
|
try {
|
|
c25798_8 = 2;
|
|
const r97 = c25798_0;
|
|
if (r97 !== void 0 && typeof r97.return === "function") {
|
|
r97.return();
|
|
}
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
c25798_11 = 3;
|
|
$pc = 33;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 33:
|
|
return {
|
|
value: value2,
|
|
done: true
|
|
};
|
|
case 34:
|
|
try {
|
|
c25798_11 = 3;
|
|
throw value2;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 35:
|
|
try {
|
|
const r110 = c25798_9;
|
|
c25798_8 = 2;
|
|
const r112 = c25798_0;
|
|
if (r112 !== void 0 && typeof r112.return === "function") {
|
|
try {
|
|
r112.return();
|
|
} catch {}
|
|
}
|
|
throw r110;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 36:
|
|
try {
|
|
if (r3 === 1) {
|
|
$pc = 57;
|
|
continue;
|
|
}
|
|
$pc = 37;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 37:
|
|
try {
|
|
if (r3 === 2) {
|
|
$pc = 55;
|
|
continue;
|
|
}
|
|
$pc = 38;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 38:
|
|
try {
|
|
env29734[0] = value2;
|
|
if (env29734[0].length === 0) {
|
|
$pc = 53;
|
|
continue;
|
|
}
|
|
$pc = 39;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 39:
|
|
try {
|
|
const r116 = c25798_6;
|
|
env29734[1] = Module12(env29734[0]).uniqBy((item) => {
|
|
let jwsRepresentation3 = item.purchaseResponse.jwsRepresentation;
|
|
if (jwsRepresentation3 == null) {
|
|
jwsRepresentation3 = item.purchaseResponse.originalTransactionIdentifier;
|
|
}
|
|
return jwsRepresentation3;
|
|
}).value();
|
|
env29734[2] = [];
|
|
env29734[3] = [];
|
|
env29734[4] = $mk114934(r116);
|
|
const r133 = env29734[1];
|
|
c25798_1 = r133;
|
|
const r135 = r133[Symbol.iterator]();
|
|
c25798_1 = r135.next;
|
|
c25798_0 = r135;
|
|
$pc = 40;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 40:
|
|
try {
|
|
const r137 = c25798_1;
|
|
let r138 = c25798_0;
|
|
r139 = r138 === void 0 ? void 0 : (r42 = r137.call(r138)).done ? r138 = void 0 : r42.value;
|
|
c25798_0 = r138;
|
|
if (r138 === void 0) {
|
|
$pc = 46;
|
|
continue;
|
|
}
|
|
$pc = 41;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 41:
|
|
try {
|
|
c25798_8 = 3;
|
|
env29734[5] = r139;
|
|
const r146 = (0, env29734[4])(env29734[5])[r13.iterator]();
|
|
c25798_5 = r146;
|
|
HermesBuiltin.ensureObject(r146, "iterator is not an object");
|
|
next = r146.next;
|
|
c25798_2 = void 0;
|
|
r74 = void 0;
|
|
$pc = 42;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 42:
|
|
try {
|
|
r153 = next.call(c25798_5, r74);
|
|
HermesBuiltin.ensureObject(r153, "iterator.next() did not return an object");
|
|
c25798_3 = r153;
|
|
if (r153.done) {
|
|
$pc = 45;
|
|
continue;
|
|
}
|
|
$pc = 43;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 43:
|
|
try {
|
|
c25798_10 = 6;
|
|
c25798_11 = 1;
|
|
$pc = 44;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 44:
|
|
return r153;
|
|
case 45:
|
|
try {
|
|
c25798_3.value;
|
|
c25798_8 = 2;
|
|
$pc = 40;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 46:
|
|
try {
|
|
if (env29734[2].length > 0) {
|
|
$pc = 51;
|
|
continue;
|
|
}
|
|
$pc = 47;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 47:
|
|
try {
|
|
if (env29734[3].length > 0) {
|
|
$pc = 50;
|
|
continue;
|
|
}
|
|
$pc = 48;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 48:
|
|
try {
|
|
value3 = env29734[2];
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
c25798_11 = 3;
|
|
$pc = 49;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 49:
|
|
return {
|
|
value: value3,
|
|
done: true
|
|
};
|
|
case 50:
|
|
try {
|
|
env29734[3].forEach($mk114935(env15661.$parent));
|
|
throw new Error("There were some errors while trying to restore");
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 51:
|
|
try {
|
|
value4 = fetchSubscriptions();
|
|
c25798_10 = 8;
|
|
c25798_11 = 1;
|
|
$pc = 52;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 52:
|
|
return {
|
|
value: value4,
|
|
done: false
|
|
};
|
|
case 53:
|
|
try {
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
c25798_11 = 3;
|
|
$pc = 54;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 54:
|
|
return {
|
|
value: [],
|
|
done: true
|
|
};
|
|
case 55:
|
|
try {
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
c25798_11 = 3;
|
|
$pc = 56;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 56:
|
|
return {
|
|
value: value2,
|
|
done: true
|
|
};
|
|
case 57:
|
|
try {
|
|
c25798_11 = 3;
|
|
throw value2;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 58:
|
|
try {
|
|
if (r3 === 1) {
|
|
$pc = 64;
|
|
continue;
|
|
}
|
|
$pc = 59;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 59:
|
|
try {
|
|
if (r3 === 2) {
|
|
$pc = 62;
|
|
continue;
|
|
}
|
|
$pc = 60;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 60:
|
|
try {
|
|
value5 = IAPUtils.restorePurchases({
|
|
fullRestore: env15661[0]
|
|
});
|
|
c25798_10 = 4;
|
|
c25798_11 = 1;
|
|
$pc = 61;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 61:
|
|
return {
|
|
value: value5,
|
|
done: false
|
|
};
|
|
case 62:
|
|
try {
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
c25798_11 = 3;
|
|
$pc = 63;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 63:
|
|
return {
|
|
value: value2,
|
|
done: true
|
|
};
|
|
case 64:
|
|
try {
|
|
c25798_11 = 3;
|
|
throw value2;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 65:
|
|
try {
|
|
const r251 = c25798_9;
|
|
c25798_8 = 1;
|
|
env29734[6] = r251;
|
|
captureBillingException(env29734[6]);
|
|
throw env29734[6];
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 66:
|
|
try {
|
|
const r263 = c25798_9;
|
|
c25798_8 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_END"
|
|
});
|
|
throw r263;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 67:
|
|
try {
|
|
if (r3 === 1) {
|
|
$pc = 76;
|
|
continue;
|
|
}
|
|
$pc = 68;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 68:
|
|
try {
|
|
if (r3 === 2) {
|
|
$pc = 74;
|
|
continue;
|
|
}
|
|
$pc = 69;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 69:
|
|
try {
|
|
c25798_7 = r21;
|
|
const r273 = env29734 = {
|
|
$parent: r21
|
|
};
|
|
c25798_6 = r273;
|
|
env29734[0] = void 0;
|
|
env29734[1] = void 0;
|
|
env29734[2] = void 0;
|
|
env29734[3] = void 0;
|
|
env29734[4] = void 0;
|
|
env29734[5] = void 0;
|
|
if (IAPStore_android.isBusy()) {
|
|
$pc = 72;
|
|
continue;
|
|
}
|
|
$pc = 70;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 70:
|
|
try {
|
|
Dispatcher.dispatch({
|
|
type: "IAP_RESTORE_PURCHASES_START"
|
|
});
|
|
c25798_8 = 2;
|
|
value6 = env15661[1].loadProducts();
|
|
c25798_10 = 3;
|
|
c25798_11 = 1;
|
|
$pc = 71;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 71:
|
|
return {
|
|
value: value6,
|
|
done: false
|
|
};
|
|
case 72:
|
|
try {
|
|
c25798_11 = 3;
|
|
$pc = 73;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 73:
|
|
return {
|
|
value: [],
|
|
done: true
|
|
};
|
|
case 74:
|
|
try {
|
|
c25798_11 = 3;
|
|
$pc = 75;
|
|
continue;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 75:
|
|
return {
|
|
value: value2,
|
|
done: true
|
|
};
|
|
case 76:
|
|
try {
|
|
c25798_11 = 3;
|
|
throw value2;
|
|
} catch ($caught) {
|
|
$e = $caught;
|
|
$pc = 77;
|
|
continue;
|
|
}
|
|
case 77:
|
|
const r295 = $e;
|
|
r296 = r295;
|
|
c25798_9 = r295;
|
|
r297 = c25798_8;
|
|
if (r297 === 0) {
|
|
$pc = 85;
|
|
continue;
|
|
}
|
|
$pc = 78;
|
|
continue;
|
|
case 78:
|
|
if (r297 === 1) {
|
|
$pc = 84;
|
|
continue;
|
|
}
|
|
$pc = 79;
|
|
continue;
|
|
case 79:
|
|
if (r297 === 2) {
|
|
$pc = 83;
|
|
continue;
|
|
}
|
|
$pc = 80;
|
|
continue;
|
|
case 80:
|
|
if (r297 === 3) {
|
|
$pc = 82;
|
|
continue;
|
|
}
|
|
$pc = 81;
|
|
continue;
|
|
case 81:
|
|
c25798_10 = 7;
|
|
$pc = 2;
|
|
continue;
|
|
case 82:
|
|
c25798_10 = 5;
|
|
$pc = 2;
|
|
continue;
|
|
case 83:
|
|
c25798_10 = 2;
|
|
$pc = 2;
|
|
continue;
|
|
case 84:
|
|
c25798_10 = 1;
|
|
$pc = 2;
|
|
continue;
|
|
case 85:
|
|
c25798_11 = 3;
|
|
throw r296;
|
|
case 86:
|
|
if (r3 === 1) {
|
|
$pc = 90;
|
|
continue;
|
|
}
|
|
$pc = 87;
|
|
continue;
|
|
case 87:
|
|
if (r3 === 2) {
|
|
$pc = 89;
|
|
continue;
|
|
}
|
|
$pc = 88;
|
|
continue;
|
|
case 88:
|
|
return {
|
|
value: void 0,
|
|
done: true
|
|
};
|
|
case 89:
|
|
return {
|
|
value: value2,
|
|
done: true
|
|
};
|
|
case 90:
|
|
throw value2;
|
|
case 91:
|
|
c25798_11 = 3;
|
|
HermesBuiltin.throwTypeError("Generator functions may not be called on executing generators");
|
|
throw new Error("unreachable");
|
|
}
|
|
throw new Error("bad pc " + $pc);
|
|
}
|
|
});
|
|
})();
|
|
}
|
|
};
|
|
c4029_26 = new Set([ErrorCode.E_USER_CANCELLED, StoreKitErrors.PAYMENT_CANCELED]);
|
|
c4029_39 = {
|
|
NONE: "none",
|
|
CANNOT_MAKE_REQUEST: "cannot_make_request",
|
|
INVALID_CURRENCY: "invalid_currency",
|
|
PURCHASE_INCOMPLETE: "purchase_incomplete",
|
|
USER_CANCELLED: "user_cancelled",
|
|
POST_PURCHASE_FAILED: "post_purchase_failed"
|
|
};
|
|
export default r78;
|
|
export { getIAPJWTRequestData };
|
|
export { updateAppleSubscription };
|
|
export async function cancelGenericSubscription(c25787_0, c25787_1, c25787_2) {
|
|
let c25787_5;
|
|
let c25787_6 = 0;
|
|
let c29724_0, c29724_1, c29724_2, c29724_3, c29724_4, c29724_5;
|
|
L17: {
|
|
try {
|
|
c29724_0 = c25787_0;
|
|
c29724_1 = c25787_1;
|
|
c29724_2 = c25787_2;
|
|
c29724_3 = void 0;
|
|
c29724_4 = void 0;
|
|
if (canMakeIAPRequest()) {
|
|
const r41 = c25787_2 ? ACRequestOperations.CANCEL : APBRequestOperations.CANCEL;
|
|
c29724_3 = r41;
|
|
const productIdentifier = determineProductId(r41);
|
|
c29724_4 = productIdentifier;
|
|
await Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_START",
|
|
productIdentifier
|
|
});
|
|
c25787_6 = 1;
|
|
await (0, updateAppleSubscription)({
|
|
operation: c29724_3,
|
|
request_identifier: c29724_0,
|
|
subscription_id: c29724_1
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: c29724_4
|
|
});
|
|
c25787_6 = 0;
|
|
break L17;
|
|
}
|
|
} catch ($e) {
|
|
const r30 = $e;
|
|
let r8 = r30;
|
|
c25787_5 = r30;
|
|
if (c25787_6 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r114 = c25787_5;
|
|
c25787_6 = 0;
|
|
c29724_5 = r114;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_FAILURE",
|
|
productIdentifier: c29724_4
|
|
});
|
|
handlePurchaseException(c29724_5, c29724_2 ? "advanced_commerce" : "partner_subscription");
|
|
} catch (r110) {
|
|
r8 = r110;
|
|
c25787_5 = r110;
|
|
if (c25787_6 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
export { isValidCurrency };
|
|
export { c4029_39 as SubscriptionPurchaseFailureReason };
|
|
export async function createGenericSubscription(c25788_0) {
|
|
let r88, r110, r291, r321;
|
|
let c25788_1, c25788_2, c25788_3;
|
|
let c25788_4 = 0;
|
|
const r19 = env4029;
|
|
L25: {
|
|
L14: {
|
|
try {
|
|
let env29725;
|
|
c25788_2 = r19;
|
|
const r49 = env29725 = {};
|
|
c25788_1 = r49;
|
|
env29725[0] = void 0;
|
|
env29725[1] = void 0;
|
|
env29725[2] = void 0;
|
|
env29725[3] = void 0;
|
|
env29725[4] = void 0;
|
|
env29725[0] = c25788_0.requestIdentifier;
|
|
env29725[1] = c25788_0.items;
|
|
env29725[2] = c25788_0.currency;
|
|
env29725[3] = c25788_0.countryCode;
|
|
env29725[4] = c25788_0.orderId;
|
|
env29725[5] = void 0;
|
|
env29725[6] = void 0;
|
|
env29725[7] = void 0;
|
|
env29725[8] = void 0;
|
|
env29725[9] = void 0;
|
|
env29725[10] = void 0;
|
|
env29725[11] = void 0;
|
|
await void 0;
|
|
if ((0, canMakeIAPRequest)()) {
|
|
if ((0, isValidCurrency)(env29725[2])) {
|
|
env29725[5] = (0, determineProductId)(ACRequestOperations.CREATE);
|
|
await Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_START",
|
|
productIdentifier: env29725[5]
|
|
});
|
|
env29725[6] = false;
|
|
c25788_4 = 1;
|
|
env29725[7] = {
|
|
request_identifier: env29725[0],
|
|
items: env29725[1].map((item) => ({
|
|
plan_id: item.planId,
|
|
quantity: item.quantity
|
|
})),
|
|
currency: env29725[2],
|
|
country_code: env29725[3],
|
|
order_id: env29725[4]
|
|
};
|
|
env29725[8] = (await getIAPJWTRequestData({
|
|
operation: ACRequestOperations.CREATE,
|
|
...env29725[7]
|
|
})).requestJSONString;
|
|
env29725[9] = await (0, clearAndMakeIAPRequest)(env29725[0], env29725[8], env29725[5], true);
|
|
env29725[10] = env29725[9].purchaseResponse;
|
|
env29725[11] = env29725[9].originalPurchase;
|
|
env29725[6] = true;
|
|
await (0, applyAppleReceipt)({
|
|
encodedReceipt: env29725[10].transactionReceipt,
|
|
retries: 3,
|
|
presentmentCurrency: env29725[2],
|
|
appStoreRegion: env29725[3],
|
|
jwsRepresentation: env29725[10].jwsRepresentation,
|
|
source: "createGenericSubscription",
|
|
orderId: env29725[4]
|
|
});
|
|
await finishTransaction({
|
|
purchase: env29725[11]
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: env29725[5]
|
|
});
|
|
r291 = {
|
|
success: true,
|
|
failureReason: c4029_39.NONE
|
|
};
|
|
c25788_4 = 0;
|
|
break L25;
|
|
}
|
|
r110 = {
|
|
success: false,
|
|
failureReason: c4029_39.INVALID_CURRENCY
|
|
};
|
|
break L14;
|
|
}
|
|
r88 = {
|
|
success: false,
|
|
failureReason: c4029_39.CANNOT_MAKE_REQUEST
|
|
};
|
|
} catch ($e) {
|
|
const r47 = $e;
|
|
let r8 = r47;
|
|
c25788_3 = r47;
|
|
if (c25788_4 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r300 = c25788_3;
|
|
c25788_4 = 0;
|
|
env29725[12] = r300;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_FAILURE",
|
|
productIdentifier: env29725[5]
|
|
});
|
|
handlePurchaseException(env29725[12], "advanced_commerce", env29725[4] == null || env29725[6]);
|
|
const r316 = env29725[6];
|
|
r321 = {
|
|
success: false,
|
|
failureReason: r316 ? c4029_39.POST_PURCHASE_FAILED : c4029_39.PURCHASE_INCOMPLETE
|
|
};
|
|
} catch (r296) {
|
|
r8 = r296;
|
|
c25788_3 = r296;
|
|
if (c25788_4 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return r321;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return r88;
|
|
}
|
|
return r110;
|
|
}
|
|
return r291;
|
|
}
|
|
export async function modifyGenericSubscription(c25789_0) {
|
|
let r109, r322, r448;
|
|
let c25789_1, c25789_2, c25789_3;
|
|
let c25789_4 = 0;
|
|
const r20 = env4029;
|
|
L27: {
|
|
try {
|
|
let env29726;
|
|
c25789_2 = r20;
|
|
const r57 = env29726 = {};
|
|
c25789_1 = r57;
|
|
env29726[0] = void 0;
|
|
env29726[1] = void 0;
|
|
env29726[2] = void 0;
|
|
env29726[3] = void 0;
|
|
env29726[4] = void 0;
|
|
env29726[0] = c25789_0.requestIdentifier;
|
|
env29726[1] = c25789_0.subscriptionId;
|
|
env29726[2] = c25789_0.items;
|
|
env29726[3] = c25789_0.orderId;
|
|
env29726[4] = c25789_0.onPurchaseComplete;
|
|
env29726[5] = void 0;
|
|
env29726[6] = void 0;
|
|
env29726[7] = void 0;
|
|
env29726[8] = void 0;
|
|
env29726[9] = void 0;
|
|
env29726[10] = void 0;
|
|
await void 0;
|
|
if ((0, canMakeIAPRequest)()) {
|
|
env29726[5] = ProductIds.GENERIC_SUBSCRIPTION;
|
|
await Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_START",
|
|
productIdentifier: env29726[5]
|
|
});
|
|
env29726[6] = false;
|
|
c25789_4 = 1;
|
|
env29726[7] = (await (0, getIAPJWTRequestData)({
|
|
operation: ACRequestOperations.MODIFY,
|
|
request_identifier: env29726[0],
|
|
subscription_id: env29726[1],
|
|
subscription_items: env29726[2].map((item) => ({
|
|
plan_id: item.planId,
|
|
quantity: item.quantity
|
|
})),
|
|
order_id: env29726[3]
|
|
})).requestJSONString;
|
|
env29726[8] = await (0, clearAndMakeIAPRequest)(env29726[0], env29726[7], env29726[5], true);
|
|
env29726[9] = env29726[8].purchaseResponse;
|
|
env29726[10] = env29726[8].originalPurchase;
|
|
env29726[6] = true;
|
|
c25789_4 = 2;
|
|
const r212 = env29726[4];
|
|
await (r212 == null ? void 0 : r212());
|
|
c25789_4 = 1;
|
|
await (0, applyAppleReceipt)({
|
|
encodedReceipt: env29726[9].transactionReceipt,
|
|
retries: 3,
|
|
jwsRepresentation: env29726[9].jwsRepresentation,
|
|
source: "modifyGenericSubscription",
|
|
orderId: env29726[3]
|
|
});
|
|
await finishTransaction({
|
|
purchase: env29726[10]
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: env29726[5]
|
|
});
|
|
r322 = {
|
|
success: true,
|
|
failureReason: c4029_39.NONE
|
|
};
|
|
c25789_4 = 0;
|
|
break L27;
|
|
}
|
|
r109 = {
|
|
success: false,
|
|
failureReason: c4029_39.CANNOT_MAKE_REQUEST
|
|
};
|
|
} catch ($e) {
|
|
const r55 = $e;
|
|
let r8 = r55;
|
|
c25789_3 = r55;
|
|
let r56 = c25789_4;
|
|
if (r56 !== 0) {
|
|
while (true) {
|
|
if (r56 === 1) {
|
|
try {
|
|
const r427 = c25789_3;
|
|
c25789_4 = 0;
|
|
env29726[12] = r427;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_FAILURE",
|
|
productIdentifier: env29726[5]
|
|
});
|
|
handlePurchaseException(env29726[12], "advanced_commerce", env29726[3] == null || env29726[6]);
|
|
const r443 = env29726[6];
|
|
r448 = {
|
|
success: false,
|
|
failureReason: r443 ? c4029_39.POST_PURCHASE_FAILED : c4029_39.PURCHASE_INCOMPLETE
|
|
};
|
|
} catch (r424) {
|
|
r8 = r424;
|
|
c25789_3 = r424;
|
|
r56 = c25789_4;
|
|
if (r56 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return r448;
|
|
}
|
|
try {
|
|
const r330 = c25789_3;
|
|
c25789_4 = 1;
|
|
env29726[11] = r330;
|
|
captureBillingException(env29726[11]);
|
|
await (0, applyAppleReceipt)({
|
|
encodedReceipt: env29726[9].transactionReceipt,
|
|
retries: 3,
|
|
jwsRepresentation: env29726[9].jwsRepresentation,
|
|
source: "modifyGenericSubscription",
|
|
orderId: env29726[3]
|
|
});
|
|
await finishTransaction({
|
|
purchase: env29726[10]
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: env29726[5]
|
|
});
|
|
r322 = {
|
|
success: true,
|
|
failureReason: c4029_39.NONE
|
|
};
|
|
c25789_4 = 0;
|
|
break L27;
|
|
} catch (r327) {
|
|
r8 = r327;
|
|
c25789_3 = r327;
|
|
r56 = c25789_4;
|
|
if (r56 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return r109;
|
|
}
|
|
return r322;
|
|
}
|
|
export async function resubscribeGenericSubscription(c25790_0, c25790_1) {
|
|
let c25790_4;
|
|
let c25790_5 = 0;
|
|
let c29727_0, c29727_1, c29727_2, c29727_3, c29727_4, c29727_5, c29727_6, c29727_7, c29727_8, c29727_9;
|
|
L21: {
|
|
try {
|
|
c29727_0 = void 0;
|
|
c29727_1 = void 0;
|
|
c29727_2 = void 0;
|
|
c29727_0 = c25790_0.requestIdentifier;
|
|
c29727_1 = c25790_0.subscriptionId;
|
|
c29727_2 = c25790_1;
|
|
c29727_3 = void 0;
|
|
c29727_4 = void 0;
|
|
c29727_5 = void 0;
|
|
c29727_6 = void 0;
|
|
c29727_7 = void 0;
|
|
c29727_8 = void 0;
|
|
await void 0;
|
|
if ((0, canMakeIAPRequest)()) {
|
|
c29727_3 = {
|
|
request_identifier: c29727_0,
|
|
subscription_id: c29727_1
|
|
};
|
|
c29727_4 = determineProductId(c29727_2 ? ACRequestOperations.REACTIVATE : APBRequestOperations.REACTIVATE);
|
|
await Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_START",
|
|
productIdentifier: c29727_4
|
|
});
|
|
c25790_5 = 1;
|
|
if (c29727_2) {
|
|
c29727_5 = (await getIAPJWTRequestData({
|
|
operation: ACRequestOperations.REACTIVATE,
|
|
...c29727_3
|
|
})).requestJSONString;
|
|
c29727_6 = await (0, clearAndMakeIAPRequest)(c29727_0, c29727_5, c29727_4, true);
|
|
c29727_7 = c29727_6.purchaseResponse;
|
|
c29727_8 = c29727_6.originalPurchase;
|
|
await (0, applyAppleReceipt)({
|
|
encodedReceipt: c29727_7.transactionReceipt,
|
|
retries: 3,
|
|
jwsRepresentation: c29727_7.jwsRepresentation,
|
|
source: "resubscribeGenericSubscription"
|
|
});
|
|
await finishTransaction({
|
|
purchase: c29727_8
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: c29727_4
|
|
});
|
|
c25790_5 = 0;
|
|
break L21;
|
|
}
|
|
await updateAppleSubscription({
|
|
operation: APBRequestOperations.REACTIVATE,
|
|
...c29727_3
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: c29727_4
|
|
});
|
|
c25790_5 = 0;
|
|
break L21;
|
|
}
|
|
} catch ($e) {
|
|
const r49 = $e;
|
|
let r8 = r49;
|
|
c25790_4 = r49;
|
|
if (c25790_5 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r320 = c25790_4;
|
|
c25790_5 = 0;
|
|
c29727_9 = r320;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_FAILURE",
|
|
productIdentifier: c29727_4
|
|
});
|
|
handlePurchaseException(c29727_9, c29727_2 ? "advanced_commerce" : "partner_subscription");
|
|
} catch (r316) {
|
|
r8 = r316;
|
|
c25790_4 = r316;
|
|
if (c25790_5 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
export async function mobilePurchaseSKU(c25792_0, c25792_1) {
|
|
let r109, r131, r430, r475, r582;
|
|
let jwsRepresentation, purchaseSKU, c25792_4, c25792_5, c25792_6;
|
|
let c25792_7 = 0;
|
|
const r19 = env4029;
|
|
L57: {
|
|
L20: {
|
|
try {
|
|
let env29729;
|
|
c25792_5 = r19;
|
|
const r57 = env29729 = {
|
|
$parent: r19
|
|
};
|
|
c25792_4 = r57;
|
|
env29729[0] = void 0;
|
|
env29729[1] = void 0;
|
|
env29729[2] = void 0;
|
|
env29729[3] = void 0;
|
|
env29729[4] = void 0;
|
|
env29729[5] = void 0;
|
|
env29729[6] = void 0;
|
|
env29729[7] = void 0;
|
|
env29729[8] = void 0;
|
|
env29729[9] = void 0;
|
|
env29729[10] = void 0;
|
|
env29729[0] = c25792_0.requestIdentifier;
|
|
env29729[1] = c25792_0.skuId;
|
|
env29729[2] = c25792_0.currency;
|
|
env29729[3] = c25792_0.countryCode;
|
|
env29729[4] = c25792_0.analyticsLocations;
|
|
env29729[5] = c25792_0.analyticsLoadId;
|
|
env29729[6] = c25792_0.isGift;
|
|
env29729[7] = c25792_0.giftInfoOptions;
|
|
const isFreeForStaffSelfPurchase = c25792_0.isFreeForStaffSelfPurchase;
|
|
if (isFreeForStaffSelfPurchase !== void 0) {
|
|
env29729[8] = isFreeForStaffSelfPurchase;
|
|
env29729[9] = c25792_0.orderId;
|
|
env29729[10] = c25792_1;
|
|
env29729[11] = void 0;
|
|
env29729[12] = void 0;
|
|
env29729[13] = void 0;
|
|
env29729[14] = void 0;
|
|
env29729[15] = void 0;
|
|
env29729[16] = void 0;
|
|
env29729[17] = void 0;
|
|
env29729[18] = void 0;
|
|
env29729[19] = void 0;
|
|
env29729[20] = void 0;
|
|
env29729[21] = void 0;
|
|
env29729[22] = void 0;
|
|
} else {
|
|
env29729[8] = true;
|
|
env29729[9] = c25792_0.orderId;
|
|
env29729[10] = c25792_1;
|
|
env29729[11] = void 0;
|
|
env29729[12] = void 0;
|
|
env29729[13] = void 0;
|
|
env29729[14] = void 0;
|
|
env29729[15] = void 0;
|
|
env29729[16] = void 0;
|
|
env29729[17] = void 0;
|
|
env29729[18] = void 0;
|
|
env29729[19] = void 0;
|
|
env29729[20] = void 0;
|
|
env29729[21] = void 0;
|
|
env29729[22] = void 0;
|
|
}
|
|
await void 0;
|
|
if ((0, canMakeIAPRequest)()) {
|
|
if ((0, isValidCurrency)(env29729[2])) {
|
|
env29729[11] = (0, determineProductId)(ACRequestOperations.CHARGE);
|
|
await Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_START",
|
|
productIdentifier: env29729[11]
|
|
});
|
|
trackPaymentFlowStartedAnalyticsAndCTP({
|
|
sku_id: env29729[1],
|
|
load_id: env29729[5],
|
|
location_stack: env29729[4],
|
|
payment_gateway: PaymentGateways.APPLE_ADVANCED_COMMERCE
|
|
});
|
|
env29729[12] = false;
|
|
c25792_7 = 1;
|
|
const r172 = env29729[2];
|
|
const r173 = env29729[3];
|
|
await $mk114927(env4029)(r172, r173);
|
|
env29729[13] = {
|
|
sku_id: env29729[1],
|
|
request_identifier: env29729[0],
|
|
currency: env29729[2],
|
|
country_code: env29729[3],
|
|
is_gift: env29729[6],
|
|
gift_info_options: env29729[7],
|
|
order_id: env29729[9]
|
|
};
|
|
env29729[14] = (await getIAPJWTRequestData({
|
|
operation: ACRequestOperations.CHARGE,
|
|
...env29729[13]
|
|
})).requestJSONString;
|
|
env29729[15] = await (0, clearAndMakeIAPRequest)(env29729[0], env29729[14], env29729[11], true);
|
|
env29729[16] = env29729[15].purchaseResponse;
|
|
env29729[17] = env29729[15].originalPurchase;
|
|
env29729[12] = true;
|
|
const jwsRepresentation3 = env29729[16].jwsRepresentation;
|
|
jwsRepresentation = jwsRepresentation3;
|
|
if (jwsRepresentation3 == null) {
|
|
jwsRepresentation = env29729[16].transactionReceipt;
|
|
}
|
|
env29729[18] = jwsRepresentation;
|
|
env29729[19] = MurmurHashV3.v3(env29729[18]);
|
|
if (env29729[6]) {
|
|
Dispatcher.dispatch({
|
|
type: "GIFT_PROMOTION_GIFT_OPTIONS_CACHE_ACTION",
|
|
key: env29729[19],
|
|
giftOptions: {
|
|
...env29729[7]
|
|
}
|
|
});
|
|
}
|
|
await (0, applyAppleReceipt)({
|
|
encodedReceipt: env29729[16].transactionReceipt,
|
|
retries: 3,
|
|
presentmentCurrency: env29729[2],
|
|
appStoreRegion: env29729[3],
|
|
giftInfoOptions: env29729[7],
|
|
isGift: env29729[6],
|
|
jwsRepresentation: env29729[16].jwsRepresentation,
|
|
source: "mobilePurchaseSKU",
|
|
orderId: env29729[9]
|
|
});
|
|
if (env29729[6]) {
|
|
Dispatcher.dispatch({
|
|
type: "GIFT_PROMOTION_GIFT_OPTIONS_CLEAR_CACHE_ACTION",
|
|
key: env29729[19]
|
|
});
|
|
}
|
|
await finishTransaction({
|
|
purchase: env29729[17]
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_SUCCESS",
|
|
productIdentifier: env29729[11]
|
|
});
|
|
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_COMPLETED, {
|
|
sku_id: env29729[1],
|
|
load_id: env29729[5],
|
|
location_stack: env29729[4],
|
|
payment_gateway: PaymentGateways.APPLE_ADVANCED_COMMERCE,
|
|
is_gift: env29729[6]
|
|
});
|
|
r430 = {
|
|
success: true,
|
|
failureReason: c4029_39.NONE
|
|
};
|
|
c25792_7 = 0;
|
|
break L57;
|
|
}
|
|
r131 = {
|
|
success: false,
|
|
failureReason: c4029_39.INVALID_CURRENCY
|
|
};
|
|
break L20;
|
|
}
|
|
r109 = {
|
|
success: false,
|
|
failureReason: c4029_39.CANNOT_MAKE_REQUEST
|
|
};
|
|
} catch ($e) {
|
|
const r55 = $e;
|
|
let r8 = r55;
|
|
c25792_6 = r55;
|
|
let r56 = c25792_7;
|
|
if (r56 !== 0) {
|
|
while (true) {
|
|
L72: {
|
|
if (r56 === 1) {
|
|
L88: {
|
|
try {
|
|
const r482 = c25792_6;
|
|
c25792_7 = 0;
|
|
env29729[23] = r482;
|
|
Dispatcher.dispatch({
|
|
type: "IAP_PURCHASE_PRODUCT_FAILURE",
|
|
productIdentifier: env29729[11]
|
|
});
|
|
env29729[20] = new BillingError(env29729[23]);
|
|
env29729[21] = UserStore.getCurrentUser();
|
|
if (env29729[21] != null && env29729[21].isStaff()) {
|
|
if (env29729[8]) {
|
|
if (env29729[20].code === ErrorCodes.BILLING_CANNOT_CHARGE_ZERO_AMOUNT) {
|
|
const r528 = env29729[10];
|
|
purchaseSKU = r528;
|
|
if (r528 == null) {
|
|
purchaseSKU = _SKUActionCreators.purchaseSKU;
|
|
}
|
|
env29729[22] = purchaseSKU;
|
|
c25792_7 = 2;
|
|
await (0, env29729[22])("collectibles", env29729[1], {
|
|
countryCode: env29729[3],
|
|
expectedAmount: 0,
|
|
expectedCurrency: CurrencyCodes.USD,
|
|
loadId: v4(),
|
|
isGift: env29729[6],
|
|
giftInfoOptions: env29729[7]
|
|
});
|
|
r582 = {
|
|
success: true,
|
|
failureReason: c4029_39.NONE
|
|
};
|
|
c25792_7 = 0;
|
|
break L88;
|
|
}
|
|
}
|
|
}
|
|
handlePurchaseException(env29729[23], "collectibles", env29729[9] == null || env29729[12]);
|
|
r475 = {
|
|
success: false,
|
|
failureReason: env29729[12] ? c4029_39.POST_PURCHASE_FAILED : (0, preCompletionFailureReason)(env29729[23])
|
|
};
|
|
break L72;
|
|
} catch (r479) {
|
|
r8 = r479;
|
|
c25792_6 = r479;
|
|
r56 = c25792_7;
|
|
if (r56 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
}
|
|
return r582;
|
|
}
|
|
try {
|
|
const r438 = c25792_6;
|
|
c25792_7 = 0;
|
|
env29729[24] = r438;
|
|
if (env29729[24].code === ErrorCodes.BILLING_PURCHASE_REQUEST_INVALID) {
|
|
captureBillingException(env29729[24], {});
|
|
}
|
|
handlePurchaseException(env29729[23], "collectibles", env29729[9] == null || env29729[12]);
|
|
r475 = {
|
|
success: false,
|
|
failureReason: env29729[12] ? c4029_39.POST_PURCHASE_FAILED : (0, preCompletionFailureReason)(env29729[23])
|
|
};
|
|
} catch (r435) {
|
|
r8 = r435;
|
|
c25792_6 = r435;
|
|
r56 = c25792_7;
|
|
if (r56 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
}
|
|
return r475;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return r109;
|
|
}
|
|
return r131;
|
|
}
|
|
return r430;
|
|
}
|
|
export async function migrateToACOM() {
|
|
let activeGuildSubscriptions, subscriptions;
|
|
let c25793_4 = 0;
|
|
L25: {
|
|
L24: {
|
|
L21: {
|
|
try {
|
|
if (UserStore.getCurrentUser() == null) {
|
|
break L25;
|
|
}
|
|
if (canMakeIAPRequest()) {
|
|
const activeGuildSubscriptions2 = SubscriptionStore.getActiveGuildSubscriptions();
|
|
activeGuildSubscriptions = activeGuildSubscriptions2;
|
|
if (activeGuildSubscriptions2 == null) {
|
|
activeGuildSubscriptions = [];
|
|
}
|
|
const r40 = activeGuildSubscriptions.filter((activeGuildSubscription) => activeGuildSubscription.paymentGateway === PaymentGateways.APPLE_PARTNER);
|
|
const r18 = Object;
|
|
const subscriptions2 = SubscriptionStore.getSubscriptions();
|
|
subscriptions = subscriptions2;
|
|
if (subscriptions2 == null) {
|
|
subscriptions = [];
|
|
}
|
|
const r49 = r18.values(subscriptions).filter((item) => item.paymentGateway === PaymentGateways.APPLE && item.type === SubscriptionTypes.PREMIUM);
|
|
const enabled = NitroACOMSubscriptionExperiment.getConfig({
|
|
location: "migrateToACOM"
|
|
}).enabled;
|
|
const migrate_premium = r49.length > 0 && enabled;
|
|
if (r40.length === 0 && migrate_premium === false) {
|
|
break L21;
|
|
}
|
|
c25793_4 = 1;
|
|
await HTTP.post({
|
|
url: Endpoints.BILLING_ACOM_SUBSCRIPTION_MIGRATION,
|
|
rejectWithError: true,
|
|
body: {
|
|
migrate_premium
|
|
}
|
|
});
|
|
c25793_4 = 0;
|
|
break L24;
|
|
}
|
|
} catch ($e) {
|
|
let r28 = $e;
|
|
if (c25793_4 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c25793_4 = 0;
|
|
} catch ($e) {
|
|
r28 = $e;
|
|
if (c25793_4 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
throw r28;
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|