// Module ID: 14997 // Function ID: 14998 // Name: ChangeSpendingLimitModal // Dependencies: [5, 19, 17, 21, 4636, 576, 8711, 4632, 1114, 2396, 14998, 4335, 4596, 4839, 4334, 7337, 8539, 8540, 5054, 6707, 12057, 5514, 5056, 5705, 12059, 2] // Exports: default // Module 14997 (ChangeSpendingLimitModal) import nativeDefault from "native" /* 576 */; import _modDef2396 from "module_2396" /* 2396 */; import ModalActionCreatorsDefault from "ModalActionCreators" /* 4839 */; import NavigatorHeader from "NavigatorHeader" /* 5705 */; import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */; import noop from "module_19" /* 19 */; require = fn; function ChangeSpendingLimitScreen(teenId) { _require = undefined; importDefault = async function _handleSave(dependencyMap) { await closure_2_0(); if (1 === tmp7) { dependencyMap = 0; const intl = tmp3(1114).intl; tmp3(4334).presentFailedToast(intl.string(v2(2396).Wu8BK2)); c3 = 3; tmp3(4334); } else if (dependencyMap === 1) { c3 = 3; throw arg1; } else if (dependencyMap !== 2) { const obj7 = { key: "SPENDING_CONTROLS_CHANGED", content: null, IconComponent: null, iconColor: "status-positive" }; const intl2 = tmp3(1114).intl; obj7.content = intl2.string(v2(2396)["2WKfG1"]); obj7.IconComponent = tmp3(4596).CircleCheckIcon; v2(4335).open(obj7); v2(4335); v2(4839).pop(); dependencyMap = 0; v2(4839); } return arg1; }; let formatToPlainStringResult = closure_8(); const changeSpendingLimitFormState = require("ChangeSpendingLimitFormState").useChangeSpendingLimitFormState(teenId.teenId); ({ amountInput, isOverspending, canSave, isSubmitting, monthlySpend, save: c0 } = changeSpendingLimitFormState); let formatPriceResult = null; ({ handleAmountChange, currencySymbol, exponent, isClearingCap, renewalDate } = changeSpendingLimitFormState); if (null != monthlySpend) { formatPriceResult = null; if (monthlySpend > 0) { formatPriceResult = tmp2(7337).formatPrice(monthlySpend, tmp5); const tmp2Result = tmp2(7337); } } const obj2 = { spacing: nativeDefault.space.PX_16, children: null }; const obj3 = { variant: "text-sm/normal", children: null }; let intl = tmp2(1114).intl; obj3.children = intl.string(_modDef2396.IFguF2); const items = [closure_6(require("Text/Text").Text, obj3), ]; const obj4 = { spacing: nativeDefault.space.PX_8, children: null }; const obj5 = { variant: "text-sm/semibold", color: "text-subtle", children: null }; let intl2 = tmp2(1114).intl; obj5.children = intl2.string(_modDef2396["1fHSu2"]); const items1 = [closure_6(require("Text/Text").Text, obj5), , ]; const obj6 = { accessibilityLabel: null, value: null, onChange: null, leadingText: null, placeholder: null, keyboardType: null, isClearable: true }; const intl3 = tmp2(1114).intl; obj6.accessibilityLabel = intl3.string(_modDef2396["1fHSu2"]); obj6.value = amountInput; obj6.onChange = handleAmountChange; let tmp12; if (tmp7) { tmp12 = currencySymbol; } obj6.leadingText = tmp12; const intl4 = tmp2(1114).intl; obj6.placeholder = intl4.string(_modDef2396.DjSv82); let str = "number-pad"; if (exponent > 0) { str = "decimal-pad"; } obj6.keyboardType = str; const items2 = [closure_6(require("TextInput").TextInput, obj6), ]; let tmp9Result = null; if (isOverspending) { let obj7 = { style: formatToPlainStringResult.warningOverlay, pointerEvents: "none" }; tmp9Result = tmp9(tmp11, obj7); } items2[1] = tmp9Result; items1[1] = closure_7(closure_5, { children: items2 }); if (null == formatPriceResult) { function handleSave() { const self = this; const apply = closure_1.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } const obj8 = { children: null }; items1[2] = null; obj4.children = items1; items[1] = tmp8(tmp2(5054).Stack, obj4); obj2.children = items; obj8.children = tmp8(tmp2(5054).Stack, obj2); const items3 = [tmp9(tmp2(8540).ModalContent, obj8), ]; if (isClearingCap) { const obj9 = { variant: "destructive", text: null, onPress: null, disabled: null, loading: null }; const intl8 = tmp2(1114).intl; obj9.text = intl8.string(tmp10(2396).JZDGJ8); obj9.onPress = handleSave; obj9.disabled = isSubmitting; obj9.loading = isSubmitting; let obj10 = obj9; } else { obj10 = { text: null, onPress: null, disabled: null, loading: null }; const intl7 = tmp2(1114).intl; obj10.text = intl7.string(tmp2(1114).t["R3BPH+"]); obj10.onPress = handleSave; let tmp16 = !canSave; if (canSave) { tmp16 = isSubmitting; } obj10.disabled = tmp16; obj10.loading = isSubmitting; } const obj11 = { children: null }; const obj12 = { children: null }; const obj13 = { children: null }; const items4 = [tmp9(tmp2(5056).Button, obj10), ]; const obj14 = { variant: "tertiary", text: null, onPress: null }; const intl9 = tmp2(1114).intl; obj14.text = intl9.string(tmp2(1114).t["ETE/oC"]); obj14.onPress = tmp10(4839).pop; items4[1] = tmp9(tmp2(5056).Button, obj14); obj13.children = items4; obj12.children = tmp8(tmp2(5514).ButtonGroup, obj13); items3[1] = tmp9(tmp2(12057).ModalFooter, obj12); obj11.children = items3; return tmp8(tmp2(8539).ModalScreen, obj11); } else if (isOverspending) { const obj15 = { style: formatToPlainStringResult.warningRow, children: null }; const obj16 = { size: "xs", color: tmp10(576).colors.ICON_FEEDBACK_WARNING }; const items5 = [tmp9(tmp2(8711).WarningIcon, obj16), ]; const obj17 = { variant: "text-sm/normal", style: formatToPlainStringResult.warningText, children: null }; const intl6 = tmp2(1114).intl; const obj18 = { amount: formatPriceResult, date: renewalDate }; formatToPlainStringResult = intl6.formatToPlainString(tmp10(2396).Tk6x4X, obj18); obj17.children = formatToPlainStringResult; items5[1] = tmp9(tmp2(4632).Text, obj17); obj15.children = items5; let tmp9Result1 = tmp8(tmp11, obj15); } else { const obj19 = { variant: "text-sm/normal", color: "text-muted", children: null }; const intl5 = tmp2(1114).intl; const obj20 = { amount: formatPriceResult }; obj19.children = intl5.formatToPlainString(tmp10(2396).pfAlRY, obj20); tmp9Result1 = tmp9(tmp2(4632).Text, obj19); } } get_ActivityIndicator = fn(17); ({ View: hasOwnProperty, StyleSheet } = get_ActivityIndicator); const jsxProd = fn(21); ({ jsx: metroRequire, jsxs: closure_7 } = jsxProd); const createStyles = fn(4636); let obj2 = { warningOverlay: null, warningRow: null, warningText: null }; let obj3 = {}; const merged = Object.assign(StyleSheet.absoluteFillObject); obj3.borderRadius = nativeDefault.modules.mobile.INPUT_FIELD_RADIUS_LG; obj3.borderWidth = 1; obj3.borderColor = nativeDefault.colors.ICON_FEEDBACK_WARNING; obj3.backgroundColor = nativeDefault.colors.BACKGROUND_FEEDBACK_WARNING; obj2.warningOverlay = obj3; obj2.warningRow = { flexDirection: "row", gap: nativeDefault.space.PX_8, alignItems: "flex-start" }; let obj4 = { flexDirection: "row", gap: nativeDefault.space.PX_8, alignItems: "flex-start" }; obj2.warningText = { flex: 1, color: nativeDefault.colors.ICON_FEEDBACK_WARNING }; let closure_8 = createStyles.createStyles(obj2); const size = fn(2); const result = size.fileFinishedImporting("modules/parent_tools/native/ChangeSpendingLimitModal.tsx"); export default function ChangeSpendingLimitModal(teenId) { teenId = teenId.teenId; const items = [teenId]; const memo = noop.useMemo(() => { let obj = { CHANGE_SPENDING_LIMIT: null }; const obj2 = { headerShown: true, headerLeft: NavigatorHeader.getHeaderCloseButton(ModalActionCreatorsDefault.pop), headerTitle() { const obj = { variant: "text-md/semibold", children: null }; const intl = teenId(1114).intl; obj.children = intl.string(closure_1_1(2396).xMRO6A); return closure_1_6(teenId(4632).Text, obj); }, render() { return closure_2_6(ChangeSpendingLimitScreen, { teenId }); } }; obj.CHANGE_SPENDING_LIMIT = obj2; return obj; }, items); let obj = { initialRouteName: "CHANGE_SPENDING_LIMIT", screens: memo, headerBackTitle: null }; let intl = teenId(1114).intl; obj.headerBackTitle = intl.string(teenId(1114).t["13/7kX"]); return closure_6(teenId(12059).Modal, obj); };