PageSourceSearch

https://ionaconsulting.com/wp-content/plugins/woocommerce-mercadop…/custom/mp-custom-page.min.js?ver=8.9.5

js ionaconsulting.com collected 2026-10-06 02:07:59 UTC 20,841 bytes, 1 lines download raw bytes

1const CheckoutPage={installmentsEnabled:!1,INSTALLMENTS_SELECT_PLACHOLDER_TEXT:wc_mercadopago_custom_page_params.installments_select_placeholder_text,TAX_TYPES:{cft:{key:"CFT_",label:"CFTEA",bold:!0},tna:{key:"TNA_",label:"TNA",bold:!1},tea:{key:"TEA_",label:"TEA",bold:!1}},A11Y_ERROR_TARGETS:{fcCardholderName:{control:"fcCardholderName",describedBy:"mp-card-holder-name-helper",describedByDefault:"mp-card-holder-name-helper-info",describedByAlways:"mp-card-holder-name-example"},fcIdentificationNumberContainer:{control:"fcIdentificationNumberInput"},fcCardNumberContainer:{sdkField:"cardNumber",describedBy:"mp-card-number-helper"},fcCardExpirationDateContainer:{sdkField:"cardExpirationDate",describedBy:"mp-expiration-date-helper"},fcSecurityNumberContainer:{sdkField:"securityCode",describedBy:"mp-security-code-helper"}},setElementDisplay(e,t){const r=document.querySelector(CheckoutElements[e]);r&&(r.style.display=t)},setText(e,t){const r=document.querySelector(CheckoutElements[e]);r&&(r.innerHTML=t)},setValueOn(e,t){const r=document.querySelector(CheckoutElements[e]);r&&(r.value=t)},setBackground(e,t){const r=document.querySelector(CheckoutElements[e]);r&&r.style.setProperty("background",t,"important")},setImageCard(e,t){const r=document.querySelector(CheckoutElements.fcCardNumberContainer);r&&(r.style.setProperty("--card-brand-icon",`url(${e})`,"important"),r.classList.add("mp-card-icon-detected"),this.announceDetectedCard(t))},announceDetectedCard(e){const t=document.querySelector(CheckoutElements.mpDetectedCardAnnouncement);if(!t)return;const r=wc_mercadopago_custom_page_params.detected_card_label;t.textContent=e?`${r} ${e}`:""},SECURE_FIELD_INSTRUCTIONS:{fcCardNumberContainer:{param:"card_number_instruction",defaultDigits:16},fcCardExpirationDateContainer:{param:"card_expiration_instruction"},fcSecurityNumberContainer:{param:"security_code_instruction",defaultDigits:3}},setSecureFieldInstruction(e,t){const r=this.SECURE_FIELD_INSTRUCTIONS[e];if(!r)return;const n=document.querySelector(CheckoutElements[e]),s=n?.querySelector("iframe");if(!s)return;const o=wc_mercadopago_custom_page_params[r.param];if(!o)return;const a=t||r.defaultDigits;s.title=a?o.replace("{digits}",a):o},setSecureFieldInstructions(e,t){this.setSecureFieldInstruction("fcCardNumberContainer",e),this.setSecureFieldInstruction("fcCardExpirationDateContainer"),this.setSecureFieldInstruction("fcSecurityNumberContainer",t)},findContainerField(e){let t="cardholderName"===e?`#form-checkout__${e}`:`#form-checkout__${e}-container`;return Object.keys(CheckoutElements).find((e=>CheckoutElements[e]===t))},setDisplayOfError(e,t,r,n="customContent"){const s=document.querySelector(CheckoutElements[n]);if(!s)return;const o=s.querySelector(CheckoutElements[e]);o&&("add"===t?o.classList.add(`${r}`):o.classList.remove(`${r}`),"mp-error"!==r&&"mp-error-2px"!==r||this.syncFieldValidity(e,o))},syncFieldValidity(e,t){const r=this.A11Y_ERROR_TARGETS[e];if(!r)return;const n=t.classList.contains("mp-error")||t.classList.contains("mp-error-2px");if(r.sdkField)return this.setSecureFieldValidity(r.sdkField,n),void this.setDescription(t,n?r.describedBy:null);const s=document.querySelector(CheckoutElements[r.control]);this.setControlValidity(s,n,r)},setDescription(e,t){e&&(t?e.setAttribute("aria-describedby",t):e.removeAttribute("aria-describedby"))},setControlValidity(e,t,r={}){if(!e)return;if(e.setAttribute("aria-invalid",t?"true":"false"),!r.describedBy&&!r.describedByDefault&&!r.describedByAlways)return;const n=[t?r.describedBy:r.describedByDefault,r.describedByAlways].filter(Boolean);n.length?e.setAttribute("aria-describedby",n.join(" ")):e.removeAttribute("aria-describedby")},setSecureFieldValidity(e,t){const r=window.mpCustomCheckoutHandler?.cardForm;if(!0===r?.formMounted)try{r.form?.update(e,{invalid:t})}catch(e){}},getInputHelperElement(e,t,r="customContent"){const n=document.querySelector(CheckoutElements[r]);if(n)return n.querySelector(`input-helper[input-id=${e}-${t}]`)},setDisplayOfInputHelperInfo(e,t,r="customContent"){let n=this.getInputHelperElement(e,"helper-info",r);n&&(n.childNodes[1].style.display=t)},setDisplayOfInputHelper(e,t,r="customContent"){let n=this.getInputHelperElement(e,"helper",r);if(n){n.querySelector("div").style.display=t}},setDisplayOfInputHelperMessage(e,t,r="customContent"){let n=this.getInputHelperElement(e,"helper",r);if(n){n.querySelector("div").childNodes[1].innerHTML=t}},setCvvConfig(e){this.setCvvHint(e.length),this.changeCvvPlaceHolder(e.length)},changeCvvPlaceHolder(e){3===e?window.mpCustomCheckoutHandler.cardForm.form.update("securityCode",{placeholder:wc_mercadopago_custom_page_params.security_code_placeholder_text_3_digits}):window.mpCustomCheckoutHandler.cardForm.form.update("securityCode",{placeholder:wc_mercadopago_custom_page_params.security_code_placeholder_text_4_digits})},setCvvHint(e){const t=document.querySelector(CheckoutElements.mpSecurityCodeInfo);if(!t)return;const r=3===e?wc_mercadopago_custom_page_params.security_code_tooltip_text_3_digits:wc_mercadopago_custom_page_params.security_code_tooltip_text_4_digits;t.setAttribute("data-tooltip",r),t.setAttribute("aria-label",r)},additionalInfoHandler(e){e.cardholder_name?this.setElementDisplay("fcCardh
1olderName","block"):this.setElementDisplay("fcCardholderName","none"),e.issuer?this.setElementDisplay("mpIssuerContainer","block"):this.setElementDisplay("mpIssuerContainer","none"),e.cardholder_identification_type&&e.cardholder_identification_number?this.setElementDisplay("mpDocumentContainer","block"):this.setElementDisplay("mpDocumentContainer","none")},getCountry:()=>wc_mercadopago_custom_checkout_params.site_id,formatCurrency(e){let t=new Intl.NumberFormat(wc_mercadopago_custom_checkout_params.intl,{currency:wc_mercadopago_custom_checkout_params.currency_code,style:"currency",currencyDisplay:"narrowSymbol"}).format(e);return"MLM"===this.getCountry()&&(t=t.replace(/^(\D+)/,"$1 ")),t},inputHelperName:e=>({cardNumber:CheckoutElements.mpCardNumber,cardholderName:CheckoutElements.mpCardholderName,expirationDate:CheckoutElements.mpExpirationDate,securityCode:CheckoutElements.mpSecurityCode,identificationNumber:CheckoutElements.mpIdentificationNumber}[e]),removeAdditionFields(e=!0){this.setElementDisplay("mpDocumentContainer","none"),this.setElementDisplay("mpInstallmentsCard","none"),this.setElementDisplay("mpIssuerContainer","none"),e&&this.setValueOn("cardInstallments","")},getHelperMessage(e){let t="input-helper[input-id="+this.inputHelperName(e)+"-helper]",r=document.querySelector(t),n=r?.querySelector("div[class=mp-helper]");return n?.childNodes[1]??null},verifyDocument(){let e=document.querySelector(CheckoutElements.fcIdentificationNumber),t=document.querySelector(CheckoutElements.mpDocumentContainer);return"none"===t.style.display||""===t.style.display||"-1"!==e.value&&""!==e.value&&"flex"!==document.querySelector("input-helper[input-id=mp-doc-number-helper]").querySelector("div").style.display},loadAdditionalInfo(e){const t={issuer:!1,cardholder_name:!1,cardholder_identification_type:!1,cardholder_identification_number:!1};for(let r=0;r<e.length;r++)"issuer_id"===e[r]&&(t.issuer=!0),"cardholder_name"===e[r]&&(t.cardholder_name=!0),"cardholder_identification_type"===e[r]&&(t.cardholder_identification_type=!0),"cardholder_identification_number"===e[r]&&(t.cardholder_identification_number=!0);return t},clearInstallmentsComponent(){const e=document.querySelector(CheckoutElements.mpInstallmentsContainer);e?.classList?.remove(CheckoutElements.mpInstallmentsContainer),e?.firstElementChild&&e?.removeChild(e?.firstElementChild)},showInstallmentsComponent(e){const t=document.querySelector(CheckoutElements.mpInstallmentsContainer);t.classList.add(CheckoutElements.mpInstallmentsContainer),t.appendChild(e)},shouldEnableInstallmentsComponent(e){if("debit_card"===e)return this.clearInstallmentsComponent(),void(this.installmentsEnabled=!1);this.installmentsEnabled=!0},hideErrors(){const e=document.querySelector(".mp-checkout-custom-container");if(!e)return;const t=e.querySelectorAll("input-helper");t&&t.forEach((e=>{e.querySelector("div").style.display="none"}))},clearCardState(){const e="super_token"===document.querySelector("#mp_checkout_type")?.value;e||this.setValueOn("paymentMethodId",""),this.setValueOn("fcCardholderName",""),this.setBackground("fcCardNumberContainer","no-repeat #fff");const t=document.querySelector(CheckoutElements.fcCardNumberContainer);t&&t.classList.remove("mp-card-icon-detected"),this.announceDetectedCard(""),this.setSecureFieldInstructions(),this.setInstallmentsErrorState(!1),this.clearInstallmentsComponent(),this.removeAdditionFields(!e)},clearInputs(){this.hideErrors(),this.clearCardState();document.querySelector(CheckoutElements.fcCardNumberContainer)&&(this.setValueOn("fcCardNumberContainer",""),this.setDisplayOfError("fcCardNumberContainer","removed","mp-error")),this.setDisplayOfError("fcCardholderName","removed","mp-error"),this.setValueOn("fcCardExpirationDateContainer",""),this.setDisplayOfError("fcCardExpirationDateContainer","removed","mp-error"),this.setValueOn("fcSecurityNumberContainer",""),this.setDisplayOfError("fcSecurityNumberContainer","removed","mp-error"),this.setValueOn("fcIdentificationNumber",""),this.setElementDisplay("mpDocumentContainer","none"),this.setDisplayOfError("fcIdentificationNumberContainer","removed","mp-error"),this.setDisplayOfError("mpCardholderNameInputLabel","removed","mp-label-error"),this.setDisplayOfInputHelper("mp-card-holder-name","none"),this.setDisplayOfError("mpCardholderNameInputLabel","removed","mp-label-error-2x");const e=document.querySelector("input[data-cy=input-document]");e&&(e.value="")},needsBankInterestDisclaimer(){const e=this.getCountry();return"MLC"===e.toUpperCase()||"MCO"===e.toUpperCase()||"MPE"===e.toUpperCase()},getInstallments(e){const t=[];if(!e||!Array.isArray(e.payer_costs))return t;return("MCO"===this.getCountry()?e.payer_costs.slice(0,Math.min(6,e.payer_costs.length)):e.payer_costs).forEac
1h((e=>{const r=e.installments,n=this.formatCurrency(e.installment_amount),s=0!==e.installment_rate,o=e?.installment_rate_collector,a=Array.isArray(o)&&o.includes("THIRD_PARTY"),l=this.formatCurrency(e.total_amount);let i=`${r.toString()}x `;1==r?i+=l:s?i+=`${n} (${l})`:this.needsBankInterestDisclaimer()&&a&&!s?i+=`${n} (${l})*`:i+=`${n} ${wc_mercadopago_custom_checkout_params.input_helper_message.installments.interest_free_option_text}`;const c={value:r.toString(),title:i};if("MLA"===this.getCountry()&&e.labels){const t=this.parseTaxInfo(e.labels);t&&(c.taxInfo=t)}t.push(c)})),t},parseTaxInfo(e){if(!e||!Array.isArray(e))return null;const t={cft:null,tna:null,tea:null},r=e=>{if(!e)return null;const t=e.replace("%","").trim();return/^\d+([,.]\d+)?$/.test(t)?t:null};return e.forEach((e=>{if("string"!=typeof e)return;e.split("|").forEach((e=>{if(e.includes("CFT_")){const n=e.split("CFT_");if(n.length>1&&n[1]){const e=r(n[1]);e&&(t.cft=e)}}else if(e.includes("TEA_")){const n=e.split("TEA_");if(n.length>1&&n[1]){const e=r(n[1]);e&&(t.tea=e)}}else if(e.includes("TNA_")){const n=e.split("TNA_");if(n.length>1&&n[1]){const e=r(n[1]);e&&(t.tna=e)}}}))})),t},verifyCardholderName(){const e=document.querySelector(CheckoutElements.fcCardholderName);if(!e)return!0;const t=e.value.trim(),r=t.length>2&&!/[^a-zA-ZÀ-ÿ0-9 ]/.test(t);return this.updateCardholderNameState(e,r),r},updateCardholderNameState(e,t){const r=document.querySelector(CheckoutElements.mpCardHolderNameHelper),n=document.querySelector(CheckoutElements.mpCardholderNameInputLabel),s=document.querySelector(CheckoutElements.mpCardHolderNameHelperInfo);t?(this.toggleErrorBorder(e),n?.classList.remove("mp-label-error"),r&&(r.style.display="none"),document.activeElement===e&&(e.classList.add("mp-focus"),s.style.display="flex")):(e.classList.remove("mp-focus"),r&&(r.style.display="flex",s.style.display="none"),n&&(n.classList.add("mp-label-error"),s.style.display="none"),this.toggleErrorBorder(e,document.activeElement===e)),this.setControlValidity(e,!t,this.A11Y_ERROR_TARGETS.fcCardholderName)},verifyCardholderNameOnFocus(){const e=document.querySelector(CheckoutElements.fcCardholderName),t=document.querySelector(CheckoutElements.mpCardHolderNameHelper),r=document.querySelector(CheckoutElements.mpCardholderNameInputLabel),n=document.querySelector(CheckoutElements.mpCardHolderNameHelperInfo);e&&(e.addEventListener("focus",(()=>{e.classList.contains("mp-error")||e.classList.contains("mp-error-2px")?e.classList.contains("mp-error")&&(this.toggleErrorBorder(e,!0),n.style.display="none"):(e.classList.add("mp-focus"),n.style.display="flex")})),e.addEventListener("blur",(()=>{const s=e.classList.contains("mp-error-2px");e.classList.remove("mp-focus"),this.toggleErrorBorder(e),t&&(t.style.display="none"),r?.classList.remove("mp-label-error"),n.style.display="flex",(""!==e.value.trim()||s)&&this.verifyCardholderName()})),e.addEventListener("input",(()=>{""!==e.value.trim()?this.verifyCardholderName():this.updateCardholderNameState(e,!0)})))},clearDocumentLabelErrorOnInput(){const e=document.querySelector(CheckoutElements.mpDocumentContainer);e&&!e.dataset.mpDocLabelClearBound&&(e.dataset.mpDocLabelClearBound="true",e.addEventListener("input",(e=>{e.target?.matches?.('[data-cy="input-document"]')&&""!==e.target.value.trim()&&this.setDisplayOfError("mpDocumentInputLabel","remove","mp-label-error")})))},addDefaultOptionOnInstallmentsSelect(e){const t=document.createElement("option");t.value="",t.disabled=!0,t.selected=!0,t.innerHTML=this.INSTALLMENTS_SELECT_PLACHOLDER_TEXT,e.insertBefore(t,e.firstChild)},setChangeEventOnInstallments(e){this.clearInstallmentsComponent();const t=document.getElementById("form-checkout__installments");if(t){if(this.installmentsItemsData=e||[],this.addDefaultOptionOnInstallmentsSelect(t),!this.installmentsEnabled)return CheckoutPage.setValueOn("cardInstallments","1"),void(t.value="1");this.replaceInstallmentsOptions(t,e),this.renderBankInterestDisclaimer(e),t.addEventListener("change",(e=>{const r=e.target.value;r&&(CheckoutPage.setValueOn("cardInstallments",r),t.value=r,this.updateTaxInfoForSelect(r,"mp-installments-tax-info"),this.setInstallmentsErrorState(!1))})),t.addEventListener("focus",(()=>{t.classList.contains("mp-error")&&this.toggleErrorBorder(t,!0)})),t.addEventListener("blur",(()=>{this.installmentsWasSelected()?this.setInstallmentsErrorState(!1):this.setInstallmentsErrorState(!0)})),this.setElementDisplay("mpInstallmentsCard","block")}},setZeroDollarInitialCitInstallmentsState(){this.installmentsItemsData=[],this.setInstallmentsErrorState(!1),this.clearInstallmentsComponent();const e=document.getElementById("form-checkout__installments");if(e)for(;e.firstChild;)e.removeChild(e.firstChild);document.getElementById("mp-installments-bank-interest-hint")?.remove();const t=document.getElementById("mp-installments-tax-info");t&&(t.textContent="",t.style.display="none"),this.setValueOn("cardInstallments","1"),this.setElementDisplay("mpInstallmentsCard","none")},replaceInstallmentsOptions(e,t){const r=this.getInstallments(t);r.length&&(Array.from(e.querySelectorAll("option")).filter((e=>
1!e.disabled)).forEach((e=>e.remove())),r.forEach((({value:t,title:r})=>{const n=document.createElement("option");n.value=t,n.textContent=r,e.appendChild(n)})))},hasThirdPartyInterestFreeInstallment:e=>!(!e||!Array.isArray(e.payer_costs))&&e.payer_costs.some((e=>{const t=e?.installment_rate_collector;return Array.isArray(t)&&t.includes("THIRD_PARTY")&&0===e?.installment_rate})),renderBankInterestDisclaimer(e){const t=document.getElementById("mp-installments-bank-interest-hint");if(t&&t.remove(),!this.needsBankInterestDisclaimer())return;if(!this.hasThirdPartyInterestFreeInstallment(e))return;const r=wc_mercadopago_custom_checkout_params?.input_helper_message?.installments?.bank_interest_hint_text;if(!r)return;const n=document.querySelector(".mp-checkout-custom-installments-select-container");if(!n)return;const s=document.createElement("div");s.id="mp-installments-bank-interest-hint",s.className="mp-installments-bank-interest-hint",s.textContent=`*${r}`;const o=document.getElementById("mp-installments-tax-info");o?n.insertBefore(s,o):n.appendChild(s)},installmentsWasSelected(){const e=document.getElementById("form-checkout__installments");return!!e?.value},cardNumberHasError(){const e=document.querySelector(CheckoutElements.fcCardNumberContainer);return!!e&&(e.classList.contains("mp-error")||e.classList.contains("mp-error-2px"))},cardholderNameHasError(){const e=document.querySelector(CheckoutElements.fcCardholderName);return!!e&&(e.classList.contains("mp-error")||e.classList.contains("mp-error-2px"))},scrollToCheckoutCustomContainer(){const e=document.querySelector(".mp-checkout-custom-container");e&&e.scrollIntoView({behavior:"smooth"})},toggleErrorBorder(e,t){e.classList.remove("mp-error","mp-error-2px"),!0===t?e.classList.add("mp-error-2px"):!1===t&&e.classList.add("mp-error")},setInstallmentsErrorState(e){const t=document.getElementById("form-checkout__installments"),r=document.querySelector(".mp-checkout-custom-installments-select-container .mp-input-label"),n=document.querySelector("#mp-installments-error");if(t&&r&&n)if(this.setControlValidity(t,e,{describedBy:"mp-installments-error"}),e){const e=document.activeElement===t;n.style.display="flex",r.classList.add("mp-label-error"),this.toggleErrorBorder(t,e)}else n.style.display="none",this.toggleErrorBorder(t),r.classList.remove("mp-label-error")},emitGateBlockedMetric(e,t,r,n){if("function"!=typeof sendMetric)return;const s=`MP_CUSTOM_CHECKOUT_${e}_VALIDATION_BLOCKED`;n?sendMetric(s,r,t,{reason:n}):sendMetric(s,r,t)},deferBlockOverlayRemoval(e){Promise.resolve().then((()=>e?.removeBlockOverlay()))},syncInstallmentsFromSelect(){const e=document.getElementById("form-checkout__installments"),t=document.querySelector(CheckoutElements.cardInstallments);e?.value&&t&&(t.value=e.value)},runPreSubmitGates(e){if(this.cardNumberHasError()){const t="function"==typeof e?.getCardValidationReason?e.getCardValidationReason():"invalid_length",r="function"==typeof e?.getCardValidationDetail?e.getCardValidationDetail():"";return this.emitGateBlockedMetric("CARD","mp_custom_card_validation",t,r),this.setDisplayOfError("fcCardNumberContainer","add","mp-error"),this.setDisplayOfInputHelper("mp-card-number","flex"),e?.scrollToCardForm(),e?.removeLoadSpinner(),this.deferBlockOverlayRemoval(e),{passed:!1,gate:"card",reason:t}}if("function"==typeof e?.isZeroDollarInitialCitContext&&e.isZeroDollarInitialCitContext())this.setZeroDollarInitialCitInstallmentsState();else if(this.syncInstallmentsFromSelect(),!this.installmentsWasSelected())return this.emitGateBlockedMetric("INSTALLMENTS","mp_custom_installments_validation","not_selected"),this.setInstallmentsErrorState(!0),this.scrollToCheckoutCustomContainer(),e?.removeLoadSpinner(),this.deferBlockOverlayRemoval(e),{passed:!1,gate:"installments",reason:"not_selected"};const t=document.querySelectorAll(CheckoutElements.fcIdentificationNumberContainer),r=Array.from(t).some((e=>e.classList.contains("mp-error")||e.classList.contains("mp-error-2px")));if(!this.verifyDocument()||r){const t=document.querySelector(CheckoutElements.fcIdentificationNumber),r=t?.value&&"-1"!==t.value?"invalid_format":"empty_field";return this.emitGateBlockedMetric("DOCUMENT","mp_custom_document_validation",r),this.setDisplayOfError("fcIdentificationNumberContainer","add","mp-error"),this.setDisplayOfError("mpDocumentInputLabel","add","mp-label-error"),this.setDisplayOfInputHelper("mp-doc-number","flex"),document.querySelector(CheckoutElements.mpDocumentComponent)?.markInvalidFromSubmit?.(),document.querySelector(CheckoutElements.mpDocumentContainer)?.scrollIntoView({behavior:"smooth"}),e?.removeLoadSpinner(),this.deferBlockOverlayRemoval(e),{passed:!1,gate:"document",reason:r}}return{passed:!0}},updateTaxInfoForSelect(e,t,r){const n=r||this.installmentsItemsData?.payer_costs,s=document.getElementById(t);if(!s)return;if("MLA"!==this.getCountry()||parseInt(e,10)<2)return void(s.style.display="none");const o=n?.find((t=>`${t.installments}`==`${e}
1`)),a=this.parseTaxInfo(o?.labels),l=this.formatTaxDisplay(a);s.style.display=l?"block":"none",l&&(s.innerHTML=l)},parseTaxInfo(e){if(!Array.isArray(e))return{};const t=e=>{const t=e?.replace("%","").trim();return/^\d+([,.]\d+)?$/.test(t)?t:null};return e.filter((e=>"string"==typeof e)).flatMap((e=>e.split("|"))).reduce(((e,r)=>{for(const[n,{key:s}]of Object.entries(this.TAX_TYPES))if(r.includes(s)){const o=t(r.split(s)[1]);o&&(e[n]=o)}return e}),{})},formatTaxDisplay(e){if(!e)return null;const t=Object.entries(this.TAX_TYPES).filter((([t])=>e[t])).map((([t,{label:r,bold:n}])=>{const s=`${r}: ${e[t]}%`;return n?`<b>${s}</b>`:s}));return t.length?`${t.join(" - ")}. Tasa fija.`:null}};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.