// Metro module 3850 (f3851). import { PaymentGateways } from "../_bundle/Module505"; import { collectDeviceData } from "./BraintreeUtils"; import SentryUtils_native from "./SentryUtils.native"; import { HTTPResponseError } from "../_bundle/sendRequest"; import BillingError from "../errors/BillingError"; export function getLocalizedDisplayMonth(a0, a1) { const date = new Date(); date.setMonth(a0 - 1); return date.toLocaleString(a1, { month: "short" }); } export async function createGatewayCheckoutContext(c24739_0) { let r24, r53; let c29051_1, c29051_0; L15: { L14: { c29051_1 = void 0; c29051_0 = null; if (c24739_0 != null && c24739_0.paymentGateway === PaymentGateways.BRAINTREE) { c29051_1 = await collectDeviceData(); if (c29051_1 != null) { c29051_0 = { braintree_device_data: c29051_1 }; } r53 = c29051_0; break L14; } r24 = c29051_0; break L15; } return r53; } return r24; } export function captureBillingException(a0, a1) { SentryUtils_native.captureException(a0, { ...a1, tags: { ...a1?.tags, app_context: "billing" } }); } export function isExpectedHttpClientError(a0) { return a0 instanceof HTTPResponseError && a0.status >= 400 && a0.status < 500 || a0 instanceof BillingError && a0.status != null && a0.status >= 400 && a0.status < 500; } export function captureBillingMessage(a0, a1) { SentryUtils_native.captureMessage(a0, { ...a1, tags: { ...a1?.tags, app_context: "billing" } }); } export function calculateStandardizedUnits(a0, a1) { let r1 = a0 === "P1M"; if ((r1 ? a1 === "P1Y" : r1) === true) { return 12; } if ((r1 ? a1 === "P6M" : r1) === true) { return 6; } if (r1) { r1 = a1 === "P3M"; } if (r1 === true) { return 3; } let r13 = a0 === "P3M"; if ((r13 ? a1 === "P1Y" : r13) === true) { return 4; } if (r13) { r13 = a1 === "P6M"; } if (r13 !== true && (a0 === "P6M" && a1 === "P1Y") !== true) { return 1; } return 2; }