{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/@babel/runtime/regenerator/index.js","webpack:///./node_modules/cpf-cnpj-validator/dist/cpf-cnpj-validator.es.js","webpack:///./app/javascript/packs/helper_functions.js","webpack:///./app/javascript/packs/formatters.js","webpack:///./app/javascript/packs/utils/correlation_id_store.js","webpack:///./app/javascript/packs/utils/ignored_form_key_codes.js","webpack:///./app/javascript/packs/gtm_script.js","webpack:///./app/javascript/packs/utils/encrypt.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///./app/javascript/packs/utils/recaptcha_wrapper.js","webpack:///./app/javascript/packs/coupon_form_factory.js","webpack:///./app/javascript/packs/coupon_service.js","webpack:///./app/javascript/packs/debounced.js","webpack:///./app/javascript/packs/webhook_service.js","webpack:///./app/javascript/packs/utils/vanish_element.js","webpack:///./app/javascript/packs/utils/form/payment/payment_form.js","webpack:///./app/javascript/packs/utils/get_descriptive_time.js","webpack:///./app/javascript/packs/utils/form/payment/cc_number.js","webpack:///./app/javascript/packs/utils/form/payment/cc_expiration_date.js","webpack:///./app/javascript/packs/utils/form/payment/cc_cvv.js","webpack:///./app/javascript/packs/utils/form/payment/cc_form.js","webpack:///./app/javascript/packs/payments/malga/pix.js","webpack:///./app/javascript/packs/payments/malga/nupay.js","webpack:///./app/javascript/packs/utils/form/client/client_form.js","webpack:///./app/javascript/packs/utils/form/product/product_form.js","webpack:///./app/javascript/packs/payments/malga/mpm_tabs.js","webpack:///./app/javascript/packs/client_payments_malga.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","BLACKLIST","STRICT_STRIP_REGEX","LOOSE_STRIP_REGEX","verifierDigit","digits","numbers","split","map","number","parseInt","modulus","length","mod","index","reduce","buffer","strip","strict","regex","replace","cpf","stripped","includes","substr","BLACKLIST$1","STRICT_STRIP_REGEX$1","LOOSE_STRIP_REGEX$1","verifierDigit$1","concat","strip$1","cnpj","isPJ","trim","toUpperCase","doesNotHaveValue","input","setElementHiddenClass","el","isHidden","classList","toggle","disableSubmitButtonElement","button","isInvalid","disabled","disableInputField","isDisabled","clearValue","style","disableRequiredInputField","isDisabledAndNotRequired","clear","required","checkoutCustomerFormHelpers","elements","alertMessageDocumentElement","documentLabelElement","formDocumentElement","formPhoneNumberElement","formClientType","isForeignerElement","submitButtonElement","whatsappAcceptElement","whatsappLabelElement","toggleDocumentErrorMessage","isEmpty","emptyErrorMessage","querySelector","invalidErrorMessage","pjMode","helpers","cpfCnpjValidator","checked","docNum","isFilled","filter","digit","test","isValid","valid","disableCpfCnpjFields","state","optionalLabel","contains","undefined","phoneNumberChangeHandler","num","addEventListener","e","target","parseFetchResponse","response","json","then","data","status","body","objectToInlineCss","obj","entries","join","querySelectorOrFail","query","document","Error","blurOnEnterKeyupHandler","event","blur","activeElement","forceBlurOnEventHandler","formatterCurrency","Intl","NumberFormat","currency","getFormattedCurrencyValueFromEl","element","format","getValueWithoutFormat","getLowerCaseInputValue","toString","toLowerCase","correlationId","corrHeaderKey","getCorrId","setCorrId","addCorrId","headers","Headers","set","loadCorrId","has","tapAndLoadCorrId","ignoredFormKeyCodes","CHECKOUT_STEP","freeze","begin_checkout","add_payment_info","purchase","PAYMENT_TYPE","card","pix","nupay","GtmFactory","dataLayer","window","sendDataLayer","eventType","payload","push","ecommerce","buildPayload","paymentType","a","fullName","phone","getPhone","email","totalAmount","item_id","productId","item_name","productName","coupon","discount","price","quantity","convert","items","hashed_full_name","hashed_email","hashed_phone","transactionId","transaction_id","sendEvent","productData","sendBeginCheckout","this","registerCheckoutOptionEvent","paymentMethod","formsValues","eventData","registerPurchaseEvent","purchaseData","encoder","TextEncoder","dataBuffer","encode","crypto","subtle","digest","hashBuffer","hashArray","Array","from","Uint8Array","hashHex","byte","padStart","runtime","Op","hasOwn","$Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","define","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","context","Context","_invoke","GenStateSuspendedStart","method","arg","GenStateExecuting","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","done","GenStateSuspendedYield","makeInvokeMethod","fn","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","invoke","resolve","reject","result","__await","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","displayName","isGeneratorFunction","genFun","ctor","constructor","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","globalThis","Function","useRecaptcha","action","grecaptcha","ready","execute","PM3","GRCSK","createCouponErrorSpan","errorMessage","className","couponErrorMessageSpan","createElement","color","textContent","couponFormFactory","params","errorMessageOptions","URLSearchParams","location","search","removeCouponFromUrlHandler","currentUrl","URL","href","searchParams","assign","clearCouponButton","Rollbar","url","fixedCoupon","couponInput","discountAmountSpan","errorSpanContainer","formAmountHiddenInput","paymentTotalSpan","submitCouponButton","emailInput","submitFormButton","couponChangeEventListeners","currentlyActiveCoupon","validEmail","couponErrorSpan","addCouponChangeListener","listener","some","registeredListener","removeCouponChangeListener","pushCouponChangeToListeners","couponData","console","couponInputClickHandler","removeErrorSpan","parentElement","removeChild","appendErrorSpan","appendChild","fetchCoupon","amount","CouponService","getCoupon","formattedDiscountedAmount","discountedAmount","formattedDiscount","discountAmount","formattedPixDiscountedAmount","pixDiscountedAmount","formattedPixAmount","pixAmount","couponInputBlurHandler","preventDefault","couponName","lowercasedEmailValue","removeCouponHandler","fetchUrlParams","product_id","fetch","couponResponse","ok","statusText","discount_amount","new_amount","amountOff","amount_off","percentOff","percent_off","pix_amount","pix_discount_amount","debounced","fnToCall","timeout","timeoutRef","args","setTimeout","clearTimeout","webhook","sendPost","JSON","stringify","text","vanishElement","hidden","setupPaymentForm","clientForm","productForm","submitButton","formCouponIdHiddenInput","getElementById","formAmountOffHiddenInput","formPercentOffHiddenInput","formDiscountAmountHiddenInput","formTotalAmountHiddenInput","formCountInstallmentsHiddenInput","formFixedInstallmentHiddenInput","coupon_accepted","inputs","couponElements","couponForm","getId","updateInstallments","fixedInstallments","numericValue","Number","formattedInstallmentValue","showInstallmentsSpan","innerText","installmentsOptionsElements","item","couponChangeHandler","rawOriginalAmount","originalAmount","getPaymentInfoHelpers","from_cents","factor","productUnitAmountHiddenInput","getUnitAmount","getDiscountAmount","percentDiscount","getTotalAmount","getDescriptiveTime","secondsTime","hideSeconds","ONE_MIN","ONE_HOUR","ONE_DAY","seconds","minutesTime","minutes","hoursTime","hours","daysTime","days","numFormat","minimumFractionDigits","maximumFractionDigits","descriptiveParts","unit","Math","floor","one","multiple","splice","descriptive","FORMATTED_CC_NUM_LENGTH","CC_NUM_LENGTH","CC_NUM_BLOCK_SIZE","CC_NUM_SPACE_POSITION_FACTOR","NUM_KEYS","fill","_","ALLOWED_KEYS_NUMERIC","creditCardNumberInputPartialValidator","creditCardNumberInputValidator","isCursorMovementKey","isInSpaceChar","creditCardNumberExtractor","char","creditCardNumberFormatter","arr","handleCCInputEmptySpace","selectionStart","selectionEnd","idx","lastIndexOf","ccNumKeydownHandler","stopPropagation","metaKey","altKey","ctrlKey","active","keyCode","slicedValue","setSelectionRange","ccNumKeyupHandler","updatedTarget","updatedValue","shouldJumpToNextField","isFieldOverflowing","sizeDiff","caretPositionDiff","nextElementSibling","focus","ccNumPasteHandler","pasteData","clipboardData","getData","setupCreditCardNumberInput","inputElement","setAttribute","proxyHandler","prop","_receiver","Reflect","arguments","Proxy","replaceStringDate","ccEDExtractor","month","year","Date","getFullYear","toFixed","ccEDFormatter","CC_ED_M_MAX_LENGTH","strMonth","ccEDValidator","currentYear","currentYearHundreds","fullYear","numMonth","getMonth","ccEDKeydownHandler","ccEDKeyupHandler","shouldFocusNext","ccEDPasteHandler","setupCCExpirationDateInput","numericOnlyFilter","filterNonNumericCharacters","CVVFilter","setupCCCVVInput","setupCreditCardForm","options","creditCardNumberInput","numberInput","numberQuerySelector","expirationDateInput","expirationInput","expirationQuerySelector","cvvInput","cvvQuerySelector","creditCardNumber","expirationDate","cvv","initPix","cancelPixPaymentValidationLoop","timeLeftUpdateLoop","copiedMessageTimeoutRef","showPaymentError","setLoading","PIX_STATUS_POLLING_TIME_LIMIT","PIX_STATUS_POLLING_INTERVAL","PIX_EXPIRATION_UPDATE_INTERVAL","fetchTransactionStatus","clientInstantPaymentId","signal","closeQrCodeDialog","dialog","open","close","amountHeader","img","copyCta","expirationInfoSpan","src","dataset","qrCode","navigator","clipboard","writeText","label","previousText","expirationDateTimeFormatter","DateTimeFormat","day","hour","minute","second","showQrCodeDialog","imgSrc","dataContents","expiresIn","expirationTimestamp","now","updateExpirationTime","timeLeftInMs","expiration","expirationUpdateInterval","setInterval","clearInterval","showModal","resolveAsPending","expirationTime","timeoutId","controller","AbortController","promise","expirationDelta","timeoutLimit","executeRequest","expired","cancel","failed","abort","pollTransactionConfirmation","setupPixPayment","bumpForm","formElements","formHelpers","baseSetLoading","gtm","setPaymentMethodSubmitHandler","onSuccess","onPending","onError","metadata","submitButtonLabel","loading","loadingIndicator","pixTotalAmountSpans","querySelectorAll","totalAmountOperators","updateTotalAmount","baseCents","getProductInfo","formatted","cents","span","unshift","enabled","bumpState","addChangeListener","createOTOPixPayment","authenticity_token","grToken","gr_token","provider","payment_method","trace","createClientInstantPayment","clientInfo","paymentInfo","getAmountAndCouponInformation","client_payment","installments_count","payment_type","order_bump_active","coupons","is_pj","is_foreigner","phone_number","whatsapp_accept","coupon_id","coupon_amount_off","counpon_percent_off","subtotal_amount","total_amount","createPixCharge","authenticityTokenElement","getFormData","chargeStrategy","clientInstantPaymentResponse","id","product_name","qrCodeData","qrCodeImageUrl","pixStatusUpdate","stripe_payment_intent","updateClientInstantPaymentResponse","paymentValues","_event","clientType","isClientPj","stateRegistrationInput","municipalRegistrationInput","stateRegistrationAlertMessageElement","productInfo","message","stack","NUPAY_STATUS_POLLING_TIME_LIMIT","initNupay","cancelPaymentValidationLoop","closeDialog","showDialog","setupNupayPayment","MPMInstance","showNupayFields","nupayTotalAmountSpan","unitAmount","createOTONupayPayment","sendDocument","sendPhone","addListener","isRequired","setPersonalPhoneNumberRequired","createNupayCharge","setPhoneNumberRequired","phoneNumberInput","add","removeAttribute","remove","setupClientForm","clientTypeInput","formElement","nameInput","documentInput","isForeignerInput","clientCreatedAtHiddenInput","getClientInformation","client_name","client_email","client_document","client_phone_number","client_created_at","client_whatsapp_accept","client_state_registration","client_municipal_registration","pj","base","created_at","state_registration","setPersonalDocumentRequired","setupProductForm","idHiddenInput","nameHiddenInput","unitAmountHiddenInput","providerHiddenInput","getName","getProvider","getUnitAmountValue","listeners","removeListener","setupMPMTabs","tabsContentsContainerElement","mpmButtons","getElementsByClassName","_idx","tabTriggerList","tabTriggersList","contentsContainerElement","targetContentId","contentContainerId","contentContainerElement","clickHandler","contentIdToShow","tabTriggerElement","children","child","isActiveTabContentsContainer","setButtonsDisabled","setupMalgaPayment","sendCardErrorToWebhook","submitCardPurchaseForm","handlePaymentResult","prepareFieldsForPaymentMethods","success","pending","getElementsByName","productIdHiddenInput","productNameHiddenInput","formPixAmountHiddenInput","coupon_percent_off","formTotalPixAmountHiddenInput","redirectURL","redirectionUrl","parent","handler","paymentMethodsSubmitHandlers","createPaymentMethodResponse","errorCode","error_level","error_code","error_contents","payment_intent_id","paymentIntentId","tokenize_cvv","pixTotalAmountSpan","formNameInput","formEmailInput","formDocumentInput","formPhoneNumberInput","productProviderHiddenInput","formDocumentAlertMessageSpan","paymentInputsForm","buttonLoadingSpinner","payNowButtonLabel","getActiveEl","getValueEl","Boolean","getValue","triggerChange","activeEl","bumpValue","totalWithBump","isLoading","errorMsgText","getClientPaymentFormData","paymentMethodId","cvvToken","payment_method_id","paymentHelpers","creditCardForm","createPaymentIntentOnDB","paymentIntentsPath","payment_intent","showOrderCompleteAndRedirect","spinnerLoading","fetchClientPayment","clientPaymentResponse","statusReason","error_message","stripe_confirm_payment_data","revenue","gtmPurchaseEventData","webhooks","allSettled","defaultErrorMessage","baseGatewayURL","malgaApiUrl","gatewayClientId","malgaClientId","gatewayClientToken","malgaClientToken","cardNumber","cardExpirationDate","cardCvv","cardHolderName","bodyText","parse","cardTokenizationResponse","cvvUpdate","cvvTokenizationResponse","tokenId","errorPayload","_err","declinedCode","declined_code","debouncedHandleSubmit","notUsingCardPaymentMethod","_self","usingPixPaymentMethod","display","hasPix","hasNupay","typPixProcessing","typPixError"],"mappings":";aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,qBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,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AASS,EAAiBxC,GAE/B,OADAsC,EAAWtC,EAASmC,SACbnC,I,6BCtCT,2DACO,IAAMyC,EAAsB,CACjC,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,M,igBCtEK,IAAMC,EAAgB3J,OAAO4J,OAAO,CACzCC,eAAgB,iBAChBC,iBAAkB,mBAClBC,SAAU,aAGCC,EAAehK,OAAO4J,OAAO,CACxCK,KAAM,0BACNC,IAAK,MACLC,MAAO,UAGF,SAASC,IAAiD,IAArCC,EAAoC,uDAAxBC,OAAOD,WAAa,GACpDE,EAAgB,SAACC,EAAWC,GAChCJ,EAAUK,KAAK,CAAEC,UAAW,OAC5BN,EAAUK,KAAK,CACb1C,MAAOwC,EACPG,UAAWF,KAITG,EAAY,6BAAG,WAAOxD,EAAMyD,GAAb,uBAAAC,EAAA,6DACbC,EAAW3D,EAAK2D,UAAY,GAC5BC,EAAQC,EAAS7D,EAAK4D,OACtBE,GAAQ,UAAA9D,EAAK8D,aAAL,eAAYpC,gBAAiB,GAHxB,KAOV1B,EAAK+D,YAPK,KAQV,CACL,CACEhJ,MAAO,EACPiJ,QAAShE,EAAKiE,UACdC,UAAWlE,EAAKmE,YAChBC,OAAQpE,EAAKoE,QAAU,GACvBjD,SAAU,MACVkD,SAAUrE,EAAKqE,UAAY,EAC3BC,MAAOtE,EAAKsE,MACZC,SAAU,IAjBG,KAoBjBZ,EApBiB,SAqBOa,kBAAQb,EAAStI,QAAQ,MAAO,IAAIqG,eArB3C,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Ae,WAAWzb,OAClG+xB,QAAS,CACP1L,MAAO,kCACPiM,YAAahrB,SAASmU,eAAe,sBAAsBzb,MAAM+C,QAAUgH,OAAOqL,IAAImiB,kBAExFnmB,MAAO,CACLiV,MAAO,2BACPiM,YAAahrB,SAASmU,eAAe,iBAAiBzb,MAAM+C,QAAUgH,OAAOqL,IAAIoiB,gBArwBpF,4C,wBA4wBPlwB,SAAShB,iBAAiB,oBAAoB,WAC5C,IAAIknB,EACJ,IACEA,EAAc+C,uBAAajpB,SAASmU,eAAe,sBACnD,MAAOxN,GACP+J,QAAQ5G,MAAM,4BAA6BnD,GAG7C,IAAMwjB,EAAkBjE,GAAgB,MAAOvf,GAC7C+J,QAAQ5G,MAAM,iCAAkCnD","file":"js/client_payments_malga-19c8b5fc67094357c817.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 40);\n","module.exports = require(\"regenerator-runtime\");\n","/*!\n * cpf-cnpj-validator v1.0.3\n * (c) 2020-present Carvalho, Vinicius Luiz \n * Released under the MIT License.\n */\nvar BLACKLIST = ['00000000000', '11111111111', '22222222222', '33333333333', '44444444444', '55555555555', '66666666666', '77777777777', '88888888888', '99999999999', '12345678909'];\nvar STRICT_STRIP_REGEX = /[.-]/g;\nvar LOOSE_STRIP_REGEX = /[^\\d]/g;\n\nvar verifierDigit = function verifierDigit(digits) {\n var numbers = digits.split('').map(function (number) {\n return parseInt(number, 10);\n });\n var modulus = numbers.length + 1;\n var multiplied = numbers.map(function (number, index) {\n return number * (modulus - index);\n });\n var mod = multiplied.reduce(function (buffer, number) {\n return buffer + number;\n }) % 11;\n return mod < 2 ? 0 : 11 - mod;\n};\n\nvar strip = function strip(number, strict) {\n var regex = strict ? STRICT_STRIP_REGEX : LOOSE_STRIP_REGEX;\n return (number || '').replace(regex, '');\n};\n\nvar format = function format(number) {\n return strip(number).replace(/^(\\d{3})(\\d{3})(\\d{3})(\\d{2})$/, '$1.$2.$3-$4');\n};\n\nvar isValid = function isValid(number, strict) {\n var stripped = strip(number, strict);\n\n if (!stripped) {\n return false;\n }\n\n if (stripped.length !== 11) {\n return false;\n }\n\n if (BLACKLIST.includes(stripped)) {\n return false;\n }\n\n var numbers = stripped.substr(0, 9);\n numbers += verifierDigit(numbers);\n numbers += verifierDigit(numbers);\n return numbers.substr(-2) === stripped.substr(-2);\n};\n\nvar generate = function generate(formatted) {\n var numbers = '';\n\n for (var i = 0; i < 9; i += 1) {\n numbers += Math.floor(Math.random() * 9);\n }\n\n numbers += verifierDigit(numbers);\n numbers += verifierDigit(numbers);\n return formatted ? format(numbers) : numbers;\n};\n\nvar cpf = {\n verifierDigit: verifierDigit,\n strip: strip,\n format: format,\n isValid: isValid,\n generate: generate\n};\nvar BLACKLIST$1 = ['00000000000000', '11111111111111', '22222222222222', '33333333333333', '44444444444444', '55555555555555', '66666666666666', '77777777777777', '88888888888888', '99999999999999'];\nvar STRICT_STRIP_REGEX$1 = /[-\\\\/.]/g;\nvar LOOSE_STRIP_REGEX$1 = /[^\\d]/g;\n\nvar verifierDigit$1 = function verifierDigit$1(digits) {\n var index = 2;\n var reverse = digits.split('').reduce(function (buffer, number) {\n return [parseInt(number, 10)].concat(buffer);\n }, []);\n var sum = reverse.reduce(function (buffer, number) {\n buffer += number * index;\n index = index === 9 ? 2 : index + 1;\n return buffer;\n }, 0);\n var mod = sum % 11;\n return mod < 2 ? 0 : 11 - mod;\n};\n\nvar strip$1 = function strip$1(number, strict) {\n var regex = strict ? STRICT_STRIP_REGEX$1 : LOOSE_STRIP_REGEX$1;\n return (number || '').replace(regex, '');\n};\n\nvar format$1 = function format$1(number) {\n return strip$1(number).replace(/^(\\d{2})(\\d{3})(\\d{3})(\\d{4})(\\d{2})$/, '$1.$2.$3/$4-$5');\n};\n\nvar isValid$1 = function isValid$1(number, strict) {\n var stripped = strip$1(number, strict);\n\n if (!stripped) {\n return false;\n }\n\n if (stripped.length !== 14) {\n return false;\n }\n\n if (BLACKLIST$1.includes(stripped)) {\n return false;\n }\n\n var numbers = stripped.substr(0, 12);\n numbers += verifierDigit$1(numbers);\n numbers += verifierDigit$1(numbers);\n return numbers.substr(-2) === stripped.substr(-2);\n};\n\nvar generate$1 = function generate$1(formatted) {\n var numbers = '';\n\n for (var i = 0; i < 12; i += 1) {\n numbers += Math.floor(Math.random() * 9);\n }\n\n numbers += verifierDigit$1(numbers);\n numbers += verifierDigit$1(numbers);\n return formatted ? format$1(numbers) : numbers;\n};\n\nvar cnpj = {\n verifierDigit: verifierDigit$1,\n strip: strip$1,\n format: format$1,\n isValid: isValid$1,\n generate: generate$1\n};\n\nvar validator = function validator(joi) {\n return {\n type: 'document',\n base: joi.string(),\n messages: {\n 'document.cpf': 'CPF inválido',\n 'document.cnpj': 'CNPJ inválido'\n },\n rules: {\n cpf: {\n validate: function validate(value, helpers, args, options) {\n if (!cpf.isValid(value)) {\n return helpers.error('document.cpf');\n }\n\n return value;\n }\n },\n cnpj: {\n validate: function validate(value, helpers, args, options) {\n if (!cnpj.isValid(value)) {\n return helpers.error('document.cnpj');\n }\n\n return value;\n }\n }\n }\n };\n};\n\nexport default validator;\nexport { cpf, cnpj, validator };","import { cpf, cnpj } from \"cpf-cnpj-validator\";\n\nexport const isPJ = function (value) {\n return value.trim().toUpperCase() === \"PJ\";\n};\n\nexport const doesNotHaveValue = function (input) {\n return (input?.value.trim() ?? \"\") === \"\";\n};\n\n/**\n * @param {HTMLElement} el to transform\n * @param {boolean} isHidden\n */\nexport const setElementHiddenClass = (el, isHidden) => {\n el.classList.toggle(\"hidden\", isHidden);\n};\n\n/**\n * @param {HTMLButtonElement} button to transform\n * @param {boolean} isInvalid\n */\nexport const disableSubmitButtonElement = (button, isInvalid) => {\n button.disabled = isInvalid;\n button.classList.toggle(\"cursor-not-allowed\", isInvalid);\n button.classList.toggle(\"opacity-60\", isInvalid);\n};\n\n/**\n * @param {HTMLInputElement} input to transform\n * @param {boolean} isDisabled\n */\nexport const disableInputField = (input, isDisabled, clearValue = true) => {\n if (clearValue) {\n input.value = \"\";\n }\n input.disabled = isDisabled;\n input.style = isDisabled ? \"background-color: #e0e0e0;\" : \"\";\n};\n\n/**\n * @param {HTMLInputElement} input to transform\n * @param {boolean} isDisabledAndNotRequired\n */\nexport const disableRequiredInputField = (input, isDisabledAndNotRequired, clear = true) => {\n disableInputField(input, isDisabledAndNotRequired, clear);\n input.required = !isDisabledAndNotRequired;\n};\n\nexport const checkoutCustomerFormHelpers = (elements) => {\n const {\n alertMessageDocumentElement,\n documentLabelElement,\n formDocumentElement,\n formPhoneNumberElement,\n formClientType,\n isForeignerElement,\n submitButtonElement,\n whatsappAcceptElement,\n whatsappLabelElement\n } = elements;\n\n function toggleDocumentErrorMessage (isInvalid, isEmpty) {\n const emptyErrorMessage = alertMessageDocumentElement.querySelector(\".document_empty\");\n const invalidErrorMessage = alertMessageDocumentElement.querySelector(\".document_invalid\");\n\n if (isEmpty) {\n setElementHiddenClass(emptyErrorMessage, false);\n setElementHiddenClass(invalidErrorMessage, true);\n } else if (isInvalid) {\n setElementHiddenClass(emptyErrorMessage, true);\n setElementHiddenClass(invalidErrorMessage, false);\n }\n\n setElementHiddenClass(alertMessageDocumentElement, !isInvalid);\n\n disableSubmitButtonElement(submitButtonElement, isInvalid);\n }\n\n const pjMode = isPJ(formClientType.value);\n\n const helpers = {\n pjMode,\n /**\n *\n * @param {HTMLInputValue} formClientType\n * @returns boolean\n */\n cpfCnpjValidator () {\n if (isForeignerElement != true && isForeignerElement?.checked) {\n return true;\n }\n const docNum = formDocumentElement.value?.trim() ?? \"\";\n const docNumDigits = docNum.split(\"\").filter(digit => /^\\d$/.test(digit));\n const isFilled = docNumDigits.length > 0;\n const isValid = isFilled && (pjMode ? cnpj.isValid(docNum) : cpf.isValid(docNum));\n\n if (formDocumentElement.required) {\n toggleDocumentErrorMessage(!isValid, !isFilled);\n return isValid;\n } else {\n const valid = isFilled ? isValid : true;\n toggleDocumentErrorMessage(!valid, false);\n return valid;\n }\n },\n /** @param {boolean} state */\n disableCpfCnpjFields: isForeignerElement\n ? (state) => {\n const optionalLabel = documentLabelElement.querySelector(\"small\");\n if (!optionalLabel || (optionalLabel && optionalLabel.classList.contains(\"inline-zero-width\"))) {\n documentLabelElement.classList.toggle(\"required\", !state);\n }\n disableRequiredInputField(formDocumentElement, state);\n\n if (state) {\n toggleDocumentErrorMessage(false, false);\n }\n }\n : undefined,\n phoneNumberChangeHandler () {\n const phoneValue = formPhoneNumberElement\n .value\n .split(\"\")\n .filter(num => /\\d/.test(num));\n\n const valid = phoneValue.length > 6;\n\n whatsappAcceptElement.checked = valid;\n whatsappAcceptElement.classList.toggle(\"hidden\", !valid);\n whatsappLabelElement.classList.toggle(\"hidden\", !valid);\n }\n };\n // to validate cpf/cnpj\n formDocumentElement.addEventListener(\"blur\", () => {\n helpers.cpfCnpjValidator(formClientType);\n });\n\n // to disabled cpf/cnpj fields\n if (isForeignerElement && isForeignerElement !== true) {\n isForeignerElement.addEventListener(\"change\", (e) => {\n helpers.disableCpfCnpjFields(e.target.checked);\n });\n }\n\n // Show hidden whatsapp checkbox and label\n formPhoneNumberElement.addEventListener(\"keyup\", helpers.phoneNumberChangeHandler);\n\n return helpers;\n};\n\nexport const parseFetchResponse = (response) =>\n response\n .json()\n .then((data) => ({ status: response.status, body: data }));\n\n/**\n * Transform object to inline CSS string to use directly in style properties.\n *\n * @param {Object.} obj containing css key:values\n * @returns\n */\nexport const objectToInlineCss = (obj) => Object.entries(obj).map(([key, value]) => `${key}: ${value}`).join(\";\");\n\n/**\n *\n * @param {string} query to search element\n * @returns {HTMLElement} element\n */\nexport const querySelectorOrFail = (query) => {\n const el = document.querySelector(query);\n if (!el) {\n throw new Error(\"Not element found with query \" + query);\n }\n return el;\n};\n\n/**\n * Trigger a blur (loss of focus) in element and document's current active element when Enter is pressed.\n * @param {KeyboardEvent} event\n */\nexport function blurOnEnterKeyupHandler (event) {\n if (event.key === \"Enter\") {\n event.target.blur();\n document.activeElement.blur();\n }\n}\n\n/**\n * Forces blur (loss of focus) in the active document on event.\n */\nexport function forceBlurOnEventHandler () {\n document.activeElement.blur();\n}\n","export const formatterCurrency = new Intl.NumberFormat(\"pt-BR\", {\n style: \"currency\",\n currency: \"BRL\"\n});\n\n/**\n * Gets value from element and returns as formatted currency string.\n *\n * @param {HTMLInputElement} element to get the value from\n * @returns {string} formatted currency value\n */\nexport const getFormattedCurrencyValueFromEl = (element) => {\n if (!(\"value\" in element) || !element.value || element.value?.trim().length < 1) {\n return 0;\n }\n return formatterCurrency.format(element.value / 100);\n};\n\n/**\n * Remove non-currency related characters from string for getting number without decimals separator\n *\n * @param {string} value formatted\n * @returns {string} numeric value without decimals (value * 100)\n */\nexport const getValueWithoutFormat = function (value) {\n return value.replace(/[^0-9,.]+/gm, \"\").replace(\",\", \".\").replace(\".\", \"\");\n};\n\n/**\n * Gets input element value in lowercase\n *\n * @param {HTMLInputElement} element input field to get value from\n * @returns {string} input element field in lowercase\n */\nexport const getLowerCaseInputValue = function (element) {\n return element.value.toString().toLowerCase();\n};\n","let correlationId = null;\n\nexport const corrHeaderKey = 'X-Correlation-Id'\n\nexport function getCorrId() {\n return correlationId;\n}\n\nexport function setCorrId(value) {\n if (correlationId == null) {\n correlationId = value;\n }\n}\n\nexport function addCorrId(headers = new Headers()) {\n if (correlationId == null) return headers;\n\n if (headers instanceof Headers) {\n headers.set(corrHeaderKey, correlationId);\n } else {\n headers[corrHeaderKey] = correlationId;\n }\n\n return headers;\n}\n\nexport function loadCorrId(headers) {\n if (correlationId) return headers;\n\n if (headers instanceof Headers && headers.has(corrHeaderKey)) {\n setCorrId(headers.get(corrHeaderKey));\n } else if (corrHeaderKey in headers && headers[corrHeaderKey]) {\n setCorrId(headers[corrHeaderKey]);\n }\n}\n\nexport function tapAndLoadCorrId(response) {\n loadCorrId(response.headers);\n return response;\n}\n","/* KeyCodes de comandos e modifiers a serem ignorados pela formatação de campos */\nexport const ignoredFormKeyCodes = [\n 3, // CANCEL\n 8, // BACKSPACE\n 9, // TAB\n 16, // SHIFT\n 17, // CTRL\n 18, // ALT\n 20, // CAPS LOCK\n 27, // ESC\n 33, // PG UP\n 34, // PG DOWN\n 35, // END\n 36, // HOME\n 37, // ARROW LEFT\n 38, // ARROW UP\n 39, // ARROW RIGHT\n 40, // ARROW DOWN\n 41, // SELECT\n 42, // PRINT\n 43, // EXECUTE\n 44, // F13/PRINTSCREEN\n 45, // INSERT\n 46, // DELETE\n 91, // Meta (Mac Key)\n 92, // Meta (Mac Key)\n 93, // Context Menu\n 112, // F1\n 113, // F2\n 114, // F3\n 115, // [...]\n 116,\n 117,\n 118,\n 119,\n 120,\n 121,\n 122, // [...]\n 123, // F12\n 124, // F13\n 125, // F14\n 126, // [...]\n 127,\n 128,\n 129,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 136,\n 137,\n 138,\n 139,\n 140,\n 141, // [...]\n 142, // F31\n 143, // F32\n 144, // Num Lock\n 145, // Scroll Lock\n 166, // Browser Back\n 167, // Browser Forward\n 168, // Browser Refresh\n 174, // [Media Key]\n 175, // [Media Key]\n 176, // [Media Key]\n 177, // [Media Key]\n 178, // [Media Key]\n 179, // [Media Key]\n 180, // [Media Key]\n 181, // [Media Key]\n 182, // [Media Key]\n 183, // [Media Key]\n 224, // Meta (Mac key)\n 225, // Alt (Mac Key)\n];\n","import { convert } from \"./utils/encrypt\";\n\n/**\n * Enum-like to define checkout option step\n */\nexport const CHECKOUT_STEP = Object.freeze({\n begin_checkout: \"begin_checkout\",\n add_payment_info: \"add_payment_info\",\n purchase: \"purchase\"\n});\n\nexport const PAYMENT_TYPE = Object.freeze({\n card: \"Cartão de Crédito\",\n pix: \"PIX\",\n nupay: \"Nupay\"\n});\n\nexport function GtmFactory (dataLayer = window.dataLayer || []) {\n const sendDataLayer = (eventType, payload) => {\n dataLayer.push({ ecommerce: null });\n dataLayer.push({\n event: eventType,\n ecommerce: payload\n });\n };\n\n const buildPayload = async (data, paymentType) => {\n const fullName = data.fullName || \"\";\n const phone = getPhone(data.phone);\n const email = data.email?.toLowerCase() || \"\";\n\n const ecommerce = {\n currency: \"BRL\",\n value: data.totalAmount,\n items: [\n {\n index: 0,\n item_id: data.productId,\n item_name: data.productName,\n coupon: data.coupon || \"\",\n currency: \"BRL\",\n discount: data.discount || 0,\n price: data.price,\n quantity: 1\n }\n ],\n fullName,\n hashed_full_name: await convert(fullName.replace(/\\s/g, \"\").toLowerCase()),\n email,\n hashed_email: await convert(email),\n phone,\n hashed_phone: await convert(phone)\n };\n\n if (paymentType) ecommerce.paymentType = paymentType;\n if (data.transactionId) ecommerce.transaction_id = data.transactionId;\n\n return ecommerce;\n };\n\n return {\n dataLayer,\n /**\n * Send any Event\n * @param {String} eventType\n * @param {Object.} productData\n * @param {String} paymentType\n */\n async sendEvent (eventType, productData, paymentType) {\n sendDataLayer(eventType, await buildPayload(productData, paymentType));\n },\n /**\n * Sends analytics data about initializing the checkout page\n */\n sendBeginCheckout ({ price, discount, productId, productName, coupon, fullName, email, phone }) {\n return this.sendEvent(CHECKOUT_STEP.begin_checkout, {\n totalAmount: price,\n productId,\n productName,\n price,\n discount,\n coupon,\n fullName,\n email,\n phone\n });\n },\n registerCheckoutOptionEvent (paymentMethod, formsValues) {\n const {\n price,\n discount,\n coupon,\n productName,\n productId,\n fullName,\n email,\n phone\n } = formsValues;\n\n const eventData = {\n price,\n discount,\n coupon,\n productName,\n productId,\n fullName,\n email,\n phone,\n totalAmount: price\n };\n\n return this.sendEvent(CHECKOUT_STEP.add_payment_info, eventData, paymentMethod);\n },\n registerPurchaseEvent (paymentMethod, formsValues) {\n // The payment succeeded!\n const {\n coupon,\n discount,\n productName,\n productId,\n price,\n transactionId,\n fullName,\n email,\n phone\n } = formsValues;\n\n const purchaseData = {\n transactionId, // Transaction ID. Required for purchases and refunds.\n coupon,\n discount,\n productId,\n productName,\n price,\n fullName,\n email,\n phone,\n totalAmount: price\n };\n\n return this.sendEvent(CHECKOUT_STEP.purchase, purchaseData, paymentMethod);\n }\n };\n}\n\nfunction getPhone (phone) {\n if (phone === \"\" || phone === undefined) {\n return \"\";\n } else {\n return `55${phone.replace(/[^0-9]/g, \"\")}`;\n }\n}\n","export async function convert (data) {\n if (data === \"\" || data === undefined) return \"\";\n\n const encoder = new TextEncoder();\n const dataBuffer = encoder.encode(data);\n const hashBuffer = await window.crypto.subtle.digest(\"SHA-256\", dataBuffer);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n\n return hashHex;\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","/** globals grecaptcha */\n/**\n * \n * @param {string} action being performed\n * @returns string\n */\nexport async function useRecaptcha(action = 'submit') {\n return new Promise((resolve, reject) => {\n try {\n grecaptcha.ready(function() {\n grecaptcha.execute(window.PM3.GRCSK, { action })\n .then(resolve)\n .catch(reject);\n });\n } catch (err) {\n reject(err);\n }\n });\n}\n","/* globals Rollbar */\n\nimport { CouponService } from \"./coupon_service\";\nimport { formatterCurrency, getLowerCaseInputValue } from \"./formatters\";\nimport {\n blurOnEnterKeyupHandler,\n disableInputField,\n disableSubmitButtonElement,\n forceBlurOnEventHandler,\n objectToInlineCss,\n setElementHiddenClass\n} from \"./helper_functions\";\n\nconst createCouponErrorSpan = ({ errorMessage = \"Cupom inválido\", className = \"alert-message\" } = {}) => {\n const couponErrorMessageSpan = document.createElement(\"span\");\n couponErrorMessageSpan.className = className;\n couponErrorMessageSpan.style = objectToInlineCss({\n color: \"#B91C1C\",\n \"font-weight\": 500,\n \"font-size\": \"14px\",\n \"font-family\": \"Inter, sans-serif\",\n \"padding-top\": \"6px\",\n });\n\n couponErrorMessageSpan.textContent = errorMessage;\n return couponErrorMessageSpan;\n};\n\n/**\n *\n * @param {{\n * elements: {\n * clearCouponButton: HTMLSpanElement;\n * couponInput: HTMLInputElement;\n * discountAmountSpan: HTMLSpanElement;\n * errorSpanContainer: HTMLElement;\n * formAmountHiddenInput: HTMLInputElement;\n * paymentTotalSpan: HTMLSpanElement;\n * submitCouponButton: HTMLSpanElement;\n * emailInput: HTMLInputElement;\n * submitFormButton: HTMLInputElement;\n * };\n * errorMessageOptions: {\n * errorMessage: string;\n * className: string;\n * };\n * }} params\n * @returns\n */\nexport const couponFormFactory = (params = {}) => {\n const { elements, productId, errorMessageOptions = {} } = params;\n if (!elements || Object.keys(elements).length < 1) {\n throw new Error(\"Should provide elements references!\");\n }\n if (!productId || !productId?.length) {\n throw new Error(\"Should provide productId value!\");\n }\n\n if (new URLSearchParams(window.location.search).has(\"cupom\")) {\n const { clearCouponButton } = elements;\n\n function removeCouponFromUrlHandler () {\n const currentUrl = new URL(window.location.href);\n currentUrl.searchParams.delete(\"cupom\");\n window.location.assign(currentUrl);\n }\n\n if (clearCouponButton) {\n clearCouponButton.addEventListener(\"click\", removeCouponFromUrlHandler);\n } else if (Rollbar) {\n Rollbar.error(\"Missing clear coupon button reference\", {\n url: window.location.href\n });\n }\n\n return { fixedCoupon: true };\n }\n\n const {\n clearCouponButton,\n couponInput,\n discountAmountSpan,\n errorSpanContainer,\n formAmountHiddenInput,\n paymentTotalSpan,\n submitCouponButton,\n emailInput,\n submitFormButton\n } = elements;\n\n /** @type {Function[]} */\n let couponChangeEventListeners = [];\n\n let currentlyActiveCoupon = \"\";\n\n let validEmail = null;\n\n const couponErrorSpan = createCouponErrorSpan(errorMessageOptions);\n\n function addCouponChangeListener (listener) {\n if (!couponChangeEventListeners.some((registeredListener) => registeredListener === listener)) {\n couponChangeEventListeners.push(listener);\n }\n }\n\n function removeCouponChangeListener (listener) {\n couponChangeEventListeners = couponChangeEventListeners\n .filter((registeredListener) => registeredListener !== listener);\n }\n\n /**\n * Publish data to listeners\n *\n * @param {{\n * amountOff: string\n * couponId: string\n * discountAmount: string\n * discountedAmount: string\n * percentOff: string\n * }} couponData\n * @param {boolean=} clear\n */\n function pushCouponChangeToListeners (couponData, clear) {\n couponChangeEventListeners.forEach((listener) => {\n try {\n listener?.(couponData, clear);\n } catch (error) {\n console.error(\"Failed to call listener:\", { listener });\n }\n });\n }\n\n function couponInputClickHandler () {\n setElementHiddenClass(submitCouponButton, false);\n disableInputField(submitCouponButton, false, !currentlyActiveCoupon.length);\n removeErrorSpan();\n }\n\n function removeErrorSpan () {\n if (couponErrorSpan.parentElement) {\n couponErrorSpan.parentElement.removeChild(couponErrorSpan);\n }\n }\n\n /**\n * Appends errorSpan into the given parentElement\n * @param {HTMLElement} parentElement to append the errorSpan as child\n */\n function appendErrorSpan (parentElement = errorSpanContainer) {\n removeErrorSpan();\n parentElement.appendChild(couponErrorSpan);\n }\n\n /**\n * Fetch coupon data from server relative to the current product\n * @param {string} coupon\n * @param {string} amount\n * @param {string} email\n */\n const fetchCoupon = async (coupon, amount, email) => {\n const couponData = await CouponService.getCoupon(coupon, amount, productId, email)\n .catch((error) => {\n console.error(error);\n appendErrorSpan(errorSpanContainer);\n });\n if (!couponData) {\n return null;\n }\n const formattedDiscountedAmount = formatterCurrency.format(couponData.discountedAmount / 100);\n const formattedDiscount = formatterCurrency.format(couponData.discountAmount / 100);\n const formattedPixDiscountedAmount = formatterCurrency.format(couponData.pixDiscountedAmount / 100);\n const formattedPixAmount = formatterCurrency.format(couponData.pixAmount / 100);\n\n return {\n ...couponData,\n formattedDiscount,\n formattedDiscountedAmount,\n formattedPixAmount,\n formattedPixDiscountedAmount\n };\n };\n\n /**\n * Handles loss of focus in couponInput\n * @param {FocusEvent} event\n */\n function couponInputBlurHandler (event) {\n event.preventDefault();\n removeErrorSpan();\n\n const couponName = couponInput.value.toUpperCase();\n\n setElementHiddenClass(submitCouponButton, true);\n disableInputField(couponInput, true, false);\n\n if (couponName.trim().length < 1 && currentlyActiveCoupon) {\n couponInput.value = currentlyActiveCoupon;\n disableInputField(couponInput, false, false);\n return;\n // eslint-disable-next-line eqeqeq\n } else if (couponName.trim() == currentlyActiveCoupon && validEmail == getLowerCaseInputValue(emailInput)) {\n disableInputField(couponInput, false, false);\n return;\n } else if (couponName.trim().length < 1) {\n disableInputField(couponInput, false, true);\n return;\n }\n\n // disable submit form while the coupon is validating\n disableSubmitButtonElement(submitFormButton, true);\n\n const lowercasedEmailValue = getLowerCaseInputValue(emailInput);\n\n fetchCoupon(couponName, formAmountHiddenInput.value, lowercasedEmailValue)\n .then((couponData) => {\n if (couponData !== null) {\n // save the previous email used to validate coupon\n validEmail = lowercasedEmailValue;\n currentlyActiveCoupon = couponName;\n couponInput.value = couponName;\n discountAmountSpan.textContent = couponData.formattedDiscount;\n paymentTotalSpan.textContent = couponData.formattedDiscountedAmount;\n // disable input to not edit coupon after a validation\n disableInputField(couponInput, true, false);\n setElementHiddenClass(discountAmountSpan, false);\n setElementHiddenClass(clearCouponButton, false);\n } else if (validEmail !== lowercasedEmailValue) {\n // if email input value is different from the first email filled, coupon is invalid\n removeCouponHandler();\n } else {\n couponInput.value = currentlyActiveCoupon;\n }\n disableInputField(submitCouponButton, true, false);\n\n pushCouponChangeToListeners(couponData);\n })\n .finally(() => {\n // deal with coupon input disable\n // when currentlyActiveCoupon has not length, disable is false\n // when currentlyActiveCoupon has length, disable is true (coupon is already validated)\n disableInputField(couponInput, currentlyActiveCoupon.length, !currentlyActiveCoupon.length);\n disableSubmitButtonElement(submitFormButton, false);\n });\n }\n\n function removeCouponHandler () {\n removeErrorSpan();\n setElementHiddenClass(submitCouponButton, false);\n disableInputField(couponInput, false, true);\n pushCouponChangeToListeners(null, true);\n setElementHiddenClass(discountAmountSpan, true);\n setElementHiddenClass(clearCouponButton, true);\n setElementHiddenClass(submitCouponButton, true);\n currentlyActiveCoupon = \"\";\n }\n\n // check coupon after email is filled\n emailInput.addEventListener(\"blur\", couponInputBlurHandler);\n\n couponInput.addEventListener(\"blur\", couponInputBlurHandler);\n\n couponInput.addEventListener(\"click\", couponInputClickHandler);\n\n couponInput.addEventListener(\"keyup\", blurOnEnterKeyupHandler);\n\n submitCouponButton.addEventListener(\"click\", forceBlurOnEventHandler);\n\n clearCouponButton.addEventListener(\"click\", removeCouponHandler);\n\n return {\n fixedCoupon: false,\n couponInput,\n clearCouponButton,\n submitCouponButton,\n discountAmountSpan,\n paymentTotalSpan,\n addCouponChangeListener,\n removeCouponChangeListener,\n appendErrorSpan,\n removeErrorSpan,\n elements\n };\n};\n","export const CouponService = {\n /**\n * Retrieves coupon info from backend\n *\n * @param {string} coupon identifier\n * @param {string} amount value of the product\n * @param {string} productId of the discounted product\n * @param {string} email of the user\n * @returns {Promise<{\n * coupon: string;\n * amount: string;\n * amountOff: number;\n * discountAmount: number;\n * discountedAmount: number;\n * percentOff: number;\n * pixAmount: number;\n * pixDiscountedAmount: number;\n * }>}\n */\n async getCoupon (coupon, amount, productId, email) {\n const fetchUrlParams = new URLSearchParams({ amount, product_id: productId, email });\n const couponResponse = await fetch(`/coupon_payments/${coupon}?${fetchUrlParams}`);\n if (!couponResponse.ok) {\n throw new Error(`Failed to get coupon: ${couponResponse.statusText}`);\n }\n const couponData = await couponResponse.json();\n if (\"error\" in couponData) {\n throw new Error(coupon.error);\n }\n const discountAmount = couponData.discount_amount;\n const discountedAmount = couponData.new_amount;\n\n return {\n coupon,\n amount,\n amountOff: couponData.amount_off,\n percentOff: couponData.percent_off,\n discountAmount,\n discountedAmount,\n pixAmount: couponData.pix_amount,\n pixDiscountedAmount: couponData.pix_discount_amount\n };\n }\n};\n","export function debounced (fnToCall, timeout = 500) {\n let timeoutRef = null;\n return (...args) => {\n if (timeoutRef) return;\n timeoutRef = setTimeout(() => {\n fnToCall(...args);\n\n clearTimeout(timeoutRef);\n timeoutRef = null;\n }, timeout);\n };\n};\n","import { addCorrId, loadCorrId } from './utils/correlation_id_store';\n\n// Send webhook to Zapier or any other service\nexport const webhook = Object.freeze({\n sendPost (url, body, headers = { \"Content-Type\": \"application/json\" }) {\n return fetch(url, {\n method: \"POST\",\n headers: addCorrId(headers),\n body: JSON.stringify(body)\n })\n .then(async (response) => {\n loadCorrId(response.headers);\n return {\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: await (response.ok ? response.json() : response.text()),\n };\n })\n .catch((error) => {\n return {\n ok: false,\n error\n };\n });\n }\n});\n","export function vanishElement (element, hidden = true) {\n element.classList.toggle(\"invisible\", hidden);\n element.classList.toggle(\"h-0\", hidden);\n}\n","import { couponFormFactory } from \"../../../coupon_form_factory\";\nimport { formatterCurrency, getValueWithoutFormat } from \"../../../formatters\";\n\nexport function setupPaymentForm (clientForm, productForm, submitButton, paymentMethod = \"card\") {\n const formCouponIdHiddenInput = document.getElementById(\"client_payment_coupon_id\");\n const formAmountOffHiddenInput = document.getElementById(\"client_payment_amount_off\");\n const formPercentOffHiddenInput = document.getElementById(\"client_payment_percent_off\");\n const formDiscountAmountHiddenInput = document.getElementById(\"client_payment_discount_amount\");\n const formAmountHiddenInput = document.getElementById(\"client_payment_amount\");\n const formTotalAmountHiddenInput = document.getElementById(\"client_payment_total_amount\");\n const formCountInstallmentsHiddenInput = document.getElementById(\"client_payment_installments_count\");\n const formFixedInstallmentHiddenInput = document.getElementById(\"client_payment_fixed_installments\");\n\n if (window.coupon_accepted) {\n const { emailInput } = clientForm.inputs;\n\n const couponElements = {\n formAmountHiddenInput,\n couponInput: document.getElementById(\"coupon_id\"),\n discountAmountSpan: document.getElementById(\"discount-amount\"),\n paymentTotalSpan: document.getElementById(\"payment-total\"),\n clearCouponButton: document.getElementById(\"clear_coupon\"),\n errorSpanContainer: document.getElementById(\"coupon-container\")?.parentElement,\n submitCouponButton: document.getElementById(\"submit_coupon\"),\n emailInput,\n submitButton\n };\n let timeoutRef = null;\n\n const couponForm = couponFormFactory({\n elements: couponElements,\n productId: productForm.getId()\n });\n if (couponForm && !couponForm.fixedCoupon) {\n // TODO: this is for card payment, should extract and have the variant for pix/nupay here\n /**\n * Update installments options or span\n *\n * @param {string} amount numeric value\n * @param {boolean} [fixedInstallments=false] flag\n */\n const updateInstallments = (amount, fixedInstallments = false) => {\n if (fixedInstallments) {\n // operates over single span element\n const numericValue = Number(formCountInstallmentsHiddenInput.value);\n const formattedInstallmentValue = formatterCurrency.format(\n Number(amount) / numericValue\n );\n showInstallmentsSpan.innerText = `${numericValue}x ${formattedInstallmentValue} sem juros`;\n } else {\n // operate over options elements\n installmentsOptionsElements.forEach(function (item) {\n const numericValue = Number(item.value);\n const formattedInstallmentValue = formatterCurrency.format(\n Number(amount) / numericValue\n );\n item.innerText = `${numericValue}x ${formattedInstallmentValue} sem juros`;\n });\n }\n };\n\n if (couponForm) {\n /**\n * Handles changes in coupon values\n *\n * @param {{\n * amount: string\n * amountOff: number\n * coupon: string\n * discountAmount: number\n * discountedAmount: number\n * formattedDiscount: string\n * formattedDiscountedAmount: string\n * percentOff: string\n * } | null} coupon\n * @param {boolean=} clear\n */\n const couponChangeHandler = (coupon, clear = false) => {\n const rawOriginalAmount = Number(formAmountHiddenInput.value) / 100;\n const originalAmount = formatterCurrency.format(rawOriginalAmount);\n\n if (clear) {\n formCouponIdHiddenInput.value = \"\";\n formTotalAmountHiddenInput.value = formAmountHiddenInput.value;\n formDiscountAmountHiddenInput.value = \"\";\n formAmountOffHiddenInput.value = \"\";\n formPercentOffHiddenInput.value = \"\";\n\n couponElements.paymentTotalSpan.innerText = originalAmount;\n couponElements.discountAmountSpan.innerText = \"\";\n\n updateInstallments(rawOriginalAmount, formFixedInstallmentHiddenInput?.value === \"true\");\n return;\n } else if (coupon === null && formCouponIdHiddenInput.value) {\n if (timeoutRef !== null) {\n clearTimeout(timeoutRef);\n }\n timeoutRef = setTimeout(() => {\n couponForm.removeErrorSpan();\n }, 3000);\n return;\n } else if (coupon === null) {\n couponForm.appendErrorSpan();\n return;\n }\n\n couponForm.removeErrorSpan();\n\n formAmountOffHiddenInput.value = coupon.amountOff;\n formCouponIdHiddenInput.value = coupon.coupon;\n formDiscountAmountHiddenInput.value = coupon.discountAmount;\n formTotalAmountHiddenInput.value = coupon.discountedAmount;\n formPercentOffHiddenInput.value = coupon.percentOff;\n\n couponElements.paymentTotalSpan.innerText = coupon.formattedDiscountedAmount;\n couponElements.discountAmountSpan.innerText = coupon.formattedDiscount;\n\n updateInstallments(coupon.discountedAmount / 100, formFixedInstallmentHiddenInput?.value === \"true\");\n };\n couponForm.addCouponChangeListener(couponChangeHandler);\n }\n }\n }\n // END of Coupon Form\n}\n\nexport function getPaymentInfoHelpers ({ from_cents } = { from_cents: false }) {\n const factor = from_cents ? 100 : 1;\n const productUnitAmountHiddenInput = document.getElementById(\"unit-amount\") || document.getElementById(\"payment-total\");\n const formAmountOffHiddenInput = document.getElementById(\"client_payment_amount_off\");\n const formPercentOffHiddenInput = document.getElementById(\"client_payment_percent_off\");\n\n function getUnitAmount () {\n return getValueWithoutFormat(productUnitAmountHiddenInput?.innerText) / factor;\n }\n\n function getDiscountAmount () {\n const percentDiscount = formPercentOffHiddenInput.value\n ? (getUnitAmount() * (+formPercentOffHiddenInput.value)) / 100\n : 0;\n const discountAmount = getValueWithoutFormat(formAmountOffHiddenInput.value)\n ? +getValueWithoutFormat(formAmountOffHiddenInput.value) / 100\n : percentDiscount;\n return discountAmount;\n }\n\n function getTotalAmount () {\n return getUnitAmount() - getDiscountAmount();\n }\n\n return { getUnitAmount, getDiscountAmount, getTotalAmount };\n}\n","/**\n * Converts a number in seconds to a string of descriptive time in the biggest units\n *\n * @param {number} secondsTime to parse\n * @param {boolean} hideSeconds to not show seconds in final string\n */\nexport function getDescriptiveTime (secondsTime, hideSeconds = false) {\n const ONE_MIN = 60;\n const ONE_HOUR = 60 * ONE_MIN;\n const ONE_DAY = 24 * ONE_HOUR;\n\n const seconds = secondsTime % ONE_MIN;\n const minutesTime = secondsTime - seconds;\n const minutes = (minutesTime % ONE_HOUR) / ONE_MIN;\n const hoursTime = minutesTime - (minutes * ONE_MIN);\n const hours = (hoursTime % ONE_DAY) / ONE_HOUR;\n const daysTime = hoursTime - (hours * ONE_HOUR);\n const days = daysTime / ONE_DAY;\n\n const numFormat = new Intl.NumberFormat([\"pt-BR\"], {\n minimumFractionDigits: 0,\n maximumFractionDigits: 0\n }).format;\n\n const descriptiveParts = [\n { value: days, unit: [\"dia\", \"dias\"] },\n { value: hours, unit: [\"hora\", \"horas\"] },\n { value: minutes, unit: [\"minuto\", \"minutos\"] },\n { value: hideSeconds ? 0 : seconds, unit: [\"segundo\", \"segundos\"] }\n ]\n .filter(({ value }) => Math.floor(value) > 0)\n .map(({ value, unit: [one, multiple] }) => `${numFormat(Math.floor(value))} ${value === 1 ? one : multiple}`);\n\n if (descriptiveParts.length > 1) {\n descriptiveParts.splice(\n descriptiveParts.length - 2,\n 2,\n [\n descriptiveParts[descriptiveParts.length - 2],\n descriptiveParts[descriptiveParts.length - 1]\n ].join(\" e \")\n );\n }\n\n const descriptive = descriptiveParts.join(\", \").trim();\n\n return descriptive.length ? descriptive : \"Agora\";\n}\n","import { ignoredFormKeyCodes } from \"../../ignored_form_key_codes\";\n\nexport const FORMATTED_CC_NUM_LENGTH = 19;\nexport const CC_NUM_LENGTH = 16;\nexport const CC_NUM_BLOCK_SIZE = 4;\nexport const CC_NUM_SPACE_POSITION_FACTOR = CC_NUM_BLOCK_SIZE + 1;\n\nconst NUM_KEYS = new Array(10).fill(null).map((_, i) => i.toString());\nconst ALLOWED_KEYS_NUMERIC = [...NUM_KEYS, ...ignoredFormKeyCodes];\n\nexport const creditCardNumberInputPartialValidator = /^[\\d\\s]+$/;\n\nexport const creditCardNumberInputValidator = (value) => /^([\\d]{4}\\s){3}[\\d]{4}$/.test(value);\nexport const isCursorMovementKey = (key) => /arrow|home|end/i.test(key);\nexport const isInSpaceChar = (num) => num % CC_NUM_SPACE_POSITION_FACTOR === 0;\n\nexport function creditCardNumberExtractor (value) {\n return value.split(\"\")\n .filter((char) => /^\\d$/.test(char))\n .slice(0, CC_NUM_LENGTH)\n .join(\"\");\n}\n\nexport function creditCardNumberFormatter (value) {\n const cleanChars = creditCardNumberExtractor(value);\n\n const formatted = cleanChars.split(\"\").reduce((result, char, index, arr) => {\n if (result.length >= FORMATTED_CC_NUM_LENGTH) return result;\n const separator =\n (index + 1) % CC_NUM_BLOCK_SIZE === 0 &&\n (result.length + 2) <= FORMATTED_CC_NUM_LENGTH\n ? \" \"\n : \"\";\n return result + char + separator;\n }, \"\").trim();\n\n return formatted;\n}\n\nexport function handleCCInputEmptySpace (event) {\n const { key, target: { value, selectionStart, selectionEnd } } = event;\n\n const target = {\n value: value.slice(0),\n selectionStart,\n selectionEnd\n };\n\n // if selection is diff it is selecting text, if is cursor movement commands skips\n // eslint-disable-next-line eqeqeq\n if (selectionStart == selectionEnd && !isCursorMovementKey(key)) {\n // handle cases where user is dealing with a space\n if (isInSpaceChar(selectionStart + 1) && isInSpaceChar(selectionEnd + 1)) {\n // case: remove space before cursor w/ backspace, remove char before space and move cursor 2 chars before\n if (/backspace/i.test(key)) {\n target.value = value\n .split(\"\")\n .filter((_, idx) => idx !== (selectionStart - 1))\n .join(\"\");\n target.selectionStart -= 2;\n target.selectionEnd -= 2;\n return target;\n }\n\n // case: remove space after cursor w/ delete, remove char after space and keep cursor position\n if (/delete/i.test(key)) {\n target.value = value\n .split(\"\")\n .filter((_, idx) => idx !== selectionStart)\n .join(\"\");\n\n return target;\n }\n }\n }\n // in case it is updating a 4-digits block moving a space, just move the caret an extra character forward\n if (value.slice(value.slice(0, selectionEnd).lastIndexOf(\" \"), selectionEnd + 1).length > 5) {\n target.selectionStart += 1;\n target.selectionEnd += 1;\n }\n\n return target;\n}\n\nexport function ccNumKeydownHandler (event) {\n if (event.key == 'Enter') {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n if (![event.metaKey, event.altKey, event.ctrlKey].some(active => active)) {\n if (!ALLOWED_KEYS_NUMERIC.includes(event.key) && !ignoredFormKeyCodes.includes(event.keyCode)) {\n event.preventDefault();\n return;\n }\n if (ignoredFormKeyCodes.includes(event.keyCode)) {\n return;\n }\n }\n\n const { value, selectionStart, selectionEnd } = event.target;\n\n const slicedValue = value.slice(0, FORMATTED_CC_NUM_LENGTH);\n\n event.target.value = slicedValue;\n\n this.value = slicedValue; // `this` here points to the input HTML Element\n\n event.target.setSelectionRange(selectionStart, selectionEnd);\n}\n\nexport function ccNumKeyupHandler (event) {\n const updatedTarget = handleCCInputEmptySpace(event);\n\n const { value } = updatedTarget;\n if (!value.length) {\n return;\n }\n\n const updatedValue = creditCardNumberFormatter(value);\n\n const shouldJumpToNextField =\n !ignoredFormKeyCodes.includes(event.keyCode) &&\n updatedTarget.value.length >= FORMATTED_CC_NUM_LENGTH &&\n updatedTarget.selectionStart >= FORMATTED_CC_NUM_LENGTH &&\n updatedTarget.selectionEnd >= FORMATTED_CC_NUM_LENGTH;\n\n // eslint-disable-next-line eqeqeq\n const isContentDiff = updatedValue != value;\n if (!isContentDiff) {\n if (shouldJumpToNextField) {\n event.target.nextElementSibling.focus();\n }\n return;\n }\n const isFieldOverflowing = value.length >= FORMATTED_CC_NUM_LENGTH;\n const sizeDiff = updatedValue.length - value.length;\n\n this.value = updatedValue.slice(0, FORMATTED_CC_NUM_LENGTH); // `this` here points to the input HTML Element\n\n const caretPositionDiff = isFieldOverflowing ? 0 : sizeDiff;\n\n event.target.setSelectionRange(\n updatedTarget.selectionStart + caretPositionDiff,\n updatedTarget.selectionEnd + caretPositionDiff\n );\n\n if (shouldJumpToNextField) {\n event.target.nextElementSibling.focus();\n }\n}\n\nfunction ccNumPasteHandler (event) {\n const pasteData = event.clipboardData.getData(\"text\");\n event.preventDefault(pasteData);\n this.value = creditCardNumberFormatter(pasteData);\n}\n\nexport function setupCreditCardNumberInput (inputElement) {\n inputElement.addEventListener(\"keydown\", ccNumKeydownHandler);\n inputElement.addEventListener(\"keyup\", ccNumKeyupHandler);\n inputElement.addEventListener(\"paste\", ccNumPasteHandler);\n\n inputElement.setAttribute(\"maxlength\", FORMATTED_CC_NUM_LENGTH);\n inputElement.setAttribute(\"pattern\", \"^([0-9]{4}\\\\s){3}[0-9]{4}$\");\n\n const proxyHandler = {\n get (target, prop, _receiver) {\n switch (prop) {\n case \"value\":\n return creditCardNumberExtractor(target.value ?? \"\");\n case \"valid\":\n return creditCardNumberInputValidator(target.value ?? \"\");\n case \"_self\":\n return target;\n default:\n return Reflect.get(...arguments);\n }\n },\n set (target, prop, value, _receiver) {\n if (prop === \"value\") {\n target.value = creditCardNumberFormatter(value.toString());\n } else {\n return Reflect.set(...arguments);\n }\n return true; // spec requires return of true in strict-mode\n }\n };\n\n return new Proxy(inputElement, proxyHandler);\n}\n","import { ignoredFormKeyCodes } from \"../../ignored_form_key_codes\";\n\nconst CC_ED_M_MAX_LENGTH = 2;\nconst CC_ED_Y_MAX_LENGTH = 2;\nconst FORMATTED_CC_ED_MAX_LENGTH = CC_ED_M_MAX_LENGTH + CC_ED_Y_MAX_LENGTH + 1;\nconst NUM_KEYS = new Array(10).fill(null).map((_, i) => i.toString());\nconst ALLOWED_KEYS_NUMERIC = [...NUM_KEYS, ...ignoredFormKeyCodes];\n\nexport function replaceStringDate (value) {\n return value\n .replace(/^([1-9]\\/|[2-9])$/g, \"0$1/\") // 3 > 03/\n .replace(/^(0[1-9]|1[0-2])$/g, \"$1/\") // 11 > 11/\n .replace(/^([0-1])([3-9])$/g, \"0$1/$2\") // 13 > 01/3\n .replace(/^(0?[1-9]|1[0-2])([0-9]{2})$/g, \"$1/$2\") // 141 > 01/41\n .replace(/^([0]+)\\/|[0]+$/g, \"0\") // 0/ > 0 and 00 > 0\n .replace(/[^\\d/]|^[/]*$/g, \"\") // To allow only digits and `/`\n .replace(/\\/\\//g, \"/\"); // Prevent entering more than 1 `/`\n}\n\nexport function ccEDExtractor (value) {\n const [month, year] = value.split(\"/\");\n\n if (year.length && year.length < 3) {\n const currentYearHundreds = new Date().getFullYear().toFixed(0).slice(0, CC_ED_Y_MAX_LENGTH);\n return [\n month,\n currentYearHundreds + year.padStart(2, \"0\")\n ].join(\"/\");\n }\n return value;\n}\n\nexport function ccEDFormatter (value) {\n const [month, year] = value.slice(0, FORMATTED_CC_ED_MAX_LENGTH).split(\"/\");\n if (Number.isNaN(+month)) {\n return \"\";\n }\n const numMonth = +month > 12 || +month < 1 ? 1 : Number(month);\n const strMonth = numMonth.toString().padStart(CC_ED_M_MAX_LENGTH, \"0\");\n\n if (year?.length && year.length > 2) {\n const twoDigitsYear = year.slice(CC_ED_Y_MAX_LENGTH).padStart(CC_ED_Y_MAX_LENGTH, \"0\");\n return [\n strMonth,\n twoDigitsYear\n ].join(\"/\");\n }\n return [strMonth, year].join(\"/\");\n}\n\nexport function ccEDValidator (value) {\n const [month, year] = value.split(\"/\");\n const currentYear = new Date().getFullYear();\n const currentYearHundreds = currentYear.toFixed(0).slice(0, CC_ED_Y_MAX_LENGTH);\n\n if (year.length === 3 || Number.isNaN(year) || +year < 1) {\n return false;\n }\n\n const fullYear = Number(\n year.length < 4\n ? currentYearHundreds + year.toFixed(0).padStart(2, \"0\")\n : year.toFixed(0)\n );\n\n if (fullYear < currentYear) {\n return false;\n }\n\n const numMonth = Number(month);\n if (!Number.isNaN(numMonth) || numMonth < 1 || numMonth > 12) {\n return false;\n }\n if (fullYear > currentYear) {\n return true;\n }\n\n const currentMonth = new Date().getMonth() + 1;\n\n return numMonth >= currentMonth;\n}\n\nexport function ccEDKeydownHandler (event) {\n if (event.key == 'Enter') {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n if (![event.metaKey, event.altKey, event.ctrlKey].some(active => active)) {\n if (!ALLOWED_KEYS_NUMERIC.includes(event.key) && !ignoredFormKeyCodes.includes(event.keyCode)) {\n event.preventDefault();\n return;\n }\n if (ignoredFormKeyCodes.includes(event.keyCode)) {\n return;\n }\n }\n\n const slicedValue = event.target.value.slice(0, FORMATTED_CC_ED_MAX_LENGTH);\n\n event.target.value = replaceStringDate(slicedValue);\n}\n\nexport function ccEDKeyupHandler (event) {\n const { selectionStart, selectionEnd } = event.target;\n const shouldFocusNext =\n !ignoredFormKeyCodes.includes(event.keyCode) &&\n event.target.value.length >= 5 &&\n selectionStart >= 5 &&\n selectionEnd >= 5;\n\n event.target.value = event.target.value.slice(0, FORMATTED_CC_ED_MAX_LENGTH);\n\n if (shouldFocusNext) {\n event.target.nextElementSibling.focus();\n }\n}\n\nexport function ccEDPasteHandler (event) {\n const pasteData = event.clipboardData.getData(\"text\");\n event.preventDefault(pasteData);\n event.target.value = replaceStringDate(pasteData);\n}\n\nexport function setupCCExpirationDateInput (inputElement) {\n inputElement.addEventListener(\"keydown\", ccEDKeydownHandler);\n inputElement.addEventListener(\"keyup\", ccEDKeyupHandler);\n inputElement.addEventListener(\"paste\", ccEDPasteHandler);\n\n inputElement.setAttribute(\"maxlength\", FORMATTED_CC_ED_MAX_LENGTH);\n inputElement.setAttribute(\"pattern\", `^[0-9]{${CC_ED_M_MAX_LENGTH}}/[0-9]{${CC_ED_Y_MAX_LENGTH}}$`);\n\n return new Proxy(inputElement, {\n get (target, prop, _receiver) {\n switch (prop) {\n case \"value\":\n return ccEDExtractor(target.value ?? \"\");\n case \"_self\":\n return target;\n default:\n return Reflect.get(...arguments);\n }\n },\n set (target, prop, value, _receiver) {\n if (prop === \"value\") {\n target.value = replaceStringDate(ccEDFormatter(value));\n } else {\n return Reflect.set(...arguments);\n }\n return true;\n }\n });\n}\n","import { ignoredFormKeyCodes } from \"../../ignored_form_key_codes\";\n\nconst NUM_KEYS = new Array(10).fill(null).map((_, i) => i.toString());\nconst ALLOWED_KEYS_NUMERIC = [...NUM_KEYS, ...ignoredFormKeyCodes];\n\nconst CVV_MIN_LENGTH = 3;\nconst CVV_MAX_LENGTH = 4;\n\nexport function numericOnlyFilter (char) {\n return /^\\d$/.test(char);\n}\n\nexport function filterNonNumericCharacters (value) {\n return value.split(\"\").filter(numericOnlyFilter).join(\"\");\n}\n\nexport function CVVFilter (value) {\n return filterNonNumericCharacters(value.slice(0, CVV_MAX_LENGTH));\n}\n\nexport function ccEDKeydownHandler (event) {\n if (event.key == 'Enter') {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n if (![event.metaKey, event.altKey, event.ctrlKey].some(active => active)) {\n if (!ALLOWED_KEYS_NUMERIC.includes(event.key) && !ignoredFormKeyCodes.includes(event.keyCode)) {\n event.preventDefault();\n return;\n }\n if (ignoredFormKeyCodes.includes(event.keyCode)) {\n return;\n }\n }\n\n event.target.value = CVVFilter(event.target.value);\n}\n\nexport function ccEDKeyupHandler (event) {\n if (event.key == 'Enter') {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n if (ignoredFormKeyCodes.includes(event.keyCode)) {\n return;\n }\n\n event.target.value = CVVFilter(event.target.value);\n}\n\nexport function ccEDPasteHandler (event) {\n const pasteData = event.clipboardData.getData(\"text\");\n event.preventDefault(pasteData);\n event.target.value = CVVFilter(pasteData);\n}\n\nexport function setupCCCVVInput (inputElement) {\n inputElement.addEventListener(\"keydown\", ccEDKeydownHandler);\n inputElement.addEventListener(\"keyup\", ccEDKeyupHandler);\n inputElement.addEventListener(\"paste\", ccEDPasteHandler);\n\n inputElement.setAttribute(\"maxlength\", CVV_MAX_LENGTH);\n inputElement.setAttribute(\"pattern\", `^[0-9]{${CVV_MIN_LENGTH},${CVV_MAX_LENGTH}}$`)\n\n return new Proxy(inputElement, {\n get (target, prop, _receiver) {\n switch (prop) {\n case \"value\":\n return CVVFilter(target.value);\n case \"_self\":\n return target;\n default:\n return Reflect.get(...arguments);\n }\n },\n set (target, prop, value, _receiver) {\n if (prop === \"value\") {\n target.value = CVVFilter(value.toString());\n } else {\n return Reflect.set(...arguments);\n }\n return true;\n }\n });\n}\n","import { setupCreditCardNumberInput } from \"./cc_number\";\nimport { setupCCExpirationDateInput } from \"./cc_expiration_date\";\nimport { setupCCCVVInput } from \"./cc_cvv\";\n\n/**\n * Builds Payment inputs inside a given form HTML element,\n * looking out form them in document if none given as parameter\n *\n * @param {HTMLFormElement} form to build the inputs inside\n * @returns {Object} object with data getters and validators\n */\nexport function setupCreditCardForm(options = {}) {\n const creditCardNumberInput = options.numberInput\n || document.querySelector(\n options.numberQuerySelector\n || \"#payment-input-form .credit-card-number-input\"\n );\n const expirationDateInput = options.expirationInput\n || document.querySelector(\n options.expirationQuerySelector\n || \"#payment-input-form .credit-card-expiration-date-input\"\n );\n const cvvInput = options.cvvInput\n || document.querySelector(\n options.cvvQuerySelector ||\n \"#payment-input-form .credit-card-cvv-input\"\n );\n\n const creditCardNumber = setupCreditCardNumberInput(creditCardNumberInput);\n const expirationDate = setupCCExpirationDateInput(expirationDateInput);\n const cvv = setupCCCVVInput(cvvInput);\n\n return {\n creditCardNumber,\n expirationDate,\n cvv\n };\n}","import { formatterCurrency } from \"../../formatters\";\nimport { PAYMENT_TYPE } from \"../../gtm_script\";\nimport { doesNotHaveValue, isPJ, parseFetchResponse } from \"../../helper_functions\";\nimport { getDescriptiveTime } from \"../../utils/get_descriptive_time\";\nimport { addCorrId, tapAndLoadCorrId } from \"../../utils/correlation_id_store\";\nimport { useRecaptcha } from \"../../utils/recaptcha_wrapper\";\n\nexport function initPix({ showPaymentError, setLoading }) {\n const PIX_STATUS_POLLING_TIME_LIMIT = window.PM3.PIX_STATUS_POLLING_TIME_LIMIT || 1000 * 60 * 5; // 5 min in ms\n const PIX_STATUS_POLLING_INTERVAL = window.PM3.PIX_STATUS_POLLING_INTERVAL || 1000 * 5; // 5s in ms\n const PIX_EXPIRATION_UPDATE_INTERVAL = window.PM3.PIX_EXPIRATION_UPDATE_INTERVAL || 60 * 1000;\n\n function fetchTransactionStatus(clientInstantPaymentId, signal) {\n return fetch(`/client_instant_payments/${clientInstantPaymentId}`, { signal, headers: addCorrId() })\n .then(tapAndLoadCorrId)\n .then(async (response) => {\n if (response.ok) {\n const { status, error } = await response.json();\n return { status, error };\n }\n return { status: undefined, error: await response.text() };\n })\n .catch((error) => {\n return { status: undefined, error: { type: \"requestError\", error } };\n });\n }\n\n let cancelPixPaymentValidationLoop;\n let timeLeftUpdateLoop;\n\n function closeQrCodeDialog() {\n cancelPixPaymentValidationLoop?.();\n timeLeftUpdateLoop?.();\n\n const dialog = document.getElementById(\"pix-dialog\");\n\n if (dialog.open) {\n dialog.close();\n }\n\n const amountHeader = dialog.querySelector(\".amount-header\");\n const img = dialog.querySelector(\"img.qr-code-img\");\n const copyCta = dialog.querySelector(\"button.qr-code-data-copy-cta\");\n const expirationInfoSpan = dialog.querySelector(\".qr-code-expiration-info\");\n\n img.src = \"\";\n copyCta.dataset.qrCode = \"\";\n amountHeader.textContent = \"\";\n expirationInfoSpan.textContent = \"Vence em\";\n }\n\n document.getElementById(\"pix-dialog\")\n .querySelector(\".close-qr-code-cta\")\n .addEventListener(\"click\", closeQrCodeDialog);\n\n document.getElementById(\"pix-dialog\").addEventListener(\"cancel\", (event) => {\n event.preventDefault();\n closeQrCodeDialog();\n });\n\n let copiedMessageTimeoutRef;\n\n document.getElementById(\"pix-dialog\")\n .querySelector(\"button.qr-code-data-copy-cta\")\n .addEventListener(\"click\", async function handleCopyCtaClick() {\n const dialog = document.getElementById(\"pix-dialog\");\n const self = dialog.querySelector(\"button.qr-code-data-copy-cta\");\n const qrCode = self.dataset.qrCode;\n if (!navigator || !(\"clipboard\" in navigator)) {\n throw new Error(\"Failed to copy Pix QR Code, Clipboard API not available\");\n }\n if (!qrCode) {\n throw new Error(\"Tried to copy empty Pix QR Code\");\n }\n await navigator.clipboard.writeText(qrCode);\n if (copiedMessageTimeoutRef) {\n clearTimeout(copiedMessageTimeoutRef);\n }\n const label = self.querySelector(\".qr-code-data-copy-cta-label\");\n const previousText = label.textContent;\n label.textContent = \"Copiado!\";\n copiedMessageTimeoutRef = setTimeout(() => {\n if (label.textContent !== previousText) {\n label.textContent = previousText;\n }\n }, 3000);\n });\n\n function pollTransactionConfirmation(clientInstantPaymentId, expirationTime = null) {\n if (cancelPixPaymentValidationLoop) {\n cancelPixPaymentValidationLoop();\n cancelPixPaymentValidationLoop = undefined;\n }\n\n let resolveAsPending;\n\n const controller = new AbortController();\n\n let timeoutId;\n\n const promise = new Promise((resolve, reject) => {\n const expirationDelta = expirationTime ? expirationTime * 1000 : PIX_STATUS_POLLING_TIME_LIMIT;\n const timeoutLimit = Date.now() + expirationDelta;\n resolveAsPending = () => {\n resolve(\"pending\");\n };\n function executeRequest() {\n if (timeoutId) clearTimeout(timeoutId);\n timeoutId = setTimeout(async () => {\n const expired = Date.now() > timeoutLimit;\n const { status, error } = await fetchTransactionStatus(clientInstantPaymentId, controller.signal);\n if (error) {\n promise.cancel(error);\n return reject(error);\n }\n if (status !== \"pending\") {\n return resolve(status);\n }\n if (expired) {\n return resolve(\"pending\");\n }\n executeRequest();\n }, PIX_STATUS_POLLING_INTERVAL);\n }\n executeRequest();\n });\n promise.cancel = (failed) => {\n if (!failed && resolveAsPending) {\n resolveAsPending();\n }\n clearTimeout(timeoutId);\n controller.abort();\n };\n cancelPixPaymentValidationLoop = promise.cancel;\n return promise;\n }\n\n const expirationDateTimeFormatter = new Intl.DateTimeFormat([\"pt-BR\"], {\n day: \"numeric\",\n month: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n second: \"2-digit\"\n });\n\n function showQrCodeDialog(clientInstantPaymentId, amount, imgSrc, dataContents, expiresIn) {\n setLoading(true);\n showPaymentError(\"\");\n const dialog = document.getElementById(\"pix-dialog\");\n const amountHeader = dialog.querySelector(\".amount-header\");\n const img = dialog.querySelector(\"img.qr-code-img\");\n const copyCta = dialog.querySelector(\"button.qr-code-data-copy-cta\");\n const expirationInfoSpan = dialog.querySelector(\".qr-code-expiration-info\");\n\n img.src = imgSrc;\n copyCta.dataset.qrCode = dataContents;\n amountHeader.textContent = formatterCurrency.format(amount / 100);\n\n const expirationTimestamp = Date.now() + (expiresIn * 1000);\n\n function updateExpirationTime() {\n const timeLeftInMs = expirationTimestamp - Date.now();\n const expiration = expirationDateTimeFormatter.format(expirationTimestamp);\n if (timeLeftInMs < 0) {\n timeLeftUpdateLoop?.();\n expirationInfoSpan.textContent = `Venceu em ${expiration}`;\n } else {\n expirationInfoSpan.textContent = `Vence em ${expiration} (${getDescriptiveTime(timeLeftInMs / 1000, true)})`;\n }\n }\n\n if (PIX_EXPIRATION_UPDATE_INTERVAL) {\n const expirationUpdateInterval = setInterval(updateExpirationTime, PIX_EXPIRATION_UPDATE_INTERVAL);\n timeLeftUpdateLoop = () => {\n clearInterval(expirationUpdateInterval);\n timeLeftUpdateLoop = undefined;\n };\n }\n\n updateExpirationTime();\n\n dialog.showModal();\n\n setLoading(false);\n\n return pollTransactionConfirmation(clientInstantPaymentId, expiresIn * 1000);\n }\n\n return {\n showQrCodeDialog,\n closeQrCodeDialog\n };\n}\n\nexport function setupPixPayment({\n clientForm,\n productForm,\n couponForm,\n bumpForm,\n formElements,\n formHelpers,\n showPaymentError,\n setLoading: baseSetLoading,\n gtm,\n setPaymentMethodSubmitHandler,\n onSuccess,\n onPending,\n onError,\n metadata: { mode = false } = {},\n}) {\n const setLoading = (state) => baseSetLoading(state, {\n label: formElements.submitButtonLabel,\n loading: formElements.loadingIndicator\n });\n\n const { showQrCodeDialog, closeQrCodeDialog } = initPix({ showPaymentError, setLoading });\n\n const pixTotalAmountSpans = document.querySelectorAll(\"#pix_total_amount\");\n\n let totalAmountOperators = [];\n\n function updateTotalAmount() {\n const { pixAmount } = formElements.getProductInfo({ formatted: false });\n const baseCents = (+pixAmount) * 100;\n const cents = totalAmountOperators.reduce((a, c, i, arr) => c(a, i, arr), baseCents);\n const amount = formatterCurrency.format(cents / 100);\n pixTotalAmountSpans.forEach(function updatePixTotalAmountSpans(span) {\n span.innerText = `${amount}`;\n });\n }\n\n if (couponForm && !couponForm.fixedCoupon) {\n let coupon\n function sumCouponInPixTotalAmount(value) {\n if (!coupon) return value;\n\n return coupon?.pixAmount || coupon?.pixAmount === 0 ? +coupon.pixAmount : value;\n }\n totalAmountOperators.unshift(sumCouponInPixTotalAmount);\n couponForm.addCouponChangeListener(function pixCouponChangeListener(state) {\n coupon = state;\n updateTotalAmount();\n });\n }\n\n if (bumpForm.enabled()) {\n let bumpState\n function sumBumpInPixTotalAmount(value) {\n if (!bumpState?.active) return value\n\n return value + bumpState.value\n }\n totalAmountOperators.push(sumBumpInPixTotalAmount);\n bumpForm.addChangeListener(function pixBumpChangeListener(state) {\n bumpState = state;\n updateTotalAmount();\n })\n }\n\n async function createOTOPixPayment(product_id, authenticity_token) {\n const grToken = await useRecaptcha('oto_pix_charge');\n const body = {\n gr_token: grToken,\n authenticity_token,\n provider: \"malga\",\n payment_method: \"pix\",\n product_id,\n };\n\n return fetch(\n \"/client_payments/oto\",\n {\n method: \"POST\",\n headers: addCorrId(new Headers({ \"Content-Type\": \"application/json\" })),\n body: JSON.stringify(body)\n }\n )\n .then(tapAndLoadCorrId)\n .then(parseFetchResponse)\n .catch((error) => {\n console.trace({ error });\n\n return null;\n });\n }\n\n async function createClientInstantPayment(product_id, authenticity_token, clientInfo) {\n const paymentInfo = formElements.getAmountAndCouponInformation();\n\n const body = {\n authenticity_token,\n provider: \"malga\",\n payment_method: \"pix\",\n product_id,\n client_payment: {\n product_id,\n installments_count: 1,\n provider: \"malga\",\n payment_type: \"pix\"\n },\n order_bump_active: bumpForm.enabled() && bumpForm.active(),\n coupons: formElements.getAmountAndCouponInformation()\n };\n\n body.client_payment = {\n ...body.client_payment,\n product_id,\n name: clientInfo.name,\n email: clientInfo.email,\n is_pj: clientInfo.is_pj,\n is_foreigner: clientInfo.is_foreigner,\n document: clientInfo.document,\n phone_number: clientInfo.phone_number,\n whatsapp_accept: clientInfo.whatsapp_accept,\n coupon_id: paymentInfo.coupon_id,\n amount_off: paymentInfo.coupon_amount_off,\n percent_off: paymentInfo.counpon_percent_off,\n discount_amount: paymentInfo.discount_amount,\n amount: paymentInfo.subtotal_amount,\n total_amount: paymentInfo.pix_amount\n };\n\n /**\n * @type {{\n * body: {\n * id: string;\n * provider: string;\n * amount: number;\n * stripe_customer: { id: string; };\n * stripe_payment_intent: { id: string, client_secret: string; };\n * }\n * }}\n */\n return fetch(\n \"/client_instant_payments\",\n {\n method: \"POST\",\n headers: addCorrId(new Headers({ \"Content-Type\": \"application/json\" })),\n body: JSON.stringify(body)\n }\n )\n .then(tapAndLoadCorrId)\n .then(parseFetchResponse)\n .catch((error) => {\n console.trace({ error });\n\n return null;\n });\n }\n\n // Submit the form to creates payment intent\n async function createPixCharge() {\n const authenticity_token = formElements.authenticityTokenElement.value;\n const product_id = productForm.getId();\n const clientInfo = clientForm.getFormData();\n\n const chargeStrategy = mode === 'oto' ? createOTOPixPayment : createClientInstantPayment;\n\n const clientInstantPaymentResponse = await chargeStrategy(product_id, authenticity_token, clientInfo);\n\n if (!clientInstantPaymentResponse) {\n setLoading(false);\n\n showPaymentError(\n \"Ocorreu um erro. Verifique os dados preenchidos e tente novamente em alguns minutos\"\n );\n\n return;\n }\n\n const {\n body: {\n id: clientInstantPaymentId,\n product_id: productId,\n product_name,\n // unit_amount: unitAmount, // exists here but not being used\n amount: totalAmount,\n // transaction_id, // exists here but not being used\n coupon_id, // exists here but not being used\n pix\n }\n } = clientInstantPaymentResponse;\n\n if (!pix?.qrCodeData) {\n setLoading(false);\n\n showPaymentError(\n \"Ocorreu um erro. Verifique os dados preenchidos e tente novamente em alguns minutos\"\n );\n\n return;\n }\n\n const pixStatusUpdate = await showQrCodeDialog(clientInstantPaymentId, totalAmount, pix.qrCodeImageUrl, pix.qrCodeData, pix.expiresIn);\n\n if (pixStatusUpdate === \"authorized\") {\n const updateClientInstantPaymentResponse = await fetch(\n `/client_instant_payments/${clientInstantPaymentId}`,\n {\n method: \"PATCH\",\n headers: addCorrId(new Headers({ \"Content-Type\": \"application/json\" })),\n body: JSON.stringify({\n authenticity_token,\n stripe_payment_intent: { status: pixStatusUpdate }\n })\n }\n )\n .then(tapAndLoadCorrId)\n .then(parseFetchResponse)\n .catch((error) => {\n console.error(\n \"Failed to update client instant payment with confirmed payment intent:\",\n error\n );\n return null;\n });\n if (\n updateClientInstantPaymentResponse === null ||\n updateClientInstantPaymentResponse.status !== 200\n ) {\n showPaymentError(\n \"Ocorreu um erro ao confirmar o pagamento. Verifique os dados e tente novamente.\"\n );\n throw new Error(\n updateClientInstantPaymentResponse?.body ??\n \"Failed to update client instant payment\"\n );\n }\n setLoading(false);\n baseSetLoading(false);\n const paymentValues = formElements.getAmountAndCouponInformation({ formatted: false });\n gtm.registerPurchaseEvent(PAYMENT_TYPE.pix, {\n coupon: coupon_id,\n discount: paymentValues.subtotal_amount - paymentValues.pix_amount,\n transactionId: clientInstantPaymentId,\n productId,\n productName: product_name,\n price: Number(totalAmount) / 100,\n fullName: clientInfo.name,\n email: clientInfo.email,\n phone: clientInfo.phone_number\n });\n onSuccess();\n } else if ([\"pre_authorized\", \"pending\"].includes(pixStatusUpdate)) {\n setLoading(false);\n baseSetLoading(false);\n onPending();\n } else {\n baseSetLoading(false);\n setLoading(false);\n closeQrCodeDialog();\n onError();\n }\n };\n\n async function handlePixChargeSubmission(_event) {\n const clientInfo = clientForm.getFormData();\n showPaymentError(\"\");\n\n if (mode !== \"oto\") { // if OTO do not validate client form\n if (!formHelpers.cpfCnpjValidator()) {\n showPaymentError(`${isPJ(clientForm.inputs.clientType.value) ? \"CNPJ\" : \"CPF\"} inválido`);\n return;\n }\n\n if (\n clientForm.isClientPj() &&\n doesNotHaveValue(clientForm.inputs.stateRegistrationInput) &&\n doesNotHaveValue(clientForm.inputs.municipalRegistrationInput)\n ) {\n if (formElements.stateRegistrationAlertMessageElement) {\n formElements.stateRegistrationAlertMessageElement.className = \"\";\n formElements.stateRegistrationAlertMessageElement.style =\n \"color:#FF5757; font-weight:600;\";\n }\n showPaymentError(\"Verifique as informações inseridas\");\n return;\n }\n\n if (formElements.stateRegistrationAlertMessageElement) {\n formElements.stateRegistrationAlertMessageElement.className = \"hidden\";\n }\n\n }\n baseSetLoading(true);\n setLoading(true);\n\n const productInfo = formElements.getProductInfo({ formatted: false });\n const paymentValues = formElements.getAmountAndCouponInformation({ formatted: false });\n\n gtm.registerCheckoutOptionEvent(PAYMENT_TYPE.pix, {\n price: paymentValues.pix_amount,\n discount: paymentValues.subtotal_amount - paymentValues.pix_amount,\n coupon: paymentValues.coupon_id,\n productName: productInfo.productName,\n productId: productInfo.productId,\n fullName: clientInfo.name,\n email: clientInfo.email,\n phone: clientInfo.phone_number\n });\n\n createPixCharge()\n .catch((error) => {\n showPaymentError(error.message);\n baseSetLoading(false);\n setLoading(false);\n console.trace(\n \"Failed to create payment method\",\n error.message,\n error?.stack ?? error\n );\n });\n };\n\n setPaymentMethodSubmitHandler(\"pix\", handlePixChargeSubmission);\n}\n","import { formatterCurrency } from \"../../formatters\";\nimport { PAYMENT_TYPE } from \"../../gtm_script\";\nimport { doesNotHaveValue, isPJ, parseFetchResponse } from \"../../helper_functions\";\nimport { addCorrId, tapAndLoadCorrId } from \"../../utils/correlation_id_store\";\nimport { useRecaptcha } from \"../../utils/recaptcha_wrapper\";\n\nconst NUPAY_STATUS_POLLING_TIME_LIMIT = 1000 * 60 * 5; // 5 min in ms\nconst NUPAY_STATUS_POLLING_INTERVAL = 1000 * 5; // 5s in ms\n\nexport function initNupay ({ setLoading, showPaymentError }) {\n function fetchTransactionStatus (clientInstantPaymentId, signal) {\n return fetch(`/client_instant_payments/${clientInstantPaymentId}`, { signal, headers: addCorrId() })\n .then(tapAndLoadCorrId)\n .then(async (response) => {\n if (response.ok) {\n const { status, error } = await response.json();\n return { status, error };\n }\n return { status: undefined, error: await response.text() };\n })\n .catch((error) => {\n return { status: undefined, error: { type: \"requestError\", error } };\n });\n }\n\n let cancelPaymentValidationLoop;\n\n function closeDialog () {\n if (cancelPaymentValidationLoop) {\n cancelPaymentValidationLoop();\n }\n\n const dialog = document.getElementById(\"nupay-dialog\");\n\n dialog.close();\n }\n\n document.getElementById(\"nupay-dialog\")\n .querySelector(\"button.close-dialog\")\n .addEventListener(\"click\", closeDialog);\n\n document.getElementById(\"nupay-dialog\").addEventListener(\"cancel\", (event) => {\n event.preventDefault();\n closeDialog();\n });\n\n function pollTransactionConfirmation (clientInstantPaymentId, expirationTime = null) {\n if (cancelPaymentValidationLoop) {\n cancelPaymentValidationLoop();\n cancelPaymentValidationLoop = undefined;\n }\n\n let resolveAsPending;\n\n const controller = new AbortController();\n\n let timeoutId;\n\n const promise = new Promise((resolve, reject) => {\n const expirationDelta = expirationTime ? expirationTime * 1000 : NUPAY_STATUS_POLLING_TIME_LIMIT;\n const timeoutLimit = Date.now() + expirationDelta;\n resolveAsPending = () => {\n resolve(\"pending\");\n };\n function executeRequest () {\n if (timeoutId) clearTimeout(timeoutId);\n timeoutId = setTimeout(async () => {\n const expired = Date.now() > timeoutLimit;\n const { status, error } = await fetchTransactionStatus(clientInstantPaymentId, controller.signal);\n if (error) {\n promise.cancel(error);\n return reject(error);\n }\n if (status !== \"pending\") {\n return resolve(status);\n }\n if (expired) {\n return resolve(\"pending\");\n }\n executeRequest();\n }, NUPAY_STATUS_POLLING_INTERVAL);\n }\n executeRequest();\n });\n promise.cancel = (failed) => {\n if (!failed && resolveAsPending) {\n resolveAsPending();\n }\n clearTimeout(timeoutId);\n controller.abort();\n };\n cancelPaymentValidationLoop = promise.cancel;\n return promise;\n }\n\n function showDialog (clientInstantPaymentId, expiresIn) {\n setLoading(true);\n showPaymentError(\"\");\n\n const dialog = document.getElementById(\"nupay-dialog\");\n\n dialog.showModal();\n\n return pollTransactionConfirmation(clientInstantPaymentId, expiresIn * 1000);\n }\n\n return {\n showDialog,\n closeDialog\n };\n}\n\nexport function setupNupayPayment ({\n clientForm,\n productForm,\n couponForm,\n bumpForm,\n formElements,\n formHelpers,\n showPaymentError,\n setLoading: baseSetLoading,\n gtm,\n setPaymentMethodSubmitHandler,\n onSuccess,\n onPending,\n onError,\n MPMInstance,\n metadata: { mode = false, showNupayFields = false } = {},\n}) {\n const setLoading = (state) => baseSetLoading(state, {\n label: formElements.submitButtonLabel,\n loading: formElements.loadingIndicator\n });\n\n const { showDialog, closeDialog } = initNupay({ setLoading, showPaymentError });\n\n const nupayTotalAmountSpan = document.getElementById(\"nupay_total_amount\");\n\n let totalAmountOperators = [];\n\n function updateTotalAmount() {\n const { unitAmount } = formElements.getProductInfo({ formatted: false });\n const baseCents = (+unitAmount) * 100;\n const cents = totalAmountOperators.reduce((a, c, i, arr) => c(a, i, arr), baseCents);\n const amount = formatterCurrency.format(cents / 100);\n nupayTotalAmountSpan.innerText = `Valor ${amount} em até 24x`;\n }\n\n if (couponForm && !couponForm.fixedCoupon) {\n let coupon\n function sumCouponInNupayTotalAmount(value) {\n if (!coupon) return value\n\n return coupon?.discountedAmount ? +coupon.discountedAmount : value;\n }\n totalAmountOperators.unshift(sumCouponInNupayTotalAmount)\n couponForm.addCouponChangeListener((state) => {\n coupon = state;\n updateTotalAmount();\n });\n }\n\n if (bumpForm.enabled()) {\n let bumpState\n function sumBumpInNupayTotalAmount(value) {\n if (!bumpState?.active) return value\n\n return value + bumpState.value\n }\n totalAmountOperators.push(sumBumpInNupayTotalAmount);\n bumpForm.addChangeListener(function nupayBumpChangeListener(state) {\n bumpState = state;\n updateTotalAmount();\n })\n }\n\n if (mode === 'oto' && showNupayFields) {\n MPMInstance.addListener((paymentMethod) => {\n const isRequired = paymentMethod === 'nupay';\n\n formHelpers.disableCpfCnpjFields(!isRequired);\n clientForm.setPersonalPhoneNumberRequired(isRequired);\n })\n }\n\n async function createOTONupayPayment ({\n authenticity_token,\n clientInfo,\n }) {\n const gr_token = await useRecaptcha('oto_nupay_charge');\n const sendDocument = document.getElementById('client_payment_use_saved_document')?.value != 'true'\n const sendPhone = document.getElementById('client_payment_use_saved_phone')?.value != 'true'\n\n const body = {\n gr_token,\n authenticity_token,\n provider: \"malga\",\n payment_method: \"nupay\",\n }\n\n if (sendDocument) {\n body.document = clientInfo.document;\n }\n\n if (sendPhone) {\n body.phone_number = clientInfo.phone;\n }\n\n return fetch('/client_payments/oto', {\n method: 'POST',\n headers: addCorrId(new Headers({ 'Content-Type': 'application/json' })),\n body: JSON.stringify(body),\n })\n .then(tapAndLoadCorrId)\n .then((response) => {\n if (!response.ok) {\n throw new Error('Erro ao criar pagamento');\n }\n return response;\n })\n .then(parseFetchResponse)\n .catch((error) => {\n console.trace({ error });\n\n return null;\n });\n }\n\n async function createClientInstantPayment ({\n authenticity_token,\n clientInfo,\n product_id,\n paymentInfo,\n }) {\n const body = {\n authenticity_token,\n provider: \"malga\",\n payment_method: \"nupay\",\n product_id,\n client_payment: {\n product_id,\n installments_count: 1,\n provider: \"malga\",\n payment_type: \"nupay\"\n },\n order_bump_active: bumpForm.enabled() && bumpForm.active(),\n coupons: formElements.getAmountAndCouponInformation()\n };\n\n body.client_payment = {\n ...body.client_payment,\n product_id,\n name: clientInfo.name,\n email: clientInfo.email,\n is_pj: clientInfo.is_pj,\n is_foreigner: clientInfo.is_foreigner,\n document: clientInfo.document,\n phone_number: clientInfo.phone_number,\n whatsapp_accept: clientInfo.whatsapp_accept,\n coupon_id: paymentInfo.coupon_id,\n amount_off: paymentInfo.coupon_amount_off,\n percent_off: paymentInfo.counpon_percent_off,\n discount_amount: paymentInfo.discount_amount,\n amount: paymentInfo.subtotal_amount,\n total_amount: paymentInfo.total_amount\n };\n\n /**\n * @type {{\n * body: {\n * id: string;\n * provider: string;\n * amount: number;\n * stripe_customer: { id: string; };\n * stripe_payment_intent: { id: string, client_secret: string; };\n * }\n * }}\n */\n return fetch(\n \"/client_instant_payments\",\n {\n method: \"POST\",\n headers: addCorrId(new Headers({ \"Content-Type\": \"application/json\" })),\n body: JSON.stringify(body)\n }\n )\n .then(tapAndLoadCorrId)\n .then(parseFetchResponse)\n .catch((error) => {\n console.trace({ error });\n\n return null;\n });\n }\n\n // Submit the form to creates payment intent\n async function createNupayCharge () {\n const authenticity_token = formElements.authenticityTokenElement.value;\n const product_id = productForm.getId();\n const clientInfo = clientForm.getFormData();\n const paymentInfo = formElements.getAmountAndCouponInformation();\n\n const chargeStrategy = mode === \"oto\"\n ? createOTONupayPayment\n : createClientInstantPayment;\n\n const clientInstantPaymentResponse = await chargeStrategy({\n authenticity_token,\n product_id,\n clientInfo,\n paymentInfo,\n });\n\n if (!clientInstantPaymentResponse) {\n setLoading(false);\n\n showPaymentError(\n \"Ocorreu um erro. Verifique os dados preenchidos e tente novamente em alguns minutos\"\n );\n\n return;\n }\n\n const {\n body: {\n id: clientInstantPaymentId,\n product_id: productId,\n product_name,\n // unit_amount: unitAmount, // exists here but not being used\n amount: totalAmount,\n // transaction_id, // exists here but not being used\n // coupon_id, // exists here but not being used\n }\n } = clientInstantPaymentResponse;\n\n const pixStatusUpdate = await showDialog(clientInstantPaymentId);\n\n if (pixStatusUpdate === \"authorized\") {\n const updateClientInstantPaymentResponse = await fetch(\n `/client_instant_payments/${clientInstantPaymentId}`,\n {\n method: \"PATCH\",\n headers: addCorrId(new Headers({ \"Content-Type\": \"application/json\" })),\n body: JSON.stringify({\n authenticity_token: authenticity_token,\n stripe_payment_intent: { status: pixStatusUpdate }\n })\n }\n )\n .then(tapAndLoadCorrId)\n .then(parseFetchResponse)\n .catch((error) => {\n console.error(\n \"Failed to update client instant payment with confirmed payment intent:\",\n error\n );\n return null;\n });\n if (\n updateClientInstantPaymentResponse === null ||\n updateClientInstantPaymentResponse.status !== 200\n ) {\n showPaymentError(\n \"Ocorreu um erro ao confirmar o pagamento. Verifique os dados e tente novamente.\"\n );\n throw new Error(\n updateClientInstantPaymentResponse?.body ??\n \"Failed to update client instant payment\"\n );\n }\n setLoading(false);\n baseSetLoading(false);\n await gtm.registerPurchaseEvent(PAYMENT_TYPE.nupay, {\n coupon: paymentInfo.coupon_id,\n discount: paymentInfo.discount_amount,\n transactionId: clientInstantPaymentId,\n productId,\n productName: product_name,\n price: Number(totalAmount) / 100\n });\n onSuccess();\n } else if ([\"pre_authorized\", \"pending\"].includes(pixStatusUpdate)) {\n setLoading(false);\n baseSetLoading(false);\n onPending();\n } else {\n baseSetLoading(false);\n setLoading(false);\n closeDialog();\n onError();\n }\n };\n\n function handleNupayChargeSubmission (_event) {\n showPaymentError(\"\");\n\n if ((mode != 'oto' || showNupayFields) && !formHelpers.cpfCnpjValidator()) {\n showPaymentError(`${isPJ(clientForm.inputs.clientType.value) ? \"CNPJ\" : \"CPF\"} inválido`);\n return;\n }\n\n if (\n clientForm.isClientPj() &&\n doesNotHaveValue(clientForm.inputs.stateRegistrationInput) &&\n doesNotHaveValue(clientForm.inputs.municipalRegistrationInput)\n ) {\n if (formElements.stateRegistrationAlertMessageElement) {\n formElements.stateRegistrationAlertMessageElement.className = \"\";\n formElements.stateRegistrationAlertMessageElement.style =\n \"color:#FF5757; font-weight:600;\";\n }\n showPaymentError(\"Verifique as informações inseridas\");\n return;\n }\n\n if (formElements.stateRegistrationAlertMessageElement) {\n formElements.stateRegistrationAlertMessageElement.className = \"hidden\";\n }\n baseSetLoading(true);\n setLoading(true);\n\n const productInfo = formElements.getProductInfo({ formatted: false });\n const paymentValues = formElements.getAmountAndCouponInformation({ formatted: false });\n\n gtm.registerCheckoutOptionEvent(PAYMENT_TYPE.nupay, {\n price: paymentValues.total_amount,\n discount: paymentValues.discount_amount,\n coupon: paymentValues.coupon_id,\n productName: productInfo.productName,\n productId: productInfo.productId\n });\n\n createNupayCharge()\n .catch((error) => {\n showPaymentError(error.message);\n baseSetLoading(false);\n setLoading(false);\n console.error(\n \"Failed to create payment method\",\n error.message,\n error?.stack ?? error\n );\n throw error;\n });\n };\n\n setPaymentMethodSubmitHandler(\"nupay\", handleNupayChargeSubmission);\n}\n","import { isPJ } from \"../../../helper_functions\";\nimport { vanishElement } from \"../../vanish_element\";\n\nexport function setPhoneNumberRequired(isRequired, { isClientPj, phoneNumberInput }) {\n if (isClientPj()) {\n return;\n }\n const label = document.querySelector(`label[for=\"${phoneNumberInput.id}\"]`);\n if (isRequired) {\n phoneNumberInput.setAttribute(\"required\", true);\n phoneNumberInput.setAttribute(\"pattern\", \"\\\\(\\\\d{2}\\\\)\\\\s\\\\d{5}-\\\\d{4}\");\n phoneNumberInput.setAttribute(\"title\", \"Número de telefone deve ser no formato (99) 99999-9999\");\n label.classList.add(\"required\");\n label.querySelector(\"small\").classList.add(\"inline-zero-width\");\n } else {\n phoneNumberInput.removeAttribute(\"required\");\n phoneNumberInput.removeAttribute(\"pattern\");\n phoneNumberInput.removeAttribute(\"title\");\n label.classList.remove(\"required\");\n label.querySelector(\"small\").classList.remove(\"inline-zero-width\");\n }\n}\n\nexport function setupClientForm () {\n // Defines PF or PJ from backend\n const clientTypeInput = document.getElementById(\"client_payment_client_type\");\n\n // form\n const formElement = document.getElementById(\"client_payment_form\");\n const nameInput = document.getElementById(\"client_payment_name\");\n const emailInput = document.getElementById(\"client_payment_email\");\n const documentInput = document.getElementById(\"client_payment_document\");\n const isForeignerInput = document.getElementById(\"is_foreigner\");\n const phoneNumberInput = document.getElementById(\n \"client_payment_phone_number\"\n );\n const whatsappAcceptElement = document.getElementById(\"whatsapp_checkbox\");\n // CNPJ registration\n const stateRegistrationInput = formElement?.querySelector(\n \"input#client_payment_state_registration\"\n );\n const municipalRegistrationInput = formElement?.querySelector(\n \"input#client_payment_municipal_registration\"\n );\n\n const clientCreatedAtHiddenInput = document.getElementById(\"client_created_at\");\n\n function isClientPj () {\n return isPJ(clientTypeInput.value);\n }\n\n return {\n isClientPj,\n getClientInformation () {\n return {\n client_name: nameInput.value,\n client_email: emailInput.value,\n client_document: documentInput.value,\n client_phone_number: phoneNumberInput.value,\n client_created_at: clientCreatedAtHiddenInput.value,\n client_whatsapp_accept: whatsappAcceptElement.checked,\n client_state_registration: stateRegistrationInput?.value.trim() ?? \"\",\n client_municipal_registration: municipalRegistrationInput?.value.trim() ?? \"\"\n };\n },\n getFormData () {\n const pj = isClientPj();\n const base = {\n name: nameInput.value,\n email: emailInput.value,\n is_pj: pj,\n is_foreigner: false,\n document: documentInput.value,\n phone_number: phoneNumberInput.value,\n whatsapp_accept: whatsappAcceptElement.checked,\n created_at: clientCreatedAtHiddenInput.value\n };\n\n return pj\n ? {\n ...base,\n state_registration: stateRegistrationInput.value,\n municipalRegistrationInput: municipalRegistrationInput.value\n }\n : {\n ...base,\n is_foreigner: isForeignerInput?.checked\n };\n },\n setPersonalDocumentRequired (isRequired = false) {\n if (isClientPj()) {\n return;\n }\n vanishElement(isForeignerInput.parentElement, isRequired);\n // Nupay Requires CPF (Nupay is not available for PJ)\n const label = document.querySelector(\"label[for=client_payment_document]\");\n const error = document.querySelector(\"#document_validation\");\n if (isRequired) {\n documentInput.setAttribute(\"required\", true);\n label.classList.add(\"required\");\n label.querySelector(\"small\").classList.add(\"inline-zero-width\");\n } else {\n documentInput.removeAttribute(\"required\");\n label.classList.remove(\"required\");\n label.querySelector(\"small\").classList.remove(\"inline-zero-width\");\n error.classList.add(\"hidden\");\n }\n },\n setPersonalPhoneNumberRequired (isRequired = false) {\n return setPhoneNumberRequired(isRequired, { isClientPj, phoneNumberInput });\n },\n inputs: {\n clientTypeInput,\n nameInput,\n emailInput,\n documentInput,\n isForeignerInput,\n phoneNumberInput,\n whatsappAcceptElement,\n stateRegistrationInput,\n municipalRegistrationInput\n }\n };\n}\n","import { getValueWithoutFormat } from \"../../../formatters\";\n\nexport function setupProductForm () {\n // Product details\n const idHiddenInput = document.getElementById(\"product_id\");\n const nameHiddenInput = document.getElementById(\"product_name\");\n const unitAmountHiddenInput = document.getElementById(\"unit-amount\") || document.getElementById(\"payment-total\");\n const providerHiddenInput = document.getElementById(\"provider\");\n\n return {\n getId () {\n return idHiddenInput.value;\n },\n getName () {\n return nameHiddenInput.value;\n },\n getProvider () {\n return providerHiddenInput.value;\n },\n getUnitAmountValue (formatted = false) {\n return formatted\n ? unitAmountHiddenInput\n : getValueWithoutFormat(unitAmountHiddenInput?.innerText) / 100;\n },\n inputs: {\n idHiddenInput,\n nameHiddenInput,\n unitAmountHiddenInput\n }\n };\n}\n","import { vanishElement } from \"../../utils/vanish_element\";\n\nlet listeners = [];\n\nfunction addListener (listener) {\n listeners = [...listeners, listener];\n}\n\nfunction removeListener (listener) {\n listeners = listeners.filter(registeredListener => registeredListener !== listener);\n}\n\nfunction createToggleTabHandler (tabTriggersList, contentsContainerElement) {\n return function toggleTabHandler (event) {\n event.preventDefault();\n\n if (event.target.disabled) return;\n\n const contentIdToShow = this.dataset?.contentContainerId; // this uses data-content-container-id attr\n\n tabTriggersList.forEach((tabTriggerElement) => {\n tabTriggerElement.classList.toggle(\"active-tab\", this === tabTriggerElement);\n });\n\n const childrenList = Array.from(contentsContainerElement.children);\n\n childrenList.forEach((child) => {\n if (child?.classList.contains(\"mpm-tab-contents\")) {\n const isActiveTabContentsContainer = child.id === contentIdToShow;\n vanishElement(child, !isActiveTabContentsContainer);\n }\n });\n\n listeners.forEach((listener) => {\n listener(this.dataset.paymentMethod, this);\n });\n };\n}\n\nexport function setupMPMTabs (tabsContentsContainerElement) {\n const mpmButtons = Array.from(document.getElementsByClassName(\"tab-trigger\"))\n .map((element, _idx, tabTriggerList) => {\n const targetContentId = element?.dataset?.contentContainerId;\n const contentContainerElement = document.getElementById(targetContentId);\n const clickHandler = createToggleTabHandler(tabTriggerList, tabsContentsContainerElement, targetContentId);\n element.addEventListener(\"click\", clickHandler);\n return {\n clickHandler,\n element,\n contentContainerElement\n };\n });\n\n function setButtonsDisabled (state) {\n mpmButtons.forEach(({ element }) => {\n if (state) {\n element.classList.toggle(\"disabled\", true);\n element.setAttribute(\"disabled\", true);\n } else {\n element.classList.toggle(\"disabled\", false);\n element.removeAttribute(\"disabled\");\n }\n });\n }\n\n return {\n addListener,\n removeListener,\n setButtonsDisabled\n };\n};\n","import { couponFormFactory } from \"./coupon_form_factory\";\nimport {\n getFormattedCurrencyValueFromEl,\n getValueWithoutFormat,\n formatterCurrency,\n getLowerCaseInputValue,\n} from \"./formatters\";\nimport {\n isPJ,\n doesNotHaveValue,\n parseFetchResponse,\n checkoutCustomerFormHelpers,\n disableSubmitButtonElement,\n setElementHiddenClass,\n disableRequiredInputField,\n} from \"./helper_functions\";\nimport { debounced } from \"./debounced\";\nimport { GtmFactory, CHECKOUT_STEP, PAYMENT_TYPE } from \"./gtm_script\";\nimport { setupMPMTabs } from \"./payments/malga/mpm_tabs\";\nimport { setupPixPayment } from \"./payments/malga/pix\";\nimport { setupNupayPayment } from \"./payments/malga/nupay\";\nimport { addCorrId, tapAndLoadCorrId } from './utils/correlation_id_store';\nimport { setupClientForm } from \"./utils/form/client/client_form\";\nimport { setupCreditCardForm } from \"./utils/form/payment/cc_form\";\nimport { getPaymentInfoHelpers } from \"./utils/form/payment/payment_form\";\nimport { setupProductForm } from \"./utils/form/product/product_form\";\nimport { useRecaptcha } from \"./utils/recaptcha_wrapper\";\nimport { webhook } from \"./webhook_service\";\n\nexport async function setupMalgaPayment(MPMInstance) {\n let paymentIntentId = null;\n\n // eslint-disable-next-line eqeqeq\n const tokenize_cvv = document.getElementsByName(\"save_card\").item(0)?.value == \"true\";\n\n // Product details\n const productIdHiddenInput = document.getElementById(\"product_id\");\n const productNameHiddenInput = document.getElementById(\"product_name\");\n const productUnitAmountHiddenInput = document.getElementById(\"unit-amount\") || document.getElementById(\"payment-total\");\n const paymentTotalSpan = document.getElementById(\"payment-total\");\n const pixTotalAmountSpan = document.getElementById('pix_total_amount');\n\n // Defines PF or PJ from backend\n const formClientType = document.getElementById(\"client_payment_client_type\");\n const pjMode = isPJ(formClientType.value);\n\n // form\n const formElement = document.getElementById(\"client_payment_form\");\n const formNameInput = document.getElementById(\"client_payment_name\");\n const formEmailInput = document.getElementById(\"client_payment_email\");\n const formDocumentInput = document.getElementById(\"client_payment_document\");\n const isForeignerInput = document.getElementById(\"is_foreigner\");\n const formPhoneNumberInput = document.getElementById(\"client_payment_phone_number\");\n const whatsappAcceptElement = document.getElementById(\"whatsapp_checkbox\");\n // CNPJ registration\n const stateRegistrationInput = formElement.querySelector(\"input#client_payment_state_registration\");\n const municipalRegistrationInput = formElement.querySelector(\"input#client_payment_municipal_registration\");\n\n const productProviderHiddenInput = document.getElementById(\"provider\");\n // const clientCreatedAtHiddenInput = document.getElementById(\"client_created_at\");\n const formCouponIdHiddenInput = document.getElementById(\"client_payment_coupon_id\");\n const formAmountOffHiddenInput = document.getElementById(\"client_payment_amount_off\");\n const formPercentOffHiddenInput = document.getElementById(\"client_payment_percent_off\");\n const formDiscountAmountHiddenInput = document.getElementById(\"client_payment_discount_amount\");\n const formAmountHiddenInput = document.getElementById(\"client_payment_amount\");\n const formTotalAmountHiddenInput = document.getElementById(\"client_payment_total_amount\");\n const formPixAmountHiddenInput = document.getElementById(\"client_payment_pix_amount\");\n const formTotalPixAmountHiddenInput = document.getElementById(\"client_payment_total_pix_amount\");\n const formCountInstallmentsHiddenInput = document.getElementById(\"client_payment_installments_count\");\n const formFixedInstallmentHiddenInput = document.getElementById(\"client_payment_fixed_installments\");\n\n const stateRegistrationAlertMessageElement = document.querySelector(\"#error_registration\");\n const formDocumentAlertMessageSpan = document.querySelector(\"#document_validation\");\n\n // UI Form elements\n const whatsappLabelElement = document.getElementById(\"whatsapp_label\");\n const documentLabelElement = document.getElementById(\"document_label\");\n const showInstallmentsSpan = document.getElementById(\"show-installments\");\n\n /** @type {HTMLFormElement} */\n const paymentInputsForm = document.getElementById(\"payment-input-form\");\n\n /** @type {HTMLButtonElement} */\n const submitButtonElement = document.querySelector(\"#submit\");\n\n /** @type {HTMLDivElement} */\n const buttonLoadingSpinner = submitButtonElement.querySelector(\"#pay-now-button-spinner\");\n /** @type {HTMLSpanElement} */\n const payNowButtonLabel = submitButtonElement.querySelector(\"#pay-now-button-label\");\n\n const formHelpers = checkoutCustomerFormHelpers({\n alertMessageDocumentElement: formDocumentAlertMessageSpan,\n documentLabelElement,\n formDocumentElement: formDocumentInput,\n formPhoneNumberElement: formPhoneNumberInput,\n formClientType,\n isForeignerElement: isForeignerInput,\n submitButtonElement,\n whatsappAcceptElement,\n whatsappLabelElement\n });\n\n const clientForm = setupClientForm(formHelpers);\n\n /** @type {HTMLOptionElement[]} */\n const installmentsOptionsElements = Array.from(\n document.querySelectorAll(\n \"form#client_payment_form select[name=\\\"client_payment[installments_count]\\\"] > option\"\n )\n );\n\n const bumpForm = {\n listeners: [],\n getActiveEl() {\n return document.getElementById(\"order-bump-active\");\n },\n getValueEl() {\n return document.getElementById(\"order-bump-value\");\n },\n enabled() {\n return Boolean(this.getActiveEl() && this.getValueEl());\n },\n active() {\n const el = this.getActiveEl();\n return Boolean(el?.checked || false);\n },\n getValue() {\n const el = this.getValueEl();\n const value = Number(el?.value);\n return Number.isNaN(value) || !value || value < 0 ? 0 : value;\n },\n triggerChange() {\n const state = {\n active: this.active(),\n activeEl: this.getActiveEl(),\n value: this.getValue(),\n };\n this.listeners.forEach((listener) => listener(state));\n },\n addChangeListener(listener) {\n if (!this.listeners.includes(listener)) {\n this.listeners.push(listener);\n }\n }\n }\n\n bumpForm.getActiveEl()?.addEventListener(\"change\", function bumpOrderActiveHandler() {\n bumpForm.triggerChange();\n });\n\n // Coupon Form init\n const couponElements = window.coupon_accepted && {\n formAmountHiddenInput,\n couponInput: document.getElementById(\"coupon_id\"),\n discountAmountSpan: document.getElementById(\"discount-amount\"),\n paymentTotalSpan,\n clearCouponButton: document.getElementById(\"clear_coupon\"),\n errorSpanContainer: document.getElementById(\"coupon-container\")?.parentElement,\n submitCouponButton: document.getElementById(\"submit_coupon\"),\n pixTotalAmountSpan,\n emailInput: formEmailInput,\n submitFormButton: submitButtonElement\n };\n\n const couponForm = window.coupon_accepted && couponFormFactory({\n elements: couponElements,\n productId: productIdHiddenInput.value\n });\n\n /**\n * Update installments options or span\n *\n * @param {string} amount numeric value\n * @param {boolean} [fixedInstallments=false] flag\n */\n const updateInstallments = (amount, fixedInstallments = false) => {\n if (fixedInstallments) {\n // operates over single span element\n const numericValue = Number(formCountInstallmentsHiddenInput.value);\n const formattedInstallmentValue = formatterCurrency.format(\n Number(amount) / numericValue\n );\n showInstallmentsSpan.innerText = `${numericValue}x ${formattedInstallmentValue} sem juros`;\n } else {\n // operate over options elements\n installmentsOptionsElements.forEach(function (item) {\n const numericValue = Number(item.value);\n const formattedInstallmentValue = formatterCurrency.format(\n Number(amount) / numericValue\n );\n item.innerText = `${numericValue}x ${formattedInstallmentValue} sem juros`;\n });\n }\n };\n\n if (window.coupon_accepted) {\n let timeoutRef = null;\n if (couponForm && !couponForm.fixedCoupon) {\n if (couponForm) {\n /**\n * Handles changes in coupon values\n *\n * @param {{\n * amount: string\n * amountOff: number\n * coupon: string\n * discountAmount: number\n * discountedAmount: number\n * formattedDiscount: string\n * formattedDiscountedAmount: string\n * percentOff: string\n * pixAmount: number\n * } | null} coupon\n * @param {boolean=} clear\n */\n const couponChangeHandler = (coupon, clear = false) => {\n const bumpValue = bumpForm.active() ? bumpForm.getValue() : 0;\n const rawOriginalAmount = (Number(formAmountHiddenInput.value) + bumpValue) / 100;\n const originalAmount = formatterCurrency.format(rawOriginalAmount);\n\n if (clear) {\n formCouponIdHiddenInput.value = \"\";\n formTotalAmountHiddenInput.value = formAmountHiddenInput.value;\n formTotalPixAmountHiddenInput.value = formPixAmountHiddenInput.value;\n formDiscountAmountHiddenInput.value = \"\";\n formAmountOffHiddenInput.value = \"\";\n formPercentOffHiddenInput.value = \"\";\n\n couponElements.paymentTotalSpan.innerText = originalAmount;\n couponElements.discountAmountSpan.innerText = \"\";\n\n updateInstallments(rawOriginalAmount, formFixedInstallmentHiddenInput?.value === \"true\");\n return;\n } else if (coupon === null && formCouponIdHiddenInput.value) {\n if (timeoutRef !== null) {\n clearTimeout(timeoutRef);\n }\n timeoutRef = setTimeout(() => {\n couponForm.removeErrorSpan();\n }, 3000);\n return;\n } else if (coupon === null) {\n couponForm.appendErrorSpan();\n return;\n }\n\n couponForm.removeErrorSpan();\n\n formAmountOffHiddenInput.value = coupon.amountOff;\n formCouponIdHiddenInput.value = coupon.coupon;\n formDiscountAmountHiddenInput.value = coupon.discountAmount;\n formTotalAmountHiddenInput.value = coupon.discountedAmount;\n formPercentOffHiddenInput.value = coupon.percentOff;\n formTotalPixAmountHiddenInput.value = coupon.pixAmount;\n\n couponElements.paymentTotalSpan.innerText = bumpValue\n ? formatterCurrency.format((coupon.discountedAmount + bumpValue) / 100)\n : coupon.formattedDiscountedAmount;\n couponElements.discountAmountSpan.innerText = coupon.formattedDiscount;\n\n updateInstallments(\n (coupon.discountedAmount + bumpValue) / 100,\n formFixedInstallmentHiddenInput?.value === \"true\",\n );\n };\n couponForm.addCouponChangeListener(couponChangeHandler);\n }\n }\n }\n // END of Coupon Form\n\n if (bumpForm.getActiveEl()) {\n const paymentTotalSpan = document.getElementById(\"payment-total\");\n bumpForm.addChangeListener(function orderBumpCardTotalListener({ active, value }) {\n const bumpValue = active ? value : 0;\n const totalWithoutBump = Number(formTotalAmountHiddenInput.value);\n const totalWithBump = (totalWithoutBump + bumpValue) / 100;\n\n paymentTotalSpan.innerText = formatterCurrency.format(totalWithBump);\n updateInstallments(totalWithBump, formFixedInstallmentHiddenInput?.value === \"true\");\n });\n }\n\n /**\n * Show a spinner on payment submission\n *\n * @param {boolean} isLoading\n */\n const setLoading = function (isLoading) {\n // Disable the button and show the spinner\n disableSubmitButtonElement(submitButtonElement, isLoading);\n MPMInstance?.setButtonsDisabled(isLoading);\n\n setElementHiddenClass(buttonLoadingSpinner, !isLoading);\n setElementHiddenClass(payNowButtonLabel, isLoading);\n };\n\n // Show the customer the error from Stripe if their card fails to charge\n const showPaymentError = function (errorMsgText) {\n setLoading(false);\n const errorMsg = document.querySelector(\"#card-error\");\n errorMsg.textContent = errorMsgText;\n };\n\n function sendCardErrorToWebhook(errorCode, error) {\n webhook.sendPost(\"/webhooks\", {\n error_level: \"tokenization\",\n error_code: errorCode,\n error_contents: error.toString(),\n payment_intent_id: paymentIntentId,\n product_name: productNameHiddenInput.value,\n product_id: productIdHiddenInput.value,\n coupon_id: couponElements?.couponInput?.value\n }, {\n \"Content-Type\": \"application/json\",\n \"X-Payment-Error\": \"tokenization\"\n });\n }\n\n // Get payment information from form\n const getPaymentInformation = () => ({\n coupon_amount_off: getFormattedCurrencyValueFromEl(formAmountOffHiddenInput),\n discount_amount: getFormattedCurrencyValueFromEl(formDiscountAmountHiddenInput),\n subtotal_amount: productUnitAmountHiddenInput?.innerText,\n total_amount: getFormattedCurrencyValueFromEl(formTotalAmountHiddenInput),\n amount: getFormattedCurrencyValueFromEl(formAmountHiddenInput),\n coupon_id: formCouponIdHiddenInput.value,\n coupon_percent_off: formPercentOffHiddenInput.value,\n provider: productProviderHiddenInput.value,\n product_name: productNameHiddenInput.value,\n product_id: productIdHiddenInput.value,\n installments_count: formCountInstallmentsHiddenInput.value\n });\n\n // Get client payment information from form\n const getClientPaymentFormData = (paymentMethodId, cvvToken) => ({\n name: formNameInput.value,\n email: formEmailInput.value,\n document: formDocumentInput.value,\n phone_number: formPhoneNumberInput.value,\n coupon_id: formCouponIdHiddenInput.value,\n amount_off: formAmountOffHiddenInput.value,\n percent_off: formPercentOffHiddenInput.value,\n discount_amount: formDiscountAmountHiddenInput.value,\n amount: (getValueWithoutFormat(formAmountHiddenInput.value) / 100.0).toFixed(2),\n total_amount: (getValueWithoutFormat(formTotalAmountHiddenInput.value) / 100.0).toFixed(2),\n product_id: productIdHiddenInput.value,\n whatsapp_accept: whatsappAcceptElement.checked,\n installments_count: formCountInstallmentsHiddenInput.value,\n payment_method_id: cvvToken ? `${paymentMethodId}:${cvvToken}` : paymentMethodId,\n payment_intent_id: paymentIntentId,\n is_foreigner: isForeignerInput?.checked,\n provider: productProviderHiddenInput.value,\n is_pj: formHelpers.pjMode,\n });\n\n const productForm = setupProductForm();\n\n const paymentHelpers = getPaymentInfoHelpers();\n\n const gtm = GtmFactory();\n gtm.sendBeginCheckout({\n productId: productIdHiddenInput.value,\n productName: productNameHiddenInput.value,\n price: formTotalAmountHiddenInput.value / 100,\n coupon: formCouponIdHiddenInput.value,\n discount: formDiscountAmountHiddenInput.value / 100,\n fullName: formNameInput.value,\n email: formEmailInput.value,\n phone: formPhoneNumberInput.value\n });\n\n const creditCardForm = setupCreditCardForm(paymentInputsForm);\n\n /**\n * Sets inputs blur event to send partial filled form data to backend as a paymentIntent\n */\n const createPaymentIntentOnDB = async () => {\n if (formEmailInput.value.trim().length) {\n const url = window.PM3.paymentIntentsPath;\n const body = {\n payment_intent: {\n id: paymentIntentId,\n name: formNameInput.value,\n email: getLowerCaseInputValue(formEmailInput),\n product_name: productNameHiddenInput.value,\n product_id: productIdHiddenInput.value,\n total_amount: formTotalAmountHiddenInput.value,\n phone_number: formPhoneNumberInput.value\n }\n };\n const response = await webhook.sendPost(url, body);\n if (response.ok) {\n paymentIntentId = response.body.payment_intent.id;\n }\n }\n };\n\n // Sets email field to trigger a Create Payment Intent on lost of focus\n formEmailInput.addEventListener(\"blur\", () => {\n if (formEmailInput.value.trim().length) createPaymentIntentOnDB();\n });\n\n // Sets phone number field to trigger a Create Payment Intent on lost of focus\n formPhoneNumberInput.addEventListener(\"blur\", () => {\n if (formPhoneNumberInput.value.trim().length) createPaymentIntentOnDB();\n });\n\n // Shows a success message when the payment is complete and redirect\n const showOrderCompleteAndRedirect = () => {\n showPaymentError(\"\");\n const redirectURL = document.getElementById(\"typ_url\").value;\n const spinnerLoading = document.getElementById(\"spinner-loading\");\n\n disableSubmitButtonElement(submitButtonElement);\n\n setTimeout(() => {\n window.parent.location.replace(redirectURL);\n }, 2000);\n\n spinnerLoading.classList.remove(\"hidden\");\n payNowButtonLabel.innerText = \"Pagamento feito com sucesso!\";\n };\n\n /**\n * Submit the form to creates payment intent\n *\n * @param {string} paymentMethodId from the tokenization service\n */\n const fetchClientPayment = (paymentMethodId, cvvToken) => {\n const [authenticityTokenElement] = Array.from(\n document.getElementsByName(\"authenticity_token\")\n );\n\n const body = {\n authenticity_token: authenticityTokenElement.value,\n order_bump_active: bumpForm.active(),\n client_payment: getClientPaymentFormData(\n paymentMethodId,\n cvvToken\n )\n };\n\n useRecaptcha('charge')\n .then((grToken) => fetch(\"/client_payments\", {\n method: \"POST\",\n headers: addCorrId(new Headers({ \"Content-Type\": \"application/json\" })),\n body: JSON.stringify({ ...body, gr_token: grToken })\n }))\n .then(tapAndLoadCorrId)\n .then(parseFetchResponse)\n .then(async (clientPaymentResponse) => {\n if (\"error_message\" in clientPaymentResponse.body) {\n console.error({ clientPaymentResponse });\n if (clientPaymentResponse.body?.error?.status == \"failed\") {\n if (clientPaymentResponse.body.error.statusReason) throw new Error(`reason:${clientPaymentResponse.body.error.statusReason}`);\n }\n throw new Error(clientPaymentResponse.body.error_message);\n }\n\n if (clientPaymentResponse.status === 200) {\n // The payment had an error!\n throw new Error(clientPaymentResponse.body?.error_message ?? clientPaymentResponse.body?.error ?? \"Unknown failure to register client payment\");\n }\n\n // The payment succeeded!\n const { product_id, coupon_id, stripe_confirm_payment_data, id: transactionId } = clientPaymentResponse.body;\n const revenue = stripe_confirm_payment_data.amount / 100;\n const amount = clientPaymentResponse.body.amount / 100;\n\n const gtmPurchaseEventData = {\n transactionId, // Transaction ID. Required for purchases and refunds.\n coupon: coupon_id,\n totalAmount: revenue,\n productId: product_id,\n productName: stripe_confirm_payment_data.metadata.product_name,\n price: revenue,\n discount: amount - revenue,\n fullName: formNameInput.value,\n email: formEmailInput.value,\n phone: formPhoneNumberInput.value\n };\n const webhooks = [\n gtm.sendEvent(CHECKOUT_STEP.purchase, gtmPurchaseEventData, PAYMENT_TYPE.card), // not webhook but async analytics\n ];\n\n await Promise.allSettled(webhooks);\n\n showOrderCompleteAndRedirect();\n })\n .catch((error) => {\n if (\"stack\" in error) {\n console.error(\"Failed to create client_payment\", error.stack);\n } else {\n console.trace(\"Failed to create client_payment\", error);\n }\n setLoading(false);\n\n const defaultErrorMessage = \"Ocorreu um erro. Verifique os dados preenchidos e tente novamente em alguns minutos\";\n if (error.message && /^reason:.+/.test(error.message)) {\n showPaymentError(error.message.split(':')[1])\n } else if (error.message) {\n switch (error.message) {\n case \"Invalid CVV\":\n showPaymentError(\"CVV de cartão de crédito inválido\");\n break;\n case \"expired_card\":\n showPaymentError(\"Cartão de crédito expirado\");\n default:\n showPaymentError(defaultErrorMessage);\n }\n } else {\n showPaymentError(defaultErrorMessage);\n }\n });\n };\n\n const baseGatewayURL = window.PM3.malgaApiUrl;\n const gatewayClientId = window.PM3.malgaClientId;\n const gatewayClientToken = window.PM3.malgaClientToken;\n\n // Creates payment method\n const createPaymentMethodResponse = () => {\n setLoading(true);\n\n const cardNumber = creditCardForm.creditCardNumber.value;\n const cardExpirationDate = creditCardForm.expirationDate.value;\n const cardCvv = creditCardForm.cvv.value;\n\n const headers = addCorrId(new Headers({\n \"Content-Type\": \"application/json\",\n \"X-Client-ID\": gatewayClientId,\n \"X-Api-Key\": gatewayClientToken\n }));\n const body = JSON.stringify({\n cardHolderName: formNameInput.value,\n cardNumber,\n cardCvv,\n cardExpirationDate\n });\n\n return fetch(`${baseGatewayURL}/tokens`, { method: \"post\", headers, body })\n .then(tapAndLoadCorrId)\n .then(async (response) => {\n const bodyText = await response.text();\n if (!response.ok) {\n throw new Error(bodyText);\n }\n return JSON.parse(bodyText);\n })\n .then(async (cardTokenizationResponse) => {\n if (cardTokenizationResponse.error) {\n // Show error to your customer\n throw new Error(cardTokenizationResponse.error.message);\n }\n\n const cvvTokenizationResponse = tokenize_cvv && !isPJ(formClientType.value)\n ? await fetch(\n `${baseGatewayURL}/tokens`,\n { method: \"post\", headers, body: JSON.stringify({ cvvUpdate: cardCvv }) }\n )\n .then(tapAndLoadCorrId)\n .then(async (response) => {\n const bodyText = await response.text();\n if (!response.ok) {\n throw new Error(bodyText);\n }\n return JSON.parse(bodyText);\n })\n : {};\n gtm.registerCheckoutOptionEvent(\n PAYMENT_TYPE.card,\n {\n price: paymentHelpers.getTotalAmount(),\n discount: paymentHelpers.getDiscountAmount(),\n coupon: formCouponIdHiddenInput.value,\n productName: productNameHiddenInput.value,\n productId: productIdHiddenInput.value,\n fullName: formNameInput.value,\n email: formEmailInput.value,\n phone: formPhoneNumberInput.value\n }\n );\n\n // Otherwise send paymentMethod.id to your server\n fetchClientPayment(cardTokenizationResponse.tokenId, cvvTokenizationResponse?.tokenId);\n })\n .catch((error) => {\n const errorPayload = \"message\" in error ? (() => { try { return JSON.parse(error.message); } catch (_err) { return error; } })() : error;\n const declinedCode = \"error\" in errorPayload &&\n \"declined_code\" in errorPayload.error &&\n errorPayload.error.declined_code;\n\n setLoading(false);\n\n sendCardErrorToWebhook(declinedCode, error);\n console.error(\"Failed to tokenize card\", error);\n\n switch (true) {\n case declinedCode === \"invalid_expiration_date\":\n showPaymentError(\"Data de validade do cartão de crédito inválida\");\n break;\n case declinedCode === \"invalid_number\":\n showPaymentError(\"Número de cartão de crédito inválido\");\n break;\n default:\n showPaymentError(\"Algo deu errado, por favor verifique os dados informados e tente novamente\");\n Rollbar.error(\"Malga Tokenization error\", error)\n }\n });\n };\n\n /**\n * Does the submit, please use `debouncedHandleSubmit` instead\n *\n * @deprecated\n */\n function submitCardPurchaseForm() {\n if (!formHelpers.cpfCnpjValidator()) {\n setLoading(false);\n return;\n }\n\n if (\n isPJ(formClientType.value) &&\n doesNotHaveValue(stateRegistrationInput) &&\n doesNotHaveValue(municipalRegistrationInput)\n ) {\n if (stateRegistrationAlertMessageElement) {\n stateRegistrationAlertMessageElement.className = \"\";\n stateRegistrationAlertMessageElement.style = \"color:#FF5757; font-weight:600;\";\n }\n setLoading(false);\n return;\n }\n\n if (stateRegistrationAlertMessageElement) {\n stateRegistrationAlertMessageElement.className = \"hidden\";\n }\n createPaymentMethodResponse();\n }\n\n const paymentMethodsSubmitHandlers = {\n card: submitCardPurchaseForm\n };\n\n function setPaymentMethodSubmitHandler(method, handler) {\n if (method in paymentMethodsSubmitHandlers) {\n console.error(\"Attempt to overwrite payment method handler already assigned:\", method);\n return;\n }\n paymentMethodsSubmitHandlers[method] = handler;\n }\n\n const debouncedHandleSubmit = debounced(() => {\n const paymentMethod = submitButtonElement.dataset.paymentMethod;\n if (!(paymentMethod in paymentMethodsSubmitHandlers)) {\n console.error(\"Missing handler for payment method\", paymentMethod);\n setLoading(false);\n }\n const handler = paymentMethodsSubmitHandlers[paymentMethod] ?? paymentMethodsSubmitHandlers.card;\n handler();\n }, 1000);\n\n formElement.addEventListener(\"submit\", (event) => {\n event.preventDefault();\n setLoading(true);\n debouncedHandleSubmit();\n });\n\n submitButtonElement.dataset.paymentMethod = \"card\";\n\n MPMInstance?.addListener((paymentMethod) => {\n submitButtonElement.dataset.paymentMethod = paymentMethod;\n clientForm.setPersonalDocumentRequired(paymentMethod === \"nupay\");\n clientForm.setPersonalPhoneNumberRequired(paymentMethod === \"nupay\");\n\n const notUsingCardPaymentMethod = paymentMethod !== \"card\";\n disableRequiredInputField(creditCardForm.creditCardNumber._self, notUsingCardPaymentMethod, true);\n disableRequiredInputField(creditCardForm.expirationDate._self, notUsingCardPaymentMethod, true);\n disableRequiredInputField(creditCardForm.cvv._self, notUsingCardPaymentMethod, true);\n\n const usingPixPaymentMethod = paymentMethod == 'pix';\n paymentTotalSpan.style.display = usingPixPaymentMethod ? 'none' : 'flex';\n pixTotalAmountSpan.style.display = usingPixPaymentMethod ? 'flex' : 'none';\n });\n\n const loadingIndicator = submitButtonElement.querySelector(\".loading-indicator\");\n const submitButtonLabel = submitButtonElement.querySelector(\"span\");\n\n function handlePaymentResult(redirectionUrl, label) {\n setLoading(false);\n disableSubmitButtonElement(submitButtonElement);\n\n setTimeout(() => {\n window.parent.location.replace(redirectionUrl);\n }, 2000);\n\n loadingIndicator.classList.remove(\"hidden\");\n submitButtonLabel.innerText = label;\n }\n\n function prepareFieldsForPaymentMethods({ success, pending, error }) {\n const [authenticityTokenElement] = Array.from(\n document.getElementsByName(\"authenticity_token\")\n );\n const formElements = {\n authenticityTokenElement,\n stateRegistrationAlertMessageElement,\n submitButtonElement,\n submitButtonLabel,\n loadingIndicator,\n getProductInfo({ formatted = true } = {}) {\n return {\n productId: productIdHiddenInput.value,\n productName: productNameHiddenInput.value,\n unitAmount: formatted\n ? getFormattedCurrencyValueFromEl(formAmountHiddenInput)\n : getValueWithoutFormat(formAmountHiddenInput.value) / 100.0,\n pixAmount: formatted\n ? getFormattedCurrencyValueFromEl(formPixAmountHiddenInput)\n : getValueWithoutFormat(formPixAmountHiddenInput.value) / 100.0\n };\n },\n getAmountAndCouponInformation({ formatted = true } = {}) {\n return {\n coupon_id: formCouponIdHiddenInput.value,\n coupon_amount_off: formatted\n ? getFormattedCurrencyValueFromEl(\n formAmountOffHiddenInput\n )\n : formAmountOffHiddenInput.value / 100,\n coupon_percent_off: formPercentOffHiddenInput.value || +formPercentOffHiddenInput.value,\n discount_amount: formatted\n ? getFormattedCurrencyValueFromEl(\n formDiscountAmountHiddenInput\n )\n : formDiscountAmountHiddenInput.value / 100,\n subtotal_amount: formatted\n ? productUnitAmountHiddenInput?.innerText\n : getValueWithoutFormat(productUnitAmountHiddenInput?.innerText) / 100,\n total_amount: formatted\n ? getFormattedCurrencyValueFromEl(formTotalAmountHiddenInput)\n : +formTotalAmountHiddenInput.value / 100,\n pix_amount: formatted\n ? getFormattedCurrencyValueFromEl(formTotalPixAmountHiddenInput)\n : +formTotalPixAmountHiddenInput.value / 100\n };\n }\n };\n\n return {\n gtm,\n clientForm,\n productForm,\n couponForm,\n bumpForm,\n formHelpers,\n formElements,\n setLoading,\n showPaymentError,\n setPaymentMethodSubmitHandler,\n onSuccess() {\n handlePaymentResult(success.redirectURL, success.label);\n },\n onPending() {\n handlePaymentResult(pending.redirectURL, pending.label);\n },\n onError() {\n handlePaymentResult(error.redirectURL, error.label);\n }\n };\n }\n\n const hasPix = document.getElementById(\"pix-payment-form\");\n const hasNupay = document.getElementById(\"nupay-payment-form\");\n\n if (hasPix) {\n setupPixPayment(\n prepareFieldsForPaymentMethods({\n success: { label: \"Pagamento feito com sucesso!\", redirectURL: document.getElementById(\"typ_url\").value },\n pending: {\n label: \"Processando pagamento via Pix\",\n redirectURL: document.getElementById(\"typ_pix_processing\").value.trim() || window.PM3.typPixProcessing\n },\n error: {\n label: \"Código Pix expirado\",\n redirectURL: document.getElementById(\"typ_pix_error\").value.trim() || window.PM3.typPixError\n }\n })\n );\n }\n if (hasNupay) {\n setupNupayPayment(\n prepareFieldsForPaymentMethods({\n success: { label: \"Pagamento feito com sucesso!\", redirectURL: document.getElementById(\"typ_url\").value },\n pending: {\n label: \"Processando pagamento via NuPay\",\n redirectURL: document.getElementById(\"typ_pix_processing\").value.trim() || window.PM3.typPixProcessing\n },\n error: {\n label: \"Pagamento NuPay expirado\",\n redirectURL: document.getElementById(\"typ_pix_error\").value.trim() || window.PM3.typPixError\n }\n }),\n );\n }\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n let MPMInstance;\n try {\n MPMInstance = setupMPMTabs(document.getElementById(\"mpm-tabs-contents\"));\n } catch (err) {\n console.error(\"Failed to start MPM Tabs:\", err);\n }\n\n try { setupMalgaPayment(MPMInstance); } catch (err) {\n console.error(\"Failed to setup Malga Payment:\", err);\n }\n});\n"],"sourceRoot":""}