218 lines
13 KiB
TypeScript
218 lines
13 KiB
TypeScript
/* Metro module 7010; source: modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx; dependencies: [57, 31, 7011, 3805, 1376, 482, 7012, 566, 1365, 7013, 4223, 694, 7017, 1962, 4080, 2] */
|
|
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Dispatcher from '../../../Dispatcher.tsx'; /* Metro dependency 694 */
|
|
import PaymentSourceStore from '../../../stores/billing/PaymentSourceStore.tsx'; /* Metro dependency 3805 */
|
|
import WalletBalanceStore from '../../billing/stores/WalletBalanceStore.tsx'; /* Metro dependency 7011 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as ConstantsModule from '../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
|
|
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as Dismissible_contentModule from '../../../external/discord_common/js/packages/protos/discord_protos/discord_users/v1/dismissible_content.tsx'; /* Metro dependency 1365 */
|
|
import * as DismissibleContentConstantsModule from '../../dismissible_content/DismissibleContentConstants.tsx'; /* Metro dependency 1376 */
|
|
import * as GiftCardsExperimentModule from '../../billing/experiments/GiftCardsExperiment.tsx'; /* Metro dependency 7012 */
|
|
import * as UseSelectedDismissibleContentModule from '../../dismissible_content/hooks/useSelectedDismissibleContent.tsx'; /* Metro dependency 7013 */
|
|
|
|
function _fun55507(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:6, offset: 0x013a8eea, size: 259 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_10 = ({Idle: 'idle', Opening: 'opening', Opened: 'opened'}).Idle;
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx');
|
|
exports.useGiftCardMobileConsumptionHalfsheet = useGiftCardMobileConsumptionHalfsheet;
|
|
function useGiftCardMobileConsumptionHalfsheet() { // fn#55508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:473, offset: 0x013a8fed, size: 505 bytes, params: 1, frame: 24
|
|
const useGiftCardsExperimentConfig = GiftCardsExperimentModule.useGiftCardsExperimentConfig;
|
|
const enabled = Reflect.apply(useGiftCardsExperimentConfig, GiftCardsExperimentModule,
|
|
[{location: 'useGiftCardMobileConsumptionHalfsheet'}]).enabled;
|
|
let useStateFromStores = FluxModule.useStateFromStores;
|
|
const value2 = Reflect.apply(useStateFromStores, FluxModule, [[PaymentSourceStore], _fun55509, [enabled]]);
|
|
useStateFromStores = FluxModule.useStateFromStores;
|
|
const walletBalanceStoreBinding = WalletBalanceStore;
|
|
const value3 = Reflect.apply(useStateFromStores, FluxModule, [[walletBalanceStoreBinding], _fun55510, [value2]]);
|
|
let r5 = enabled && value2 != null && !FluxModule.useStateFromStores([walletBalanceStoreBinding], _fun55511,
|
|
[value2]);
|
|
r5 = r5 && value3 != null && value3.amount > 0;
|
|
const useMemo = ReactModule.useMemo;
|
|
let value = Module00057((UseSelectedDismissibleContentModule).useSelectedDismissibleContent(Reflect.apply(useMemo,
|
|
ReactModule, [_fun55512, [r5]]), undefined, true), 2);
|
|
const property = value[0];
|
|
const property2 = value[1];
|
|
const env0_5 = ReactModule.useRef(property2);
|
|
ReactModule.useEffect(_fun55513, [property2]);
|
|
value = ReactModule.useCallback(_fun55514, []);
|
|
ReactModule.useEffect(_fun55515, [enabled]);
|
|
ReactModule.useEffect(_fun55516, [value2]);
|
|
ReactModule.useEffect(_fun55517, [property, value]);
|
|
ReactModule.useEffect(_fun55521, [property]);
|
|
function _fun55509() { // fn#55509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:659, offset: 0x013a91e6, size: 105 bytes, params: 1, frame: 14
|
|
var r2;
|
|
var Object;
|
|
var values;
|
|
var value2;
|
|
var length;
|
|
var value3;
|
|
var property;
|
|
var type;
|
|
var TDS_WALLET;
|
|
var value4;
|
|
if (enabled) {
|
|
Object = global.Object;
|
|
values = Object.values;
|
|
value = environment.__proto__;
|
|
value2 = Reflect.apply(values, Object, [PaymentSourceStore.paymentSources]);
|
|
length = value2.length;
|
|
value3 = 0;
|
|
if (value3 < length) {
|
|
r2 = value3;
|
|
loopExit3: while (true) {
|
|
property = value2[r2];
|
|
type = property.type;
|
|
TDS_WALLET = PaymentSourceTypes.TDS_WALLET;
|
|
if (type === TDS_WALLET) {
|
|
return property.id;
|
|
}
|
|
value4 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
length = value2.length;
|
|
if (value4 < length) {
|
|
r2 = value4;
|
|
continue;
|
|
}
|
|
break loopExit3;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function _fun55510() { // fn#55510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:845, offset: 0x013a924f, size: 42 bytes, params: 1, frame: 12
|
|
const value2 = null;
|
|
return value2 != env0_1 ? WalletBalanceStore.getBalance(env0_1) : value2;
|
|
}
|
|
|
|
function _fun55511() { // fn#55511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:918, offset: 0x013a9279, size: 40 bytes, params: 1, frame: 12
|
|
return env0_1 != null && WalletBalanceStore.getIsFetching(env0_1);
|
|
}
|
|
|
|
function _fun55512() { // fn#55512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1007, offset: 0x013a92a1, size: 66 bytes, params: 1, frame: 12
|
|
return env0_2 ? [(require(1365) /* metro dependency 1365: dismissible_content */).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET] : [];
|
|
}
|
|
|
|
function _fun55513() { // fn#55513, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1205, offset: 0x013a92e3, size: 21 bytes, params: 1, frame: 2
|
|
env0_5.current = ReactModule;
|
|
}
|
|
|
|
function _fun55514(a0) { // fn#55514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1250, offset: 0x013a92f8, size: 24 bytes, params: 2, frame: 11
|
|
env0_5.current(a0);
|
|
}
|
|
|
|
function _fun55515() { // fn#55515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1286, offset: 0x013a9310, size: 49 bytes, params: 1, frame: 11
|
|
var value;
|
|
if (enabled) {
|
|
value = environment.__proto__;
|
|
value = require(4223) /* metro dependency 4223: BillingActionCreators */;
|
|
value.fetchPaymentSources();
|
|
}
|
|
}
|
|
|
|
function _fun55516() { // fn#55516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1345, offset: 0x013a9341, size: 57 bytes, params: 1, frame: 12
|
|
var value2;
|
|
if (env0_1 != null) {
|
|
value2 = environment.__proto__;
|
|
(require(4223) /* metro dependency 4223: BillingActionCreators */).fetchWalletInformation(env0_1);
|
|
}
|
|
}
|
|
|
|
function _fun55517() { // fn#55517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1414, offset: 0x013a937a, size: 244 bytes, params: 1, frame: 21
|
|
var Opening;
|
|
var value3;
|
|
var defaultImport2;
|
|
const DismissibleContent = require(dependencyMap[8]).DismissibleContent;
|
|
const GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET = DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET;
|
|
if (Module00057 === GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
|
|
var Idle2 = env1_9.Idle;
|
|
if (Idle === Idle2) {
|
|
Opening = env1_9.Opening;
|
|
importDefault(dependencyMap[11]).subscribe('SHOW_ACTION_SHEET', handleShow);
|
|
value3 = require(dependencyMap[13])(dependencyMap[12], dependencyMap.paths);
|
|
value3.catch(_fun55519);
|
|
defaultImport2 = importDefault(dependencyMap[14]);
|
|
defaultImport2.openLazy(value3, 'GiftCardMobileConsumptionActionSheet', {markAsDismissed: env0_6}, 'stack');
|
|
return _fun55520;
|
|
}
|
|
}
|
|
function handleShow(a0) { // fn#55518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1549, offset: 0x013a946e, size: 52 bytes, params: 2, frame: 3
|
|
var Opened;
|
|
var value;
|
|
if (!(env0_0 || a0.key !== 'GiftCardMobileConsumptionActionSheet')) {
|
|
value = environment.__proto__.__proto__;
|
|
Opened = env2_9.Opened;
|
|
}
|
|
}
|
|
|
|
function _fun55519() { // fn#55519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1678, offset: 0x013a94a2, size: 55 bytes, params: 1, frame: 3
|
|
var r0;
|
|
var Idle2;
|
|
var value;
|
|
const binding = env0_0;
|
|
if (binding) {
|
|
r0 = binding;
|
|
} else {
|
|
value = environment.__proto__.__proto__;
|
|
value = Idle !== env2_9.Opening;
|
|
r0 = value;
|
|
}
|
|
if (!r0) {
|
|
value = environment.__proto__.__proto__;
|
|
Idle2 = env2_9.Idle;
|
|
}
|
|
}
|
|
|
|
function _fun55520() { // fn#55520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1766, offset: 0x013a94d9, size: 88 bytes, params: 1, frame: 15
|
|
var Idle2;
|
|
const defaultImport = Dispatcher;
|
|
defaultImport.unsubscribe('SHOW_ACTION_SHEET', handleShow);
|
|
const Opening = env2_9.Opening;
|
|
if (Idle === Opening) {
|
|
Idle2 = env2_9.Idle;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function _fun55521() { // fn#55521, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1879, offset: 0x013a9531, size: 104 bytes, params: 1, frame: 15
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
const DismissibleContent = (Dismissible_contentModule).DismissibleContent;
|
|
const GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET = DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET;
|
|
if (Module00057 === GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).subscribe('HIDE_ACTION_SHEET', handleHide);
|
|
return _fun55523;
|
|
}
|
|
function handleHide({key}) { // fn#55522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1985, offset: 0x013a9599, size: 52 bytes, params: 2, frame: 11
|
|
var value;
|
|
var binding;
|
|
var current;
|
|
if (key === 'GiftCardMobileConsumptionActionSheet') {
|
|
value = environment.__proto__;
|
|
binding = env1_5;
|
|
current = binding.current;
|
|
value = environment.__proto__.__proto__;
|
|
Reflect.apply(current, binding, [ContentDismissActionType.USER_DISMISS]);
|
|
}
|
|
}
|
|
|
|
function _fun55523() { // fn#55523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:2085, offset: 0x013a95cd, size: 50 bytes, params: 1, frame: 14
|
|
let value = environment.__proto__.__proto__;
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.unsubscribe('HIDE_ACTION_SHEET', handleHide);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun55507, 7010, [57, 31, 7011, 3805, 1376, 482, 7012, 566, 1365, 7013, 4223, 694, 7017, 1962, 4080,
|
|
2]) /* metro module 7010, dependencies: [57, 31, 7011, 3805, 1376, 482, 7012, 566, 1365, 7013, 4223, 694, 7017, 1962, 4080, 2] */;
|