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

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
// Metro module 4511 (f4512).
export const StripeErrorTypes = ["api_connection_error", "api_error", "authentication_error", "card_error", "idempotency_error", "invalid_request_error", "rate_limit_error", "validation_error"];
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,241 @@
// Metro module 4510 (f4511).
import PaymentSourceRecord from "../../../records/PaymentSourceRecord";
import { StripeErrorTypes } from "../Constants";
import { AnalyticEvents, Endpoints } from "../../../Constants";
import { HTTP } from "../../../_bundle/sendRequest";
import { parseV8BillingAddressSkemaErrorToBillingError, ErrorCodes } from "../../../errors/BillingError";
import Dispatcher from "../../../Dispatcher";
import { intl, t } from "../../../intl/index.native";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { BillingError } from "../../../errors/index";
import { captureBillingException } from "../../../utils/BillingUtils";
export async function validatePaymentSourceBillingAddress(c25195_0) {
let token;
let c25195_3;
let c25195_4 = 0;
let c29358_0, c29358_1;
try {
c29358_0 = void 0;
c25195_4 = 1;
token = (await HTTP.post({
url: Endpoints.BILLING_PAYMENT_SOURCES_VALIDATE_BILLING_ADDRESS,
body: {
billing_address: {
name: c25195_0.name,
line_1: c25195_0.line1,
line_2: c25195_0.line2,
city: c25195_0.city,
state: c25195_0.state,
postal_code: c25195_0.postalCode,
country: c25195_0.country,
email: c25195_0.email
}
},
rejectWithError: false
})).body.token;
c25195_4 = 0;
} catch ($e) {
const r26 = $e;
let r8 = r26;
c25195_3 = r26;
if (c25195_4 !== 0) {
while (true) {
try {
const r69 = c25195_3;
c25195_4 = 0;
c29358_1 = r69;
c29358_0 = parseV8BillingAddressSkemaErrorToBillingError(c29358_1);
Dispatcher.dispatch({
type: "BILLING_PAYMENT_SOURCE_CREATE_FAIL",
error: c29358_0
});
throw c29358_0;
} catch (r65) {
r8 = r65;
c25195_3 = r65;
if (c25195_4 === 0) {
break;
}
}
}
}
throw r8;
}
return token;
}
export function dispatchConfirmationError(a0, r13 = true, r16 = intl.string(t.khEaRI), r8 = {}) {
let r9, r43, error;
let r10 = a0;
if (StripeErrorTypes.includes(a0.type)) {
const failure_message = a0.message != null ? `${r16}: ${a0.message}` : r16;
const r57 = {
failure_message,
error_type: a0.type,
failure_code: a0.code,
failure_sub_code: a0.decline_code,
payment_source_type: a0.payment_method?.type
};
if (a0.type === "card_error") {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_SOURCE_CREATION_FAILED, {
...r57,
stacktrace: new Error().stack
});
r13 = false;
}
error = new BillingError(failure_message);
r43 = r13;
r9 = r57;
} else {
const billingError = new BillingError(typeof a0 === "string" ? r16 : a0);
const r15 = {
failure_message: billingError.message,
status_code: billingError.code
};
const code = billingError.code;
r9 = r15;
error = billingError;
r43 = r13;
if (code === 429) {
r43 = false;
r9 = r15;
error = billingError;
}
}
Dispatcher.dispatch({
type: "BILLING_PAYMENT_SOURCE_CREATE_FAIL",
error
});
const r99 = Error;
if (typeof a0 !== "string") {
r10 = error.message;
}
const r104 = new r99(r10);
if (r43) {
captureBillingException(r104, {
...r8,
extra: {
...r9,
...r8.extra
}
});
}
return r104;
}
export async function popupBridgeState(c25196_0) {
let c25196_2;
c25196_2 = void 0;
let c29359_0 = c25196_0;
let c29359_1 = (await HTTP.post({
url: Endpoints.BILLING_POPUP_BRIDGE(c25196_0),
oldFormErrors: true,
rejectWithError: true
})).body.state;
Dispatcher.dispatch({
type: "BILLING_POPUP_BRIDGE_STATE_UPDATE",
state: c29359_1,
paymentSourceType: c29359_0
});
return c29359_1;
}
export async function createPaymentSource(c25197_0, c25197_1, c25197_2, c25197_3, c25197_4) {
let r142;
let c25197_5, c25197_6, c25197_7;
let c25197_8 = 0;
const r11 = void 0;
try {
let env29360;
c25197_6 = r11;
const r33 = env29360 = {};
c25197_5 = r33;
env29360[4] = void 0;
env29360[0] = c25197_0;
env29360[1] = c25197_1;
env29360[2] = c25197_2;
env29360[3] = c25197_3;
if (c25197_4 !== void 0) {
env29360[4] = c25197_4;
env29360[5] = void 0;
env29360[6] = void 0;
env29360[7] = void 0;
} else {
env29360[4] = false;
env29360[5] = void 0;
env29360[6] = void 0;
env29360[7] = void 0;
}
await void 0;
Dispatcher.dispatch({
type: "BILLING_PAYMENT_SOURCE_CREATE_START"
});
c25197_8 = 1;
env29360[5] = await HTTP.post({
url: Endpoints.BILLING_PAYMENT_SOURCES,
query: {
location: env29360[3].analyticsLocation
},
body: {
payment_gateway: env29360[0],
token: env29360[1],
billing_address: {
name: env29360[2].name,
line_1: env29360[2].line1,
line_2: env29360[2].line2,
city: env29360[2].city,
state: env29360[2].state,
postal_code: env29360[2].postalCode,
country: env29360[2].country,
email: env29360[2].email
},
billing_address_token: env29360[3].billingAddressToken,
bank: env29360[3].bank,
pix: env29360[3].pix != null ? {
tax_id: env29360[3].pix.taxId
} : void 0,
return_url: env29360[3].returnUrl,
default: env29360[4]
},
rejectWithError: false
});
env29360[6] = PaymentSourceRecord.createFromServer(env29360[5].body);
Dispatcher.dispatch({
type: "BILLING_PAYMENT_SOURCE_CREATE_SUCCESS",
paymentSource: env29360[6]
});
r142 = env29360[6];
c25197_8 = 0;
} catch ($e) {
const r31 = $e;
let r8 = r31;
c25197_7 = r31;
if (c25197_8 !== 0) {
while (true) {
try {
const r151 = c25197_7;
c25197_8 = 0;
env29360[8] = r151;
env29360[7] = parseV8BillingAddressSkemaErrorToBillingError(env29360[8]);
(function addFieldsToBillingError(a0, a1) {
if (a1 == null ? void 0 : a1.body?.adyen_redirect_url) {
a0.fields.adyen_redirect_url = a1 == null ? void 0 : a1.body?.adyen_redirect_url;
}
})(env29360[7], env29360[8]);
if (env29360[7].code !== ErrorCodes.CONFIRMATION_REQUIRED) {
Dispatcher.dispatch({
type: "BILLING_PAYMENT_SOURCE_CREATE_FAIL",
error: env29360[7]
});
}
throw env29360[7];
} catch (r147) {
r8 = r147;
c25197_7 = r147;
if (c25197_8 === 0) {
break;
}
}
}
}
throw r8;
}
return r142;
}
@@ -0,0 +1,351 @@
// Metro module 4519 (f4520).
import { Endpoints, REDIRECTED_PAYMENT_SOURCES } from "../../../Constants";
import { PaymentSourceTypes } from "../../../_bundle/Module505";
import { dispatchConfirmationError, popupBridgeState } from "./BillingSharedActionCreators";
import * as _StripeUtils from "../../../utils/StripeUtils";
import { HTTP, getAPIBaseURL } from "../../../_bundle/sendRequest";
let c2727_6, c2727_7;
const r24 = {};
r24[PaymentSourceTypes.GIROPAY] = {
confirmationType: "stripe_redirect_confirmation",
constructStripeConfirmPaymentHandler: (a0) => ({
stripeConfirmPayment: a0.stripe.confirmGiropayPayment,
paymentMethod: {
billing_details: {
name: a0.paymentSource.billingAddress.name
}
}
})
};
r24[PaymentSourceTypes.SOFORT] = {
confirmationType: "stripe_redirect_confirmation",
constructStripeConfirmPaymentHandler: (a0) => {
const paymentSource = a0.paymentSource;
return {
stripeConfirmPayment: a0.stripe.confirmSofortPayment,
paymentMethod: {
sofort: {
country: paymentSource.billingAddress.country
},
billing_details: {
name: paymentSource.billingAddress.name,
email: paymentSource.email
}
}
};
}
};
r24[PaymentSourceTypes.PRZELEWY24] = {
confirmationType: "stripe_redirect_confirmation",
constructStripeConfirmPaymentHandler: ({ paymentSource, stripe }) => {
if (paymentSource.bank == null) {
throw dispatchConfirmationError(`PaymentSource (${paymentSource.id}) missing bank info for p24.`);
}
return {
stripeConfirmPayment: stripe.confirmP24Payment,
paymentMethod: {
p24: {
bank: paymentSource.bank
},
billing_details: {
name: paymentSource.billingAddress.name,
email: paymentSource.email
}
}
};
}
};
r24[PaymentSourceTypes.BANCONTACT] = {
confirmationType: "stripe_redirect_confirmation",
constructStripeConfirmPaymentHandler: (a0) => {
const paymentSource = a0.paymentSource;
return {
stripeConfirmPayment: a0.stripe.confirmBancontactPayment,
paymentMethod: {
billing_details: {
name: paymentSource.billingAddress.name,
email: paymentSource.email
}
}
};
}
};
r24[PaymentSourceTypes.EPS] = {
confirmationType: "stripe_redirect_confirmation",
constructStripeConfirmPaymentHandler: ({ paymentSource, stripe }) => {
if (paymentSource.bank == null) {
throw dispatchConfirmationError(`PaymentSource (${paymentSource.id}) missing bank info for EPS.`);
}
return {
stripeConfirmPayment: stripe.confirmEpsPayment,
paymentMethod: {
eps: {
bank: paymentSource.bank
},
billing_details: {
name: paymentSource.billingAddress.name
}
}
};
}
};
r24[PaymentSourceTypes.IDEAL] = {
confirmationType: "stripe_redirect_confirmation",
constructStripeConfirmPaymentHandler: ({ paymentSource, stripe }) => {
const paymentMethod = {
ideal: {},
billing_details: {
name: paymentSource.billingAddress.name
}
};
if (paymentSource.bank != null) {
paymentMethod.ideal = {
bank: paymentSource.bank
};
}
return {
stripeConfirmPayment: stripe.confirmIdealPayment,
paymentMethod
};
}
};
c2727_6 = r24;
const r42 = {};
r42[PaymentSourceTypes.SEPA_DEBIT] = {
confirmationType: "stripe_direct_confirmation",
constructStripeConfirmPaymentHandler: ({ stripe, paymentMethodId: paymentMethodId4 }) => {
if (paymentMethodId4 == null) {
throw dispatchConfirmationError("On a sepa payment payment method id cannot be null");
}
return {
stripeConfirmPayment: stripe.confirmSepaDebitPayment,
paymentMethod: paymentMethodId4
};
}
};
r42[PaymentSourceTypes.PIX] = {
confirmationType: "stripe_direct_confirmation",
constructStripeConfirmPaymentHandler: (a0) => ({
stripeConfirmPayment: a0.stripe.confirmPixPayment,
paymentMethod: a0.paymentMethodId,
pendingCustomerAction: true
})
};
c2727_7 = r42;
class PaymentConfirmationHandler {
constructor(a0, a1) {
this.paymentSource = a0;
this.payment = a1;
this.paymentSourceType = a0.type;
this.paymentId = a1.payment_id;
}
performRedirect(a0) {
window.open(a0);
}
}
export { c2727_6 as STRIPE_REDIRECTED_PAYMENT_METHOD_REGISTRY };
export function getIsStripeRedirectedPaymentSource(a0) {
return REDIRECTED_PAYMENT_SOURCES.has(a0) && a0 in c2727_6;
}
export { c2727_7 as STRIPE_DIRECT_CONFIRM_PAYMENT_METHOD_REGISTRY };
export function getIsStripeDirectConfirmationPaymentSource(a0) {
return a0 in c2727_7;
}
class StripePaymentConfirmationHandler extends PaymentConfirmationHandler {
constructor(a0, a1) {
if (a0 == null) {
throw dispatchConfirmationError("Payment source cannot be null on a redirect.");
}
super(a0, a1);
this.stripe = null;
const paymentSourceType = this.paymentSourceType;
if (REDIRECTED_PAYMENT_SOURCES.has(paymentSourceType) && paymentSourceType in c2727_6) {
this.handlerRegistry = c2727_6[this.paymentSourceType];
} else {
if (!(this.paymentSourceType in c2727_7)) {
throw dispatchConfirmationError("Invalid Payment Source Type - redirect or direct confirmation handlers not found.");
}
this.handlerRegistry = c2727_7[this.paymentSourceType];
}
}
async getStripe() {
let stripe;
const _this = this;
let _this7, c25235_1;
L17: {
c25235_1 = void 0;
if (_this.stripe == null) {
_this7 = _this;
_this7.stripe = await _StripeUtils.getStripe();
if (_this.stripe == null) {
throw dispatchConfirmationError("Stripe cannot be null on a redirect.");
}
stripe = _this.stripe;
break L17;
}
if (_this.stripe == null) {
throw dispatchConfirmationError("Stripe cannot be null on a redirect.");
}
return _this.stripe;
}
return stripe;
}
async getPaymentIntentInfo() {
const _this2 = this;
let c29403_0 = (await HTTP.get({
url: Endpoints.BILLING_STRIPE_PAYMENT_INTENTS(_this2.paymentId),
oldFormErrors: true,
rejectWithError: true
})).body;
return {
clientSecret: c29403_0.stripe_payment_intent_client_secret,
paymentMethodId: c29403_0.stripe_payment_intent_payment_method_id
};
}
async getStripeRedirect({ clientSecret, state, paymentMethodId }) {
const _this3 = this;
let c25237_2;
c25237_2 = void 0;
let c29404_0 = await _this3.getStripe();
let c29404_1 = _this3.handlerRegistry.constructStripeConfirmPaymentHandler({
stripe: c29404_0,
paymentSource: _this3.paymentSource,
paymentMethodId
});
let c29404_2 = c29404_1.stripeConfirmPayment;
let c29404_3 = c29404_1.paymentMethod;
const aPIBaseURL = getAPIBaseURL();
const paymentSourceType = _this3.paymentSourceType;
let c25237_0 = state;
if (state == null) {
c25237_0 = "";
}
let c29404_4 = await c29404_2(clientSecret, {
payment_method: c29404_3,
return_url: aPIBaseURL + Endpoints.BILLING_POPUP_BRIDGE_CALLBACK_REDIRECT_PREFIX(paymentSourceType, c25237_0, "success")
}, {
handleActions: false
});
let c29404_5 = c29404_4.paymentIntent;
let c29404_6 = c29404_4.error;
if (c29404_6 != null) {
throw dispatchConfirmationError(c29404_6);
}
if (c29404_5 == null) {
throw dispatchConfirmationError("paymentIntent not available with successful api call");
}
const next_action = c29404_5.next_action;
if ((next_action == null ? void 0 : next_action.redirect_to_url?.url) == null) {
throw dispatchConfirmationError("confirm payment did not return a redirect url");
}
return c29404_5.next_action.redirect_to_url.url;
}
async confirmRedirectedPaymentSource({ clientSecret: clientSecret2, paymentMethodId: paymentMethodId2 }) {
const _this4 = this;
let c25238_1;
c25238_1 = void 0;
let c29405_0 = await popupBridgeState(_this4.paymentSourceType);
let c29405_1 = await _this4.getStripeRedirect({
clientSecret: clientSecret2,
state: c29405_0,
paymentMethodId: paymentMethodId2
});
_this4.performRedirect(c29405_1);
}
async confirmDirectPaymentSource({ clientSecret: clientSecret3, paymentMethodId: paymentMethodId3 }) {
const _this5 = this;
let c25239_1;
c25239_1 = void 0;
let c29406_0 = await _this5.getStripe();
let c29406_1 = _this5.handlerRegistry.constructStripeConfirmPaymentHandler({
stripe: c29406_0,
paymentSource: _this5.paymentSource,
paymentMethodId: paymentMethodId3
});
let c29406_2 = c29406_1.stripeConfirmPayment;
let c29406_3 = c29406_1.paymentMethod;
let c29406_4 = c29406_1.pendingCustomerAction;
let c29406_5 = await (0, c29406_2)(clientSecret3, {
payment_method: c29406_3
});
let c29406_6 = c29406_5.paymentIntent;
let c29406_7 = c29406_5.error;
if (c29406_7 != null) {
throw dispatchConfirmationError(c29406_7);
}
if (c29406_6 == null) {
throw dispatchConfirmationError("paymentIntent not available with successful stripe call");
}
return {
pendingCustomerAction: c29406_4,
customerActionCancelled: c29406_6.status === "requires_action"
};
}
async confirmPayment() {
const _this6 = this;
let c25240_1;
let c29407_0, c29407_1, c29407_2, c29407_3;
L15: {
c25240_1 = void 0;
c29407_0 = void 0;
c29407_1 = void 0;
c29407_2 = void 0;
c29407_3 = void 0;
c29407_0 = await _this6.getPaymentIntentInfo();
c29407_1 = c29407_0.clientSecret;
c29407_2 = c29407_0.paymentMethodId;
if (_this6.handlerRegistry.confirmationType === "stripe_redirect_confirmation") {
await _this6.confirmRedirectedPaymentSource({
clientSecret: c29407_1,
paymentMethodId: c29407_2
});
break L15;
}
c29407_3 = await _this6.confirmDirectPaymentSource({
clientSecret: c29407_1,
paymentMethodId: c29407_2
});
return {
redirectConfirmation: false,
pendingCustomerAction: c29407_3.pendingCustomerAction,
customerActionCancelled: c29407_3.customerActionCancelled
};
}
return {
redirectConfirmation: true
};
}
}
export { StripePaymentConfirmationHandler };
class AdyenPaymentConfirmationHandler extends PaymentConfirmationHandler {
constructor(a0, a1) {
if (a0 == null) {
throw dispatchConfirmationError("Payment source cannot be null on a redirect.");
}
super(a0, a1);
}
handleAdyenConfirmation() {
let r10;
const adyen_redirect_url = this.payment.adyen_redirect_url;
if (adyen_redirect_url == null) {
throw dispatchConfirmationError("redirect url cannot be null on a redirect for adyen.");
}
if (REDIRECTED_PAYMENT_SOURCES.has(this.paymentSource.type)) {
this.performRedirect(adyen_redirect_url);
r10 = {
redirectConfirmation: true,
redirectURL: adyen_redirect_url
};
} else {
r10 = {
redirectConfirmation: false,
redirectURL: adyen_redirect_url
};
}
return r10;
}
confirmPayment() {
return Promise.resolve(this.handleAdyenConfirmation());
}
}
export { AdyenPaymentConfirmationHandler };
@@ -0,0 +1,36 @@
// Metro module 4514 (f4515).
import { Endpoints } from "../../../Constants";
import { HTTP } from "../../../_bundle/sendRequest";
export async function createStripeSetupIntent(c25230_0) {
let c25230_2;
c25230_2 = void 0;
let r27 = c25230_0;
if (r27 === void 0) {
r27 = {};
}
let c29397_0 = r27;
await void 0;
return (await HTTP.post({
url: Endpoints.BILLING_STRIPE_SETUP_INTENT_SECRET,
oldFormErrors: true,
rejectWithError: true,
...c29397_0
})).body;
}
export async function createSetupIntentForPaymentElements(c25231_0) {
let c25231_2;
c25231_2 = void 0;
let r27 = c25231_0;
if (r27 === void 0) {
r27 = {};
}
let c29398_0 = r27;
await void 0;
return (await HTTP.post({
url: Endpoints.BILLING_STRIPE_SETUP_INTENT_SECRET_FOR_PAYMENT_ELEMENTS,
oldFormErrors: true,
rejectWithError: true,
failImmediatelyWhenRateLimited: true,
...c29398_0
})).body;
}
@@ -0,0 +1,4 @@
// Metro module 6253 (f6254).
import BillingError from "../../../errors/BillingError";
class InvalidGooglePlayPurchase extends BillingError {}
export default InvalidGooglePlayPurchase;
@@ -0,0 +1,18 @@
// Metro module 8735 (f8736).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-06-android-shop-orders",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export default apexExperiment;
export function useAndroidShopOrdersEnabled(a0) {
return apexExperiment.useConfig(a0).enabled;
}
@@ -0,0 +1,77 @@
// Metro module 6291 (f6292).
import { createExperiment } from "../../experiments/index";
import { createApexExperiment } from "../../experiments/apex/index";
import useGeoForUser_native from "../../premium/hooks/useGeoForUser.native";
const experiment = createExperiment({
kind: "user",
id: "2022-03_block_russian_purchases",
label: "Block purchases based on country",
defaultConfig: {
paymentsBlocked: false
},
treatments: [{
id: 1,
label: "Payments Blocked",
config: {
paymentsBlocked: true
}
}]
});
const apexExperiment = createApexExperiment({
name: "2026-03-block-purchases",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export function useBlockedPaymentsConfig() {
let paymentsBlocked = experiment.useExperiment({
location: "c519a9_1"
}, {
autoTrackExposure: false
}).paymentsBlocked;
const enabled = apexExperiment.useConfig({
location: "c519a9_1"
}).enabled;
const defaultBillingCountryCode = useGeoForUser_native().defaultBillingCountryCode;
if (!paymentsBlocked) {
paymentsBlocked = enabled;
}
if (!paymentsBlocked) {
paymentsBlocked = defaultBillingCountryCode === "RU";
}
return paymentsBlocked;
}
export function useIsPaymentsBlocked() {
let paymentsBlocked = experiment.useExperiment({
location: "dc120b_3"
}, {
autoTrackExposure: false
}).paymentsBlocked;
const enabled = apexExperiment.useConfig({
location: "dc120b_3"
}).enabled;
if (!paymentsBlocked) {
paymentsBlocked = enabled;
}
return paymentsBlocked;
}
export function getIsPaymentsBlocked() {
let paymentsBlocked = experiment.getCurrentConfig({
location: "1ee357_1"
}, {
autoTrackExposure: false
}).paymentsBlocked;
const enabled = apexExperiment.getConfig({
location: "1ee357_1"
}).enabled;
if (!paymentsBlocked) {
paymentsBlocked = enabled;
}
return paymentsBlocked;
}
@@ -0,0 +1,20 @@
// Metro module 12488 (f12489).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-02-gift-cards",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export default apexExperiment;
export function useGiftCardsExperimentConfig(a0) {
return {
enabled: apexExperiment.useConfig(a0).enabled
};
}
+118
View File
@@ -0,0 +1,118 @@
// Metro module 12491 (f12492).
import { t } from "../../../intl/index.native";
import useCountdown from "../../../hooks/useCountdown";
import { unitsAsStrings } from "../../../utils/DateUtils";
import SentryUtils_native from "../../../utils/SentryUtils.native";
let c8633_3;
const roundFPCountdownUnits = function roundFPCountdownUnits(a0) {
const r4 = {
...a0
};
if (r4.seconds > 0) {
r4.minutes = r4.minutes + 1;
r4.seconds = 0;
}
if (r4.minutes === 60) {
r4.hours = r4.hours + 1;
r4.minutes = 0;
}
if (r4.hours === 24) {
r4.days = r4.days + 1;
r4.hours = 0;
}
if (r4.days > 0) {
return {
days: r4.hours > 0 ? r4.days + 1 : r4.days,
hours: 0,
minutes: 0,
seconds: 0
};
}
if (r4.hours > 0) {
const hours2 = r4.minutes > 45 ? r4.hours + 1 : r4.hours;
return hours2 > 11 ? {
days: 1,
hours: 0,
minutes: 0,
seconds: 0
} : {
days: 0,
hours: hours2,
minutes: 0,
seconds: 0
};
}
if (r4.minutes > 0) {
const hours = r4.minutes > 45 ? 1 : 0;
return {
days: 0,
hours,
minutes: hours !== 1 ? r4.minutes : 0,
seconds: 0
};
}
return r4.seconds > 0 ? {
days: 0,
hours: 0,
minutes: 1,
seconds: 0
} : r4;
};
c8633_3 = {
SHORT_TIME_LEFT: 0,
0: "SHORT_TIME_LEFT",
LONG_TIME_LEFT: 1,
1: "LONG_TIME_LEFT",
ENDS_IN: 2,
2: "ENDS_IN",
SHORT_TIME: 3,
3: "SHORT_TIME",
CREDITS_ENDS_IN: 4,
4: "CREDITS_ENDS_IN"
};
export default function useFPDurationLeft(a0, a1) {
let r30, r120;
if (c8633_3.SHORT_TIME_LEFT === a1) {
r30 = {
days: t["/wnvqA"],
hours: t.Jsq0XN,
minutes: t["SBd+Bs"]
};
} else if (c8633_3.LONG_TIME_LEFT === a1) {
r30 = {
days: t.UD5nn5,
hours: t.Hg8Fee,
minutes: t.XSbQZZ
};
} else if (c8633_3.ENDS_IN === a1) {
r30 = {
days: t.rLqNad,
hours: t.d1LvCA,
minutes: t.Z2LX7K
};
} else if (c8633_3.CREDITS_ENDS_IN === a1) {
r30 = {
days: t.xQ3zuN,
hours: t.SFU7QN,
minutes: t.Y4FNdL
};
} else {
if (c8633_3.SHORT_TIME !== a1) {
throw new Error(`Unknown messageType (${a1}) when rendering time left`);
}
r30 = {
days: t.fYmirx,
hours: t["C3RO+g"],
minutes: t.r77oHc
};
}
const r115 = roundFPCountdownUnits(useCountdown(a0.toDate(), 60000));
try {
r120 = unitsAsStrings(r115, r30);
} catch ($e) {
SentryUtils_native.captureMessage("Error trying to format string for fractional nitro duration pill");
}
return r120;
};
export { c8633_3 as CountDownMessageTypes };
export { roundFPCountdownUnits };
@@ -0,0 +1,143 @@
// Metro module 5848 (f5849).
import { useState, useEffect } from "react";
import UserStore from "../../../stores/UserStore";
import SubscriptionStore from "../../../stores/billing/SubscriptionStore";
import EntitlementStore from "../../../stores/game_store/EntitlementStore";
import { EntitlementSourceTypes, EntitlementTypes, SubscriptionStatusTypes } from "../../../Constants";
import { FractionalPremiumStates, PREMIUM_SUBSCRIPTION_APPLICATION } from "../../premium/PremiumConstants";
import Module3771 from "../../../_bundle/Module3771";
import Module38 from "../../../_bundle/Module38";
import { captureBillingMessage } from "../../../utils/BillingUtils";
import { extendDateWithUnconsumedFractionalPremium } from "../../../utils/PremiumUtils";
import { useStateFromStores, useStateFromStoresArray } from "../../../_bundle/Module589";
import useMountEffect from "../../../hooks/useMountEffect";
import { fetchUserEntitlements, fetchUserEntitlementsForApplication } from "../../../actions/EntitlementActionCreators";
import { isEqual } from "../../../_bundle/Module12";
const calculateFractionalPremiumInfo = function calculateFractionalPremiumInfo(a0) {
let r42;
const { isFetching = false, entitlements, unactivatedFractionalPremiumUnits, currentUser, premiumSubscription, fetchedAllEntitlements } = a0;
let excludeReverseTrialFromCountdown2 = a0.excludeReverseTrialFromCountdown;
const r24 = {
isFractionalPremiumActive: false,
fractionalState: FractionalPremiumStates.NONE,
startsAt: Module3771(0),
endsAt: Module3771(0),
currentEntitlementId: "",
currentEntitlementEndsAt: Module3771(0),
unactivatedUnits: [],
fetched: fetchedAllEntitlements
};
if (isFetching) {
return {
...r24,
fetched: false
};
}
L35: {
if (currentUser != null) {
if (entitlements.length === 0 && unactivatedFractionalPremiumUnits.length === 0) {
break L35;
}
L10: {
r42 = entitlements.filter((entitlement) => entitlement.endsAt != null && entitlement.startsAt != null).sort((a, b) => {
Module38(a.endsAt != null && b.endsAt != null, "endsAt should not be null");
return a.endsAt < b.endsAt ? -1 : a.endsAt > b.endsAt ? 1 : 0;
});
r42.reverse();
if (r42.length > 0) {
if (r42.length === entitlements.length && r42[0].startsAt != null && r42[0].endsAt != null) {
break L10;
}
const r99 = {
extra: {
entitlementIds: Array.from(entitlements.values()).map((item) => item.id)
}
};
const r100 = "fractional redemption entitlements should have startsAt/endsAt";
captureBillingMessage(r100, r99);
throw new Error(r100);
}
}
let r52 = r42[0];
if (r52 == null) {
r52 = null;
}
let NONE = FractionalPremiumStates.NONE;
if (r52 != null) {
NONE = premiumSubscription != null && premiumSubscription.status === SubscriptionStatusTypes.PAUSED ? FractionalPremiumStates.FP_SUB_PAUSED : FractionalPremiumStates.FP_ONLY;
}
if (excludeReverseTrialFromCountdown2) {
excludeReverseTrialFromCountdown2 = r52?.sourceType === EntitlementSourceTypes.REVERSE_TRIAL;
}
return {
isFractionalPremiumActive: r52 != null,
fractionalState: NONE,
startsAt: r52 != null ? Module3771(r52.startsAt) : Module3771(0),
endsAt: r52 != null ? Module3771(extendDateWithUnconsumedFractionalPremium(r52.endsAt, unactivatedFractionalPremiumUnits, void 0, excludeReverseTrialFromCountdown2)) : Module3771(0),
currentEntitlementId: r52 != null ? r52.id : "",
currentEntitlementEndsAt: r52 != null ? Module3771(r52.endsAt) : Module3771(0),
unactivatedUnits: unactivatedFractionalPremiumUnits,
fetched: fetchedAllEntitlements
};
}
}
return r24;
};
export default function useFractionalPremiumInfo(r4 = {
forceFetch: false,
excludeReverseTrial: false,
excludeReverseTrialFromCountdown: false
}) {
let stateFromStoresArray, stateFromStores2, stateFromStoresArray2, stateFromStores3, setState;
const { forceFetch, excludeReverseTrial, excludeReverseTrialFromCountdown } = r4;
stateFromStoresArray = void 0;
stateFromStores2 = void 0;
stateFromStoresArray2 = void 0;
stateFromStores3 = void 0;
setState = void 0;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
stateFromStoresArray = useStateFromStoresArray([EntitlementStore], () => EntitlementStore.getFractionalPremium({
excludeReverseTrial
}));
stateFromStores2 = useStateFromStores([EntitlementStore], () => EntitlementStore.fetchedAllEntitlements);
stateFromStoresArray2 = useStateFromStoresArray([EntitlementStore], () => EntitlementStore.getUnactivatedFractionalPremiumUnits());
stateFromStores3 = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription());
let state;
[state, setState] = useState(calculateFractionalPremiumInfo({
isFetching: stateFromStores != null && !EntitlementStore.fetchingAllEntitlements && (EntitlementStore.fetchedAllEntitlements ? forceFetch : !EntitlementStore.fetchedAllEntitlements) || EntitlementStore.fetchingAllEntitlements || stateFromStores != null && !EntitlementStore.applicationIdsFetching.has(PREMIUM_SUBSCRIPTION_APPLICATION) && !EntitlementStore.applicationIdsFetched.has(PREMIUM_SUBSCRIPTION_APPLICATION) || EntitlementStore.applicationIdsFetching.has(PREMIUM_SUBSCRIPTION_APPLICATION),
entitlements: stateFromStoresArray,
unactivatedFractionalPremiumUnits: stateFromStoresArray2,
currentUser: stateFromStores,
premiumSubscription: stateFromStores3,
fetchedAllEntitlements: stateFromStores2,
excludeReverseTrialFromCountdown
}));
useMountEffect(() => {
if (stateFromStores != null && !EntitlementStore.fetchingAllEntitlements && (EntitlementStore.fetchedAllEntitlements ? forceFetch : !EntitlementStore.fetchedAllEntitlements)) {
fetchUserEntitlements({
entitlementType: EntitlementTypes.FRACTIONAL_REDEMPTION
});
}
if (stateFromStores != null && !EntitlementStore.applicationIdsFetching.has(PREMIUM_SUBSCRIPTION_APPLICATION) && !EntitlementStore.applicationIdsFetched.has(PREMIUM_SUBSCRIPTION_APPLICATION)) {
fetchUserEntitlementsForApplication(PREMIUM_SUBSCRIPTION_APPLICATION);
}
});
useEffect(() => {
let c25630_0 = calculateFractionalPremiumInfo({
entitlements: stateFromStoresArray,
unactivatedFractionalPremiumUnits: stateFromStoresArray2,
currentUser: stateFromStores,
premiumSubscription: stateFromStores3,
fetchedAllEntitlements: stateFromStores2,
excludeReverseTrialFromCountdown
});
setState((prevState) => {
let r9 = c25630_0;
if (isEqual(prevState, r9)) {
r9 = prevState;
}
return r9;
});
}, [stateFromStores, stateFromStoresArray, stateFromStores3, stateFromStoresArray2, stateFromStores2, excludeReverseTrialFromCountdown]);
return state;
};
@@ -0,0 +1,32 @@
// Metro module 12447 (f12448).
import PaymentSourceStore from "../../../stores/billing/PaymentSourceStore";
import SubscriptionPlanStore from "../../../stores/billing/SubscriptionPlanStore";
import SubscriptionStore from "../../../stores/billing/SubscriptionStore";
import { ACTIVE_PREMIUM_SKUS } from "../../premium/PremiumConstants";
import Logger from "../../debug/Logger";
import { useStateFromStores } from "../../../_bundle/Module589";
const getSubscriptionPlansLoaded = function getSubscriptionPlansLoaded(r5 = [...ACTIVE_PREMIUM_SKUS], r26 = [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore]) {
const [r36, r37, r40] = r26;
const { paymentSourceIds, defaultPaymentSourceId } = r36;
const isLoadedForSKUs = r37.isLoadedForSKUs(r5);
const paymentSourceId = r40.getPremiumTypeSubscription()?.paymentSourceId;
if (paymentSourceId != null && !r37.hasPaymentSourceForSKUIds(paymentSourceId, r5)) {
return false;
}
if (defaultPaymentSourceId != null && !r37.hasPaymentSourceForSKUIds(defaultPaymentSourceId, r5)) {
return false;
}
for (const item of paymentSourceIds) {
if (r37.hasPaymentSourceForSKUIds(item, r5)) {
continue;
}
return false;
}
return isLoadedForSKUs;
};
new Logger("useSubscriptionPlansLoaded");
export function useSubscriptionPlansLoaded(r7 = [...ACTIVE_PREMIUM_SKUS]) {
let c19850_0 = r7;
return useStateFromStores([PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore], () => getSubscriptionPlansLoaded(c19850_0, [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore]), [r7]);
}
export { getSubscriptionPlansLoaded };
@@ -0,0 +1,80 @@
// Metro module 6502 (f6503).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-03-nitro-acom-subscription",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment2 = createApexExperiment({
name: "2026-03-acom-modify-dark-launch",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment3 = createApexExperiment({
name: "2026-06-otp-acom-order",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment4 = createApexExperiment({
name: "2026-06-gift-acom-order",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment5 = createApexExperiment({
name: "2026-07-nitro-acom-trials",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment6 = createApexExperiment({
name: "2026-07-nitro-acom-discounts",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as NitroACOMSubscriptionExperiment };
export { apexExperiment2 as ACOMModifyDarkLaunchExperiment };
export { apexExperiment3 as OTPACOMOrderExperiment };
export { apexExperiment4 as GiftACOMOrderExperiment };
export { apexExperiment5 as NitroACOMTrialsExperiment };
export { apexExperiment6 as NitroACOMDiscountsExperiment };
@@ -0,0 +1,8 @@
// Metro module 6357 (f6358).
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import BlockedPaymentsCountryDisplay from "./BlockedPaymentsCountryDisplay";
export default function BlockedPaymentsCountryActionSheet() {
return <BottomSheet>
<BlockedPaymentsCountryDisplay />
</BottomSheet>;
};
@@ -0,0 +1,41 @@
// Metro module 6358 (f6359).
import { Image as Image2, View } from "react-native";
import { HelpdeskArticles } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useTheme from "../../../hooks/useTheme";
import { LegacyText } from "../../../design/void/native";
import { intl, t } from "../../../intl/index.native";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import { isThemeDark } from "../../../design/shared";
import Module6359 from "../../../_bundle/Module6359";
import Module6360 from "../../../_bundle/Module6360";
const useStyles = createStyles({
container: {
alignItems: "center"
},
header: {
fontSize: 20,
fontWeight: "700",
color: Module712.colors.TEXT_SUBTLE,
marginBottom: 16
},
image: {
marginTop: 38
}
});
export default function BlockedPaymentsCountryDisplay() {
const styles = useStyles();
const theme = useTheme();
return <View style={styles.container}>
<LegacyText style={styles.header}>
{intl.string(t.vwMEHS)}
</LegacyText>
<LegacyText>
{intl.format(t.IHxEJU, {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.BLOCKED_PAYMENTS)
})}
</LegacyText>
<Image2 style={styles.image} source={isThemeDark(theme) ? Module6359 : Module6360} />
</View>;
};
@@ -0,0 +1,42 @@
// Metro module 5674 (f5675).
import Module589 from "../../../_bundle/Module589";
import Module12 from "../../../_bundle/Module12";
import { GenericProductIds } from "../../premium/native/ProductIds.android";
import Dispatcher from "../../../Dispatcher";
const products = null;
const connected = false;
const storeFront = null;
class GenericIAPStore extends Module589.Store {
static displayName = "GenericIAPStore";
isGenericIapConnected() {
return connected;
}
genericProductsLoaded() {
return products != null && Module12.filter(products, (a0) => GenericProductIds.includes(a0.identifier)).length === GenericProductIds.length;
}
getProducts() {
return products;
}
getStoreFront() {
return storeFront;
}
}
const genericIAPStore = new GenericIAPStore(Dispatcher, {
IAP_LOAD_GENERIC_PRODUCTS: function initGenericProducts({ products: products2, storeFront: storeFront2 }) {
products = products2;
storeFront = storeFront2;
},
GENERIC_IAP_INIT_CONNECTION: function genericIapInitConnection(a0) {
connected = a0.connected;
},
GENERIC_IAP_INIT_CONNECTION_FAILED: function genericIapInitConnectionFailed() {
connected = false;
},
GENERIC_IAP_END_CONNECTION: function genericIapEndConnection() {
connected = false;
},
GENERIC_IAP_SET_STORE_FRONT: function setStoreFront(a0) {
storeFront = a0.storeFront;
}
});
export default genericIAPStore;
@@ -0,0 +1,31 @@
// Metro module 12436 (f12437).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { DARK_PRIMARY_630_LIGHT_PRIMARY_230 } from "../../../design/migrations/native/LegacyTokens";
import { WarningCircle } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
padding: 10,
marginVertical: 5,
borderRadius: Module712.radii.xs,
display: "flex",
flexDirection: "row",
alignItems: "center",
backgroundColor: DARK_PRIMARY_630_LIGHT_PRIMARY_230
},
icon: {
marginRight: 10
},
text: {
flexShrink: 1
}
});
export default function PaymentFlowWarningMessage(props) {
const styles = useStyles();
return <View style={styles.container}>
<WarningCircle style={styles.icon} color={Module712.unsafe_rawColors.YELLOW_300} width={16} height={16} />
<Text variant="text-sm/medium" style={styles.text}>{props.message}</Text>
</View>;
};
+247
View File
@@ -0,0 +1,247 @@
// Metro module 6352 (f6353).
import { NativeModules } from "react-native";
import { convertToAlpha2 } from "../../i18n/CountryCodeUtils";
import { CurrencyExponents } from "../../../_bundle/convertToMajorCurrencyUnits";
import { getProducts } from "../../../_bundle/Module6333";
let RNIapIosSk2;
let env4056 = {};
const productSK2ToIAPProduct = function productSK2ToIAPProduct(a0) {
const discounts = a0.subscription.promotionalOffers != null ? a0.subscription.promotionalOffers.map((promotionalOffer) => {
const paymentMode = promotionalOffer.paymentMode;
const paymentMode2 = paymentMode === "freeTrial" ? "FREETRIAL" : paymentMode === "payAsYouGo" ? "PAYASYOUGO" : paymentMode !== "payUpFront" ? "" : "PAYUPFRONT";
return {
identifier: promotionalOffer.id,
type: "SUBSCRIPTION",
numberOfPeriods: promotionalOffer.period.value.toString(),
price: promotionalOffer.price.toString(),
localizedPrice: promotionalOffer.displayPrice,
paymentMode: paymentMode2,
subscriptionPeriod: promotionalOffer.period.unit.toUpperCase()
};
}) : [];
if (a0.subscription.introductoryOffer != null) {
const introductoryOffer = a0.subscription.introductoryOffer;
const paymentMode = introductoryOffer.paymentMode;
const paymentMode2 = paymentMode === "freeTrial" ? "FREETRIAL" : paymentMode === "payAsYouGo" ? "PAYASYOUGO" : paymentMode !== "payUpFront" ? "" : "PAYUPFRONT";
discounts.push({
identifier: introductoryOffer.id,
type: "SUBSCRIPTION",
numberOfPeriods: introductoryOffer.period.value.toString(),
price: introductoryOffer.price.toString(),
localizedPrice: introductoryOffer.displayPrice,
paymentMode: paymentMode2,
subscriptionPeriod: introductoryOffer.period.unit.toUpperCase()
});
}
const price = Number(a0.price.toFixed(CurrencyExponents[a0.currency.toLowerCase()]));
return {
identifier: String(a0.id),
price,
currencySymbol: a0.displayPrice.split(/[0-9]/)[0],
currencyCode: a0.currency.toLowerCase(),
priceString: String(price),
countryCode: "",
downloadable: false,
description: a0.description,
title: a0.displayName,
discounts
};
};
RNIapIosSk2 = NativeModules.RNIapIosSk2;
class StorekitIAPQueueClass {
constructor() {
return {
__proto__: new.target.prototype,
_queue: [],
_processingQueue: false
};
}
fetchSubscriptions(c15683_0) {
const _this = this;
const promise = new Promise((c25828_0, c25828_1) => {
_this._queue.push(async () => {
let c29759_0, c29759_1, c29759_2;
let c29759_3 = 0;
const r12 = void 0;
L10: {
try {
let env31419;
c29759_1 = r12;
const r27 = env31419 = {};
c29759_0 = r27;
env31419[0] = void 0;
c29759_3 = 1;
env31419[0] = (await RNIapIosSk2.getItems(c15683_0)).filter((item) => item.subscription != null).map(productSK2ToIAPProduct);
(0, c25828_0)(env31419[0]);
c29759_3 = 0;
} catch ($e) {
const r25 = $e;
let r7 = r25;
c29759_2 = r25;
if (c29759_3 !== 0) {
while (true) {
try {
const r64 = c29759_2;
c29759_3 = 0;
(0, c25828_1)(r64);
break L10;
} catch (r61) {
r7 = r61;
c29759_2 = r61;
if (c29759_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
});
});
this.processQueue();
return promise;
}
fetchProducts(skus) {
const _this2 = this;
const promise = new Promise((c25829_0, c25829_1) => {
_this2._queue.push(async () => {
let c29760_0, c29760_1, c29760_2;
let c29760_3 = 0;
const r12 = void 0;
const r11 = env4056;
L10: {
try {
let env31420;
c29760_1 = r12;
const r26 = env31420 = {
$parent: r11
};
c29760_0 = r26;
env31420[0] = void 0;
c29760_3 = 1;
env31420[0] = await getProducts({
skus
}).then((result) => result.filter((item) => item.type === "iap").map((item) => (function mapToIAPProduct(a0) {
let countryCode = "";
if (a0.countryCode != null && a0.countryCode.length !== 0) {
try {
countryCode = (0, convertToAlpha2)(a0.countryCode);
} catch ($e) {}
}
const r15 = {
identifier: a0.productId,
price: parseFloat(a0.price),
currencySymbol: null,
currencyCode: null,
priceString: null,
countryCode: null,
downloadable: false,
description: null,
title: null,
discounts: null
};
const localizedPrice = a0.localizedPrice;
r15.currencySymbol = localizedPrice == null ? void 0 : localizedPrice.split(/[0-9]/)[0];
r15.currencyCode = a0.currency.toLowerCase();
r15.priceString = a0.price;
r15.countryCode = countryCode;
r15.description = a0.description;
r15.title = a0.title;
r15.discounts = "discounts" in a0 ? a0.discounts : void 0;
return r15;
})(item)));
(0, c25829_0)(env31420[0]);
c29760_3 = 0;
} catch ($e) {
const r24 = $e;
let r7 = r24;
c29760_2 = r24;
if (c29760_3 !== 0) {
while (true) {
try {
const r64 = c29760_2;
c29760_3 = 0;
(0, c25829_1)(r64);
break L10;
} catch (r61) {
r7 = r61;
c29760_2 = r61;
if (c29760_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
});
});
this.processQueue();
return promise;
}
async processQueue() {
const _this3 = this;
let c25830_2;
let c25830_3 = 0;
let c29761_0;
L19: {
L17: {
try {
c29761_0 = void 0;
if (_this3._processingQueue) {
break L19;
}
_this3._processingQueue = true;
c25830_3 = 1;
if (!(_this3._queue.length > 0)) {
c25830_3 = 0;
_this3._processingQueue = false;
break L19;
}
c29761_0 = _this3._queue.shift();
await (0, c29761_0)();
while (true) {
if (!(_this3._queue.length > 0)) {
c25830_3 = 0;
_this3._processingQueue = false;
break L17;
}
c29761_0 = _this3._queue.shift();
await (0, c29761_0)();
}
break L19;
} catch ($e) {
const r26 = $e;
let r8 = r26;
c25830_2 = r26;
if (c25830_3 !== 0) {
while (true) {
try {
const r99 = c25830_2;
c25830_3 = 0;
_this3._processingQueue = false;
throw r99;
} catch (r96) {
r8 = r96;
c25830_2 = r96;
if (c25830_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
}
const r33 = {
__proto__: StorekitIAPQueueClass.prototype,
_queue: [],
_processingQueue: false
};
export default r33;
@@ -0,0 +1,31 @@
// Metro module 8772 (f8773).
import { View } from "react-native";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
export default function UnsupportedFeatureModal(props) {
const { title, onDismiss } = props;
return <Navigator initialRouteName="Unsupported" screens={{
Unsupported: {
title,
headerLeft: getHeaderCloseButton(function() {
ModalActionCreators.pop();
if (onDismiss != null) {
onDismiss();
}
}),
render: () => <View style={{
flex: 1,
alignItems: "center",
justifyContent: "center",
padding: 24
}}>
<Text variant="text-lg/normal" color="text-default">
{intl.string(t.I22zuX)}
</Text>
</View>
}
}} />;
};
@@ -0,0 +1,347 @@
// Metro module 9760 (f9761).
import { useRef, useCallback, useEffect } from "react";
import { useNativeCheckoutStoreOrNull } from "../../../checkout/native/NativeCheckoutStore";
import UserStore from "../../../../stores/UserStore";
import { CurrencyCodes } from "../../../../Constants";
import { GPlayBillingResult } from "../../../gplay/native/Constants";
import Logger from "../../../debug/Logger";
import { useHandlePremiumPurchase } from "../../../premium/native/handlePremiumPurchase.android";
import { useAndroidShopOrdersEnabled } from "../../experiments/AndroidShopOrdersExperiment";
import useInitialValue from "../../../../hooks/useInitialValue";
import { getNewAnalyticsLoadId } from "../../../../utils/AnalyticsUtils";
import Dispatcher from "../../../../Dispatcher";
import { cancelOrderSigning, markOrderAsSigningInProgress } from "../../../payments/native/OrderActionCreators";
import { captureBillingException } from "../../../../utils/BillingUtils";
import { isNullOrEmpty } from "../../../../utils/StringUtils";
import * as _SKUActionCreators from "../../../../actions/SKUActionCreators";
import { v4 } from "../../../../_bundle/Module514";
let env6469 = {};
const c6469_9 = new Logger("useMobilePurchaseSKU.android");
export default function useMobilePurchaseSKU(a0) {
let env17468 = {
$parent: env6469
};
const skuId = a0.skuId;
env17468[0] = skuId;
const platformSkuId = a0.platformSkuId;
env17468[1] = platformSkuId;
const analyticsLocations = a0.analyticsLocations;
env17468[2] = analyticsLocations;
let analyticsLoadId = a0.analyticsLoadId;
env17468[3] = analyticsLoadId;
const analyticsData = a0.analyticsData;
env17468[4] = analyticsData;
const onPurchaseComplete = a0.onPurchaseComplete;
env17468[5] = onPurchaseComplete;
const onPurchaseError = a0.onPurchaseError;
env17468[6] = onPurchaseError;
const freePurchaseCallback = a0.freePurchaseCallback;
env17468[7] = freePurchaseCallback;
const onPurchasePending = a0.onPurchasePending;
env17468[8] = onPurchasePending;
const giftParams = a0.giftParams;
env17468[9] = giftParams;
let isFreeForStaffSelfPurchase = a0.isFreeForStaffSelfPurchase;
if (isFreeForStaffSelfPurchase === void 0) {
isFreeForStaffSelfPurchase = true;
}
env17468[10] = isFreeForStaffSelfPurchase;
const orderId = a0.orderId;
env17468[11] = orderId;
env17468[12] = void 0;
env17468[13] = void 0;
env17468[14] = void 0;
env17468[15] = void 0;
env17468[16] = void 0;
env17468[17] = void 0;
env17468[18] = void 0;
env17468[19] = void 0;
env17468[20] = void 0;
env17468[21] = void 0;
const currentUser = UserStore.getCurrentUser();
const handlePremiumPurchase = useHandlePremiumPurchase();
env17468[12] = handlePremiumPurchase;
const androidShopOrdersEnabled = useAndroidShopOrdersEnabled({
location: "useMobilePurchaseSKU"
});
env17468[13] = androidShopOrdersEnabled;
const nativeCheckoutStoreOrNull = useNativeCheckoutStoreOrNull((a0) => a0.setOrder);
env17468[14] = nativeCheckoutStoreOrNull;
const nativeCheckoutStoreOrNull2 = useNativeCheckoutStoreOrNull((a0) => a0.setCheckoutSucceeded);
env17468[15] = nativeCheckoutStoreOrNull2;
env17468[16] = useRef(false);
const r44 = currentUser !== void 0 && currentUser.isStaff();
env17468[17] = r44;
const initialValue = useInitialValue(() => getNewAnalyticsLoadId());
let r50 = giftParams?.isGift;
if (r50 == null) {
r50 = false;
}
env17468[18] = r50;
if (analyticsLoadId == null) {
env17468[3] = initialValue;
analyticsLoadId = initialValue;
}
let c17469_0;
const callback = useCallback(() => {
Dispatcher.unsubscribe("GPLAY_PURCHASE_VERIFIED", env17468[19]);
env17468[16].current = false;
const r13 = env17468[15];
if (r13 != null) {
r13();
}
(0, env17468[5])();
}, [onPurchaseComplete, nativeCheckoutStoreOrNull2]);
env17468[19] = callback;
const callback2 = useCallback(() => {
Dispatcher.unsubscribe("GPLAY_PURCHASE_VERIFIED", env17468[19]);
env17468[16].current = false;
(0, env17468[6])();
}, [onPurchaseError, callback]);
env17468[20] = callback2;
c17469_0 = void 0;
c17469_0 = async (c30143_0) => {
let c30143_3;
let c30143_4 = 0;
let c31513_0, c31513_1;
const r16 = "[handleGPlayUpdatePurchaseAction] User canceled purchase, canceling order signing";
L21: {
L20: {
try {
c31513_0 = void 0;
if (c30143_0.billingResult !== GPlayBillingResult.OK) {
Dispatcher.unsubscribe("GPLAY_PURCHASE_VERIFIED", env17468[19]);
if (env17468[11] != null && env17468[13] && c30143_0.isActivePurchase && c30143_0.billingResult === GPlayBillingResult.USER_CANCELED) {
c6469_9.info(r16, {
orderId: env17468[11],
platformSkuId: env17468[1],
skuId: env17468[0]
});
c30143_4 = 1;
c31513_0 = await cancelOrderSigning(env17468[11]);
const r97 = env17468[14];
if (r97 != null) {
r97(c31513_0);
}
c30143_4 = 0;
env17468[16].current = false;
(0, env17468[6])();
(0, env17468[8])();
break L20;
}
env17468[16].current = false;
(0, env17468[6])();
}
(0, env17468[8])();
break L21;
} catch ($e) {
const r34 = $e;
let r7 = r34;
c30143_3 = r34;
if (c30143_4 !== 0) {
while (true) {
try {
const r118 = c30143_3;
c30143_4 = 0;
c31513_1 = r118;
captureBillingException(c31513_1, {
tags: {
source: "useMobilePurchaseSKU_cancelOrderSigning"
},
extra: {
orderId: env17468[11]
}
});
c6469_9.error("Failed to cancel order signing", {
error: c31513_1,
orderId: env17468[11],
skuId: env17468[0]
});
env17468[16].current = false;
(0, env17468[6])();
(0, env17468[8])();
break L20;
} catch (r114) {
r7 = r114;
c30143_3 = r114;
if (c30143_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
return void 0;
}
};
const callback3 = useCallback(function() {
return c17469_0.apply(this, arguments);
}, [callback, onPurchaseError, onPurchasePending, orderId, androidShopOrdersEnabled, nativeCheckoutStoreOrNull, platformSkuId, skuId]);
env17468[21] = callback3;
useEffect(() => {
Dispatcher.subscribe("GPLAY_UPDATE_PURCHASE_STATE", env17468[21]);
Dispatcher.subscribe("GPLAY_PURCHASE_VERIFIED", env17468[19]);
Dispatcher.subscribe("GPLAY_PURCHASE_VERIFICATION_FAILED", env17468[20]);
return () => {
Dispatcher.unsubscribe("GPLAY_UPDATE_PURCHASE_STATE", env17468[21]);
Dispatcher.unsubscribe("GPLAY_PURCHASE_VERIFIED", env17468[19]);
Dispatcher.unsubscribe("GPLAY_PURCHASE_VERIFICATION_FAILED", env17468[20]);
};
}, [callback3, callback, callback2]);
return useCallback(async () => {
let c30144_0, c30144_1;
let purchaseSKU, c26533_3;
let c26533_4 = 0;
try {
if (env17468[16].current) {
throw new Error("Purchase already in progress");
}
if (isNullOrEmpty(env17468[1])) {
throw new Error("Missing google play sku ID");
}
c26533_4 = 2;
env17468[16].current = true;
if (env17468[17] && (env17468[10] && !env17468[18])) {
c26533_4 = 4;
const r74 = env17468[7];
purchaseSKU = r74;
if (r74 == null) {
purchaseSKU = _SKUActionCreators.purchaseSKU;
}
await purchaseSKU("collectibles", env17468[0], {
expectedAmount: 0,
expectedCurrency: CurrencyCodes.USD,
loadId: v4()
});
(0, env17468[5])();
c26533_4 = 2;
env17468[16].current = false;
} else if (env17468[11] != null && env17468[13]) {
c26533_4 = 5;
await markOrderAsSigningInProgress(env17468[11]);
c26533_4 = 2;
await env17468[12]({
productId: env17468[1],
skuId: env17468[0],
isOneTimePurchase: true,
analyticsLoadId: env17468[3],
analyticsLocations: env17468[2],
analyticsData: env17468[4],
isGift: env17468[18],
giftInfoOptions: env17468[9]?.options,
onPurchaseError: env17468[6]
});
} else {
await env17468[12]({
productId: env17468[1],
skuId: env17468[0],
isOneTimePurchase: true,
analyticsLoadId: env17468[3],
analyticsLocations: env17468[2],
analyticsData: env17468[4],
isGift: env17468[18],
giftInfoOptions: env17468[9]?.options,
onPurchaseError: env17468[6]
});
}
c26533_4 = 0;
env17468[16].current = false;
} catch ($e) {
const r49 = $e;
let r7 = r49;
c26533_3 = r49;
let r50 = c26533_4;
if (r50 !== 0) {
while (true) {
if (r50 === 1) {
try {
const r299 = c26533_3;
c26533_4 = 0;
env17468[16].current = false;
throw r299;
} catch (r297) {
r7 = r297;
c26533_3 = r297;
r50 = c26533_4;
if (r50 === 0) {
break;
}
}
} else if (r50 === 2) {
try {
const r293 = c26533_3;
c26533_4 = 1;
throw r293;
} catch (r292) {
r7 = r292;
c26533_3 = r292;
r50 = c26533_4;
if (r50 === 0) {
break;
}
}
} else if (r50 === 3) {
try {
const r287 = c26533_3;
c26533_4 = 2;
env17468[16].current = false;
throw r287;
} catch (r285) {
r7 = r285;
c26533_3 = r285;
r50 = c26533_4;
if (r50 === 0) {
break;
}
}
} else if (r50 === 4) {
try {
const r278 = c26533_3;
c26533_4 = 3;
c30144_0 = r278;
(0, env17468[6])();
throw c30144_0;
} catch (r275) {
r7 = r275;
c26533_3 = r275;
r50 = c26533_4;
if (r50 === 0) {
break;
}
}
} else {
try {
const r254 = c26533_3;
c26533_4 = 2;
c30144_1 = r254;
captureBillingException(c30144_1, {
tags: {
source: "useMobilePurchaseSKU_markSigning"
},
extra: {
orderId: env17468[11]
}
});
c6469_9.error("Failed to mark order signing-in-progress", {
error: c30144_1,
skuId: env17468[0],
orderId: env17468[11]
});
throw c30144_1;
} catch (r251) {
r7 = r251;
c26533_3 = r251;
r50 = c26533_4;
if (r50 === 0) {
break;
}
}
}
}
}
throw r7;
}
}, [skuId, platformSkuId, r44, r50, handlePremiumPurchase, onPurchaseComplete, onPurchaseError, freePurchaseCallback, analyticsLoadId, analyticsLocations, analyticsData, giftParams, isFreeForStaffSelfPurchase, orderId, androidShopOrdersEnabled]);
};
+475
View File
@@ -0,0 +1,475 @@
// Metro module 6355 (f6356).
export const copiedIAPProducts = [{
identifier: "premium_tier_2_premium_guild_5_yearly",
price: 274.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$274.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 7 Boosts (Yearly Sub)",
title: "Nitro + 5 Boosts (Yearly)",
discounts: []
}, {
identifier: "premium_tier_1_premium_guild_1_yearly",
price: 84.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$84.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 1 Boost (Yearly Sub)",
title: "Nitro Classic + 1 Boost",
discounts: []
}, {
identifier: "premium_tier_0_yearly",
price: 29.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$29.99",
countryCode: "US",
downloadable: false,
description: "Chat perks (Yearly Sub)",
title: "Nitro Basic Yearly",
discounts: [{
identifier: "premium_tier_0_yearly_likelihood",
localizedPrice: "$0.00",
numberOfPeriods: "1",
type: "SUBSCRIPTION",
paymentMode: "FREETRIAL",
subscriptionPeriod: "MONTH",
price: "0"
}]
}, {
identifier: "premium_tier_2_monthly",
price: 9.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$9.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 2 Boosts (Monthly Sub)",
title: "Nitro Monthly",
discounts: [{
numberOfPeriods: "14",
type: "SUBSCRIPTION",
localizedPrice: "$0.00",
identifier: "premium_tier_2_monthly_q4_drop",
paymentMode: "FREETRIAL",
price: "0",
subscriptionPeriod: "DAY"
}, {
identifier: "premium_tier_2_monthly_reactivation",
price: "0",
subscriptionPeriod: "MONTH",
paymentMode: "FREETRIAL",
localizedPrice: "$0.00",
type: "SUBSCRIPTION",
numberOfPeriods: "1"
}, {
numberOfPeriods: "14",
type: "SUBSCRIPTION",
identifier: "premium_tier_2_monthly_referral_trial",
price: "0",
subscriptionPeriod: "DAY",
paymentMode: "FREETRIAL",
localizedPrice: "$0.00"
}, {
localizedPrice: "$0.00",
type: "SUBSCRIPTION",
numberOfPeriods: "1",
identifier: "premium_tier_2_monthly_likelihood",
paymentMode: "FREETRIAL",
price: "0",
subscriptionPeriod: "MONTH"
}]
}, {
identifier: "premium_tier_1_premium_guild_1_monthly",
price: 8.49,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$8.49",
countryCode: "US",
downloadable: false,
description: "Chat perks and 1 Boost (Monthly Sub)",
title: "Nitro Classic + 1 Boost",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_28_monthly",
price: 107.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$107.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 30 Boosts (Monthly Sub)",
title: "Nitro + 28 Boosts (Monthly)",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_3_monthly",
price: 20.49,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$20.49",
countryCode: "US",
downloadable: false,
description: "Chat perks and 5 Boosts (Monthly Sub)",
title: "Nitro + 3 Boosts (Monthly)",
discounts: []
}, {
identifier: "premium_month_tier_2.1",
price: 9.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$9.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 2 Boosts (Monthly Sub)",
title: "Nitro Monthly",
discounts: []
}, {
identifier: "premium_tier_0_monthly",
price: 2.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$2.99",
countryCode: "US",
downloadable: false,
description: "Chat perks (Monthly Sub)",
title: "Nitro Basic Monthly",
discounts: [{
localizedPrice: "$0.00",
paymentMode: "FREETRIAL",
subscriptionPeriod: "MONTH",
price: "0",
numberOfPeriods: "1",
type: "SUBSCRIPTION",
identifier: "premium_tier_0_monthly_likelihood"
}]
}, {
identifier: "premium_guild_1_monthly",
price: 4.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$4.99",
countryCode: "US",
downloadable: false,
description: "1 Server Boost (Monthly)",
title: "1 Server Boost Monthly",
discounts: []
}, {
identifier: "premium_month_tier_1.1",
price: 4.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$4.99",
countryCode: "US",
downloadable: false,
description: "Chat perks like animated emojis (Monthly Sub)",
title: "Classic Monthly",
discounts: [{
localizedPrice: "$0.00",
identifier: "premium_tier_1_monthly_likelihood",
paymentMode: "FREETRIAL",
subscriptionPeriod: "MONTH",
price: "0",
type: "SUBSCRIPTION",
numberOfPeriods: "1"
}]
}, {
identifier: "premium_tier_1_yearly",
price: 49.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$49.99",
countryCode: "US",
downloadable: false,
description: "Chat perks like animated emojis (Yearly Sub)",
title: "Nitro Classic Yearly",
discounts: []
}, {
identifier: "premium_year_tier_1.1",
price: 49.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$49.99",
countryCode: "US",
downloadable: false,
description: "Chat perks like animated emojis (Yearly Sub)",
title: "Classic Yearly",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_1_monthly",
price: 13.49,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$13.49",
countryCode: "US",
downloadable: false,
description: "Chat perks and 3 Boosts (Monthly Sub)",
title: "Nitro + 1 Boost (Monthly)",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_2_monthly",
price: 16.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$16.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 4 Boosts (Monthly Sub)",
title: "Nitro + 2 Boosts (Monthly)",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_2_yearly",
price: 169.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$169.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 4 Boosts (Yearly Sub)",
title: "Nitro + 2 Boosts (Yearly)",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_1_yearly",
price: 134.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$134.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 3 Boosts (Yearly Sub)",
title: "Nitro + 1 Boost (Yearly)",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_3_yearly",
price: 204.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$204.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 5 Boosts (Yearly Sub)",
title: "Nitro + 3 Boosts (Yearly)",
discounts: []
}, {
identifier: "premium_tier_1_monthly",
price: 4.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$4.99",
countryCode: "US",
downloadable: false,
description: "Chat perks like animated emojis (Monthly Sub)",
title: "Nitro Classic Monthly",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_10_monthly",
price: 44.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$44.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 12 Boosts (Monthly Sub)",
title: "Nitro + 10 Boosts (Monthly)",
discounts: []
}, {
identifier: "premium_year_tier_2.1",
price: 99.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$99.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 2 Boosts (Yearly Sub)",
title: "Nitro Yearly",
discounts: []
}, {
identifier: "premium_guild_2_monthly",
price: 9.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$9.99",
countryCode: "US",
downloadable: false,
description: "2 Server Boosts (Monthly)",
title: "2 Server Boosts Monthly",
discounts: []
}, {
identifier: "premium_tier_2_premium_guild_5_monthly",
price: 27.49,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$27.49",
countryCode: "US",
downloadable: false,
description: "Chat perks and 7 Boosts (Monthly Sub)",
title: "Nitro + 5 Boosts (Monthly)",
discounts: []
}, {
identifier: "api_generic_subscription",
price: 4.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$4.99",
countryCode: "US",
downloadable: false,
description: "Discord Subscription",
title: "Discord Subscription",
discounts: []
}, {
identifier: "premium_tier_2_yearly",
price: 99.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$99.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 2 Boosts (Yearly Sub)",
title: "Nitro Yearly",
discounts: [{
subscriptionPeriod: "MONTH",
paymentMode: "FREETRIAL",
price: "0",
type: "SUBSCRIPTION",
numberOfPeriods: "1",
localizedPrice: "$0.00",
identifier: "premium_tier_2_yearly_reactivation"
}, {
localizedPrice: "$0.00",
paymentMode: "FREETRIAL",
subscriptionPeriod: "DAY",
price: "0",
type: "SUBSCRIPTION",
numberOfPeriods: "14",
identifier: "premium_tier_2_yearly_q4_drop"
}, {
identifier: "premium_tier_2_yearly_referral_trial",
localizedPrice: "$0.00",
price: "0",
subscriptionPeriod: "DAY",
paymentMode: "FREETRIAL",
numberOfPeriods: "14",
type: "SUBSCRIPTION"
}, {
localizedPrice: "$0.00",
type: "SUBSCRIPTION",
numberOfPeriods: "1",
subscriptionPeriod: "MONTH",
price: "0",
paymentMode: "FREETRIAL",
identifier: "premium_tier_2_yearly_likelihood"
}]
}, {
identifier: "premium_tier_2_premium_guild_13_monthly",
price: 54.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$54.99",
countryCode: "US",
downloadable: false,
description: "Chat perks and 15 Boosts (Monthly Sub)",
title: "Nitro + 13 Boosts (Monthly)",
discounts: []
}, {
identifier: "api_generic_consumable",
price: 4.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$4.99",
countryCode: "US",
downloadable: false,
description: "Profile and Avatar Decorations from the Shop",
title: "Discord Collectible",
discounts: []
}, {
identifier: "premium_month_tier_0",
price: 2.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$2.99",
countryCode: "US",
downloadable: false,
description: "1 month of sweet chat perks",
title: "Nitro Basic (1 Month)",
discounts: []
}, {
identifier: "premium_month_tier_2.2",
price: 9.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$9.99",
countryCode: "US",
downloadable: false,
description: "1 month of sweet chat perks and 1 Nitro Boost",
title: "Nitro (1 Month)",
discounts: []
}, {
identifier: "premium_year_tier_1.2",
price: 49.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$49.99",
countryCode: "US",
downloadable: false,
description: "1 year of sweet chat perks",
title: "Nitro Classic (1 Year)",
discounts: []
}, {
identifier: "premium_month_tier_1.2",
price: 4.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$4.99",
countryCode: "US",
downloadable: false,
description: "1 month of sweet chat perks",
title: "Nitro Classic (1 Month)",
discounts: []
}, {
identifier: "sticker_pack_199",
price: 1.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$1.99",
countryCode: "US",
downloadable: false,
description: "A pack of stickers you can use in chat",
title: "Discord Sticker Pack",
discounts: []
}, {
identifier: "premium_year_tier_0",
price: 29.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$29.99",
countryCode: "US",
downloadable: false,
description: "1 year of sweet chat perks",
title: "Nitro Basic (1 Year)",
discounts: []
}, {
identifier: "sticker_pack_299",
price: 2.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$2.99",
countryCode: "US",
downloadable: false,
description: "A pack of stickers you can use in chat",
title: "Discord Sticker Pack",
discounts: []
}, {
identifier: "premium_year_tier_2.2",
price: 99.99,
currencySymbol: "$",
currencyCode: "usd",
priceString: "$99.99",
countryCode: "US",
downloadable: false,
description: "1 year of sweet chat perks and 1 Nitro Boost",
title: "Nitro (1 Year)",
discounts: []
}];
@@ -0,0 +1,6 @@
// Metro module 6356 (f6357).
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
export default function openBlockedPaymentsCountryActionSheet() {
ActionSheetActionCreators.hideActionSheet();
ActionSheetActionCreators.openLazy(import("./BlockedPaymentsCountryActionSheet"), "BlockedPaymentsCountryActionSheet");
};
@@ -0,0 +1,285 @@
// Metro module 14794 (f14795).
import { useState, useRef, useEffect, useMemo } from "react";
import { View } from "react-native";
import UserStore from "../../../../stores/UserStore";
import SKUStore from "../../../../stores/game_store/SKUStore";
import { PriceSetAssignmentPurchaseTypes } from "../../../../Constants";
import { PremiumTypes } from "../../../premium/PremiumConstants";
import Logger from "../../../debug/Logger";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useNativeGiftContext, NativeGiftContextProvider } from "../../../payments/native/NativeGiftContext";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useFetchCollectiblesProduct } from "../../../collectibles/hooks/useFetchCollectiblesProduct";
import * as _CollectiblesActionCreators from "../../../collectibles/CollectiblesActionCreators";
import * as _PremiumTypeUtils from "../../../../utils/PremiumTypeUtils";
import { loadInAppSkus } from "../../../../actions/native/GPlayActionCreators";
import useMobileCollectiblesPurchaseSKU_android from "../../../collectibles/native/hooks/useMobileCollectiblesPurchaseSKU.android";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import { getFormattedPriceForCollectiblesProduct } from "../../../collectibles/CollectiblesUtils";
import { Stack } from "../../../../design/components/Stack/native/Stack.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Card } from "../../../../design/components/Card/native/Card.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import PremiumGiftBackgroundSelect from "../../../premium/native/gifting/PremiumGiftBackgroundSelect";
import { v4 } from "../../../../_bundle/Module514";
import { getBasePurchaseFlowAnalyticsFields } from "../../../premium/native/PremiumAnalyticsUtils";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { NativePaymentContextProvider } from "../../../payments/native/NativePaymentContext";
let c10439_13, SimpleRequestOTPActionSheet;
const GiftPurchaseSKUView = function GiftPurchaseSKUView(props) {
let state, setState, currentUser, ref, product, memo, memo2, c21348_8;
const { selectedSkuId, giftRecipientId, giftMessage } = props;
state = void 0;
setState = void 0;
currentUser = void 0;
ref = void 0;
product = void 0;
memo = void 0;
memo2 = void 0;
c21348_8 = void 0;
let _submitGiftPurchase2 = function _submitGiftPurchase() {
const r9 = async () => {
let c30781_2;
let c30781_3 = 0;
let c31740_0;
const r16 = "Cannot proceed with purchase: collectibleProduct is undefined";
L17: {
L15: {
try {
c30781_3 = 1;
if (product == null) {
c10439_13.error(r16);
AlertActionCreators.show({
title: "Product Not Found",
body: "The product information could not be loaded. Please try again."
});
c30781_3 = 0;
break L17;
}
if (product.googleSkuIds != null && memo.length !== 0) {
await c21348_8();
c30781_3 = 0;
break L15;
}
c10439_13.error(`No Google SKU IDs available for product ${product.skuId}`);
AlertActionCreators.show({
title: "Product Not Available",
body: "This product is not available for purchase on Google Play."
});
c30781_3 = 0;
} catch ($e) {
const r31 = $e;
let r7 = r31;
c30781_2 = r31;
if (c30781_3 !== 0) {
while (true) {
try {
const r95 = c30781_2;
c30781_3 = 0;
c31740_0 = r95;
c10439_13.warn("Error creating gift purchase:", c31740_0);
AlertActionCreators.show({
title: "Gift Purchase Failed",
body: `Error: ${c31740_0?.message || JSON.stringify(c31740_0)}`
});
break L15;
} catch (r91) {
r7 = r91;
c30781_2 = r91;
if (c30781_3 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
return void 0;
}
};
_submitGiftPurchase2 = r9;
return r9.apply(this, arguments);
};
const safeAreaInsets_native = useSafeAreaInsets_native();
[state, setState] = useState(false);
currentUser = UserStore.getCurrentUser();
ref = useRef({});
const giftStyle = useNativeGiftContext().giftStyle;
const stateFromStores = useStateFromStores([SKUStore], () => SKUStore.get(selectedSkuId));
const fetchCollectiblesProduct = useFetchCollectiblesProduct(selectedSkuId);
product = fetchCollectiblesProduct.product;
let isFetching = fetchCollectiblesProduct.isFetching;
useEffect(() => {
if (selectedSkuId != null) {
_CollectiblesActionCreators.fetchCollectiblesProduct(selectedSkuId);
}
}, [selectedSkuId]);
memo = useMemo(() => {
if (product != null && product.googleSkuIds != null) {
const isPremium = _PremiumTypeUtils.isPremium(currentUser, PremiumTypes.TIER_2);
const googleSkuIds = product.googleSkuIds;
const r18 = isPremium ? googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2] : googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE];
return r18 == null ? [r18] : Object.values(product.googleSkuIds);
}
c10439_13.warn(`No googleSkuIds available for product: ${selectedSkuId}`);
return [];
}, [product, currentUser, selectedSkuId]);
memo2 = useMemo(() => memo.sort().join(","), [memo]);
useEffect(() => {
let _loadGoogleSkus2 = function _loadGoogleSkus() {
const r9 = async () => {
let c31741_2;
let c31741_3 = 0;
let c32061_0;
let r10 = "Unable to fetch product IDs from Google Play store:";
L10: {
L18: {
try {
if (memo2 != null && ref.current[memo2]) {
break L10;
}
if (memo.length === 0) {
break L10;
}
if (state) {
break L10;
}
setState(true);
c31741_3 = 1;
await loadInAppSkus(memo);
r10 = "Unable to fetch product IDs from Google Play store:";
if (memo2 != null) {
ref.current[memo2] = true;
}
(0, setState)(false);
c31741_3 = 0;
} catch ($e) {
const r28 = $e;
let r7 = r28;
c31741_2 = r28;
if (c31741_3 !== 0) {
while (true) {
try {
const r86 = c31741_2;
c31741_3 = 0;
c32061_0 = r86;
c10439_13.error(r10, c32061_0);
(0, setState)(false);
break L18;
} catch (r82) {
r7 = r82;
c31741_2 = r82;
if (c31741_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
return void 0;
}
};
_loadGoogleSkus2 = r9;
return r9.apply(this, arguments);
};
(function loadGoogleSkus() {
return _loadGoogleSkus2.apply(this, arguments);
})();
}, [memo, state, memo2]);
c21348_8 = useMobileCollectiblesPurchaseSKU_android({
product: product == null ? {
skuId: selectedSkuId,
googleSkuIds: {}
} : product,
onPurchaseComplete: function onPurchaseComplete() {
ActionSheetActionCreators.hideActionSheet();
},
onPurchaseError: () => {
c10439_13.error("Purchase error occurred");
},
onPurchasePending: () => {
c10439_13.info("Purchase is pending");
},
giftParams: {
isGift: true,
options: {
recipient_id: giftRecipientId,
custom_message: giftMessage,
gift_style: giftStyle
}
}
});
const [r82, r83] = useMemo(() => product == null ? ["Loading...", "Loading..."] : [getFormattedPriceForCollectiblesProduct(product, true, true), getFormattedPriceForCollectiblesProduct(product, false, true)], [product]);
if (!isFetching) {
isFetching = state;
}
if (!isFetching) {
isFetching = product == null;
}
return <Stack spacing={24} style={{
paddingTop: safeAreaInsets_native.top,
paddingBottom: safeAreaInsets_native.bottom,
paddingHorizontal: 12
}}>
<Text variant="text-md/medium" color="text-overlay-light">
{"Gifting "}
{stateFromStores?.name}
{" to "}
{giftRecipientId}
{" "}
{"\n"}
{"Regular price: "}
{r83}
{" "}
{"\n"}
{"Premium price: "}
{r82}
{" "}
{"\n"}
{giftMessage != null ? giftMessage !== "" ? `Message: ${giftMessage}` : "No message" : "No message"}
</Text>
<Card>
<Button variant="primary" text={isFetching ? "Loading..." : "Send Gift"} onPress={function submitGiftPurchase() {
return _submitGiftPurchase2.apply(this, arguments);
}} disabled={isFetching} />
</Card>
<Card>
<Text variant="text-md/medium" color="text-overlay-light">
{"Select style: "}
{giftStyle}
</Text>
<PremiumGiftBackgroundSelect />
</Card>
</Stack>;
};
SimpleRequestOTPActionSheet = function SimpleRequestOTPActionSheet(props) {
const { selectedSkuId: selectedSkuId2, requestType, giftRecipientId, giftMessage } = props;
const analyticsLoadId = v4();
const memo3 = useMemo(() => getBasePurchaseFlowAnalyticsFields({
isGift: true,
analyticsLoadId,
analyticsLocations: []
}), [analyticsLoadId]);
return <BottomSheet>
{requestType === "giftSku" && (selectedSkuId2 != null && giftRecipientId != null) ? <NativeGiftContextProvider basePurchaseAnalytics={memo3} onClose={() => {}} setCurrentAnalyticsStep={() => {}}>
<GiftPurchaseSKUView selectedSkuId={selectedSkuId2} giftRecipientId={giftRecipientId} giftMessage={giftMessage} />
</NativeGiftContextProvider> : <View>
<Text variant="text-lg/bold" color="text-feedback-warning">Gift purchasing is the only supported feature on Android in this version.</Text>
<Text variant="text-md/normal" color="text-feedback-warning">
{"Request type: "}
{requestType ?? "none"}
</Text>
</View>}
</BottomSheet>;
};
c10439_13 = new Logger("PaymentFlowTest.android");
export default function SimpleCreateOTPActionSheetWrapper(props) {
return <NativePaymentContextProvider skuIDs={[]} activeSubscription={null}>
<SimpleRequestOTPActionSheet {...props} />
</NativePaymentContextProvider>;
};
@@ -0,0 +1,8 @@
// Metro module 14800 (f14801).
import { View } from "react-native";
const r18 = {
RunAllFlows: function RunAllFlows() {
return <View />;
}
};
export default r18;
@@ -0,0 +1,24 @@
// Metro module 6557 (f6558).
import { SubscriptionStatusTypes } from "../../../../Constants";
import { getBillingInformationString } from "../../../../utils/PremiumUtils";
import { isIOS } from "../../../../_bundle/Module501";
import { t, intl } from "../../../../intl/index.native";
import { manageSubscription } from "../../../../utils/native/IAPUtils";
export function getBillingInformationStringNative(a0, a1, r12 = null, r11 = false) {
let c15794_0;
c15794_0 = void 0;
let r19 = getBillingInformationString(a0, a1, r12, r11, arguments[4]);
if (isIOS() && a0.isPurchasedViaApple && a0.status === SubscriptionStatusTypes.ACTIVE) {
const gknRR3 = t.gknRR3;
c15794_0 = async () => {
await manageSubscription();
};
r19 = intl.format(gknRR3, {
renewalDate: a1.subscriptionPeriodStart,
onSubscriptionManagementClick: function() {
return c15794_0.apply(this, arguments);
}
});
}
return r19;
}
@@ -0,0 +1,13 @@
// Metro module 6670 (f6671).
import { useMemo } from "react";
import useToggleOnIAPSuccess from "./useToggleOnIAPSuccess";
import { v4 } from "../../../../_bundle/Module514";
export default function useCancelSubscriptionParams(a0) {
const subscriptionId = a0;
const toggleOnIAPSuccess = useToggleOnIAPSuccess();
let c15839_1 = toggleOnIAPSuccess;
return useMemo(() => subscriptionId == null ? null : c15839_1 == null ? null : {
requestIdentifier: v4(),
subscriptionId
}, [a0, toggleOnIAPSuccess]);
};
@@ -0,0 +1,24 @@
// Metro module 6668 (f6669).
import { useMemo } from "react";
import useToggleOnIAPSuccess from "./useToggleOnIAPSuccess";
import { v4 } from "../../../../_bundle/Module514";
export default function useCreateSubscriptionParams(a0, a1) {
const toggleOnIAPSuccess = useToggleOnIAPSuccess();
let c15837_2 = toggleOnIAPSuccess;
return useMemo(() => {
const r1 = a0 == null;
let r2 = null;
if (!r1) {
r2 = a1 == null ? null : c15837_2 == null ? null : {
requestIdentifier: v4(),
items: [{
planId: a0.id,
quantity: 1
}],
countryCode: a1.country,
currency: a1.currency
};
}
return r2;
}, [a0, a1, toggleOnIAPSuccess]);
};
@@ -0,0 +1,93 @@
// Metro module 14227 (f14228).
import { useRef, useState, useEffect } from "react";
import Logger from "../../../debug/Logger";
import BillingActionCreators from "../../../../actions/native/BillingActionCreators";
let c9995_5 = new Logger("useRestorePurchases");
export default function useRestorePurchases(r3 = {}) {
let forceRestore = r3.forceRestore;
if (forceRestore === void 0) {
forceRestore = true;
}
let ref, setState;
let c21049_0 = forceRestore;
ref = void 0;
setState = void 0;
let _restore2 = function _restore() {
const r9 = async () => {
let c30716_2;
let c30716_3 = 0;
let c31721_0;
L10: {
try {
setState(true);
c9995_5.log("isRestoring true");
c30716_3 = 2;
await BillingActionCreators.restoreAndApplyPurchases();
c9995_5.log("restored unfinished transactions");
ref.current = true;
c30716_3 = 1;
c30716_3 = 0;
(0, setState)(false);
c9995_5.log("isRestoring false");
} catch ($e) {
const r27 = $e;
let r7 = r27;
c30716_2 = r27;
let r28 = c30716_3;
if (r28 !== 0) {
while (true) {
if (r28 === 1) {
try {
const r99 = c30716_2;
c30716_3 = 0;
(0, setState)(false);
c9995_5.log("isRestoring false");
throw r99;
} catch (r97) {
r7 = r97;
c30716_2 = r97;
r28 = c30716_3;
if (r28 === 0) {
break;
}
}
} else {
try {
const r80 = c30716_2;
c30716_3 = 1;
c31721_0 = r80;
c9995_5.error(c31721_0);
c30716_3 = 0;
(0, setState)(false);
c9995_5.log("isRestoring false");
break L10;
} catch (r77) {
r7 = r77;
c30716_2 = r77;
r28 = c30716_3;
if (r28 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
_restore2 = r9;
return r9.apply(this, arguments);
};
ref = useRef(false);
let state;
[state, setState] = useState(false);
useEffect(() => {
if (c21049_0 || !ref.current) {
(function restore() {
return _restore2.apply(this, arguments);
})();
}
}, [forceRestore]);
return state;
};
@@ -0,0 +1,13 @@
// Metro module 6671 (f6672).
import { useMemo } from "react";
import useToggleOnIAPSuccess from "./useToggleOnIAPSuccess";
import { v4 } from "../../../../_bundle/Module514";
export default function useResubscribeSubscriptionParams(a0) {
const subscriptionId = a0;
const toggleOnIAPSuccess = useToggleOnIAPSuccess();
let c15840_1 = toggleOnIAPSuccess;
return useMemo(() => subscriptionId == null ? null : c15840_1 == null ? null : {
requestIdentifier: v4(),
subscriptionId
}, [a0, toggleOnIAPSuccess]);
};
@@ -0,0 +1,42 @@
// Metro module 6573 (f6574).
import { useMemo } from "react";
import { PriceSetAssignmentPurchaseTypes } from "../../../../Constants";
import { getCountryPrices, experimentalGetPrice } from "../../../../utils/PremiumUtils";
let c4232_4 = {
PRICE_AVAILABLE: "PRICE_AVAILABLE",
SUBSCRIPTION_PLAN_UNAVAILABLE: "SUBSCRIPTION_PLAN_UNAVAILABLE",
STOREFRONT_UNAVAILABLE: "STOREFRONT_UNAVAILABLE",
MISMATCHING_COUNTRIES: "MISMATCHING_COUNTRIES",
COUNTRY_PRICE_UNAVAILABLE: "COUNTRY_PRICE_UNAVAILABLE"
};
export default function useStoreFrontPrice(a0, a1) {
return useMemo(() => {
let SUBSCRIPTION_PLAN_UNAVAILABLE, price;
if (a0 == null) {
SUBSCRIPTION_PLAN_UNAVAILABLE = c4232_4.SUBSCRIPTION_PLAN_UNAVAILABLE;
price = void 0;
} else if (a1 == null) {
SUBSCRIPTION_PLAN_UNAVAILABLE = c4232_4.STOREFRONT_UNAVAILABLE;
price = void 0;
} else {
const prices = a0.prices;
if ((prices == null ? void 0 : prices[PriceSetAssignmentPurchaseTypes.MOBILE]) == null) {
SUBSCRIPTION_PLAN_UNAVAILABLE = c4232_4.COUNTRY_PRICE_UNAVAILABLE;
price = void 0;
} else {
const countryPrices = getCountryPrices(a0.id, PriceSetAssignmentPurchaseTypes.MOBILE);
const r29 = experimentalGetPrice(a0.id, {
purchaseType: PriceSetAssignmentPurchaseTypes.MOBILE,
currency: a1.currency
});
SUBSCRIPTION_PLAN_UNAVAILABLE = countryPrices.countryCode !== a1.country ? c4232_4.MISMATCHING_COUNTRIES : r29 == null ? c4232_4.COUNTRY_PRICE_UNAVAILABLE : c4232_4.PRICE_AVAILABLE;
price = r29;
}
}
return {
price,
priceState: SUBSCRIPTION_PLAN_UNAVAILABLE
};
}, [a0, a1]);
};
export { c4232_4 as PriceStates };
@@ -0,0 +1,16 @@
// Metro module 6669 (f6670).
import { useState, useEffect } from "react";
import Dispatcher from "../../../../Dispatcher";
export default function useToggleOnIAPSuccess() {
const toggleFlip2 = function toggleFlip() {
setState((prevState) => !prevState);
};
const [state, setState] = useState(false);
useEffect(() => {
Dispatcher.subscribe("IAP_PURCHASE_PRODUCT_SUCCESS", toggleFlip2);
return () => {
Dispatcher.unsubscribe("IAP_PURCHASE_PRODUCT_SUCCESS", toggleFlip2);
};
}, []);
return state;
};
@@ -0,0 +1,58 @@
// Metro module 12487 (f12488).
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c8629_0 = {};
let c8629_1 = new Set();
class WalletBalanceStore extends Module589.Store {
static displayName = "WalletBalanceStore";
getBalance(a0) {
let r4 = c8629_0[a0];
if (r4 == null) {
r4 = null;
}
return r4;
}
getIsFetching(a0) {
return c8629_1.has(a0);
}
}
const walletBalanceStore = new WalletBalanceStore(Dispatcher, {
BILLING_WALLET_BALANCE_FETCH_START: function handleFetchStart(a0) {
const set = new Set(c8629_1);
c8629_1 = set;
set.add(a0.paymentSourceId);
},
BILLING_WALLET_BALANCE_FETCH_SUCCESS: function handleFetchSuccess(a0) {
const set = new Set(c8629_1);
c8629_1 = set;
set.delete(a0.paymentSourceId);
const r15 = {
...c8629_0
};
r15[a0.paymentSourceId] = {
currency: a0.currency,
amount: a0.amount
};
c8629_0 = r15;
},
BILLING_WALLET_BALANCE_FETCH_FAIL: function handleFetchFail(a0) {
const set = new Set(c8629_1);
c8629_1 = set;
set.delete(a0.paymentSourceId);
},
WALLET_BALANCE_UPDATE: function handleBalanceUpdate(a0) {
const r1 = {
...c8629_0
};
r1[a0.paymentSourceId] = {
currency: a0.currency,
amount: a0.balance
};
c8629_0 = r1;
},
LOGOUT: function reset() {
c8629_0 = {};
c8629_1 = new Set();
}
});
export default walletBalanceStore;
@@ -0,0 +1,26 @@
// Metro module 1896 (f1897).
export function parseStoreCountry(a0) {
let r1 = a0;
if (a0 != null) {
let set_at = a0.set_at;
if (set_at == null) {
set_at = a0.setAt;
}
if (set_at == null) {
set_at = null;
}
let is_locked = a0.is_locked;
if (is_locked == null) {
is_locked = a0.isLocked;
}
if (is_locked == null) {
is_locked = false;
}
r1 = {
country: a0.country,
setAt: set_at,
isLocked: is_locked
};
}
return r1;
}