UNPKG

@malga-checkout/core

Version:
1 lines 5.15 kB
import{r as a,c as o,h as t,F as c,H as e}from"./p-626f6dad.js";import{Y as l}from"./p-da40223f.js";import{s as n}from"./p-47ee1a00.js";import{s as r}from"./p-4fec35c1.js";import{s as i}from"./p-d9f97f36.js";const m=class{constructor(t){a(this,t),this.paymentFail=o(this,"paymentFail",7),this.paymentMethods=["credit","pix","boleto","drip"],this.handlePaymentChange=a=>{n.selectedPaymentMethod=a},this.showCurrentPaymentMethod=a=>this.paymentMethods.includes(a)}renderCreditCardLabel(){return l(i.hasCards?"paymentMethods.card.newCardTitle":"paymentMethods.card.title",r.locale)}render(){return t(e,{class:{"malga-payments__container":!0}},t("section",{class:{"malga-payments__content":!0}},this.showCurrentPaymentMethod("credit")&&t(c,null,r.transactionConfig.customerId&&t("malga-payments-credit-saved-cards",null),t("checkout-radio-field",{fullWidth:!0,label:this.renderCreditCardLabel(),value:"credit",isChecked:"credit"===n.selectedPaymentMethod,onClicked:()=>this.handlePaymentChange("credit")}),"credit"===n.selectedPaymentMethod&&t("malga-payments-credit",null)),this.showCurrentPaymentMethod("boleto")&&t(c,null,t("checkout-radio-field",{fullWidth:!0,label:l("paymentMethods.boleto.title",r.locale),value:"boleto",isChecked:"boleto"===n.selectedPaymentMethod,onClicked:()=>this.handlePaymentChange("boleto")}),"boleto"===n.selectedPaymentMethod&&t("malga-payments-boleto",null)),this.showCurrentPaymentMethod("pix")&&t(c,null,t("checkout-radio-field",{fullWidth:!0,label:l("paymentMethods.pix.title",r.locale),value:"pix",endIcon:"pix",isChecked:"pix"===n.selectedPaymentMethod,onClicked:()=>this.handlePaymentChange("pix")}),"pix"===n.selectedPaymentMethod&&t("malga-payments-pix",{onPixPaymentFailed:({detail:{error:a}})=>this.paymentFail.emit({error:a})})),this.showCurrentPaymentMethod("nupay")&&t(c,null,t("checkout-radio-field",{fullWidth:!0,label:l("paymentMethods.nupay.title",r.locale),value:"nupay",endIcon:"nubank",isChecked:"nupay"===n.selectedPaymentMethod,onClicked:()=>this.handlePaymentChange("nupay")}),"nupay"===n.selectedPaymentMethod&&t("malga-payments-nupay",null)),this.showCurrentPaymentMethod("drip")&&t(c,null,t("checkout-radio-field",{fullWidth:!0,label:l("paymentMethods.drip.title",r.locale),value:"drip",endIcon:"drip",isChecked:"drip"===n.selectedPaymentMethod,onClicked:()=>this.handlePaymentChange("drip")}),t("malga-payments-drip",null))))}};m.style='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap"); :root{--malga-checkout-color-page-background:#eef2f6;--malga-checkout-color-brand-accent-light:#79DBD4;--malga-checkout-color-brand-accent-normal:#39BFAD;--malga-checkout-color-brand-clean:#C3F4EF;--malga-checkout-color-brand-light:#79DBD4;--malga-checkout-color-brand-normal:#39BFAD;--malga-checkout-color-brand-middle:#2FAC9B;--malga-checkout-color-brand-dark:#147F70;--malga-checkout-color-grey-light:#666666;--malga-checkout-color-grey-normal:#4D4D4D;--malga-checkout-color-grey-middle:#333333;--malga-checkout-color-grey-dark:#1A1A1A;--malga-checkout-color-grey-darkness:#000000;--malga-checkout-color-accent-light:#ffffff;--malga-checkout-color-accent-normal:#F1F1F1;--malga-checkout-color-accent-middle:#CBCBCB;--malga-checkout-color-warning-light:#FFF8E6;--malga-checkout-color-warning-normal:#F9DF8D;--malga-checkout-color-warning-middle:#FFA400;--malga-checkout-color-modal-success:#00AE42;--malga-checkout-color-modal-error:#ED3A3D;--malga-checkout-color-modal-neutral:#4D4D4D;--malga-checkout-color-modal-action-button-error:#000000;--malga-checkout-color-modal-action-button-error-hover:#333333;--malga-checkout-color-modal-action-button-success:#000000;--malga-checkout-color-modal-action-button-success-hover:#333333;--malga-checkout-color-modal-action-button-success-font-color:#ffffff;--malga-checkout-color-modal-action-button-error-font-color:#ffffff;--malga-checkout-typography-family:"Inter", sans-serif;--malga-checkout-spacing-xxs:4px;--malga-checkout-spacing-xs:8px;--malga-checkout-spacing-sm:16px;--malga-checkout-spacing-default:24px;--malga-checkout-spacing-md:32px;--malga-checkout-spacing-lg:48px;--malga-checkout-spacing-xlg:64px;--malga-checkout-spacing-xxlg:96px;--malga-checkout-size-min-width:250px;--malga-checkout-border-radius-default:4px;--malga-checkout-border-radius-md:6px;--malga-checkout-border-radius-lg:20px;--malga-checkout-transition-slow:0.3s;--malga-checkout-transition-default:0.5s}.malga-payments__container{display:flex;width:100%;margin-left:auto;margin-right:auto}.malga-payments__content{display:flex;flex-direction:column;width:100%}.malga-payments__content>checkout-radio-field{margin-bottom:calc( var(--malga-checkout-spacing-xxs) + var(--malga-checkout-spacing-xs) )}.malga-payments__content>malga-payments-boleto>checkout-manual-payment,.malga-payments__content>malga-payments-pix>checkout-manual-payment{margin-bottom:var(--malga-checkout-spacing-sm)}.malga-payments__content>malga-payments-boleto>checkout-manual-payment>checkout-typography,.malga-payments__content>malga-payments-pix>checkout-manual-payment>checkout-typography{padding:0px var(--malga-checkout-spacing-sm)}';export{m as malga_payments}