310 lines
14 KiB
TypeScript
310 lines
14 KiB
TypeScript
/* Metro module 13421; source: modules/parent_tools/ChangeSpendingLimitFormState.tsx; dependencies: [5, 57, 31, 5116, 13348, 566, 5138, 13350, 2] */
|
|
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import FamilyCenterStore from './FamilyCenterStore.tsx'; /* Metro dependency 5116 */
|
|
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 FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as PriceUtilsModule from '../../external/discord_common/js/shared/utils/PriceUtils.tsx'; /* Metro dependency 5138 */
|
|
import * as ParentalControlledUserSettingsModule from '../user_settings/family_center/ParentalControlledUserSettings.tsx'; /* Metro dependency 13348 */
|
|
import * as SpendingLimitUtilsModule from './SpendingLimitUtils.tsx'; /* Metro dependency 13350 */
|
|
|
|
function _fun102121(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#102121, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13611:6, offset: 0x0222ddd0, size: 165 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/parent_tools/ChangeSpendingLimitFormState.tsx');
|
|
exports.useChangeSpendingLimitFormState = useChangeSpendingLimitFormState;
|
|
function useChangeSpendingLimitFormState(a0) { // fn#102122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13611:257, offset: 0x0222de75, size: 681 bytes, params: 2, frame: 31
|
|
const env0_0 = a0;
|
|
const value2 = undefined;
|
|
const ParentalControlledSpendingLimit = (ParentalControlledUserSettingsModule).ParentalControlledSpendingLimit;
|
|
const value3 = ParentalControlledSpendingLimit.useControlledSetting(a0);
|
|
const useStateFromStores = FluxModule.useStateFromStores;
|
|
const familyCenterStoreBinding = FamilyCenterStore;
|
|
const spendingLimit = Reflect.apply(useStateFromStores, FluxModule, [[familyCenterStoreBinding], function() {
|
|
return FamilyCenterStore.getSpendingLimit();
|
|
}]);
|
|
const value4 = FluxModule.useStateFromStores([familyCenterStoreBinding], _fun102124);
|
|
const value5 = null;
|
|
const currency = value5 == value3 ? value2 : value3.currency;
|
|
const r3 = value5 != currency ? currency : value5 == spendingLimit ? value2 : spendingLimit.currency;
|
|
let r5 = value5 != r3 ? r3 : 'usd';
|
|
const value7 = r5.toLowerCase();
|
|
const env0_2 = value7;
|
|
const CurrencyExponents = (PriceUtilsModule).CurrencyExponents;
|
|
let property = CurrencyExponents[value7];
|
|
const value8 = 2;
|
|
const r10 = value5 != property ? property : value8;
|
|
const env0_3 = r10;
|
|
let binding = env0_4;
|
|
let useMemo = binding.useMemo;
|
|
const value9 = Reflect.apply(useMemo, binding, [_fun102125, [value7]]);
|
|
useMemo = binding.useMemo;
|
|
const getNextRenewalDateLabel = (SpendingLimitUtilsModule).getNextRenewalDateLabel;
|
|
const value10 = Reflect.apply(useMemo, binding, [getNextRenewalDateLabel, []]);
|
|
const value12 = env0_3(binding.useState(_fun102126), value8);
|
|
property = value12[0];
|
|
var env0_4 = value12[1];
|
|
let useCallback = binding.useCallback;
|
|
const value13 = Reflect.apply(useCallback, binding, [_fun102127, [r10]]);
|
|
const r6 = property === '' && value5 != value3;
|
|
const float = global.parseFloat(property);
|
|
const Number = global.Number;
|
|
const r15 = !Number.isNaN(float) && float >= 0;
|
|
r5 = r6 || r15;
|
|
const r7 = r15 ? global.Math.round(float * exponentiationOperator(10, r10, float)) : value5;
|
|
binding = env0_4;
|
|
const value20 = env0_3(binding.useState(false), value8);
|
|
const property2 = value20[0];
|
|
const env0_8 = value20[1];
|
|
useCallback = binding.useCallback;
|
|
let value = env0_2(_fun102129);
|
|
value = Reflect.apply(useCallback, binding, [value, [r5, r6, r7, a0, value7]]);
|
|
return {amountInput: property, handleAmountChange: value13, currency: value7, currencySymbol: value9, exponent: r10,
|
|
isClearingCap: r6, isOverspending: value5 != value4 && value4 > 0 && value5 != r7 && r7 <= value4, canSave: r5,
|
|
isSubmitting: property2, renewalDate: value10, monthlySpend: value4, save: value};
|
|
function _fun102124() { // fn#102124, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13611:472, offset: 0x0222e133, size: 48 bytes, params: 1, frame: 11
|
|
let value = environment.__proto__;
|
|
value = FamilyCenterStore.getMonthlyPurchases();
|
|
const value2 = null;
|
|
const total_amount = value2 == value ? undefined : value.total_amount;
|
|
return value2 != total_amount ? total_amount : value2;
|
|
}
|
|
|
|
function _fun102125() { // fn#102125, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13611:726, offset: 0x0222e163, size: 45 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
return (SpendingLimitUtilsModule).getCurrencySymbol(env0_2);
|
|
}
|
|
|
|
function _fun102126() { // fn#102126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13611:827, offset: 0x0222e190, size: 62 bytes, params: 1, frame: 14
|
|
var r0;
|
|
var String;
|
|
var value;
|
|
if (env0_1 == null) {
|
|
r0 = '';
|
|
} else {
|
|
String = global.String;
|
|
value = env0_1.amount / exponentiationOperator(10, env0_3, undefined);
|
|
value = String(value);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun102127(a0) { // fn#102127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13611:907, offset: 0x0222e1ce, size: 58 bytes, params: 2, frame: 15
|
|
const binding = env0_4;
|
|
return binding(SpendingLimitUtilsModule.sanitizeAmountInput(a0, env0_3));
|
|
}
|
|
|
|
function* _fun102129() { // fn#102129, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13611:1106, offset: 0x0222e213, size: 250 bytes, params: 1, frame: 17
|
|
var familyCenterStoreBinding;
|
|
var binding;
|
|
var value3;
|
|
var binding2;
|
|
var property;
|
|
var value5;
|
|
var ParentalControlledSpendingLimit;
|
|
var updateControlledSetting;
|
|
var object;
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
var value9;
|
|
var binding3;
|
|
var value10;
|
|
var value11;
|
|
var value12;
|
|
var value13;
|
|
var error;
|
|
if (true) {
|
|
value = environment.__proto__;
|
|
if (env1_6) {
|
|
env1_8(true);
|
|
try {
|
|
familyCenterStoreBinding = FamilyCenterStore;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
if (familyCenterStoreBinding) {
|
|
value9 = environment.__proto__.__proto__;
|
|
try {
|
|
binding = env2_0;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
binding3 = env2_1;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
property = binding3[4];
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
value10 = binding(property);
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
ParentalControlledSpendingLimit = value10.ParentalControlledSpendingLimit;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
updateControlledSetting = ParentalControlledSpendingLimit.updateControlledSetting;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
value11 = Reflect.apply(updateControlledSetting, ParentalControlledSpendingLimit, [require, null]);
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
yield value11;
|
|
try {
|
|
value12 = undefined;
|
|
value13 = false;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
if (value13) {
|
|
env1_8(false);
|
|
return value12;
|
|
}
|
|
env1_8(false);
|
|
return undefined;
|
|
}
|
|
try {
|
|
binding = env1_7;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
value3 = binding == null;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
if (value3) {
|
|
env1_8(false);
|
|
return undefined;
|
|
}
|
|
try {
|
|
binding = env2_0;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
binding2 = env2_1;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
property = binding2[4];
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
value5 = binding(property);
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
ParentalControlledSpendingLimit = value5.ParentalControlledSpendingLimit;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
updateControlledSetting = ParentalControlledSpendingLimit.updateControlledSetting;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
object = {};
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
binding = env1_7;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
object.amount = binding;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
binding = env1_2;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
object.currency = binding;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
value6 = Reflect.apply(updateControlledSetting, ParentalControlledSpendingLimit, [require, object]);
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
yield value6;
|
|
try {
|
|
value7 = undefined;
|
|
value8 = false;
|
|
} catch (error) {
|
|
env1_8(false);
|
|
throw error;
|
|
}
|
|
if (value8) {
|
|
env1_8(false);
|
|
return value7;
|
|
}
|
|
env1_8(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun102121, 13421, [5, 57, 31, 5116, 13348, 566, 5138, 13350,
|
|
2]) /* metro module 13421, dependencies: [5, 57, 31, 5116, 13348, 566, 5138, 13350, 2] */;
|