Files
discord-decomp/modules/checkout/native/showCheckoutOrderErrorModal.tsx
T
2026-11-01 12:12:55 +02:00

82 lines
2.5 KiB
TypeScript

// 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
});
});
}