This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
// Metro module 8042 (f8043).
import { RevenueError } from "../revenue_components/errors/RevenueError";
class CheckoutError extends RevenueError {
name = "FatalCheckoutError";
constructor(a0) {
super(a0);
}
}
export { CheckoutError };
@@ -0,0 +1,132 @@
// Metro module 1993 (f1994).
import { loadJsonAsset } from "../../asset_json/native/AssetJsonUtils";
import * as _Module1994 from "../../../_bundle/Module1994";
import * as _Module1995 from "../../../_bundle/Module1995";
import * as _Module1996 from "../../../_bundle/Module1996";
import * as _Module1997 from "../../../_bundle/Module1997";
import * as _Module1998 from "../../../_bundle/Module1998";
import * as _Module1999 from "../../../_bundle/Module1999";
import * as _Module2000 from "../../../_bundle/Module2000";
import * as _Module2001 from "../../../_bundle/Module2001";
import * as _Module2002 from "../../../_bundle/Module2002";
import * as _Module2003 from "../../../_bundle/Module2003";
import * as _Module2004 from "../../../_bundle/Module2004";
import * as _Module2005 from "../../../_bundle/Module2005";
import * as _Module2006 from "../../../_bundle/Module2006";
import * as _Module2007 from "../../../_bundle/Module2007";
import * as _Module2008 from "../../../_bundle/Module2008";
import * as _Module2009 from "../../../_bundle/Module2009";
import * as _Module2010 from "../../../_bundle/Module2010";
import * as _Module2011 from "../../../_bundle/Module2011";
import * as _Module2012 from "../../../_bundle/Module2012";
import * as _Module2013 from "../../../_bundle/Module2013";
import * as _Module2014 from "../../../_bundle/Module2014";
import * as _Module2015 from "../../../_bundle/Module2015";
import * as _Module2016 from "../../../_bundle/Module2016";
import * as _Module2017 from "../../../_bundle/Module2017";
import * as _Module2018 from "../../../_bundle/Module2018";
import * as _Module2019 from "../../../_bundle/Module2019";
import * as _Module2020 from "../../../_bundle/Module2020";
import * as _Module2021 from "../../../_bundle/Module2021";
import * as _Module2022 from "../../../_bundle/Module2022";
import * as _Module2023 from "../../../_bundle/Module2023";
import * as _Module2024 from "../../../_bundle/Module2024";
import { createLoader, makeMessagesProxy } from "../../../_bundle/Module1274";
const loader = createLoader({
bg: () => loadJsonAsset(_Module1994).then((result) => ({
default: result
})),
cs: () => loadJsonAsset(_Module1995).then((result) => ({
default: result
})),
da: () => loadJsonAsset(_Module1996).then((result) => ({
default: result
})),
de: () => loadJsonAsset(_Module1997).then((result) => ({
default: result
})),
el: () => loadJsonAsset(_Module1998).then((result) => ({
default: result
})),
"en-GB": () => loadJsonAsset(_Module1999).then((result) => ({
default: result
})),
"es-419": () => loadJsonAsset(_Module2000).then((result) => ({
default: result
})),
"es-ES": () => loadJsonAsset(_Module2001).then((result) => ({
default: result
})),
fi: () => loadJsonAsset(_Module2002).then((result) => ({
default: result
})),
fr: () => loadJsonAsset(_Module2003).then((result) => ({
default: result
})),
hi: () => loadJsonAsset(_Module2004).then((result) => ({
default: result
})),
hr: () => loadJsonAsset(_Module2005).then((result) => ({
default: result
})),
hu: () => loadJsonAsset(_Module2006).then((result) => ({
default: result
})),
it: () => loadJsonAsset(_Module2007).then((result) => ({
default: result
})),
ja: () => loadJsonAsset(_Module2008).then((result) => ({
default: result
})),
ko: () => loadJsonAsset(_Module2009).then((result) => ({
default: result
})),
lt: () => loadJsonAsset(_Module2010).then((result) => ({
default: result
})),
nl: () => loadJsonAsset(_Module2011).then((result) => ({
default: result
})),
no: () => loadJsonAsset(_Module2012).then((result) => ({
default: result
})),
pl: () => loadJsonAsset(_Module2013).then((result) => ({
default: result
})),
"pt-BR": () => loadJsonAsset(_Module2014).then((result) => ({
default: result
})),
ro: () => loadJsonAsset(_Module2015).then((result) => ({
default: result
})),
ru: () => loadJsonAsset(_Module2016).then((result) => ({
default: result
})),
"sv-SE": () => loadJsonAsset(_Module2017).then((result) => ({
default: result
})),
th: () => loadJsonAsset(_Module2018).then((result) => ({
default: result
})),
tr: () => loadJsonAsset(_Module2019).then((result) => ({
default: result
})),
uk: () => loadJsonAsset(_Module2020).then((result) => ({
default: result
})),
vi: () => loadJsonAsset(_Module2021).then((result) => ({
default: result
})),
"zh-CN": () => loadJsonAsset(_Module2022).then((result) => ({
default: result
})),
"zh-TW": () => loadJsonAsset(_Module2023).then((result) => ({
default: result
})),
"en-US": () => loadJsonAsset(_Module2024).then((result) => ({
default: result
}))
}, "en-US");
const r51 = makeMessagesProxy(loader);
export default r51;
export { loader as messagesLoader };
@@ -0,0 +1,12 @@
// Metro module 2025 (f2026).
import { loadJsonAsset } from "../../asset_json/native/AssetJsonUtils";
import * as _Module2026 from "../../../_bundle/Module2026";
import { createLoader, makeMessagesProxy } from "../../../_bundle/Module1274";
const loader = createLoader({
"en-US": () => loadJsonAsset(_Module2026).then((result) => ({
default: result
}))
}, "en-US");
const r21 = makeMessagesProxy(loader);
export default r21;
export { loader as messagesLoader };
@@ -0,0 +1,132 @@
// Metro module 2027 (f2028).
import { loadJsonAsset } from "../../asset_json/native/AssetJsonUtils";
import * as _Module1994 from "../../../_bundle/Module1994";
import * as _Module1995 from "../../../_bundle/Module1995";
import * as _Module1996 from "../../../_bundle/Module1996";
import * as _Module1997 from "../../../_bundle/Module1997";
import * as _Module1998 from "../../../_bundle/Module1998";
import * as _Module1999 from "../../../_bundle/Module1999";
import * as _Module2000 from "../../../_bundle/Module2000";
import * as _Module2001 from "../../../_bundle/Module2001";
import * as _Module2002 from "../../../_bundle/Module2002";
import * as _Module2003 from "../../../_bundle/Module2003";
import * as _Module2004 from "../../../_bundle/Module2004";
import * as _Module2005 from "../../../_bundle/Module2005";
import * as _Module2006 from "../../../_bundle/Module2006";
import * as _Module2007 from "../../../_bundle/Module2007";
import * as _Module2008 from "../../../_bundle/Module2008";
import * as _Module2009 from "../../../_bundle/Module2009";
import * as _Module2010 from "../../../_bundle/Module2010";
import * as _Module2011 from "../../../_bundle/Module2011";
import * as _Module2012 from "../../../_bundle/Module2012";
import * as _Module2013 from "../../../_bundle/Module2013";
import * as _Module2014 from "../../../_bundle/Module2014";
import * as _Module2015 from "../../../_bundle/Module2015";
import * as _Module2016 from "../../../_bundle/Module2016";
import * as _Module2017 from "../../../_bundle/Module2017";
import * as _Module2018 from "../../../_bundle/Module2018";
import * as _Module2019 from "../../../_bundle/Module2019";
import * as _Module2020 from "../../../_bundle/Module2020";
import * as _Module2021 from "../../../_bundle/Module2021";
import * as _Module2022 from "../../../_bundle/Module2022";
import * as _Module2023 from "../../../_bundle/Module2023";
import * as _Module2028 from "../../../_bundle/Module2028";
import { createLoader, makeMessagesProxy } from "../../../_bundle/Module1274";
const loader = createLoader({
bg: () => loadJsonAsset(_Module1994).then((result) => ({
default: result
})),
cs: () => loadJsonAsset(_Module1995).then((result) => ({
default: result
})),
da: () => loadJsonAsset(_Module1996).then((result) => ({
default: result
})),
de: () => loadJsonAsset(_Module1997).then((result) => ({
default: result
})),
el: () => loadJsonAsset(_Module1998).then((result) => ({
default: result
})),
"en-GB": () => loadJsonAsset(_Module1999).then((result) => ({
default: result
})),
"es-419": () => loadJsonAsset(_Module2000).then((result) => ({
default: result
})),
"es-ES": () => loadJsonAsset(_Module2001).then((result) => ({
default: result
})),
fi: () => loadJsonAsset(_Module2002).then((result) => ({
default: result
})),
fr: () => loadJsonAsset(_Module2003).then((result) => ({
default: result
})),
hi: () => loadJsonAsset(_Module2004).then((result) => ({
default: result
})),
hr: () => loadJsonAsset(_Module2005).then((result) => ({
default: result
})),
hu: () => loadJsonAsset(_Module2006).then((result) => ({
default: result
})),
it: () => loadJsonAsset(_Module2007).then((result) => ({
default: result
})),
ja: () => loadJsonAsset(_Module2008).then((result) => ({
default: result
})),
ko: () => loadJsonAsset(_Module2009).then((result) => ({
default: result
})),
lt: () => loadJsonAsset(_Module2010).then((result) => ({
default: result
})),
nl: () => loadJsonAsset(_Module2011).then((result) => ({
default: result
})),
no: () => loadJsonAsset(_Module2012).then((result) => ({
default: result
})),
pl: () => loadJsonAsset(_Module2013).then((result) => ({
default: result
})),
"pt-BR": () => loadJsonAsset(_Module2014).then((result) => ({
default: result
})),
ro: () => loadJsonAsset(_Module2015).then((result) => ({
default: result
})),
ru: () => loadJsonAsset(_Module2016).then((result) => ({
default: result
})),
"sv-SE": () => loadJsonAsset(_Module2017).then((result) => ({
default: result
})),
th: () => loadJsonAsset(_Module2018).then((result) => ({
default: result
})),
tr: () => loadJsonAsset(_Module2019).then((result) => ({
default: result
})),
uk: () => loadJsonAsset(_Module2020).then((result) => ({
default: result
})),
vi: () => loadJsonAsset(_Module2021).then((result) => ({
default: result
})),
"zh-CN": () => loadJsonAsset(_Module2022).then((result) => ({
default: result
})),
"zh-TW": () => loadJsonAsset(_Module2023).then((result) => ({
default: result
})),
"en-US": () => loadJsonAsset(_Module2028).then((result) => ({
default: result
}))
}, "en-US");
const r51 = makeMessagesProxy(loader);
export default r51;
export { loader as messagesLoader };
@@ -0,0 +1,76 @@
// Metro module 12489 (f12490).
import { useRef, useEffect, useCallback } from "react";
import { View } from "react-native";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { LaptopSpotIllustration } from "../../../design/assets/native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl } from "../../../intl/index.native";
import GiftCard_messages from "../messages/GiftCard.messages";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
sheet: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
container: {
paddingHorizontal: Module712.space.PX_16
},
illustration: {
alignSelf: "stretch",
alignItems: "center",
paddingTop: Module712.space.PX_12
},
body: {
textAlign: "center",
fontFamily: "gg sans",
fontSize: 16,
fontWeight: 600,
lineHeight: 20,
alignSelf: "center",
width: 280
}
});
export default function GiftCardMobileConsumptionActionSheet(props) {
let callback;
const markAsDismissed = props.markAsDismissed;
callback = void 0;
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
const ref = useRef(false);
const ref2 = useRef(markAsDismissed);
useEffect(() => {
ref2.current = markAsDismissed;
}, [markAsDismissed]);
useEffect(() => () => {
if (!ref.current) {
ref2.current(ContentDismissActionType.AUTO_DISMISS);
}
}, []);
callback = useCallback((a0) => {
if (!ref.current) {
ref.current = true;
markAsDismissed(a0);
ActionSheetActionCreators.hideActionSheet();
}
}, [markAsDismissed]);
return <BottomSheet startExpanded backgroundStyles={styles.sheet} onDismiss={() => callback(ContentDismissActionType.USER_DISMISS)}>
<View style={[styles.container, {
paddingBottom: bottom
}]}>
<Stack spacing={Module712.space.PX_16}>
<View style={styles.illustration}>
<LaptopSpotIllustration scale={1} width={150} height={123} />
</View>
<Text variant="text-md/medium" color="text-default" style={styles.body}>
{intl.string(GiftCard_messages.V3DI1E)}
</Text>
<Button size="lg" variant="secondary" grow text={intl.string(GiftCard_messages.YZePWx)} onPress={() => callback(ContentDismissActionType.USER_DISMISS)} />
</Stack>
</View>
</BottomSheet>;
};
@@ -0,0 +1,328 @@
// Metro module 6218 (f6219).
import { createContext, useContext } from "react";
import OrderRecord from "../../payments/records/OrderRecord";
import ContextUtils from "../../../utils/ContextUtils";
import { shallow } from "../../../_bundle/Module3802";
import { createWithEqualityFn } from "../../../_bundle/identity_700";
import { patchOrder, createOrder } from "../../payments/native/OrderActionCreators";
import Module12 from "../../../_bundle/Module12";
import { captureBillingException } from "../../../utils/BillingUtils";
import { showCheckoutOrderErrorModal } from "./showCheckoutOrderErrorModal";
function $mk117975($env) {
return () => {
const r1 = $env;
return (0, $env.$parent[2])(r1[0], r1[1]);
};
}
function $mk117976($env) {
return () => (0, $env.$parent[4])($env[0]);
}
let env3946 = {};
const [r26, c3946_6] = ContextUtils();
const context = createContext("unset_context");
const c3946_7 = context;
export { context as NativeCheckoutStoreContextOrNull };
export function useNativeCheckoutStore(a0, r3 = shallow) {
return c3946_6()(a0, r3);
}
export function useNativeCheckoutStoreOrNull(a0, r4 = shallow) {
const context = useContext(c3946_7);
return context !== "unset_context" ? context(a0, r4) : null;
}
export function createNativeStore(a0) {
let env15592 = {
$parent: env3946
};
env15592[0] = a0.order;
env15592[1] = a0.checkoutInitParameters;
env15592[2] = a0.contextMetadata;
env15592[3] = a0.paymentGateway;
env15592[4] = a0.orderRequired;
env15592[5] = a0.onOrderRetryCancellation;
return createWithEqualityFn((a0, a1) => {
let env25750 = {
$parent: env15592
};
env25750[0] = a0;
env25750[1] = a1;
env25750[2] = function runPatchOrderLineItems() {
return env25750[3].apply(this, arguments);
};
env25750[3] = function _runPatchOrderLineItems() {
const r9 = async (orderLineItems, externalGatewayFacet) => {
const orderRecord = (0, env25750[1])().orderRecord;
if (orderRecord == null) {
throw new Error("Patch being called in a missing order state");
}
let c31953_0 = await patchOrder({
orderId: orderRecord.id,
expectedRevision: orderRecord.revision,
orderLineItems,
externalGatewayFacet
});
(0, env25750[0])({
orderRecord: OrderRecord.createFromServer(c31953_0)
});
return c31953_0;
};
env25750[3] = r9;
return r9.apply(this, arguments);
};
env25750[4] = function runRecreateOrder() {
return env25750[5].apply(this, arguments);
};
env25750[5] = function _runRecreateOrder() {
const r9 = async (c31405_0) => {
let c31405_1, c31405_2;
L18: {
let env31954;
c31405_2 = env25750;
const r30 = env31954 = {};
c31405_1 = r30;
env31954[0] = void 0;
const orderRecord = (0, env25750[1])().orderRecord;
if (orderRecord != null) {
const orderLineItems2 = orderRecord.orderLineItems.map((orderLineItem) => ({
sku_id: orderLineItem.sku_id,
quantity: orderLineItem.quantity,
purchase_type: orderLineItem.purchase_type,
subscription_plan_id: orderLineItem.subscription_plan_id
}));
const r39 = Module12.some(orderLineItems2, (a0) => a0.subscription_plan_id != null);
let subscriptionFacet = void 0;
if (r39) {
const r47 = {
subscription_preview: {
currency: c31405_0.currency,
country_code: c31405_0.country
}
};
const activeSubscription = env15592[1].activeSubscription;
subscriptionFacet = r47;
if (activeSubscription != null) {
r47.subscription_id = env15592[1].activeSubscription.id;
subscriptionFacet = r47;
}
}
env31954[0] = await createOrder({
orderLineItems: orderLineItems2,
paymentGateway: env15592[3],
isGift: env15592[1].isGift,
subscriptionFacet,
externalGatewayFacet: orderRecord.externalGatewayFacet != null ? {
line_items: orderRecord.externalGatewayFacet.line_items.map((line_item) => ({
external_product_id: line_item.external_product_id
}))
} : void 0,
countryCode: c31405_0.country
});
(0, env25750[0])({
orderRecord: OrderRecord.createFromServer(env31954[0])
});
break L18;
}
return void 0;
}
};
env25750[5] = r9;
return r9.apply(this, arguments);
};
const r6 = env15592[0];
const orderRecord = r6 != null ? OrderRecord.createFromServer(r6) : null;
env25750[7] = async (c29693_0, c29693_1) => {
let r25, r27;
let c29693_2, c29693_3, c29693_4;
let c29693_5 = 0;
const r12 = env25750;
try {
let env31406;
c29693_3 = r12;
const r33 = env31406 = {
$parent: r12
};
c29693_2 = r33;
env31406[0] = c29693_0;
env31406[1] = c29693_1;
c29693_5 = 2;
(0, env25750[0])({
isPatchOrderLoading: true
});
r25 = await (0, env25750[2])(c29693_0, c29693_1);
c29693_5 = 0;
(0, env25750[0])({
isPatchOrderLoading: false
});
} catch ($e) {
const r31 = $e;
let r7 = r31;
c29693_4 = r31;
let r32 = c29693_5;
if (r32 !== 0) {
while (true) {
if (r32 !== 1) {
try {
const r66 = c29693_4;
c29693_5 = 1;
env31406[2] = r66;
const r72 = env31406[2];
const id = (0, env25750[1])().orderRecord?.id;
const r79 = c29693_2;
captureBillingException(r72, {
tags: {
source: "NativeCheckoutStore_patchOrderLineItems"
},
extra: {
orderId: id
}
});
r27 = await showCheckoutOrderErrorModal($mk117975(r79));
c29693_5 = 0;
(0, env25750[0])({
isPatchOrderLoading: false
});
} catch (r63) {
r7 = r63;
c29693_4 = r63;
r32 = c29693_5;
if (r32 === 0) {
break;
}
continue;
}
return r27;
}
try {
const r116 = c29693_4;
c29693_5 = 0;
(0, env25750[0])({
isPatchOrderLoading: false
});
throw r116;
} catch (r114) {
r7 = r114;
c29693_4 = r114;
r32 = c29693_5;
if (r32 === 0) {
break;
}
}
}
}
throw r7;
}
return r25;
};
env25750[6] = async (c29694_0) => {
let c29694_1, c29694_2, c29694_3;
let c29694_4 = 0;
const r12 = env25750;
L10: {
try {
let env31407;
c29694_2 = r12;
const r33 = env31407 = {
$parent: r12
};
c29694_1 = r33;
env31407[0] = c29694_0;
c29694_4 = 2;
(0, env25750[0])({
isCreateOrderLoading: true
});
await (0, env25750[4])(c29694_0);
c29694_4 = 1;
c29694_4 = 0;
(0, env25750[0])({
isCreateOrderLoading: false
});
} catch ($e) {
const r31 = $e;
let r7 = r31;
c29694_3 = r31;
let r32 = c29694_4;
if (r32 !== 0) {
while (true) {
if (r32 === 1) {
try {
const r117 = c29694_3;
c29694_4 = 0;
(0, env25750[0])({
isCreateOrderLoading: false
});
throw r117;
} catch (r115) {
r7 = r115;
c29694_3 = r115;
r32 = c29694_4;
if (r32 === 0) {
break;
}
}
} else {
try {
const r66 = c29694_3;
c29694_4 = 1;
env31407[1] = r66;
const r71 = env31407[1];
const id = (0, env25750[1])().orderRecord?.id;
const r78 = c29694_1;
const r79 = c29694_2;
captureBillingException(r71, {
tags: {
source: "NativeCheckoutStore_recreateOrder"
},
extra: {
orderId: id
}
});
const r88 = r79.$parent[5];
await showCheckoutOrderErrorModal($mk117976(r78), r88);
c29694_4 = 0;
(0, env25750[0])({
isCreateOrderLoading: false
});
break L10;
} catch (r63) {
r7 = r63;
c29694_3 = r63;
r32 = c29694_4;
if (r32 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
return {
orderRecord,
setOrder: (a0) => (0, env25750[0])({
orderRecord: OrderRecord.createFromServer(a0)
}),
getCheckoutContextRecord: () => {
const orderRecord = (0, env25750[1])().orderRecord;
return orderRecord != null ? orderRecord.checkoutContextRecord : null;
},
isPatchOrderLoading: false,
patchOrderLineItems: function() {
return env25750[7].apply(this, arguments);
},
isCreateOrderLoading: false,
recreateOrder: function() {
return env25750[6].apply(this, arguments);
},
checkoutInitParameters: env15592[1],
contextMetadata: env15592[2],
orderRequired: env15592[4],
checkoutSucceeded: false,
setCheckoutSucceeded: () => (0, env25750[0])({
checkoutSucceeded: true
}),
onOrderRetryCancellation: env15592[5]
};
}, shallow);
}
export { r26 as NativeCheckoutStoreContext };
@@ -0,0 +1,27 @@
// Metro module 8809 (f8810).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { Avatar, AvatarSizes } from "../../../../design/void/native";
import { Text } from "../../../../design/components/Text/native/Text";
import UserUtils from "../../../../utils/UserUtils";
const useStyles = createStyles({
container: {
flexDirection: "row",
alignItems: "center",
marginLeft: Module712.space.PX_16
},
avatar: {
marginEnd: Module712.space.PX_8
}
});
export default function LockedRecipientField(props) {
const user = props.user;
const styles = useStyles();
return <View style={styles.container}>
<Avatar style={styles.avatar} user={user} guildId={void 0} size={AvatarSizes.NORMAL} />
<Text variant="text-md/semibold">
{UserUtils.getName(user)}
</Text>
</View>;
};
@@ -0,0 +1,80 @@
// Metro module 8810 (f8811).
import { Pressable, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { InputFieldContainer } from "../../../../design/components/Input/native/InputFieldContainer.native";
import { intl, t } from "../../../../intl/index.native";
import UserUtils from "../../../../utils/UserUtils";
import { MagnifyingGlassIcon } from "../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import { Avatar, AvatarSizes } from "../../../../design/void/native";
import { Text } from "../../../../design/components/Text/native/Text";
import { CircleXIcon } from "../../../../design/components/Icon/native/redesign/generated/CircleXIcon";
const useStyles = createStyles({
container: {
marginHorizontal: Module712.space.PX_16
},
content: {
flexDirection: "row",
overflow: "hidden",
alignItems: "center",
display: "flex"
},
opener: {
flexDirection: "row",
alignItems: "center",
flex: 1,
paddingHorizontal: Module712.space.PX_16,
paddingVertical: 6
},
openerWithClearButton: {
paddingRight: 0
},
searchIcon: {
marginRight: Module712.space.PX_8
},
userPill: {
flexDirection: "row",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.lg,
paddingVertical: 6,
paddingHorizontal: 6
},
userPillText: {
marginLeft: 6
},
clearButton: {
alignItems: "center",
justifyContent: "center",
minWidth: 44,
minHeight: 44,
paddingRight: Module712.space.PX_16,
paddingLeft: Module712.space.PX_8
}
});
export default function SelectedUserField(props) {
const { selectedUser, onPress: onPress2, setSelectedUser } = props;
const styles = useStyles();
return <View style={styles.container}>
<InputFieldContainer>
<View style={styles.content}>
<Pressable style={[styles.opener, selectedUser != null && styles.openerWithClearButton]} onPress={onPress2} accessibilityRole="button" accessibilityLabel={selectedUser != null ? `${intl.string(t.xFn72s)}, ${UserUtils.getName(selectedUser)}` : `${intl.string(t.xFn72s)}, ${intl.string(t.R0vK0N)}`}>
<MagnifyingGlassIcon style={styles.searchIcon} size="xs" color="interactive-text-default" />
{selectedUser != null ? <View style={styles.userPill}>
<Avatar user={selectedUser} guildId={void 0} size={AvatarSizes.XSMALL_20} />
<Text variant="text-md/medium" style={styles.userPillText}>
{UserUtils.getName(selectedUser)}
</Text>
</View> : <Text variant="text-sm/semibold" color="text-subtle" style={styles.userPillText}>
{intl.string(t.R0vK0N)}
</Text>}
</Pressable>
{selectedUser != null ? <Pressable style={styles.clearButton} onPress={() => setSelectedUser(void 0)} accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(t["0Vb9FQ"], {
text: UserUtils.getName(selectedUser)
})}>
<CircleXIcon size="xs" />
</Pressable> : null}
</View>
</InputFieldContainer>
</View>;
};
@@ -0,0 +1,43 @@
// Metro module 8773 (f8774).
import { useState, useCallback } from "react";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { Navigator, useNavigatorScreens } from "../../../../design/components/Navigator/native/Navigator.native";
import { UnifiedGiftModalScreens } from "./UnifiedGiftModalTypes";
import { intl, t } from "../../../../intl/index.native";
import { getHeaderCloseButton, getHeaderBackButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import UnifiedGiftModalDetailsScreen from "./UnifiedGiftModalDetailsScreen";
import UnifiedGiftModalRecipientSelectScreen from "./UnifiedGiftModalRecipientSelectScreen";
import { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
export default function UnifiedGiftModal(props) {
const { skuId: skuId2, applicationId: applicationId2, analyticsLocations, lockedRecipientUser: lockedRecipientUser2, onGiftModalDismiss: onGiftModalDismiss2, validateRecipient: validateRecipient2, renderProductDetails: renderProductDetails2, renderPurchaseSection: renderPurchaseSection2 } = props;
const skuId = skuId2;
const applicationId = applicationId2;
const lockedRecipientUser = lockedRecipientUser2;
const onGiftModalDismiss = onGiftModalDismiss2;
const validateRecipient = validateRecipient2;
const renderProductDetails = renderProductDetails2;
const renderPurchaseSection = renderPurchaseSection2;
const [state, setState] = useState(lockedRecipientUser);
const callback = useCallback(() => {
ModalActionCreators.pop();
if (onGiftModalDismiss != null) {
onGiftModalDismiss();
}
}, [onGiftModalDismiss]);
return <AnalyticsLocationProvider value={analyticsLocations}>
<Navigator initialRouteName={UnifiedGiftModalScreens.GIFT_DETAIL} screens={useNavigatorScreens(() => {
const r1 = {};
r1[UnifiedGiftModalScreens.GIFT_DETAIL] = {
title: intl.string(t["JCFN/y"]),
headerLeft: getHeaderCloseButton(callback),
render: () => <UnifiedGiftModalDetailsScreen skuId={skuId} applicationId={applicationId} recipientUser={state} setRecipientUser={setState} lockedRecipient={lockedRecipientUser != null} validateRecipient={validateRecipient} renderProductDetails={renderProductDetails} renderPurchaseSection={renderPurchaseSection} />
};
r1[UnifiedGiftModalScreens.RECIPENT_SELECT] = {
title: intl.string(t.R0vK0N),
headerLeft: getHeaderBackButton(),
render: () => <UnifiedGiftModalRecipientSelectScreen setRecipientUser={setState} />
};
return r1;
}, [lockedRecipientUser, state, skuId, applicationId, callback, validateRecipient, renderProductDetails, renderPurchaseSection])} />
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,125 @@
// Metro module 8775 (f8776).
import * as Module19 from "react";
import { useState, useCallback, useMemo, useEffect, useRef } from "react";
import { ScrollView, View } from "react-native";
import { AnalyticEvents } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { UnifiedGiftModalScreens } from "./UnifiedGiftModalTypes";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import useInitialValue from "../../../../hooks/useInitialValue";
import { v4 } from "../../../../_bundle/Module514";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { useGiftStyles } from "../../../premium/gifting/hooks/useGiftStyles";
import { GiftBackgroundSelect } from "../../../premium/native/gifting/PremiumGiftBackgroundSelect";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import LockedRecipientField from "./LockedRecipientField";
import SelectedUserField from "./SelectedUserField";
import { GiftCustomMessage } from "../../../premium/native/gifting/PremiumGiftCustomMessage";
const useStyles = createStyles({
container: {
flex: 1,
paddingTop: Module712.space.PX_12,
alignItems: "stretch"
},
scrollView: {
paddingBottom: Module712.space.PX_24
},
sectionHeader: {
marginTop: Module712.space.PX_24,
marginBottom: Module712.space.PX_8,
paddingHorizontal: Module712.space.PX_16,
textTransform: "capitalize"
}
});
const r58 = Module19.memo(function({ skuId, applicationId, recipientUser, setRecipientUser, lockedRecipient, validateRecipient, renderProductDetails, renderPurchaseSection }) {
let analyticsLocations, load_id, memo, state, ref, state2, state3;
analyticsLocations = void 0;
load_id = void 0;
memo = void 0;
state = void 0;
ref = void 0;
state2 = void 0;
state3 = void 0;
const styles = useStyles();
const navigation = useNavigation();
const [isValidRecipient, setState] = useState(true);
const [state4, setState2] = useState(false);
const callback2 = useCallback(() => {
navigation.navigate(UnifiedGiftModalScreens.RECIPENT_SELECT);
}, [navigation]);
analyticsLocations = useAnalyticsLocations().analyticsLocations;
load_id = useInitialValue(() => v4());
memo = useMemo(() => ({
is_gift: true,
location_stack: analyticsLocations,
payment_type: "sku",
sku_id: skuId,
application_id: applicationId,
load_id
}), [analyticsLocations, skuId, applicationId, load_id]);
useEffect(() => {
setState(true);
if (recipientUser != null) {
setState2(true);
validateRecipient(recipientUser.id).then((result) => {
setState(result);
}).finally(() => {
setState2(false);
});
}
}, [recipientUser, skuId, validateRecipient]);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_STARTED, memo);
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_LOADED, {
...memo,
initial_step: "gift_customization"
});
}, [memo]);
let setGiftStyle;
[state, setGiftStyle] = useState(useGiftStyles()[0]);
ref = useRef(null);
let setMessagePosition;
[state2, setMessagePosition] = useState(0);
let setCustomGiftMessage;
[state3, setCustomGiftMessage] = useState(void 0);
const callback = useCallback(() => {
setTimeout(() => {
const current = ref.current;
return current == null ? void 0 : current.scrollTo({
y: state2,
animated: true
});
}, 100);
}, [state2]);
const memo2 = useMemo(() => ({
gift_style: state,
recipient_id: recipientUser?.id,
custom_message: state3
}), [state, recipientUser, state3]);
return <View style={styles.container}>
<ScrollView ref={ref} contentContainerStyle={styles.scrollView} showsVerticalScrollIndicator={false}>
<GiftBackgroundSelect giftStyle={state} setGiftStyle={setGiftStyle} withConsistentHeight={false} />
<Text variant="text-sm/semibold" style={styles.sectionHeader}>
{intl.string(t.xFn72s)}
</Text>
{lockedRecipient && recipientUser != null ? <LockedRecipientField user={recipientUser} /> : <SelectedUserField selectedUser={recipientUser} onPress={callback2} setSelectedUser={setRecipientUser} />}
<Text variant="text-sm/semibold" style={styles.sectionHeader}>
{intl.string(t.PpoJzt)}
</Text>
{renderProductDetails({
recipientUser,
isValidRecipient
})}
<GiftCustomMessage onFocusMessage={callback} setMessagePosition={setMessagePosition} customGiftMessage={state3} setCustomGiftMessage={setCustomGiftMessage} />
</ScrollView>
{renderPurchaseSection({
isPurchaseDisabled: recipientUser == null || state4 || !isValidRecipient,
giftOptions: memo2,
baseAnalyticsFields: memo
})}
</View>;
});
export default r58;
@@ -0,0 +1,25 @@
// Metro module 8812 (f8813).
import { View } from "react-native";
import { UserRowModes } from "../../../main_tabs_v2/native/shared_components/user_list/UserRowConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import SearchableUserList from "../../../main_tabs_v2/native/shared_components/user_list/SearchableUserList";
import { UnifiedGiftModalScreens } from "./UnifiedGiftModalTypes";
const useStyles = createStyles({
container: {
flex: 1,
paddingTop: 16,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
}
});
export default function UnifiedGiftModalRecipientSelectScreen(props) {
const setRecipientUser = props.setRecipientUser;
const navigation = useNavigation();
return <View style={useStyles().container}>
<SearchableUserList onSelectUser={(event) => {
setRecipientUser(event);
navigation.navigate(UnifiedGiftModalScreens.GIFT_DETAIL);
}} rowMode={UserRowModes.NONE} disableGradient disableThemedGradient />
</View>;
};
@@ -0,0 +1,71 @@
// Metro module 11889 (f11890).
import { useCallback } from "react";
import { Image as Image2 } from "react-native";
import { UserSettingsSections } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { GIFT_STYLE_IMG } from "../../../premium/native/gifting/PremiumGiftBackgroundSelectTile";
import { GiftingBadgeExperiment } from "../../../premium/gifting/experiments/GiftingBadgeExperiment";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { openUserSettings } from "../../../user_settings/core/native/openUserSettings";
import Alert from "../../../../components_native/common/Alert";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { BaseTextButton } from "../../../../design/components/Button/native/BaseTextButton.native";
const useStyles = createStyles({
alertContainer: {
paddingHorizontal: Module712.space.PX_24,
paddingBottom: Module712.space.PX_24,
alignItems: "center"
},
image: {
position: "relative",
top: -50
},
title: {
marginTop: -Module712.space.PX_24,
marginBottom: Module712.space.PX_8
},
description: {
marginBottom: Module712.space.PX_24
}
});
export default function UnifiedGiftModalSuccessScreen(props) {
const { giftStyle, giftBadgeProgress, onClose } = props;
const styles = useStyles();
const source = GIFT_STYLE_IMG[giftStyle];
const enabled = GiftingBadgeExperiment.useConfig({
location: "UnifiedGiftModalSuccessScreen"
}).enabled;
const callback2 = useCallback(() => {
onClose();
let r9 = enabled;
if (enabled) {
r9 = giftBadgeProgress != null;
}
if (r9) {
ModalActionCreators.pushLazy(import("../../../collectibles/native/CollectiblesShopGiftBadgePostPurchaseModal"), {
giftBadgeProgress
}, "collectibles_shop_gift_badge_modal");
}
}, [enabled, giftBadgeProgress, onClose]);
const callback = useCallback(() => {
onClose();
openUserSettings({
screen: UserSettingsSections.PREMIUM_GIFTING,
params: {}
});
}, [onClose]);
return <Alert onClose={callback2} noDefaultButtons style={styles.alertContainer}>
<Image2 source={source} style={styles.image} />
<Text variant="heading-lg/bold" style={styles.title}>
{intl.string(t.MqZXbv)}
</Text>
<Text variant="text-md/medium" style={styles.description}>
{intl.format(t.YS2J4S, {
onClick: callback
})}
</Text>
<BaseTextButton onPress={callback2} text={intl.string(enabled && giftBadgeProgress != null ? t.PDTjLN : t.cpT0Cq)} textVariant="text-md/semibold" grow />
</Alert>;
};
@@ -0,0 +1,6 @@
// Metro module 8774 (f8775).
const r8 = {
GIFT_DETAIL: "GiftDetail",
RECIPENT_SELECT: "RecipientSelect"
};
export { r8 as UnifiedGiftModalScreens };
@@ -0,0 +1,81 @@
// Metro module 6224 (f6225).
import { useState } from "react";
import { AlertModal, AlertActionButton } from "../../../design/components/AlertModal/native/AlertModal.native";
import { intl, t } from "../../../intl/index.native";
import { openAlert } from "../../../design/components/AlertModal/native/useAlertStore.native";
const SyncedLoadingAlertModal = function SyncedLoadingAlertModal(props) {
const { title, content, confirmText, onConfirm, onCancel: onCancel2 } = props;
const [loading, setState] = useState(false);
return <AlertModal title={title} content={content} actions={<>
<AlertActionButton variant="primary" text={confirmText} onPress={async () => {
let c25762_2;
let c25762_3 = 0;
try {
setState(true);
c25762_3 = 1;
await onConfirm();
c25762_3 = 0;
(0, setState)(false);
} catch ($e) {
const r22 = $e;
let r7 = r22;
c25762_2 = r22;
if (c25762_3 !== 0) {
while (true) {
try {
const r54 = c25762_2;
c25762_3 = 0;
(0, setState)(false);
throw r54;
} catch (r51) {
r7 = r51;
c25762_2 = r51;
if (c25762_3 === 0) {
break;
}
}
}
}
throw r7;
}
}} loading={loading} />
<AlertActionButton variant="secondary" text={intl.string(t["ETE/oC"])} onPress={onCancel2} loading={loading} />
</>} />;
};
export function showRetryConfirmModal({ key, onCloseCallback, dismissable, ...rest }) {
openAlert(key, <SyncedLoadingAlertModal {...rest} />, onCloseCallback, {
dismissable
});
}
export function showCheckoutOrderErrorModal(c15596_0, c15596_1) {
return new Promise((c25763_0) => {
const r10 = {
key: "checkout-order-error",
title: intl.string(t.zrhHH3),
content: intl.string(t.PjfUXe),
confirmText: intl.string(t["7NqTJn"]),
onConfirm: null,
onCancel: null,
dismissable: false
};
let c25763_1 = async () => {
let c29705_1;
c29705_1 = void 0;
let c31410_0 = await c15596_0();
(0, c25763_0)(c31410_0);
};
r10.onConfirm = function() {
return c25763_1.apply(this, arguments);
};
r10.onCancel = () => {
if (c15596_1 != null) {
c15596_1();
}
c25763_0(void 0);
};
const { key, onCloseCallback, dismissable, ...rest } = r10;
openAlert(key, <SyncedLoadingAlertModal {...rest} />, onCloseCallback, {
dismissable
});
});
}
@@ -0,0 +1,275 @@
// Metro module 6665 (f6666).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useState, useRef, useEffect, useCallback } from "react";
import { View } from "react-native";
import { createNativeStore, NativeCheckoutStoreContext, NativeCheckoutStoreContextOrNull } from "../NativeCheckoutStore";
import { ItemPurchaseType } from "../../../payments/PaymentConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import useInitialValue from "../../../../hooks/useInitialValue";
import { useNativeIAPPayments } from "../../../payments/native/hooks/NativePaymentHooks.ios";
import { createOrder } from "../../../payments/native/OrderActionCreators";
import { showCheckoutOrderErrorModal } from "../showCheckoutOrderErrorModal";
import { ActivityIndicator } from "../../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
import { v4 } from "../../../../_bundle/Module514";
import SentryUtils_native from "../../../../utils/SentryUtils.native";
import { discardDraftOrder } from "../../utils/OrderUtils.native";
function $mk118013($env) {
return () => (0, $env.$parent[14])($env[0]);
}
function $mk118014($env) {
return () => {
const r2 = $env;
(0, r2[10])(false);
(0, r2[6])();
};
}
let useStyles;
let env4267 = {};
const NativeCheckoutStoreProvider = function NativeCheckoutStoreProvider(props) {
let state, ref;
const { checkoutInitParameters, order, paymentGateway, orderRequired, onOrderRetryCancellation, children } = props;
state = void 0;
ref = void 0;
const contextMetadata = useInitialValue(() => {
let loadId = order?.id;
if (loadId == null) {
loadId = v4();
}
SentryUtils_native.addBreadcrumb({
message: `Checkout session ID: ${loadId}`
});
return {
loadId,
startTime: Date.now()
};
});
state = _slicedToArray(useState(() => (0, createNativeStore)({
order,
checkoutInitParameters,
contextMetadata,
paymentGateway,
orderRequired,
onOrderRetryCancellation
})), 1)[0];
ref = useRef(order != null);
useEffect(() => {
if (!(ref.current || order == null)) {
state.getState().setOrder(order);
ref.current = true;
}
}, [order, state]);
useEffect(() => () => {
const state2 = state.getState();
const { orderRecord, checkoutSucceeded } = state2;
if (orderRecord != null) {
discardDraftOrder({
checkoutSucceeded,
order: {
id: orderRecord.id,
status: orderRecord.status
}
});
}
}, [state]);
return <NativeCheckoutStoreContext value={state}>
<NativeCheckoutStoreContextOrNull.Provider value={state}>{children}</NativeCheckoutStoreContextOrNull.Provider>
</NativeCheckoutStoreContext>;
};
useStyles = createStyles({
loadingSpinnerContainer: {
display: "flex",
alignItems: "center",
justifyContent: "center",
height: "100%"
}
});
export default function NativeCheckoutStoreProviderWrapper(props) {
let env15826 = {
$parent: env4267
};
const orderRequired2 = props.orderRequired;
env15826[0] = orderRequired2;
const { skuIds, paymentGateway: paymentGateway2 } = props;
env15826[1] = paymentGateway2;
const isGift = props.isGift;
env15826[2] = isGift;
const onOrderCreated = props.onOrderCreated;
env15826[3] = onOrderCreated;
const activeSubscription = props.activeSubscription;
env15826[4] = activeSubscription;
const { children, defaultPlans } = props;
env15826[5] = defaultPlans;
const onOrderRetryCancellation2 = props.onOrderRetryCancellation;
env15826[6] = onOrderRetryCancellation2;
const initialSubscriptionFacet = props.initialSubscriptionFacet;
env15826[7] = initialSubscriptionFacet;
const initialExternalGatewayFacet = props.initialExternalGatewayFacet;
env15826[8] = initialExternalGatewayFacet;
env15826[9] = void 0;
env15826[10] = void 0;
env15826[11] = void 0;
env15826[12] = void 0;
env15826[13] = void 0;
env15826[14] = void 0;
env15826[15] = void 0;
const styles = useStyles();
const r32 = _slicedToArray(useState(null), 2);
const order2 = r32[0];
env15826[9] = r32[1];
const r36 = _slicedToArray(useState(orderRequired2), 2);
const r37 = r36[0];
env15826[10] = r36[1];
env15826[11] = useRef(false);
const initialValue = useInitialValue(skuIds.length > 0 ? skuIds[0] : null);
env15826[12] = initialValue;
if (initialValue == null && defaultPlans == null && orderRequired2) {
throw Error("SkuIDs needs to a specified!");
}
let c15828_0;
const storeFront = useNativeIAPPayments().storeFront;
env15826[13] = storeFront;
let c15827_0 = async (c29807_0) => {
let c29807_2;
c29807_2 = void 0;
let c31430_0 = c29807_0.orderLineItems;
let c31430_1 = c29807_0.subscriptionFacet;
await void 0;
const r12 = c29807_2;
let countryCode = void 0;
const r50 = r12.$parent;
const r55 = r50[13];
if (r55 != null) {
countryCode = r55.country;
}
const order2 = await createOrder({
orderLineItems: c31430_0,
paymentGateway: r50[1],
isGift: r50[2],
subscriptionFacet: c31430_1,
externalGatewayFacet: r50[8],
countryCode
});
const r73 = c29807_2;
let c31430_2 = order2;
const r74 = r73.$parent;
(0, r74[9])(c31430_2);
if (r74[3] != null) {
(0, c29807_2.$parent[3])(c31430_2);
}
(0, c29807_2.$parent[10])(false);
};
const callback = useCallback(function() {
return c15827_0.apply(this, arguments);
}, [paymentGateway2, onOrderCreated, isGift, storeFront, initialExternalGatewayFacet]);
env15826[14] = callback;
c15828_0 = void 0;
c15828_0 = async (c29808_0) => {
let c29808_1, c29808_2;
let c29808_3 = 0;
const r11 = void 0;
const r10 = env15826;
L10: {
try {
let env31431;
c29808_2 = r11;
const r24 = env31431 = {
$parent: r10
};
c29808_1 = r24;
env31431[0] = c29808_0;
c29808_3 = 1;
await (0, env15826[14])(c29808_0);
c29808_3 = 0;
} catch ($e) {
let r23 = $e;
if (c29808_3 !== 0) {
while (true) {
try {
const r49 = c29808_1;
c29808_3 = 0;
const r56 = $mk118014(env15826);
showCheckoutOrderErrorModal($mk118013(r49), r56);
break L10;
} catch ($e) {
r23 = $e;
if (c29808_3 === 0) {
break;
}
}
}
}
throw r23;
}
}
};
const callback2 = useCallback(function() {
return c15828_0.apply(this, arguments);
}, [callback, onOrderRetryCancellation2]);
env15826[15] = callback2;
useEffect(() => {
let subscriptionFacet;
L15: {
const r5 = env15826[11];
if (!r5.current) {
const r10 = env15826[13];
if (r10 != null && env15826[0]) {
const sku_id = env15826[12];
if (sku_id == null && env15826[5] == null) {
break L15;
}
const orderLineItems = [];
const r12 = env15826[5];
if (r12 != null) {
orderLineItems.push.apply(orderLineItems, [...r12.map((item) => ({
sku_id: item.skuId,
subscription_plan_id: item.subscriptionPlanId,
quantity: item.quantity,
purchase_type: ItemPurchaseType.SUBSCRIPTION
}))]);
const r35 = {
subscription_preview: {
currency: r10.currency,
country_code: r10.country
}
};
const r36 = env15826[4];
if (r36 != null) {
r35.subscription_id = r36.id;
}
const r38 = env15826[7];
const r1 = r38 != null && r38.subscription_preview.subscription_trial_id != null;
subscriptionFacet = r35;
if (r1) {
r35.subscription_preview.subscription_trial_id = r38.subscription_preview.subscription_trial_id;
subscriptionFacet = r35;
}
} else {
const r3 = sku_id != null;
subscriptionFacet = void 0;
if (r3) {
orderLineItems.push({
sku_id,
quantity: 1,
purchase_type: ItemPurchaseType.ONE_TIME
});
subscriptionFacet = void 0;
}
}
r5.current = true;
(0, env15826[15])({
orderLineItems,
subscriptionFacet
});
}
}
}
}, [initialValue, orderRequired2, callback2, defaultPlans, storeFront, activeSubscription, initialSubscriptionFacet]);
return r37 ? <View style={styles.loadingSpinnerContainer}>
<ActivityIndicator animating size="large" />
</View> : <NativeCheckoutStoreProvider checkoutInitParameters={{
skuIds,
isGift,
activeSubscription,
referralTrialOfferId: null
}} order={order2} paymentGateway={paymentGateway2} onOrderRetryCancellation={onOrderRetryCancellation2} orderRequired={orderRequired2}>{children}</NativeCheckoutStoreProvider>;
};
@@ -0,0 +1,103 @@
// Metro module 12486 (f12487).
import { useMemo, useRef, useEffect, useCallback } from "react";
import WalletBalanceStore from "../../billing/stores/WalletBalanceStore";
import PaymentSourceStore from "../../../stores/billing/PaymentSourceStore";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import { PaymentSourceTypes } from "../../../_bundle/Module505";
import { useGiftCardsExperimentConfig } from "../../billing/experiments/GiftCardsExperiment";
import { useStateFromStores } from "../../../_bundle/Module589";
import { DismissibleContent } from "../../../_bundle/Module1358";
import { useSelectedDismissibleContent } from "../../dismissible_content/hooks/useSelectedDismissibleContent";
import { fetchPaymentSources, fetchWalletInformation } from "../../billing/actions/BillingActionCreators";
import Dispatcher from "../../../Dispatcher";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
let c8628_9 = "GiftCardMobileConsumptionActionSheet";
let c8628_10 = {
Idle: "idle",
Opening: "opening",
Opened: "opened"
};
let Idle = c8628_10.Idle;
export function useGiftCardMobileConsumptionHalfsheet() {
let c19863_2, c19863_3, ref, callback;
const enabled = useGiftCardsExperimentConfig({
location: "useGiftCardMobileConsumptionHalfsheet"
}).enabled;
const stateFromStores = useStateFromStores([PaymentSourceStore], () => {
if (!enabled) {
return null;
}
for (const item of Object.values(PaymentSourceStore.paymentSources)) {
if (item.type !== PaymentSourceTypes.TDS_WALLET) {
continue;
}
return item.id;
}
return null;
}, [enabled]);
const stateFromStores2 = useStateFromStores([WalletBalanceStore], () => stateFromStores != null ? WalletBalanceStore.getBalance(stateFromStores) : null, [stateFromStores]);
const stateFromStores3 = useStateFromStores([WalletBalanceStore], () => stateFromStores != null && WalletBalanceStore.getIsFetching(stateFromStores), [stateFromStores]);
const r36 = (enabled ? stateFromStores != null : enabled) && !stateFromStores3 && stateFromStores2 != null && stateFromStores2.amount > 0;
c19863_2 = r36;
let [r52, current] = useSelectedDismissibleContent(useMemo(() => c19863_2 ? [DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET] : [], [r36]), void 0, true);
c19863_3 = r52;
ref = useRef(current);
useEffect(() => {
ref.current = current;
}, [current]);
callback = useCallback((a0) => {
ref.current(a0);
}, []);
useEffect(() => {
if (enabled) {
fetchPaymentSources();
}
}, [enabled]);
useEffect(() => {
if (stateFromStores != null) {
fetchWalletInformation(stateFromStores);
}
}, [stateFromStores]);
useEffect(() => {
let c27295_0;
const handleShow2 = function handleShow(a0) {
if (!(c27295_0 || a0.key !== c8628_9)) {
Idle = c8628_10.Opened;
}
};
if (c19863_3 === DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET && Idle === c8628_10.Idle) {
Idle = c8628_10.Opening;
c27295_0 = false;
Dispatcher.subscribe("SHOW_ACTION_SHEET", handleShow2);
const r32 = import("./GiftCardMobileConsumptionActionSheet");
r32.catch(() => {
if (!(c27295_0 || Idle !== c8628_10.Opening)) {
Idle = c8628_10.Idle;
}
});
ActionSheetActionCreators.openLazy(r32, c8628_9, {
markAsDismissed: callback
}, "stack");
return () => {
c27295_0 = true;
Dispatcher.unsubscribe("SHOW_ACTION_SHEET", handleShow2);
if (Idle === c8628_10.Opening) {
Idle = c8628_10.Idle;
}
};
}
}, [r52, callback]);
useEffect(() => {
const handleHide2 = function handleHide(a0) {
if (a0.key === c8628_9) {
ref.current(ContentDismissActionType.USER_DISMISS);
}
};
if (c19863_3 === DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
Dispatcher.subscribe("HIDE_ACTION_SHEET", handleHide2);
return () => {
Dispatcher.unsubscribe("HIDE_ACTION_SHEET", handleHide2);
};
}
}, [r52]);
}
@@ -0,0 +1,127 @@
// Metro module 9769 (f9770).
import { useRef, useState, useCallback, useEffect, useMemo } from "react";
import Logger from "../../debug/Logger";
import { updateOrder } from "../../payments/native/OrderActionCreators";
import { captureBillingException } from "../../../utils/BillingUtils";
let c6476_4 = new Logger("useSyncGiftOptionsToOrder");
export default function useSyncGiftOptionsToOrder(a0, a1) {
let callback2;
let c17473_0 = a0;
const current = a1;
const ref = useRef(null);
const ref2 = useRef(null);
const ref3 = useRef(false);
const ref4 = useRef(void 0);
const ref5 = useRef(null);
const ref6 = useRef(0);
const ref7 = useRef(null);
const ref8 = useRef(null);
const ref9 = useRef([]);
const [state, setState] = useState(0);
const callback = useCallback((a0) => {
const current2 = ref9.current;
ref9.current = [];
for (const item of current2) {
item(a0);
}
}, []);
useEffect(() => () => {
if (ref8.current != null) {
clearTimeout(ref8.current);
}
callback(false);
}, [callback]);
useEffect(() => {
if (c17473_0 != null) {
const id = c17473_0.id;
ref2.current = current;
if (ref5.current !== id) {
ref5.current = id;
ref4.current = c17473_0.revision;
ref.current = null;
ref6.current = 0;
}
if (ref7.current !== current) {
ref6.current = 0;
}
if (!ref3.current) {
if (ref.current !== current) {
if (ref8.current != null) {
clearTimeout(ref8.current);
ref8.current = null;
}
ref3.current = true;
ref7.current = current;
updateOrder({
orderId: id,
giftInfo: {
recipient_id: current.recipient_id,
gift_style: current.gift_style,
emoji_id: current.emoji_id,
emoji_name: current.emoji_name,
sound_id: current.sound_id,
reward_sku_ids: current.reward_sku_ids,
custom_message_contents: current.custom_message
},
expectedRevision: ref4.current
}).then((result) => {
ref4.current = result;
ref.current = current;
ref6.current = 0;
}).catch((a0) => {
ref6.current = ref6.current + 1;
c6476_4.error("Failed to sync gift customization to order", {
error: a0,
orderId: id
});
captureBillingException(a0, {
tags: {
source: "useSyncGiftOptionsToOrder"
},
extra: {
orderId: id
}
});
}).finally(() => {
ref3.current = false;
if (ref.current !== ref2.current) {
if (ref6.current === 0) {
setState((prevState) => prevState + 1);
} else if (ref6.current < 3) {
ref8.current = setTimeout(() => setState((prevState) => prevState + 1), 500 * 2 ** (ref6.current - 1));
} else {
callback(false);
}
} else {
callback(true);
}
});
} else {
callback(true);
}
}
} else {
callback(true);
}
}, [a0, a1, state, callback]);
callback2 = useCallback(() => {
let r17;
if (c17473_0 != null && ref.current !== ref2.current) {
if (ref6.current >= 3) {
ref6.current = 0;
}
r17 = new Promise((resolve) => {
ref9.current.push(resolve);
if (!(ref3.current || ref8.current != null)) {
setState((prevState) => prevState + 1);
}
});
} else {
r17 = Promise.resolve(true);
}
return r17;
}, [a0]);
return useMemo(() => ({
awaitSync: callback2
}), [callback2]);
};
@@ -0,0 +1,39 @@
// Metro module 6672 (f6673).
import { OrderStatus } from "../../payments/PaymentConstants";
import { discardOrder } from "../../payments/native/OrderActionCreators";
export async function discardDraftOrder(c25946_0) {
let c25946_4 = 0;
let c29811_0, c29811_1;
L17: {
try {
c29811_0 = void 0;
c29811_1 = void 0;
c29811_0 = c25946_0.checkoutSucceeded;
c29811_1 = c25946_0.order;
await void 0;
if (!c29811_0) {
if (c29811_1?.id != null && c29811_1.status === OrderStatus.DRAFT) {
c25946_4 = 1;
await discardOrder(c29811_1.id);
c25946_4 = 0;
}
}
} catch ($e) {
let r8 = $e;
if (c25946_4 !== 0) {
while (true) {
try {
c25946_4 = 0;
break L17;
} catch ($e) {
r8 = $e;
if (c25946_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
}