// Module ID: 4233 // Function ID: 4234 // Name: _createGatewayCheckoutContext // Dependencies: [5, 1085, 4234, 1232, 1272, 4240, 2] // Exports: calculateStandardizedUnits, captureBillingException, captureBillingMessage, createGatewayCheckoutContext, getLocalizedDisplayMonth, isExpectedHttpClientError // Module 4233 (_createGatewayCheckoutContext) import _modDef1232 from "module_1232" /* 1232 */; import sendRequest from "sendRequest" /* 1272 */; import setDefault from "set" /* 4240 */; import closure_3 from "asyncGeneratorStep" /* 5 */; import { PaymentGateways } from "sum" /* 1085 */; require = arg1; function _createGatewayCheckoutContext() { const self = this; const tmp = callback((arg0) => { closure_0 = arg0; c2 = 0; c3 = 0; return (function*(arg0) { if (c3 === 2) { c3 = 3; HermesBuiltin.throwTypeError(); } else if (tmp4 === 3) { if (arg0 === 1) { throw arg1; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { return { value: "HermesInternal", done: null }; } } else { try { c3 = 2; if (0 === table) { if (arg0 === 1) { c3 = 3; throw arg1; } else if (arg0 === 2) { c3 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { closure_1 = tmp2; closure_1 = undefined; let obj2 = null; if (null != obj2) { if (obj2.paymentGateway === closure_1_4.BRAINTREE) { obj1 = callback(table[2]); table = 1; c3 = 1; obj1 = { value: null, done: false }; obj1[0] = obj1.collectDeviceData(); return obj1; } } c3 = 3; } } else if (arg0 === 1) { c3 = 3; throw arg1; } else if (arg0 !== 2) { closure_1 = arg1; if (null != closure_1) { obj2 = { braintree_device_data: null }; obj2[0] = closure_1; } } c3 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } catch (tmp14) { c3 = tmp; throw tmp14; } } })(); }); closure_5 = tmp; const apply = tmp.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } const result = require("set").fileFinishedImporting("utils/BillingUtils.tsx"); export const getLocalizedDisplayMonth = function getLocalizedDisplayMonth(arg0, arg1) { const date = new Date(); date.setMonth(arg0 - 1); return date.toLocaleString(arg1, { month: "short" }); }; export const createGatewayCheckoutContext = function createGatewayCheckoutContext(paymentSource) { const self = this; const apply = _createGatewayCheckoutContext.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }; export const captureBillingException = function captureBillingException(error, tags) { let obj = _modDef1232; obj = {}; const merged = Object.assign(tags); tags = undefined; if (tags != null) { tags = tags.tags; } obj = {}; const merged1 = Object.assign(tags); obj.app_context = "billing"; obj.tags = obj; obj.captureException(error, obj); }; export const isExpectedHttpClientError = function isExpectedHttpClientError(status) { let tmp2 = status instanceof sendRequest.HTTPResponseError; if (tmp2) { tmp2 = status.status >= 400; } if (tmp2) { tmp2 = status.status < 500; } if (!tmp2) { let tmp4 = status instanceof setDefault; if (tmp4) { tmp4 = null != status.status; } if (tmp4) { tmp4 = status.status >= 400; } if (tmp4) { tmp4 = status.status < 500; } tmp2 = tmp4; } return tmp2; }; export const captureBillingMessage = function captureBillingMessage(arg0, tags) { let obj = _modDef1232; obj = {}; const merged = Object.assign(tags); tags = undefined; if (tags != null) { tags = tags.tags; } obj = {}; const merged1 = Object.assign(tags); obj.app_context = "billing"; obj.tags = obj; obj.captureMessage(arg0, obj); }; export function calculateStandardizedUnits(billingPeriod, billingPeriod2) { let tmp = "P1M" === billingPeriod; let tmp2 = tmp; if (tmp) { tmp2 = "P1Y" === billingPeriod2; } if (tmp2 === true) { return 12; } else { let tmp3 = tmp; if (tmp) { tmp3 = "P6M" === billingPeriod2; } if (tmp3 === true) { return 6; } else { if (tmp) { tmp = "P3M" === billingPeriod2; } if (tmp === true) { return 3; } else { let tmp4 = "P3M" === billingPeriod; let tmp5 = tmp4; if (tmp4) { tmp5 = "P1Y" === billingPeriod2; } if (tmp5 === true) { return 4; } else { if (tmp4) { tmp4 = "P6M" === billingPeriod2; } if (tmp4 !== true) { let tmp6 = "P6M" === billingPeriod; if (tmp6) { tmp6 = "P1Y" === billingPeriod2; } if (tmp6 !== true) { return 1; } } return 2; } } } } }