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

30 lines
1.2 KiB
TypeScript

// Metro module 6254 (f6255).
import { BillingError } from "../../../errors/index";
import { ErrorCodes } from "../../../errors/BillingError";
import { getActiveLinkUserIds } from "../hooks/useUserLinks";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
import { popLayer } from "../../../actions/LayerActionCreators";
import ChannelActionCreators from "../../../actions/ChannelActionCreators";
export function isSpendingLimitError(a0) {
return a0 instanceof BillingError && (a0.code === ErrorCodes.BILLING_SPENDING_LIMIT_REACHED || a0.code === ErrorCodes.BILLING_SPENDING_LIMIT_WILL_EXCEED);
}
export function showSpendingLimitReachedAlert() {
const activeLinkUserIds = getActiveLinkUserIds();
AlertActionCreators.show({
title: intl.string(t.QJKKrT),
body: intl.string(t["73Islf"]),
isDismissable: true,
...activeLinkUserIds.length > 0 ? {
confirmText: intl.string(t.GF9RCX),
onConfirm: () => {
popLayer();
ChannelActionCreators.openPrivateChannel({
recipientIds: activeLinkUserIds
});
},
cancelText: intl.string(t.L5eIZ2)
} : {}
});
}