decord/source/modules/parent_tools/ChangeSpendingLimitFormState.tsx

207 lines
6.4 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 14032
// Function ID: 14033
2026-07-20 16:05:17 +00:00
// Name: useChangeSpendingLimitFormState
2026-08-05 07:35:12 +00:00
// Dependencies: [5, 32, 19, 6890, 13949, 589, 5750, 13951, 2]
2026-07-20 16:05:17 +00:00
// Exports: useChangeSpendingLimitFormState
2026-08-05 07:35:12 +00:00
// Module 14032 (useChangeSpendingLimitFormState)
2026-07-23 10:11:24 +00:00
import initialize from "initialize";
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
import freshTeenActivityWithMap from "freshTeenActivityWithMap";
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
const result = require("noop").fileFinishedImporting("modules/parent_tools/ChangeSpendingLimitFormState.tsx");
2026-07-20 16:05:17 +00:00
export const useChangeSpendingLimitFormState = function useChangeSpendingLimitFormState(teenId) {
2026-07-29 08:29:29 +00:00
let noop;
let tmp12;
2026-07-23 10:11:24 +00:00
const _require = teenId;
2026-07-29 08:29:29 +00:00
let ParentalControlledSpendingLimit = _require(controlledSetting[4]).ParentalControlledSpendingLimit;
2026-07-23 10:11:24 +00:00
controlledSetting = ParentalControlledSpendingLimit.useControlledSetting(teenId);
let obj = _require(controlledSetting[5]);
2026-07-29 08:29:29 +00:00
const items = [freshTeenActivityWithMap];
2026-07-20 16:05:17 +00:00
const stateFromStores = obj.useStateFromStores(items, () => tmp14.getSpendingLimit());
2026-07-29 08:29:29 +00:00
const items1 = [freshTeenActivityWithMap];
2026-07-23 10:11:24 +00:00
const stateFromStores1 = _require(controlledSetting[5]).useStateFromStores(items1, () => {
2026-07-20 16:05:17 +00:00
const monthlyPurchases = tmp14.getMonthlyPurchases();
let total_amount;
2026-07-29 08:29:29 +00:00
if (monthlyPurchases != null) {
2026-07-20 16:05:17 +00:00
total_amount = monthlyPurchases.total_amount;
}
2026-07-29 08:29:29 +00:00
if (total_amount == null) {
total_amount = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return total_amount;
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
let str;
if (controlledSetting != null) {
str = controlledSetting.currency;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
let currency;
if (stateFromStores != null) {
currency = stateFromStores.currency;
2026-07-20 16:05:17 +00:00
}
str = currency;
}
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "usd";
}
2026-07-20 16:05:17 +00:00
const formatted = str.toLowerCase();
2026-07-29 08:29:29 +00:00
let num = tmp(tmp2[6]).CurrencyExponents[formatted];
if (num == null) {
num = 2;
2026-07-20 16:05:17 +00:00
}
const items2 = [formatted];
2026-07-23 10:11:24 +00:00
const memo = React.useMemo(() => teenId(controlledSetting[7]).getCurrencySymbol(formatted), items2);
2026-07-29 08:29:29 +00:00
const memo1 = React.useMemo(tmp(tmp2[7]).getNextRenewalDateLabel, []);
let obj2 = _require(controlledSetting[5]);
const tmp10 = num;
[tmp12, noop] = num(React.useState(() => {
2026-07-20 16:05:17 +00:00
let str = "";
if (null != controlledSetting) {
const _String = String;
2026-07-29 08:29:29 +00:00
str = String(tmp.amount / 10 ** num);
2026-07-20 16:05:17 +00:00
}
return str;
}), 2);
const items3 = [num];
2026-07-29 08:29:29 +00:00
let tmp14 = "" === tmp12;
2026-07-23 10:11:24 +00:00
const callback = React.useCallback((arg0) => callback(teenId(controlledSetting[7]).sanitizeAmountInput(arg0, num)), items3);
2026-07-20 16:05:17 +00:00
if (tmp14) {
tmp14 = null != controlledSetting;
}
2026-07-29 08:29:29 +00:00
freshTeenActivityWithMap = tmp14;
const parsed = parseFloat(tmp12);
const isNaNResult = Number.isNaN(parsed);
let tmp17 = !isNaNResult;
if (!isNaNResult) {
tmp17 = parsed >= 0;
}
let tmp18 = tmp14;
2026-07-20 16:05:17 +00:00
if (!tmp14) {
2026-07-29 08:29:29 +00:00
tmp18 = tmp17;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let closure_6 = tmp18;
2026-07-20 16:05:17 +00:00
let rounded = null;
2026-07-29 08:29:29 +00:00
if (tmp17) {
2026-07-20 16:05:17 +00:00
const _Math = Math;
rounded = Math.round(parsed * 10 ** num);
}
2026-07-29 08:29:29 +00:00
const tmp10Result = tmp10(React.useState(false), 2);
let closure_8 = tmp10Result[1];
const items4 = [tmp18, tmp14, rounded, teenId, formatted];
obj = { amountInput: tmp12, handleAmountChange: callback, currency: formatted, currencySymbol: memo, exponent: num, isClearingCap: tmp14, isOverspending: null, canSave: null, isSubmitting: null, renewalDate: null, monthlySpend: null, save: null };
let tmp23 = null != stateFromStores1;
const callback1 = obj3.useCallback(formatted(function*() {
if (c4 === 2) {
c4 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c4 = 2;
if (0 === dependencyMap) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let closure_0 = tmp3;
if (outer1_6) {
outer1_8(true);
let c3 = 1;
if (outer1_5) {
2026-08-05 07:35:12 +00:00
const ParentalControlledSpendingLimit2 = outer1_0(13949).ParentalControlledSpendingLimit;
2026-07-29 08:29:29 +00:00
dependencyMap = 2;
c4 = 1;
const obj1 = { value: null, done: false };
obj1[0] = ParentalControlledSpendingLimit2.updateControlledSetting(outer1_0, null);
return obj1;
} else if (null != outer1_7) {
2026-08-05 07:35:12 +00:00
const ParentalControlledSpendingLimit = outer1_0(13949).ParentalControlledSpendingLimit;
2026-07-29 08:29:29 +00:00
const obj2 = { amount: null, currency: null };
obj2[0] = tmp16;
obj2[1] = outer1_2;
dependencyMap = 3;
c4 = 1;
const obj3 = { value: null, done: false };
obj3[0] = ParentalControlledSpendingLimit.updateControlledSetting(outer1_0, obj2);
return obj3;
}
}
c4 = 3;
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp7) {
c3 = 0;
callback(false);
throw initialize;
} else if (2 === tmp7) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 0;
callback(false);
c4 = 3;
const obj4 = { value: null, done: true };
obj4[0] = arg1;
return obj4;
}
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 0;
callback(false);
c4 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
}
c3 = 0;
callback(false);
} catch (tmp27) {
initialize = tmp27;
if (tmp4 === c3) {
c4 = tmp2;
throw tmp27;
} else {
dependencyMap = tmp;
}
}
}
}), items4);
if (tmp23) {
tmp23 = stateFromStores1 > 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp23) {
tmp23 = null != rounded;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp23) {
tmp23 = rounded <= stateFromStores1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[6] = tmp23;
obj[7] = tmp18;
obj[8] = tmp10Result[0];
obj[9] = memo1;
obj[10] = stateFromStores1;
obj[11] = callback1;
2026-07-20 16:05:17 +00:00
return obj;
};