130 lines
7.5 KiB
TypeScript
130 lines
7.5 KiB
TypeScript
/* Metro module 7039; source: modules/premium/native/PremiumPlanPurchasedStore.tsx; dependencies: [3849, 1880, 629, 690, 7040, 6789, 2] */
|
|
function _fun55852(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:6, offset: 0x013b4efa, size: 230 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const actionSheetStore = importDefault(3849) /* metro dependency 3849: ActionSheetStore */;
|
|
const env0_4 = (require(1880) /* metro dependency 1880: PremiumConstants */).PremiumTypes;
|
|
let value = require(629) /* metro dependency 629 */;
|
|
value = value.create(function() {
|
|
return {'productId': '', 'initiatedPurchaseFromNewFlow': false, 'isPaymentSuccess': false,
|
|
'mobileWebRedirectCheckoutStatus': null};
|
|
});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/native/PremiumPlanPurchasedStore.tsx');
|
|
exports.usePremiumPlanPurchasedStore = value;
|
|
exports.setInitiatedPurchaseFromNewFlow = setInitiatedPurchaseFromNewFlow;
|
|
exports.setPaymentSuccess = setPaymentSuccess;
|
|
exports.setMobileWebRedirectCheckoutStatus = setMobileWebRedirectCheckoutStatus;
|
|
exports.handleMobileWebCheckoutStatus = handleMobileWebCheckoutStatus;
|
|
exports.showOldPaymentFlowSuccess = showOldPaymentFlowSuccess;
|
|
exports.reset = reset_55864;
|
|
}
|
|
|
|
function setInitiatedPurchaseFromNewFlow({productId, onPaymentSuccess, onPaymentDismiss}) { // fn#55854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:416, offset: 0x013b4ff0, size: 78 bytes, params: 2, frame: 12
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun55855);
|
|
}
|
|
|
|
function setPaymentSuccess() { // fn#55856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:657, offset: 0x013b507b, size: 107 bytes, params: 1, frame: 14
|
|
var state;
|
|
var productId;
|
|
var onPaymentSuccess;
|
|
const binding = env0_5;
|
|
const getState = binding.getState;
|
|
if (Reflect.apply(getState, binding, []).initiatedPurchaseFromNewFlow) {
|
|
state = env0_5.getState();
|
|
productId = state.productId;
|
|
onPaymentSuccess = state.onPaymentSuccess;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun55857);
|
|
if (onPaymentSuccess != null) {
|
|
onPaymentSuccess(productId);
|
|
}
|
|
}
|
|
}
|
|
|
|
function setMobileWebRedirectCheckoutStatus(a0) { // fn#55858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:901, offset: 0x013b5103, size: 52 bytes, params: 2, frame: 12
|
|
const env0_0 = a0;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun55859);
|
|
}
|
|
|
|
function handleMobileWebCheckoutStatus(a0) { // fn#55860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:1057, offset: 0x013b5159, size: 244 bytes, params: 2, frame: 18
|
|
var defaultImport;
|
|
var object2;
|
|
const env0_0 = a0;
|
|
if (a0 === 'succeeded') {
|
|
var value;
|
|
var state = env0_5.getState();
|
|
var productId = state.productId;
|
|
var onPaymentSuccess = state.onPaymentSuccess;
|
|
if (state.mobileWebRedirectCheckoutStatus === 'dismissed') {
|
|
return undefined;
|
|
}
|
|
var key = ActionSheetStore.getKey();
|
|
var PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY = (require(7040) /* metro dependency 7040: openPremiumPlanSelectionActionSheet */).PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY;
|
|
if (key !== PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY) {
|
|
defaultImport = importDefault(7040) /* metro dependency 7040: openPremiumPlanSelectionActionSheet */;
|
|
object2 = {};
|
|
object2.premiumType = PremiumTypes.TIER_2;
|
|
object2.analyticsLocations = [(importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).DEEPLINK];
|
|
object2.analyticsLocation = {};
|
|
defaultImport(object2);
|
|
}
|
|
value = require(690) /* metro dependency 690: ReactBatchUpdatesNative */;
|
|
value.batchUpdates(_fun55861);
|
|
if (onPaymentSuccess != null) {
|
|
onPaymentSuccess(productId);
|
|
}
|
|
}
|
|
}
|
|
|
|
function showOldPaymentFlowSuccess(a0) { // fn#55862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:1524, offset: 0x013b5276, size: 81 bytes, params: 2, frame: 11
|
|
const binding = env0_5;
|
|
const getState = binding.getState;
|
|
if (Reflect.apply(getState, binding, []).initiatedPurchaseFromNewFlow) {
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun55863);
|
|
} else {
|
|
a0();
|
|
}
|
|
}
|
|
|
|
function reset_55864() { // fn#55864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:1679, offset: 0x013b52c7, size: 112 bytes, params: 1, frame: 14
|
|
const state = env0_5.getState();
|
|
const productId = state.productId;
|
|
const isPaymentSuccess = state.isPaymentSuccess;
|
|
const onPaymentDismiss = state.onPaymentDismiss;
|
|
const env0_0 = state.mobileWebRedirectCheckoutStatus;
|
|
if (onPaymentDismiss != null) {
|
|
onPaymentDismiss({productId: productId, isSuccess: isPaymentSuccess});
|
|
}
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun55865);
|
|
}
|
|
|
|
function _fun55855() { // fn#55855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:532, offset: 0x013b503e, size: 61 bytes, params: 1, frame: 13
|
|
env1_5.setState({productId: productId, initiatedPurchaseFromNewFlow: true, onPaymentSuccess: onPaymentSuccess,
|
|
onPaymentDismiss: onPaymentDismiss});
|
|
}
|
|
|
|
function _fun55857() { // fn#55857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:808, offset: 0x013b50e6, size: 29 bytes, params: 1, frame: 12
|
|
return env1_5.setState({isPaymentSuccess: true});
|
|
}
|
|
|
|
function _fun55859() { // fn#55859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:970, offset: 0x013b5137, size: 34 bytes, params: 1, frame: 12
|
|
return env1_5.setState({mobileWebRedirectCheckoutStatus: env0_0});
|
|
}
|
|
|
|
function _fun55861() { // fn#55861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:1406, offset: 0x013b524d, size: 41 bytes, params: 1, frame: 12
|
|
return env1_5.setState({isPaymentSuccess: true, mobileWebRedirectCheckoutStatus: env0_0});
|
|
}
|
|
|
|
function _fun55865() { // fn#55865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7217:1867, offset: 0x013b5337, size: 89 bytes, params: 1, frame: 15
|
|
const value = environment.__proto__;
|
|
const binding = env1_5;
|
|
const setState = binding.setState;
|
|
const mobileWebRedirectCheckoutStatusBinding = mobileWebRedirectCheckoutStatus;
|
|
const value2 = null;
|
|
Reflect.apply(setState, binding, [{'productId': '', 'initiatedPurchaseFromNewFlow': false,
|
|
'isPaymentSuccess': false,
|
|
mobileWebRedirectCheckoutStatus: value2 != mobileWebRedirectCheckoutStatusBinding ? mobileWebRedirectCheckoutStatus === 'in_mobile_web' ? value2 : 'dismissed' : value2,
|
|
onPaymentSuccess: undefined, onPaymentDismiss: undefined}]);
|
|
}
|
|
|