rebill-web-components-sdk 1.8.3-beta.9 → 1.8.4-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/otp-component.rebill-modal-overlay.rebill-mode-sandbox.rebill-mode-sandbox-mobile.rebill-summary.success-page.user-information.entry.cjs.js.map +1 -1
  2. package/dist/cjs/otp-component_7.cjs.entry.js +9 -9
  3. package/dist/cjs/otp-component_7.cjs.entry.js.map +1 -1
  4. package/dist/cjs/rebill-renewal.cjs.entry.js +1 -1
  5. package/dist/cjs/rebill-renewal.cjs.entry.js.map +1 -1
  6. package/dist/cjs/rebill-renewal.entry.cjs.js.map +1 -1
  7. package/dist/cjs/renewal-success-page.cjs.entry.js +1 -1
  8. package/dist/cjs/renewal-success-page.cjs.entry.js.map +1 -1
  9. package/dist/cjs/renewal-success-page.entry.cjs.js.map +1 -1
  10. package/dist/cjs/renewal-success-page.renewal-summary.entry.cjs.js.map +1 -1
  11. package/dist/cjs/renewal-success-page_2.cjs.entry.js +1 -1
  12. package/dist/cjs/renewal-success-page_2.cjs.entry.js.map +1 -1
  13. package/dist/cjs/success-page.cjs.entry.js +9 -9
  14. package/dist/cjs/success-page.cjs.entry.js.map +1 -1
  15. package/dist/cjs/success-page.entry.cjs.js.map +1 -1
  16. package/dist/collection/components/checkout/card-success-page/success-page.css +27 -22
  17. package/dist/collection/components/checkout/card-success-page/success-page.js +8 -8
  18. package/dist/collection/components/checkout/card-success-page/success-page.js.map +1 -1
  19. package/dist/collection/components/renewal/rebill-renewal.js +1 -1
  20. package/dist/collection/components/renewal/rebill-renewal.js.map +1 -1
  21. package/dist/collection/components/renewal/renewal-success-page/renewal-success-page.css +27 -22
  22. package/dist/components/{p-C-B8iTeF.js → p-BUDYSPjD.js} +3 -3
  23. package/dist/components/{p-C-B8iTeF.js.map → p-BUDYSPjD.js.map} +1 -1
  24. package/dist/components/{p-BEEjWgM3.js → p-R_YFY6AY.js} +11 -11
  25. package/dist/components/p-R_YFY6AY.js.map +1 -0
  26. package/dist/components/rebill-renewal.js +1 -1
  27. package/dist/components/rebill-renewal.js.map +1 -1
  28. package/dist/components/renewal-success-page2.js +1 -1
  29. package/dist/components/renewal-success-page2.js.map +1 -1
  30. package/dist/components/success-page2.js +9 -9
  31. package/dist/components/success-page2.js.map +1 -1
  32. package/dist/esm/otp-component.rebill-modal-overlay.rebill-mode-sandbox.rebill-mode-sandbox-mobile.rebill-summary.success-page.user-information.entry.js.map +1 -1
  33. package/dist/esm/otp-component_7.entry.js +9 -9
  34. package/dist/esm/otp-component_7.entry.js.map +1 -1
  35. package/dist/esm/rebill-renewal.entry.js +1 -1
  36. package/dist/esm/rebill-renewal.entry.js.map +1 -1
  37. package/dist/esm/renewal-success-page.entry.js +1 -1
  38. package/dist/esm/renewal-success-page.entry.js.map +1 -1
  39. package/dist/esm/renewal-success-page.renewal-summary.entry.js.map +1 -1
  40. package/dist/esm/renewal-success-page_2.entry.js +1 -1
  41. package/dist/esm/renewal-success-page_2.entry.js.map +1 -1
  42. package/dist/esm/success-page.entry.js +9 -9
  43. package/dist/esm/success-page.entry.js.map +1 -1
  44. package/dist/rebill-web-components-sdk/otp-component.rebill-modal-overlay.rebill-mode-sandbox.rebill-mode-sandbox-mobile.rebill-summary.success-page.user-information.entry.esm.js.map +1 -1
  45. package/dist/rebill-web-components-sdk/{p-d51a9b31.entry.js → p-02c8d5ca.entry.js} +2 -2
  46. package/dist/rebill-web-components-sdk/{p-d51a9b31.entry.js.map → p-02c8d5ca.entry.js.map} +1 -1
  47. package/dist/rebill-web-components-sdk/p-836f16da.entry.js +2 -0
  48. package/dist/rebill-web-components-sdk/p-836f16da.entry.js.map +1 -0
  49. package/dist/rebill-web-components-sdk/p-9460caf2.entry.js +2 -0
  50. package/dist/rebill-web-components-sdk/{p-2d406e83.entry.js.map → p-9460caf2.entry.js.map} +1 -1
  51. package/dist/rebill-web-components-sdk/rebill-renewal.entry.esm.js.map +1 -1
  52. package/dist/rebill-web-components-sdk/rebill-renewal.entry.js +1 -1
  53. package/dist/rebill-web-components-sdk/rebill-renewal.entry.js.map +1 -1
  54. package/dist/rebill-web-components-sdk/renewal-success-page.entry.esm.js.map +1 -1
  55. package/dist/rebill-web-components-sdk/renewal-success-page.entry.js +1 -1
  56. package/dist/rebill-web-components-sdk/renewal-success-page.entry.js.map +1 -1
  57. package/dist/rebill-web-components-sdk/renewal-success-page.renewal-summary.entry.esm.js.map +1 -1
  58. package/dist/rebill-web-components-sdk/success-page.entry.esm.js.map +1 -1
  59. package/dist/rebill-web-components-sdk/success-page.entry.js +9 -9
  60. package/dist/rebill-web-components-sdk/success-page.entry.js.map +1 -1
  61. package/package.json +1 -1
  62. package/dist/components/p-BEEjWgM3.js.map +0 -1
  63. package/dist/rebill-web-components-sdk/p-2d406e83.entry.js +0 -2
  64. package/dist/rebill-web-components-sdk/p-8db3574a.entry.js +0 -2
  65. package/dist/rebill-web-components-sdk/p-8db3574a.entry.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e,c as t,h as i}from"./p-DyaDabZ4.js";import{c as r}from"./p-BFhvUZPU.js";import{a as o,C as n}from"./p-C6wUNEUc.js";import{P as a,G as s,a as l}from"./p-DDeOZpZn.js";import{P as c,I as d}from"./p-B2B19LUC.js";import{r as h,R as m,o as u}from"./p-Dcf7Or4N.js";import{B as p,g as f,i as b}from"./p-Do_vNuMa.js";import{C as y}from"./p-DA598vBj.js";import{m as g,i as x,g as w,P as k,a as v}from"./p-CAKTSGNY.js";import"./p-BFTU3MAI.js";import"./p-B2LDUv1-.js";import"./p-uZj1dMLQ.js";import"./p-UlyTyHvM.js";import"./p-BYrqevT1.js";import"./p-Bf6g23G6.js";import"./p-lWh04UqG.js";const j=async(e,t,i)=>{const r=await o.checkout.getRequiredFields({currency:e,method:t},i);return{fields:g(r.data),original:r.data}};const q=async()=>{const e=[...new Set(h.data.paymentMethods.map((e=>e.type)))];const t=e.map((async e=>{try{const t=a.mapToAPMPaymentMethod(e,h.data.price.country);const i=await j(h.data.price.currency,t,h.data.organization.id);return{paymentMethod:e,...i}}catch(t){console.error(`Error getting required fields for ${e}:`,t);return{paymentMethod:e,fields:[],original:[]}}}));const i=await Promise.all(t);const r={};i.forEach((e=>{r[e.paymentMethod]={fields:e.fields,original:e.original}}));return r};const C=(e,t)=>{const i=t[e];if(i){return i}else{return{fields:[],original:[]}}};const D=":root{--rebill-color-primary:#3b82f6;--rebill-color-primary-light:rgba(59, 130, 246, 0.1);--rebill-color-primary-hover:#2563eb;--rebill-color-primary-dark:#001131;--rebill-color-primary-dark-text:#000000;--rebill-color-primary-dark-hover:#001c4a;--rebill-color-primary-dark-light:rgba(0, 17, 49, 0.1);--rebill-color-error:#ef4444;--rebill-color-error-background:#fef2f2;--rebill-color-error-light:rgba(239, 68, 68, 0.1);--rebill-color-error-dark:#6f101b;--rebill-color-background:#ffffff;--rebill-color-background-left:#fafafa;--rebill-color-background-right:#f4f5f6;--rebill-color-background-secondary:#f7f8fa;--rebill-color-border:#ebedef;--rebill-color-timeline-connector:#c4c8cf;--rebill-color-neutrals-700:#58616e;--rebill-color-neutrals-500:#9ca3af;--rebill-color-border-primary:#e4e4e7;--rebill-color-text-primary:#3b4049;--rebill-color-text-secondary:#6b7280;--rebill-color-grey-700:#7d7d7d;--rebill-color-text-secondary-light:#a1a1aa;--rebill-color-text-on-primary:#ffffff;--rebill-color-disabled:#9ca3af;--rebill-color-shadow:rgba(0, 0, 0, 0.1);--rebill-color-green:#10b981;--rebill-color-green-text:#257c67;--rebill-color-green-light:rgba(183, 233, 221, 0.15);--rebill-color-green-light-2:rgba(183, 233, 221, 1);--rebill-color-info-background:#d5e4ff;--rebill-color-info-border:#0156f6;--rebill-color-info-text:#172b85;--rebill-color-background-secondary-light:#f7f8fa;--rebill-breakpoint-mobile:768px;--rebill-breakpoint-tablet:1024px;--rebill-breakpoint-desktop:1025px;--rebill-color-orange:#ff9400;--rebill-color-black:#1e2025;--rebill-color-grey-300:#3b4049;--rebill-color-grey-100:#aeaeae}.qr-container,.qr-image,.qr-image svg,.qr-image img,[class*='qr-'],[class*='success'],[class*='receipt']{transition:none !important;animation:none !important;will-change:auto !important}button:active,button:focus,button:hover{isolation:isolate}@media (max-width: 1024px){.rebill-checkout-renewal{flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%;margin-top:24px}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}}@media (min-width: 1025px){.rebill-checkout-renewal{width:100vw;min-height:100vh;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;margin-top:24px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const N=class{constructor(i){e(this,i);this.success=t(this,"success");this.paymentError=t(this,"paymentError");this.paymentMethodSelected=t(this,"paymentMethodSelected")}renewalData;renewalToken;currentPaymentMethod=c.CARD;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;errorMessage=null;breakpoint=p.DESKTOP;errorPaymentCard=false;errorPaymentAPM=false;initialData={};checkoutResponse=null;currentApmPaymentMethod=null;countries=[];allRequiredFields={};currentRequiredFields=[];errorCardInvalid=false;cardMode="select";success;paymentError;paymentMethodSelected;validationSchema={phoneNumber:r().when([],{is:()=>x("phoneNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.phoneRequired"),otherwise:e=>e.notRequired()}),"billing-country":r().when([],{is:()=>x("billing-country",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.countryRequired"),otherwise:e=>e.notRequired()}),"billing-state":r().when([],{is:()=>x("billing-state",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.stateRequired"),otherwise:e=>e.notRequired()}),"billing-address":r().when([],{is:()=>x("billing-address",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.addressRequired"),otherwise:e=>e.notRequired()}),"billing-city":r().when([],{is:()=>x("billing-city",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.cityRequired"),otherwise:e=>e.notRequired()}),"billing-zip":r().when([],{is:()=>x("billing-zip",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.zipRequired"),otherwise:e=>e.notRequired()}),bankId:r().when([],{is:()=>x("bankId",this.currentRequiredFields),then:e=>e.required("validation.bankRequired"),otherwise:e=>e.notRequired()}),documentType:r().when([],{is:()=>x("documentType",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentTypeRequired"),otherwise:e=>e.notRequired()}),documentNumber:r().when([],{is:()=>x("documentNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentNumberRequired").min(7,"validation.documentInvalid"),otherwise:e=>e.notRequired()})};resizeHandler=()=>{this.breakpoint=f(window.innerWidth)};async componentWillLoad(){this.resizeHandler();window.addEventListener("resize",this.resizeHandler);const e=typeof this.renewalData==="string"?JSON.parse(this.renewalData):this.renewalData;m.initializeRenewal({...e,token:this.renewalToken});s.loadGoogleMapsScript();try{const e=await o.data.getCountries();this.countries=e.data}catch(e){console.error("Error loading countries:",e)}try{this.allRequiredFields=await q()}catch(e){console.error("Error loading required fields:",e)}if(h.data.paymentMethods.length>0){const e=h.data.paymentMethods[0].type;this.currentPaymentMethod=e;m.setSelectedPaymentMethod(e);try{this.currentRequiredFields=C(e,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(e)}this.initialData=this.getInitialData();this.cardMode=h.cardMode;u("cardMode",(()=>{this.cardMode=h.cardMode}))}disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler)}async handlePaymentMethodSelected(e){e.stopPropagation();if(this.currentPaymentMethod===e.detail){return}this.currentPaymentMethod=e.detail;m.setSelectedPaymentMethod(this.currentPaymentMethod);if(this.currentPaymentMethod!==c.CARD){this.cardMode="input";m.setCardMode("input")}try{this.currentRequiredFields=C(this.currentPaymentMethod,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(this.currentPaymentMethod);this.paymentMethodSelected.emit(e.detail)}async initializeFingerprint(e){if(e===c.CARD&&!h.deviceId){try{const e=crypto.randomUUID();const t=await o.fingerPrint.getFingerPrint(e);m.setDeviceId(e);const i=t.result.script;const r=document.createElement("script");r.innerHTML=i;document.body.appendChild(r)}catch(e){console.error("Failed to initialize fingerprint:",e)}}}handleBankSelected(e){e.stopPropagation();m.setSelectedBankId(e.detail)}handleCardSelected(e){const{card:t,cvv:i}=e.detail;m.setSelectedCard(t);m.setCvv(i||"")}get currentPaymentError(){if(this.currentPaymentMethod===c.CARD){return this.errorPaymentCard}else if(this.currentPaymentMethod===c.CASH||this.currentPaymentMethod===c.BANK_TRANSFER){return this.errorPaymentAPM}return false}async handleSubmit(e){if(this.isSubmitting){return}if(this.currentPaymentMethod===c.CARD){await this.handleCardRenewal(e)}else{await this.handleAPMRenewal(e)}}async handleCardRenewal(e){const t=e?.detail||this.getInitialData();if(!h.data.cardId&&!h.data.cardTokenId){this.errorCardInvalid=true;return}if(!h.data.cardInformation&&!h.data.cardId){this.errorCardInvalid=true;return}this.errorCardInvalid=false;this.isSubmitting=true;this.isCardSubmitting=true;m.setLoading(true);try{const e={transaction:{quantity:1},...h.data.cardId&&{cardId:h.data.cardId},...h.data.cardTokenId&&{cardTokenId:h.data.cardTokenId},customAttributes:{...h.deviceId&&{deviceId:h.deviceId}},...this.cardMode==="input"&&{customer:{firstName:t.fullName?.split(" ")[0]||h.data.subscription.customerName?.split(" ")[0],lastName:t.fullName?.split(" ").slice(1).join(" ")||h.data.subscription.customerName?.split(" ").slice(1).join(" "),email:t.email||h.data.subscription.customerEmail,phone:{countryCode:t.countryCodePhoneNumber||"",number:t.phoneNumber||""}},billingDetails:{address:{lineOne:t["billing-address"]||"",city:t["billing-city"]||"",state:t["billing-state"]||"",country:t["billing-country"]||"",zipCode:t["billing-zip"]||""},identification:{type:t.documentType||"",value:t.documentNumber||""}}}};const i=w();const r=await o.checkout.createCardCheckoutRequest(h.data.id,i,e,h.token);this.isSubmitting=false;this.isCardSubmitting=false;m.setLoading(false);m.setCheckoutResponse(r.data);if(r.data.result?.status.toUpperCase()===n.APPROVED){this.isCardSuccess=true}else{this.isCardSuccess=false;this.errorPaymentCard=true;this.errorMessage={message:r.data.error?.error?.message}}}catch(e){this.isSubmitting=false;this.isCardSubmitting=false;m.setLoading(false);this.errorPaymentCard=true;this.errorMessage={message:e.data?.error?.message}}}async handleAPMRenewal(e){this.isSubmitting=true;m.setLoading(true);try{const t=a.mapToAPMPaymentMethod(this.currentPaymentMethod,h.data.price.country);const i=e?.detail||this.getFormData();const r={address:{country:i["billing-country"],state:i["billing-state"]||"",city:i["billing-city"]||"",zipCode:i["billing-zip"]||"",lineOne:i["billing-address"]||""},identification:{type:i.documentType||"dni",value:i.documentNumber||""}};const s={transaction:{quantity:1},method:t,billingDetails:r,redirect:{approved:window.location.origin+"/renewal/success",rejected:window.location.origin+"/renewal/failure"},paymentMetadata:{orderId:h.data.id,source:"renewal-web"},customAttributes:{bank:i.bankId||""},...t!==l.CO_TRANSFERENCE_PSE&&{targetCurrency:h.data.price.currency}};s.customer={firstName:i.fullName?.split(" ")[0]||h.data.subscription.customerName.split(" ")[0]||"",lastName:i.fullName?.split(" ").slice(1).join(" ")||h.data.subscription.customerName.split(" ").slice(1).join(" ")||"",email:i.email||h.data.subscription.customerEmail,phone:{countryCode:i.countryCodePhoneNumber||"",number:i.phoneNumber||""}};const c=w();const d=await o.checkout.createAPMCheckoutRequest(h.data.id,c,s);this.isSubmitting=false;m.setLoading(false);m.setCheckoutResponse(d.data);this.checkoutResponse=d.data;if(d.data.result?.status.toUpperCase()===n.APPROVED){this.isCardSuccess=true}else{this.paymentError.emit(d.data);m.setCheckoutResponse(d.data);this.errorPaymentAPM=true;this.errorMessage={alertTitle:d.data?.error?.message,message:d.data.error?.message}}}catch(e){this.isSubmitting=false;m.setLoading(false);this.paymentError.emit(e);this.errorPaymentAPM=true;this.errorMessage={alertTitle:e.data?.error?.message,message:e.data?.error?.message}}}getFormData=()=>this.initialData;getInitialData=()=>({email:h.data.subscription.customerEmail,fullName:h.data.subscription.customerName,card:"","billing-country":"","billing-state":"","billing-address":"","billing-city":"","billing-zip":"",bankId:"",phoneNumber:"",countryCodePhoneNumber:"",documentType:"",documentNumber:""});hasPrefilledAddress=()=>{const e=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return e.some((e=>{const t=this.initialData[e];return t&&t.trim()!==""}))};getPaymentDate=()=>{const e=h.form.checkoutResponse;if(!e)return"";if("date"in e){return e.date}return""};getReferenceNumber=()=>{const e=h.form.checkoutResponse;if(!e)return"";if("traceId"in e){return e.traceId}return""};render(){if(!h.isInitialized){return i("div",{class:"loading"},d.translate("renewal.loading"))}const e=e=>i("renewal-summary",{totalAmount:h.data.price.amount,currency:h.data.price.currency,subscriptionTitle:h.data.subscription.name[0]?.text||"Subscription",subscriptionAmount:h.data.subscription.amount,nextChargeDate:h.data.subscription.nextChargeDate,frequency:h.data.subscription.frequency,...e});return i(i.Fragment,null,i("rebill-processing-payment",{style:{display:this.isCardSubmitting?"block":"none"}}),this.isCardSuccess?i("renewal-success-page",{typePaymentMethod:this.currentPaymentMethod,paymentDate:this.getPaymentDate(),referenceNumber:this.getReferenceNumber(),cardLastFour:h.data.subscription.cardLastFour,country:h.data.price.country,paymentMethodName:a.mapToAPMPaymentMethod(this.currentPaymentMethod,h.data?.price?.country),bank:h.form?.selectedBankId||""}):i("rebill-checkout-form",{style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:e=>this.handleSubmit(e),renderForm:({submit:t,formData:r,errors:o})=>i("div",{class:"rebill-checkout-renewal"},i("div",{class:"left-section"},i("div",{class:"left-section-container"},i("organization-logo",{organization:h.data.organization}),i("div",{class:"checkout-form-section"},i("user-information-static",{userInfo:{customerName:h.data.subscription.customerName,customerEmail:h.data.subscription.customerEmail}}),b(this.breakpoint,p.DESKTOP)&&e({displayedComponents:"header"}),b(this.breakpoint,p.DESKTOP)&&e({displayedComponents:"details"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"32px"}},i("payment-method-selector",{enabledPaymentMethods:[...new Set(h.data.paymentMethods.map((e=>e.type)))],defaultSelected:this.currentPaymentMethod,errorComponent:{showErrorComponent:this.currentPaymentError,alertTitle:k.getErrorTitle(this.currentPaymentMethod,h.data.price.country,this.errorMessage?.alertTitle),message:k.getErrorMessage(this.errorMessage.message,this.currentPaymentMethod,h.data.price.country)},cardError:{showCardInvalid:this.errorCardInvalid,type:null},country:h.data.price.country,documentTypeError:o?.documentType,documentNumberError:o?.documentNumber,showDocument:this.cardMode==="input"&&(x("documentType",this.currentRequiredFields)||x("documentNumber",this.currentRequiredFields))}),this.currentPaymentMethod!==c.CARD&&i("rebill-alert",{type:"info",message:d.translate("renewal.paymentMethodAlert",{cardLastFour:h.data.subscription.cardLastFour||"****"}),icon:"calendar-edit",variant:"outlined",colorIcon:y.PRIMARY}),this.cardMode==="input"&&x("bankId",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("rebill-bank-selector",{banks:v("bank",this.allRequiredFields[this.currentPaymentMethod]?.original)||[],defaultSelectedBankId:r.bankId||"",error:o?.bankId}))),this.cardMode==="input"&&(x("billing-country",this.currentRequiredFields)||x("billing-state",this.currentRequiredFields)||x("billing-address",this.currentRequiredFields)||x("billing-city",this.currentRequiredFields)||x("billing-zip",this.currentRequiredFields))&&i("div",{class:"animated-component slide-in"},i("rebill-address",{countryOptions:this.countries.map((e=>({label:e.country,value:e.isoCountryCode}))),billingView:this.hasPrefilledAddress()?"form":"search",errors:{"billing-country":o["billing-country"],"billing-state":o["billing-state"],"billing-address":o["billing-address"],"billing-city":o["billing-city"],"billing-zip":o["billing-zip"]}})),this.cardMode==="input"&&x("phoneNumber",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("user-information-phone",{error:o?.phoneNumber})),this.checkoutResponse?.result&&(this.currentPaymentMethod===c.CASH||this.currentPaymentMethod===c.BANK_TRANSFER)&&i("apm-checkout",{paymentMethod:this.currentPaymentMethod,referenceId:this.currentPaymentMethod===c.CASH?this.checkoutResponse.result.data.referenceId:undefined,qrCodeData:this.currentPaymentMethod===c.BANK_TRANSFER?this.checkoutResponse.result.data.qrCode:undefined,providerName:h.data.organization?.name||"",expirationDate:(()=>{const e=new Date;e.setDate(e.getDate()+30);return e.toISOString()})(),country:h.data.price.country,redirectUrl:this.checkoutResponse.result.data.url}),b(this.breakpoint,p.DESKTOP)&&e({displayedComponents:"summary"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},i("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,isRenewal:true,trialPeriodDays:h.data.subscription.trialPeriodDays,redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:5e3,country:h.data.price.country,isDisabled:h.fetchingInstallments,onSubmit:()=>t()}),i("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:d.translate("otp.secureMessage")}))),i("rebill-footer",null))),!b(this.breakpoint,p.DESKTOP)&&i("div",{class:"right-section"},i("div",{class:"checkout-summary-section"},e({displayedComponents:["header","details","summary"]}))))}))}};N.style=D;export{N as rebill_renewal};
2
- //# sourceMappingURL=p-d51a9b31.entry.js.map
1
+ import{r as e,c as t,h as i}from"./p-DyaDabZ4.js";import{c as r}from"./p-BFhvUZPU.js";import{a as o,C as n}from"./p-C6wUNEUc.js";import{P as a,G as s,a as l}from"./p-DDeOZpZn.js";import{P as c,I as d}from"./p-B2B19LUC.js";import{r as h,R as m,o as u}from"./p-Dcf7Or4N.js";import{B as p,g as f,i as b}from"./p-Do_vNuMa.js";import{C as y}from"./p-DA598vBj.js";import{m as g,i as x,g as w,P as k,a as v}from"./p-CAKTSGNY.js";import"./p-BFTU3MAI.js";import"./p-B2LDUv1-.js";import"./p-uZj1dMLQ.js";import"./p-UlyTyHvM.js";import"./p-BYrqevT1.js";import"./p-Bf6g23G6.js";import"./p-lWh04UqG.js";const j=async(e,t,i)=>{const r=await o.checkout.getRequiredFields({currency:e,method:t},i);return{fields:g(r.data),original:r.data}};const q=async()=>{const e=[...new Set(h.data.paymentMethods.map((e=>e.type)))];const t=e.map((async e=>{try{const t=a.mapToAPMPaymentMethod(e,h.data.price.country);const i=await j(h.data.price.currency,t,h.data.organization.id);return{paymentMethod:e,...i}}catch(t){console.error(`Error getting required fields for ${e}:`,t);return{paymentMethod:e,fields:[],original:[]}}}));const i=await Promise.all(t);const r={};i.forEach((e=>{r[e.paymentMethod]={fields:e.fields,original:e.original}}));return r};const C=(e,t)=>{const i=t[e];if(i){return i}else{return{fields:[],original:[]}}};const D=":root{--rebill-color-primary:#3b82f6;--rebill-color-primary-light:rgba(59, 130, 246, 0.1);--rebill-color-primary-hover:#2563eb;--rebill-color-primary-dark:#001131;--rebill-color-primary-dark-text:#000000;--rebill-color-primary-dark-hover:#001c4a;--rebill-color-primary-dark-light:rgba(0, 17, 49, 0.1);--rebill-color-error:#ef4444;--rebill-color-error-background:#fef2f2;--rebill-color-error-light:rgba(239, 68, 68, 0.1);--rebill-color-error-dark:#6f101b;--rebill-color-background:#ffffff;--rebill-color-background-left:#fafafa;--rebill-color-background-right:#f4f5f6;--rebill-color-background-secondary:#f7f8fa;--rebill-color-border:#ebedef;--rebill-color-timeline-connector:#c4c8cf;--rebill-color-neutrals-700:#58616e;--rebill-color-neutrals-500:#9ca3af;--rebill-color-border-primary:#e4e4e7;--rebill-color-text-primary:#3b4049;--rebill-color-text-secondary:#6b7280;--rebill-color-grey-700:#7d7d7d;--rebill-color-text-secondary-light:#a1a1aa;--rebill-color-text-on-primary:#ffffff;--rebill-color-disabled:#9ca3af;--rebill-color-shadow:rgba(0, 0, 0, 0.1);--rebill-color-green:#10b981;--rebill-color-green-text:#257c67;--rebill-color-green-light:rgba(183, 233, 221, 0.15);--rebill-color-green-light-2:rgba(183, 233, 221, 1);--rebill-color-info-background:#d5e4ff;--rebill-color-info-border:#0156f6;--rebill-color-info-text:#172b85;--rebill-color-background-secondary-light:#f7f8fa;--rebill-breakpoint-mobile:768px;--rebill-breakpoint-tablet:1024px;--rebill-breakpoint-desktop:1025px;--rebill-color-orange:#ff9400;--rebill-color-black:#1e2025;--rebill-color-grey-300:#3b4049;--rebill-color-grey-100:#aeaeae}.qr-container,.qr-image,.qr-image svg,.qr-image img,[class*='qr-'],[class*='success'],[class*='receipt']{transition:none !important;animation:none !important;will-change:auto !important}button:active,button:focus,button:hover{isolation:isolate}@media (max-width: 1024px){.rebill-checkout-renewal{flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%;margin-top:24px}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}}@media (min-width: 1025px){.rebill-checkout-renewal{width:100vw;min-height:100vh;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;margin-top:24px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const N=class{constructor(i){e(this,i);this.success=t(this,"success");this.paymentError=t(this,"paymentError");this.paymentMethodSelected=t(this,"paymentMethodSelected")}renewalData;renewalToken;currentPaymentMethod=c.CARD;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;errorMessage=null;breakpoint=p.DESKTOP;errorPaymentCard=false;errorPaymentAPM=false;initialData={};checkoutResponse=null;currentApmPaymentMethod=null;countries=[];allRequiredFields={};currentRequiredFields=[];errorCardInvalid=false;cardMode="select";success;paymentError;paymentMethodSelected;validationSchema={phoneNumber:r().when([],{is:()=>x("phoneNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.phoneRequired"),otherwise:e=>e.notRequired()}),"billing-country":r().when([],{is:()=>x("billing-country",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.countryRequired"),otherwise:e=>e.notRequired()}),"billing-state":r().when([],{is:()=>x("billing-state",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.stateRequired"),otherwise:e=>e.notRequired()}),"billing-address":r().when([],{is:()=>x("billing-address",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.addressRequired"),otherwise:e=>e.notRequired()}),"billing-city":r().when([],{is:()=>x("billing-city",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.cityRequired"),otherwise:e=>e.notRequired()}),"billing-zip":r().when([],{is:()=>x("billing-zip",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.zipRequired"),otherwise:e=>e.notRequired()}),bankId:r().when([],{is:()=>x("bankId",this.currentRequiredFields),then:e=>e.required("validation.bankRequired"),otherwise:e=>e.notRequired()}),documentType:r().when([],{is:()=>x("documentType",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentTypeRequired"),otherwise:e=>e.notRequired()}),documentNumber:r().when([],{is:()=>x("documentNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentNumberRequired").min(7,"validation.documentInvalid"),otherwise:e=>e.notRequired()})};resizeHandler=()=>{this.breakpoint=f(window.innerWidth)};async componentWillLoad(){this.resizeHandler();window.addEventListener("resize",this.resizeHandler);const e=typeof this.renewalData==="string"?JSON.parse(this.renewalData):this.renewalData;m.initializeRenewal({...e,token:this.renewalToken});s.loadGoogleMapsScript();try{const e=await o.data.getCountries();this.countries=e.data}catch(e){console.error("Error loading countries:",e)}try{this.allRequiredFields=await q()}catch(e){console.error("Error loading required fields:",e)}if(h.data.paymentMethods.length>0){const e=h.data.paymentMethods[0].type;this.currentPaymentMethod=e;m.setSelectedPaymentMethod(e);try{this.currentRequiredFields=C(e,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(e)}this.initialData=this.getInitialData();this.cardMode=h.cardMode;u("cardMode",(()=>{this.cardMode=h.cardMode}))}disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler)}async handlePaymentMethodSelected(e){e.stopPropagation();if(this.currentPaymentMethod===e.detail){return}this.currentPaymentMethod=e.detail;m.setSelectedPaymentMethod(this.currentPaymentMethod);if(this.currentPaymentMethod!==c.CARD){this.cardMode="input";m.setCardMode("input")}try{this.currentRequiredFields=C(this.currentPaymentMethod,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(this.currentPaymentMethod);this.paymentMethodSelected.emit(e.detail)}async initializeFingerprint(e){if(e===c.CARD&&!h.deviceId){try{const e=crypto.randomUUID();const t=await o.fingerPrint.getFingerPrint(e);m.setDeviceId(e);const i=t.result.script;const r=document.createElement("script");r.innerHTML=i;document.body.appendChild(r)}catch(e){console.error("Failed to initialize fingerprint:",e)}}}handleBankSelected(e){e.stopPropagation();m.setSelectedBankId(e.detail)}handleCardSelected(e){const{card:t,cvv:i}=e.detail;m.setSelectedCard(t);m.setCvv(i||"")}get currentPaymentError(){if(this.currentPaymentMethod===c.CARD){return this.errorPaymentCard}else if(this.currentPaymentMethod===c.CASH||this.currentPaymentMethod===c.BANK_TRANSFER){return this.errorPaymentAPM}return false}async handleSubmit(e){if(this.isSubmitting){return}if(this.currentPaymentMethod===c.CARD){await this.handleCardRenewal(e)}else{await this.handleAPMRenewal(e)}}async handleCardRenewal(e){const t=e?.detail||this.getInitialData();if(!h.data.cardId&&!h.data.cardTokenId){this.errorCardInvalid=true;return}if(!h.data.cardInformation&&!h.data.cardId){this.errorCardInvalid=true;return}this.errorCardInvalid=false;this.isSubmitting=true;this.isCardSubmitting=true;m.setLoading(true);try{const e={transaction:{quantity:1},...h.data.cardId&&{cardId:h.data.cardId},...h.data.cardTokenId&&{cardTokenId:h.data.cardTokenId},customAttributes:{...h.deviceId&&{deviceId:h.deviceId}},...this.cardMode==="input"&&{customer:{firstName:t.fullName?.split(" ")[0]||h.data.subscription.customerName?.split(" ")[0],lastName:t.fullName?.split(" ").slice(1).join(" ")||h.data.subscription.customerName?.split(" ").slice(1).join(" "),email:t.email||h.data.subscription.customerEmail,phone:{countryCode:t.countryCodePhoneNumber||"",number:t.phoneNumber||""}},billingDetails:{address:{lineOne:t["billing-address"]||"",city:t["billing-city"]||"",state:t["billing-state"]||"",country:t["billing-country"]||"",zipCode:t["billing-zip"]||""},identification:{type:t.documentType||"",value:t.documentNumber||""}}}};const i=w();const r=await o.checkout.createCardCheckoutRequest(h.data.id,i,e,h.token);this.isSubmitting=false;this.isCardSubmitting=false;m.setLoading(false);m.setCheckoutResponse(r.data);if(r.data.result?.status.toUpperCase()===n.APPROVED){this.isCardSuccess=true}else{this.isCardSuccess=false;this.errorPaymentCard=true;this.errorMessage={message:r.data.error?.error?.message}}}catch(e){this.isSubmitting=false;this.isCardSubmitting=false;m.setLoading(false);this.errorPaymentCard=true;this.errorMessage={message:e.data?.error?.message}}}async handleAPMRenewal(e){this.isSubmitting=true;m.setLoading(true);try{const t=a.mapToAPMPaymentMethod(this.currentPaymentMethod,h.data.price.country);const i=e?.detail||this.getFormData();const r={address:{country:i["billing-country"],state:i["billing-state"]||"",city:i["billing-city"]||"",zipCode:i["billing-zip"]||"",lineOne:i["billing-address"]||""},identification:{type:i.documentType||"dni",value:i.documentNumber||""}};const s={transaction:{quantity:1},method:t,billingDetails:r,redirect:{approved:window.location.origin+"/renewal/success",rejected:window.location.origin+"/renewal/failure"},paymentMetadata:{orderId:h.data.id,source:"renewal-web"},customAttributes:{bank:i.bankId||""},...t!==l.CO_TRANSFERENCE_PSE&&{targetCurrency:h.data.price.currency}};s.customer={firstName:i.fullName?.split(" ")[0]||h.data.subscription.customerName.split(" ")[0]||"",lastName:i.fullName?.split(" ").slice(1).join(" ")||h.data.subscription.customerName.split(" ").slice(1).join(" ")||"",email:i.email||h.data.subscription.customerEmail,phone:{countryCode:i.countryCodePhoneNumber||"",number:i.phoneNumber||""}};const c=w();const d=await o.checkout.createAPMCheckoutRequest(h.data.id,c,s);this.isSubmitting=false;m.setLoading(false);m.setCheckoutResponse(d.data);this.checkoutResponse=d.data;if(d.data.result?.status.toUpperCase()===n.APPROVED){this.isCardSuccess=true}else{this.paymentError.emit(d.data);m.setCheckoutResponse(d.data);this.errorPaymentAPM=true;this.errorMessage={alertTitle:d.data?.error?.message,message:d.data.error?.message}}}catch(e){this.isSubmitting=false;m.setLoading(false);this.paymentError.emit(e);this.errorPaymentAPM=true;this.errorMessage={alertTitle:e.data?.error?.message,message:e.data?.error?.message}}}getFormData=()=>this.initialData;getInitialData=()=>({email:h.data.subscription.customerEmail,fullName:h.data.subscription.customerName,card:"","billing-country":"","billing-state":"","billing-address":"","billing-city":"","billing-zip":"",bankId:"",phoneNumber:"",countryCodePhoneNumber:"",documentType:"",documentNumber:""});hasPrefilledAddress=()=>{const e=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return e.some((e=>{const t=this.initialData[e];return t&&t.trim()!==""}))};getPaymentDate=()=>{const e=h.form.checkoutResponse;if(!e)return"";if("date"in e){return e.date}return""};getReferenceNumber=()=>{const e=h.form.checkoutResponse;if(!e)return"";if("traceId"in e){return e.traceId}return""};render(){if(!h.isInitialized){return i("div",{class:"loading"},d.translate("renewal.loading"))}const e=e=>i("renewal-summary",{totalAmount:h.data.price.amount,currency:h.data.price.currency,subscriptionTitle:h.data.subscription.name[0]?.text||"Subscription",subscriptionAmount:h.data.subscription.amount,nextChargeDate:h.data.subscription.nextChargeDate,frequency:h.data.subscription.frequency,...e});return i(i.Fragment,null,i("rebill-processing-payment",{style:{display:this.isCardSubmitting?"block":"none"}}),this.isCardSuccess?i("renewal-success-page",{typePaymentMethod:this.currentPaymentMethod,paymentDate:this.getPaymentDate(),referenceNumber:this.getReferenceNumber(),cardLastFour:h.data.subscription.cardLastFour,country:h.data.price.country,paymentMethodName:a.mapToAPMPaymentMethod(this.currentPaymentMethod,h.data?.price?.country),bank:h.form?.selectedBankId||""}):i("rebill-checkout-form",{style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:e=>this.handleSubmit(e),renderForm:({submit:t,formData:r,errors:o})=>i("div",{class:"rebill-checkout-renewal"},i("div",{class:"left-section"},i("div",{class:"left-section-container"},i("organization-logo",{organization:h.data.organization}),i("div",{class:"checkout-form-section"},i("user-information-static",{userInfo:{customerName:h.data.subscription.customerName,customerEmail:h.data.subscription.customerEmail}}),b(this.breakpoint,p.DESKTOP)&&e({displayedComponents:"header"}),b(this.breakpoint,p.DESKTOP)&&e({displayedComponents:"details"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"32px"}},i("payment-method-selector",{enabledPaymentMethods:[...new Set(h.data.paymentMethods.map((e=>e.type)))],defaultSelected:this.currentPaymentMethod,errorComponent:{showErrorComponent:this.currentPaymentError,alertTitle:k.getErrorTitle(this.currentPaymentMethod,h.data.price.country,this.errorMessage?.alertTitle),message:k.getErrorMessage(this.errorMessage?.message,this.currentPaymentMethod,h.data.price.country)},cardError:{showCardInvalid:this.errorCardInvalid,type:null},country:h.data.price.country,documentTypeError:o?.documentType,documentNumberError:o?.documentNumber,showDocument:this.cardMode==="input"&&(x("documentType",this.currentRequiredFields)||x("documentNumber",this.currentRequiredFields))}),this.currentPaymentMethod!==c.CARD&&i("rebill-alert",{type:"info",message:d.translate("renewal.paymentMethodAlert",{cardLastFour:h.data.subscription.cardLastFour||"****"}),icon:"calendar-edit",variant:"outlined",colorIcon:y.PRIMARY}),this.cardMode==="input"&&x("bankId",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("rebill-bank-selector",{banks:v("bank",this.allRequiredFields[this.currentPaymentMethod]?.original)||[],defaultSelectedBankId:r.bankId||"",error:o?.bankId}))),this.cardMode==="input"&&(x("billing-country",this.currentRequiredFields)||x("billing-state",this.currentRequiredFields)||x("billing-address",this.currentRequiredFields)||x("billing-city",this.currentRequiredFields)||x("billing-zip",this.currentRequiredFields))&&i("div",{class:"animated-component slide-in"},i("rebill-address",{countryOptions:this.countries.map((e=>({label:e.country,value:e.isoCountryCode}))),billingView:this.hasPrefilledAddress()?"form":"search",errors:{"billing-country":o["billing-country"],"billing-state":o["billing-state"],"billing-address":o["billing-address"],"billing-city":o["billing-city"],"billing-zip":o["billing-zip"]}})),this.cardMode==="input"&&x("phoneNumber",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("user-information-phone",{error:o?.phoneNumber})),this.checkoutResponse?.result&&(this.currentPaymentMethod===c.CASH||this.currentPaymentMethod===c.BANK_TRANSFER)&&i("apm-checkout",{paymentMethod:this.currentPaymentMethod,referenceId:this.currentPaymentMethod===c.CASH?this.checkoutResponse.result.data.referenceId:undefined,qrCodeData:this.currentPaymentMethod===c.BANK_TRANSFER?this.checkoutResponse.result.data.qrCode:undefined,providerName:h.data.organization?.name||"",expirationDate:(()=>{const e=new Date;e.setDate(e.getDate()+30);return e.toISOString()})(),country:h.data.price.country,redirectUrl:this.checkoutResponse.result.data.url}),b(this.breakpoint,p.DESKTOP)&&e({displayedComponents:"summary"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},i("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,isRenewal:true,trialPeriodDays:h.data.subscription.trialPeriodDays,redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:5e3,country:h.data.price.country,isDisabled:h.fetchingInstallments,onSubmit:()=>t()}),i("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:d.translate("otp.secureMessage")}))),i("rebill-footer",null))),!b(this.breakpoint,p.DESKTOP)&&i("div",{class:"right-section"},i("div",{class:"checkout-summary-section"},e({displayedComponents:["header","details","summary"]}))))}))}};N.style=D;export{N as rebill_renewal};
2
+ //# sourceMappingURL=p-02c8d5ca.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getRequiredFields","async","currency","method","organizationId","requiredFieldsResponse","api","checkout","fields","mapRequiredFields","data","original","getAllRequiredFieldsRenewal","paymentMethods","Set","renewalState","map","pm","type","promises","paymentMethod","apiPaymentMethod","PaymentMethodMapper","mapToAPMPaymentMethod","price","country","result","organization","id","error","console","results","Promise","all","fieldsMap","forEach","getRequiredFieldsForMethod","allRequiredFields","storedFields","rebillRenewalCss","RebillRenewal","renewalData","renewalToken","currentPaymentMethod","PAYMENT_METHOD_ENUM","CARD","isSubmitting","isCardSubmitting","isCardSuccess","errorMessage","breakpoint","BREAKPOINT_ENUM","DESKTOP","errorPaymentCard","errorPaymentAPM","initialData","checkoutResponse","currentApmPaymentMethod","countries","currentRequiredFields","errorCardInvalid","cardMode","success","paymentError","paymentMethodSelected","validationSchema","phoneNumber","yup.string","when","is","isFieldRequired","this","then","schema","required","otherwise","notRequired","bankId","documentType","documentNumber","min","resizeHandler","getBreakpoint","window","innerWidth","componentWillLoad","addEventListener","renewalProps","JSON","parse","RenewalStore","initializeRenewal","token","GoogleMapsService","loadGoogleMapsScript","response","getCountries","length","firstPaymentMethod","setSelectedPaymentMethod","initializeFingerprint","getInitialData","renewalOnChange","disconnectedCallback","removeEventListener","handlePaymentMethodSelected","event","stopPropagation","detail","setCardMode","emit","deviceId","uuid","crypto","randomUUID","fingerprintResponse","fingerPrint","getFingerPrint","setDeviceId","script","scriptElement","document","createElement","innerHTML","body","appendChild","handleBankSelected","setSelectedBankId","handleCardSelected","card","cvv","setSelectedCard","setCvv","currentPaymentError","CASH","BANK_TRANSFER","handleSubmit","handleCardRenewal","handleAPMRenewal","formData","cardId","cardTokenId","cardInformation","setLoading","renewalRequest","transaction","quantity","customAttributes","customer","firstName","fullName","split","subscription","customerName","lastName","slice","join","email","customerEmail","phone","countryCode","countryCodePhoneNumber","number","billingDetails","address","lineOne","city","state","zipCode","identification","value","idempotencyKey","generateIdempotencyKey","createCardCheckoutRequest","setCheckoutResponse","status","toUpperCase","CheckoutStatusE","APPROVED","message","apmPaymentMethod","getFormData","redirect","approved","location","origin","rejected","paymentMetadata","orderId","source","bank","PaymentMethodNameE","CO_TRANSFERENCE_PSE","targetCurrency","createAPMCheckoutRequest","alertTitle","hasPrefilledAddress","billingFields","some","key","trim","getPaymentDate","payment","form","date","getReferenceNumber","traceId","render","isInitialized","h","class","I18nService","translate","renderRenewalSummary","props","totalAmount","amount","subscriptionTitle","name","text","subscriptionAmount","nextChargeDate","frequency","Fragment","style","display","typePaymentMethod","paymentDate","referenceNumber","cardLastFour","paymentMethodName","selectedBankId","onSubmit","args","renderForm","submit","errors","userInfo","isBreakpointBelow","displayedComponents","flexDirection","gap","enabledPaymentMethods","defaultSelected","errorComponent","showErrorComponent","PaymentErrorMapper","getErrorTitle","getErrorMessage","cardError","showCardInvalid","documentTypeError","documentNumberError","showDocument","icon","variant","colorIcon","COLORS_ENUM","PRIMARY","banks","getFieldValues","defaultSelectedBankId","countryOptions","label","isoCountryCode","billingView","referenceId","undefined","qrCodeData","qrCode","providerName","expirationDate","Date","setDate","getDate","toISOString","redirectUrl","url","isLoading","isRenewal","trialPeriodDays","timeToRedirect","isDisabled","fetchingInstallments"],"sources":["src/components/renewal/utils/getRequiredFieldsRenewal.ts","src/components/renewal/rebill-renewal.css?tag=rebill-renewal","src/components/renewal/rebill-renewal.tsx"],"sourcesContent":["import { api } from '../../../api';\nimport { PAYMENT_METHOD_ENUM } from '../../../models/enums/payment-methods.enum';\nimport { renewalState } from '../../../store/renewal.store';\nimport { PaymentMethodMapper } from '../../../utils/payment-method-mapper';\nimport { mapRequiredFields, RequiredField } from '../../../utils/required-fields-mappers';\n\nexport interface RequiredFieldsResult {\n fields: string[];\n original: RequiredField[];\n}\n\nexport interface AllRequiredFieldsMap {\n [key: string]: RequiredFieldsResult;\n}\n\nconst getRequiredFields = async (\n currency: string,\n method: string,\n organizationId: string,\n): Promise<RequiredFieldsResult> => {\n const requiredFieldsResponse = await api.checkout.getRequiredFields(\n {\n currency,\n method,\n },\n organizationId,\n );\n\n return {\n fields: mapRequiredFields(requiredFieldsResponse.data),\n original: requiredFieldsResponse.data,\n };\n};\n\nexport const getAllRequiredFieldsRenewal = async (): Promise<AllRequiredFieldsMap> => {\n const paymentMethods = [\n ...new Set(renewalState.data.paymentMethods.map(pm => pm.type as PAYMENT_METHOD_ENUM)),\n ];\n const promises = paymentMethods.map(async paymentMethod => {\n try {\n const apiPaymentMethod = PaymentMethodMapper.mapToAPMPaymentMethod(\n paymentMethod,\n renewalState.data.price.country,\n );\n\n const result = await getRequiredFields(\n renewalState.data.price.currency,\n apiPaymentMethod,\n renewalState.data.organization.id,\n );\n\n return {\n paymentMethod,\n ...result,\n };\n } catch (error) {\n console.error(`Error getting required fields for ${paymentMethod}:`, error);\n return {\n paymentMethod,\n fields: [],\n original: [],\n };\n }\n });\n\n const results = await Promise.all(promises);\n const fieldsMap: AllRequiredFieldsMap = {};\n\n results.forEach(result => {\n fieldsMap[result.paymentMethod] = {\n fields: result.fields,\n original: result.original,\n };\n });\n return fieldsMap;\n};\n\nexport const getRequiredFieldsForMethod = (\n paymentMethod: PAYMENT_METHOD_ENUM,\n allRequiredFields: AllRequiredFieldsMap,\n): RequiredFieldsResult => {\n const storedFields = allRequiredFields[paymentMethod];\n if (storedFields) {\n return storedFields;\n } else {\n return {\n fields: [],\n original: [],\n };\n }\n};\n","@import '../../styles/variables.css';\n\n@media (max-width: 1024px) {\n .rebill-checkout-renewal {\n flex-direction: column;\n gap: 0;\n justify-content: flex-start;\n background: var(--rebill-color-background);\n padding: 20px;\n }\n .right-section .left-section {\n width: 100%;\n height: 100%;\n background: var(--rebill-color-background);\n }\n .checkout-form-section {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n gap: 24px;\n height: 100%;\n margin-top: 24px;\n }\n .otp-container {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n gap: 24px;\n }\n}\n\n@media (min-width: 1025px) {\n .rebill-checkout-renewal {\n width: 100vw;\n min-height: 100vh;\n display: flex;\n flex-direction: row;\n justify-content: center;\n overflow-y: auto;\n }\n\n .left-section {\n display: flex;\n width: 60%;\n background: var(--rebill-color-background-left);\n justify-content: space-around;\n }\n\n .right-section {\n display: flex;\n padding-top: 72px;\n width: 40%;\n background: var(--rebill-color-background-right);\n position: sticky;\n top: 0;\n\n justify-content: center;\n }\n\n .checkout-form-section {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n margin-bottom: 36px;\n margin-top: 24px;\n gap: 32px;\n }\n .left-section-container {\n max-width: 450px;\n min-width: 450px;\n margin: 2.5rem 2rem 1.5rem 2rem;\n display: flex;\n flex-direction: column;\n }\n\n .checkout-summary-section {\n max-width: 450px;\n min-width: 350px;\n margin: 0rem 2rem;\n background: var(--rebill-color-background-right);\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n width: 100%;\n }\n\n .checkout-form-section user-information,\n .checkout-form-section payment-method-selector,\n .checkout-form-section rebill-address,\n .checkout-summary-section rebill-summary {\n width: 100%;\n }\n\n /* Google Maps Autocomplete Styles */\n .pac-container {\n border-radius: 4px;\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\n border: 1px solid #e0e0e0;\n margin-top: 4px;\n font-family: inherit;\n }\n\n .pac-item {\n padding: 10px 12px;\n cursor: pointer;\n border-top: none;\n }\n\n .pac-item:first-child {\n border-top: none;\n }\n\n .pac-item:hover {\n background-color: #f5f5f5;\n }\n\n .pac-item-query {\n font-weight: 500;\n }\n\n .pac-icon {\n display: none;\n }\n}\n\n.payment-button-container {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 16px;\n}\n/* Animaciones para componentes condicionales */\n.animated-component {\n transition: all 0.3s ease-in-out;\n overflow: visible;\n}\n\n/* Keep overflow hidden only for sliding height animations */\n/* .animated-component.slide-in {\n overflow: hidden;\n} */\n\n.fade-in {\n animation: fadeIn 0.4s ease-in-out;\n}\n\n.slide-in {\n animation: slideIn 0.5s ease-out;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideIn {\n from {\n opacity: 0;\n transform: translateX(-20px);\n max-height: 0;\n }\n to {\n opacity: 1;\n transform: translateX(0);\n max-height: 450px;\n }\n}\n\n/* Animación para cuando se ocultan los componentes */\n.animated-component.hide {\n animation: fadeOut 0.3s ease-in-out forwards;\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(20px);\n }\n}\n\n/* Test Mode Chip Positioning */\nrebill-mode-sandbox {\n position: fixed;\n bottom: 50px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 1000;\n}\n\n/* Ensure the chip is visible on all screen sizes */\n@media (max-width: 1024px) {\n rebill-test-mode-chip {\n bottom: 46px;\n }\n}\n\n@media (min-width: 1025px) {\n rebill-test-mode-chip {\n bottom: 46px;\n }\n}\n.mode-sandbox-mobile-container {\n display: flex;\n align-items: center;\n width: 100%;\n\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n/* Desktop grande - mantener tamaños originales */\n@media (min-width: 1451px) {\n .left-section-container {\n min-width: 450px;\n margin: 2.5rem 5rem 1.5rem 5rem;\n }\n\n .checkout-summary-section {\n min-width: 450px;\n margin: 0rem 5rem;\n }\n}\n","import { Component, Event, EventEmitter, h, Listen, Prop, State } from '@stencil/core';\nimport * as yup from 'yup';\nimport { api, Country } from '../../api';\nimport { SavedCard } from '../../api/entities/cards/types';\nimport {\n CheckoutStatusE,\n CreateAPMCheckoutRequest,\n CreateAPMCheckoutResponse,\n CreateCardCheckoutRequest,\n} from '../../api/entities/checkout/types';\nimport '../../components/checkout/apm/apm-checkout/apm-checkout';\nimport '../../components/checkout/processing-payment/processing-payment';\nimport { I18nService } from '../../i18n/i18n.service';\n\nimport { PaymentMethodNameE } from '../../models/enums/payment-method-name.enum';\nimport { PAYMENT_METHOD_ENUM } from '../../models/enums/payment-methods.enum';\nimport { PaymentMessageE } from '../../models/enums/payment-status.enum';\nimport { onChange as renewalOnChange, renewalState, RenewalStore } from '../../store/renewal.store';\nimport { BREAKPOINT_ENUM, getBreakpoint, isBreakpointBelow } from '../../utils/breakpoint';\nimport { COLORS_ENUM } from '../../utils/color-class-mapper';\nimport { generateIdempotencyKey } from '../../utils/generate-idempotency-key';\nimport { GoogleMapsService } from '../../utils/google-maps.service';\nimport { AlertErrorKeys, PaymentErrorMapper } from '../../utils/payment-error-mapper';\nimport { PaymentMethodMapper } from '../../utils/payment-method-mapper';\nimport { getFieldValues, isFieldRequired } from '../../utils/required-fields-mappers';\nimport {\n AllRequiredFieldsMap,\n getAllRequiredFieldsRenewal,\n getRequiredFieldsForMethod,\n} from './utils/getRequiredFieldsRenewal';\n\n@Component({\n tag: 'rebill-renewal',\n styleUrl: 'rebill-renewal.css',\n shadow: false,\n})\nexport class RebillRenewal {\n @Prop() renewalData!: string;\n @Prop() renewalToken!: string;\n\n @State() currentPaymentMethod: PAYMENT_METHOD_ENUM = PAYMENT_METHOD_ENUM.CARD;\n @State() isSubmitting: boolean = false;\n @State() isCardSubmitting: boolean = false;\n @State() isCardSuccess: boolean = false;\n @State() errorMessage: AlertErrorKeys | null = null;\n @State() breakpoint: BREAKPOINT_ENUM = BREAKPOINT_ENUM.DESKTOP;\n @State() errorPaymentCard: boolean = false;\n @State() errorPaymentAPM: boolean = false;\n @State() initialData: any = {};\n @State() checkoutResponse: CreateAPMCheckoutResponse | null = null;\n @State() currentApmPaymentMethod: PaymentMethodNameE | null = null;\n @State() countries: Country[] = [];\n @State() allRequiredFields: AllRequiredFieldsMap = {};\n @State() currentRequiredFields: string[] = [];\n @State() errorCardInvalid: boolean = false;\n @State() cardMode: 'input' | 'select' | null = 'select';\n\n @Event() success: EventEmitter<any>;\n @Event() paymentError: EventEmitter<any>;\n @Event() paymentMethodSelected: EventEmitter<PAYMENT_METHOD_ENUM>;\n\n private validationSchema = {\n 'phoneNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('phoneNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.phoneRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-country': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-country', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.countryRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-state': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-state', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.stateRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-address': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-address', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.addressRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-city': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-city', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.cityRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-zip': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-zip', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.zipRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'bankId': yup.string().when([], {\n is: () => isFieldRequired('bankId', this.currentRequiredFields),\n then: schema => schema.required('validation.bankRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentType': yup.string().when([], {\n is: () =>\n isFieldRequired('documentType', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.documentTypeRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('documentNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema =>\n schema.required('validation.documentNumberRequired').min(7, 'validation.documentInvalid'),\n otherwise: schema => schema.notRequired(),\n }),\n };\n\n private resizeHandler = () => {\n this.breakpoint = getBreakpoint(window.innerWidth);\n };\n\n async componentWillLoad() {\n this.resizeHandler();\n window.addEventListener('resize', this.resizeHandler);\n\n const renewalProps =\n typeof this.renewalData === 'string' ? JSON.parse(this.renewalData) : this.renewalData;\n\n RenewalStore.initializeRenewal({\n ...renewalProps,\n token: this.renewalToken,\n });\n\n // Load Google Maps script for address autocomplete\n GoogleMapsService.loadGoogleMapsScript();\n\n // Load countries data\n try {\n const response = await api.data.getCountries();\n this.countries = response.data;\n } catch (error) {\n console.error('Error loading countries:', error);\n }\n\n // Load required fields data\n try {\n this.allRequiredFields = await getAllRequiredFieldsRenewal();\n } catch (error) {\n console.error('Error loading required fields:', error);\n }\n\n if (renewalState.data.paymentMethods.length > 0) {\n const firstPaymentMethod = renewalState.data.paymentMethods[0].type as PAYMENT_METHOD_ENUM;\n this.currentPaymentMethod = firstPaymentMethod;\n RenewalStore.setSelectedPaymentMethod(firstPaymentMethod);\n\n // Set required fields for the initial payment method\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n firstPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n // Initialize fingerprint for the first payment method\n await this.initializeFingerprint(firstPaymentMethod);\n }\n\n this.initialData = this.getInitialData();\n\n this.cardMode = renewalState.cardMode;\n renewalOnChange('cardMode', () => {\n this.cardMode = renewalState.cardMode;\n });\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.resizeHandler);\n }\n\n @Listen('paymentMethodSelected')\n async handlePaymentMethodSelected(event: CustomEvent<PAYMENT_METHOD_ENUM>) {\n event.stopPropagation();\n\n if (this.currentPaymentMethod === event.detail) {\n return;\n }\n\n this.currentPaymentMethod = event.detail;\n RenewalStore.setSelectedPaymentMethod(this.currentPaymentMethod);\n\n // Change cardMode to 'input' if payment method is not CARD\n if (this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD) {\n this.cardMode = 'input';\n RenewalStore.setCardMode('input');\n }\n\n // Update required fields for the new payment method\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n this.currentPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n // Note: Fingerprint is handled in componentWillLoad\n\n // Initialize fingerprint for the new payment method\n await this.initializeFingerprint(this.currentPaymentMethod);\n\n this.paymentMethodSelected.emit(event.detail);\n }\n\n private async initializeFingerprint(paymentMethod: PAYMENT_METHOD_ENUM) {\n // Only initialize fingerprint for card payments and if not already generated\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD && !renewalState.deviceId) {\n try {\n const uuid = crypto.randomUUID();\n const fingerprintResponse = await api.fingerPrint.getFingerPrint(uuid);\n RenewalStore.setDeviceId(uuid);\n const script = fingerprintResponse.result.script;\n const scriptElement = document.createElement('script');\n scriptElement.innerHTML = script;\n document.body.appendChild(scriptElement);\n } catch (error) {\n console.error('Failed to initialize fingerprint:', error);\n }\n }\n }\n\n @Listen('bankSelected')\n handleBankSelected(event: CustomEvent<string>) {\n event.stopPropagation();\n RenewalStore.setSelectedBankId(event.detail);\n }\n\n @Listen('cardSelected')\n handleCardSelected(event: CustomEvent<{ card: SavedCard; cvv?: string }>) {\n const { card, cvv } = event.detail;\n RenewalStore.setSelectedCard(card);\n RenewalStore.setCvv(cvv || '');\n }\n\n private get currentPaymentError(): boolean {\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return this.errorPaymentCard;\n } else if (\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ) {\n return this.errorPaymentAPM;\n }\n return false;\n }\n\n private async handleSubmit(event?: CustomEvent) {\n if (this.isSubmitting) {\n return;\n }\n\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n await this.handleCardRenewal(event);\n } else {\n await this.handleAPMRenewal(event);\n }\n }\n\n private async handleCardRenewal(event?: CustomEvent) {\n const formData = event?.detail || this.getInitialData();\n\n if (!renewalState.data.cardId && !renewalState.data.cardTokenId) {\n this.errorCardInvalid = true;\n return;\n }\n if (!renewalState.data.cardInformation && !renewalState.data.cardId) {\n this.errorCardInvalid = true;\n return;\n }\n this.errorCardInvalid = false;\n this.isSubmitting = true;\n this.isCardSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const renewalRequest: CreateCardCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n ...(renewalState.data.cardId && { cardId: renewalState.data.cardId }),\n ...(renewalState.data.cardTokenId && { cardTokenId: renewalState.data.cardTokenId }),\n customAttributes: {\n ...(renewalState.deviceId && { deviceId: renewalState.deviceId }),\n },\n ...(this.cardMode === 'input' && {\n customer: {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName?.split(' ')[0],\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName?.split(' ').slice(1).join(' '),\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n },\n billingDetails: {\n address: {\n lineOne: formData['billing-address'] || '',\n city: formData['billing-city'] || '',\n state: formData['billing-state'] || '',\n country: formData['billing-country'] || '',\n zipCode: formData['billing-zip'] || '',\n },\n identification: {\n type: formData.documentType || '',\n value: formData.documentNumber || '',\n },\n },\n }),\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createCardCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n renewalState.token,\n );\n\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.isCardSuccess = false;\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: response.data.error?.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: error.data?.error?.message as PaymentMessageE,\n };\n }\n }\n\n private async handleAPMRenewal(event?: CustomEvent) {\n this.isSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const apmPaymentMethod = PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n );\n\n // Get form data for billing details and customer info\n const formData = event?.detail || this.getFormData();\n\n // Transform form data to match CreateAPMCheckoutRequest structure\n const billingDetails = {\n address: {\n country: formData['billing-country'],\n state: formData['billing-state'] || '',\n city: formData['billing-city'] || '',\n zipCode: formData['billing-zip'] || '',\n lineOne: formData['billing-address'] || '',\n },\n identification: {\n type: formData.documentType || 'dni',\n value: formData.documentNumber || '',\n },\n };\n\n const renewalRequest: CreateAPMCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n method: apmPaymentMethod,\n billingDetails,\n redirect: {\n approved: window.location.origin + '/renewal/success',\n rejected: window.location.origin + '/renewal/failure',\n },\n paymentMetadata: {\n orderId: renewalState.data.id,\n source: 'renewal-web',\n },\n customAttributes: {\n bank: formData.bankId || '',\n },\n // Remove targetCurrency for PSE payments as it's not supported\n ...(apmPaymentMethod !== PaymentMethodNameE.CO_TRANSFERENCE_PSE && {\n targetCurrency: renewalState.data.price.currency,\n }),\n };\n\n // Add customer data for renewal\n renewalRequest.customer = {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName.split(' ')[0] ||\n '',\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName.split(' ').slice(1).join(' ') ||\n '',\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createAPMCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n );\n\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n this.checkoutResponse = response.data;\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.paymentError.emit(response.data);\n RenewalStore.setCheckoutResponse(response.data);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: response.data?.error?.message as PaymentMessageE,\n message: response.data.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n this.paymentError.emit(error);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: error.data?.error?.message as PaymentMessageE,\n message: error.data?.error?.message,\n };\n }\n }\n\n private getFormData = () => {\n return this.initialData;\n };\n\n private getInitialData = () => {\n return {\n 'email': renewalState.data.subscription.customerEmail,\n 'fullName': renewalState.data.subscription.customerName,\n 'card': '',\n 'billing-country': '',\n 'billing-state': '',\n 'billing-address': '',\n 'billing-city': '',\n 'billing-zip': '',\n 'bankId': '',\n 'phoneNumber': '',\n 'countryCodePhoneNumber': '',\n 'documentType': '',\n 'documentNumber': '',\n };\n };\n\n private hasPrefilledAddress = () => {\n const billingFields = [\n 'billing-country',\n 'billing-state',\n 'billing-address',\n 'billing-city',\n 'billing-zip',\n ];\n return billingFields.some(key => {\n const value = this.initialData[key];\n return value && value.trim() !== '';\n });\n };\n\n private getPaymentDate = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n\n if ('date' in payment) {\n return payment.date as string;\n }\n\n return '';\n };\n\n private getReferenceNumber = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n if ('traceId' in payment) {\n return payment.traceId as string;\n }\n\n return '';\n };\n\n render() {\n if (!renewalState.isInitialized) {\n return <div class=\"loading\">{I18nService.translate('renewal.loading')}</div>;\n }\n\n const renderRenewalSummary = props => (\n <renewal-summary\n totalAmount={renewalState.data.price.amount}\n currency={renewalState.data.price.currency}\n subscriptionTitle={renewalState.data.subscription.name[0]?.text || 'Subscription'}\n subscriptionAmount={renewalState.data.subscription.amount}\n nextChargeDate={renewalState.data.subscription.nextChargeDate}\n frequency={renewalState.data.subscription.frequency}\n {...props}\n />\n );\n\n return (\n <>\n <rebill-processing-payment style={{ display: this.isCardSubmitting ? 'block' : 'none' }} />\n {this.isCardSuccess ? (\n <renewal-success-page\n typePaymentMethod={this.currentPaymentMethod}\n paymentDate={this.getPaymentDate()}\n referenceNumber={this.getReferenceNumber()}\n cardLastFour={renewalState.data.subscription.cardLastFour}\n country={renewalState.data.price.country}\n paymentMethodName={PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data?.price?.country,\n )}\n bank={renewalState.form?.selectedBankId || ''}\n />\n ) : (\n <rebill-checkout-form\n style={{ display: this.isCardSubmitting || this.isCardSuccess ? 'none' : 'block' }}\n validationSchema={this.validationSchema}\n initialData={this.initialData}\n onSubmit={(args: any) => this.handleSubmit(args)}\n renderForm={({ submit, formData, errors }) => (\n <div class=\"rebill-checkout-renewal\">\n <div class=\"left-section\">\n <div class=\"left-section-container\">\n <organization-logo organization={renewalState.data.organization} />\n\n <div class=\"checkout-form-section\">\n {/* Customer Information - Readonly */}\n <user-information-static\n userInfo={{\n customerName: renewalState.data.subscription.customerName,\n customerEmail: renewalState.data.subscription.customerEmail,\n }}\n />\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'header',\n })}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'details',\n })}\n\n {/* Payment Method Selection */}\n <div style={{ display: 'flex', flexDirection: 'column', gap: '32px' }}>\n <payment-method-selector\n enabledPaymentMethods={[\n ...new Set(\n renewalState.data.paymentMethods.map(\n pm => pm.type as PAYMENT_METHOD_ENUM,\n ),\n ),\n ]}\n defaultSelected={this.currentPaymentMethod}\n errorComponent={{\n showErrorComponent: this.currentPaymentError,\n alertTitle: PaymentErrorMapper.getErrorTitle(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n this.errorMessage?.alertTitle,\n ),\n message: PaymentErrorMapper.getErrorMessage(\n this.errorMessage.message,\n this.currentPaymentMethod,\n renewalState.data.price.country,\n ),\n }}\n cardError={{\n showCardInvalid: this.errorCardInvalid,\n type: null,\n }}\n country={renewalState.data.price.country}\n documentTypeError={errors?.documentType}\n documentNumberError={errors?.documentNumber}\n showDocument={\n this.cardMode === 'input' &&\n (isFieldRequired('documentType', this.currentRequiredFields) ||\n isFieldRequired('documentNumber', this.currentRequiredFields))\n }\n />\n {/* Alert for non-card payment methods */}\n {this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD && (\n <rebill-alert\n type=\"info\"\n message={I18nService.translate('renewal.paymentMethodAlert', {\n cardLastFour: renewalState.data.subscription.cardLastFour || '****',\n })}\n icon=\"calendar-edit\"\n variant=\"outlined\"\n colorIcon={COLORS_ENUM.PRIMARY}\n />\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('bankId', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <rebill-bank-selector\n banks={\n getFieldValues(\n 'bank',\n this.allRequiredFields[this.currentPaymentMethod]?.original,\n ) || []\n }\n defaultSelectedBankId={formData.bankId || ''}\n error={errors?.bankId}\n />\n </div>\n )}\n </div>\n {this.cardMode === 'input' &&\n (isFieldRequired('billing-country', this.currentRequiredFields) ||\n isFieldRequired('billing-state', this.currentRequiredFields) ||\n isFieldRequired('billing-address', this.currentRequiredFields) ||\n isFieldRequired('billing-city', this.currentRequiredFields) ||\n isFieldRequired('billing-zip', this.currentRequiredFields)) && (\n <div class=\"animated-component slide-in\">\n <rebill-address\n countryOptions={this.countries.map(country => ({\n label: country.country,\n value: country.isoCountryCode,\n }))}\n billingView={this.hasPrefilledAddress() ? 'form' : 'search'}\n errors={{\n 'billing-country': errors['billing-country'],\n 'billing-state': errors['billing-state'],\n 'billing-address': errors['billing-address'],\n 'billing-city': errors['billing-city'],\n 'billing-zip': errors['billing-zip'],\n }}\n />\n </div>\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('phoneNumber', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <user-information-phone error={errors?.phoneNumber} />\n </div>\n )}\n\n {/* Show APM checkout response after successful payment submission */}\n {this.checkoutResponse?.result &&\n (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) && (\n <apm-checkout\n paymentMethod={this.currentPaymentMethod}\n referenceId={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH\n ? this.checkoutResponse.result.data.referenceId\n : undefined\n }\n qrCodeData={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ? this.checkoutResponse.result.data.qrCode\n : undefined\n }\n providerName={renewalState.data.organization?.name || ''}\n expirationDate={(() => {\n const expirationDate = new Date();\n expirationDate.setDate(expirationDate.getDate() + 30);\n return expirationDate.toISOString();\n })()}\n country={renewalState.data.price.country}\n redirectUrl={this.checkoutResponse.result.data.url}\n />\n )}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'summary',\n })}\n\n <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>\n {/* Payment Button */}\n <payment-button\n paymentMethod={this.currentPaymentMethod}\n isLoading={this.isSubmitting}\n isRenewal={true}\n trialPeriodDays={renewalState.data.subscription.trialPeriodDays}\n redirectUrl={!!this.checkoutResponse?.result?.data?.url}\n timeToRedirect={5000}\n country={renewalState.data.price.country}\n isDisabled={renewalState.fetchingInstallments}\n onSubmit={() => submit()}\n />\n\n {/* Disabled Button Below */}\n <rebill-alert\n type=\"secure\"\n variant=\"variant-secure\"\n icon=\"lock-outline\"\n message={I18nService.translate('otp.secureMessage')}\n />\n </div>\n </div>\n <rebill-footer />\n </div>\n </div>\n\n {/* Desktop Summary */}\n {!isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) && (\n <div class=\"right-section\">\n <div class=\"checkout-summary-section\">\n {renderRenewalSummary({\n displayedComponents: ['header', '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AeI,aACvB,EAJe,GAKhB1P,QAASV,EAAaL,KAAKc,MAAMC,QACjC2P,YAAa7M,KAAKf,iBAAiB9B,OAAOhB,KAAK2Q,MAIpDvC,EAAkBvK,KAAKrB,WAAYC,EAAgBC,UAClDiK,EAAqB,CACnB0B,oBAAqB,YAGzB9B,EAAA,OAAKe,MAAO,CAAEC,QAAS,OAAQe,cAAe,SAAUC,IAAK,SAE3DhC,EAAA,kBACE7L,cAAemD,KAAK5B,qBACpB2O,UAAW/M,KAAKzB,aAChByO,UAAW,KACXC,gBAAiBzQ,EAAaL,KAAK8I,aAAagI,gBAChDJ,cAAe7M,KAAKf,kBAAkB9B,QAAQhB,MAAM2Q,IACpDI,eAAgB,IAChBhQ,QAASV,EAAaL,KAAKc,MAAMC,QACjCiQ,WAAY3Q,EAAa4Q,qBACzBnD,SAAU,IAAMG,MAIlB1B,EACE,gBAAA/L,KAAK,SACL6O,QAAQ,iBACRD,KAAK,eACL3E,QAASgC,EAAYC,UAAU,yBAIrCH,EAAA,yBAKF6B,EAAkBvK,KAAKrB,WAAYC,EAAgBC,UACnD6J,EAAK,OAAAC,MAAM,iBACTD,EAAA,OAAKC,MAAM,4BACRG,EAAqB,CACpB0B,oBAAqB,CAAC,SAAU,UAAW,kB","ignoreList":[]}
1
+ {"version":3,"names":["getRequiredFields","async","currency","method","organizationId","requiredFieldsResponse","api","checkout","fields","mapRequiredFields","data","original","getAllRequiredFieldsRenewal","paymentMethods","Set","renewalState","map","pm","type","promises","paymentMethod","apiPaymentMethod","PaymentMethodMapper","mapToAPMPaymentMethod","price","country","result","organization","id","error","console","results","Promise","all","fieldsMap","forEach","getRequiredFieldsForMethod","allRequiredFields","storedFields","rebillRenewalCss","RebillRenewal","renewalData","renewalToken","currentPaymentMethod","PAYMENT_METHOD_ENUM","CARD","isSubmitting","isCardSubmitting","isCardSuccess","errorMessage","breakpoint","BREAKPOINT_ENUM","DESKTOP","errorPaymentCard","errorPaymentAPM","initialData","checkoutResponse","currentApmPaymentMethod","countries","currentRequiredFields","errorCardInvalid","cardMode","success","paymentError","paymentMethodSelected","validationSchema","phoneNumber","yup.string","when","is","isFieldRequired","this","then","schema","required","otherwise","notRequired","bankId","documentType","documentNumber","min","resizeHandler","getBreakpoint","window","innerWidth","componentWillLoad","addEventListener","renewalProps","JSON","parse","RenewalStore","initializeRenewal","token","GoogleMapsService","loadGoogleMapsScript","response","getCountries","length","firstPaymentMethod","setSelectedPaymentMethod","initializeFingerprint","getInitialData","renewalOnChange","disconnectedCallback","removeEventListener","handlePaymentMethodSelected","event","stopPropagation","detail","setCardMode","emit","deviceId","uuid","crypto","randomUUID","fingerprintResponse","fingerPrint","getFingerPrint","setDeviceId","script","scriptElement","document","createElement","innerHTML","body","appendChild","handleBankSelected","setSelectedBankId","handleCardSelected","card","cvv","setSelectedCard","setCvv","currentPaymentError","CASH","BANK_TRANSFER","handleSubmit","handleCardRenewal","handleAPMRenewal","formData","cardId","cardTokenId","cardInformation","setLoading","renewalRequest","transaction","quantity","customAttributes","customer","firstName","fullName","split","subscription","customerName","lastName","slice","join","email","customerEmail","phone","countryCode","countryCodePhoneNumber","number","billingDetails","address","lineOne","city","state","zipCode","identification","value","idempotencyKey","generateIdempotencyKey","createCardCheckoutRequest","setCheckoutResponse","status","toUpperCase","CheckoutStatusE","APPROVED","message","apmPaymentMethod","getFormData","redirect","approved","location","origin","rejected","paymentMetadata","orderId","source","bank","PaymentMethodNameE","CO_TRANSFERENCE_PSE","targetCurrency","createAPMCheckoutRequest","alertTitle","hasPrefilledAddress","billingFields","some","key","trim","getPaymentDate","payment","form","date","getReferenceNumber","traceId","render","isInitialized","h","class","I18nService","translate","renderRenewalSummary","props","totalAmount","amount","subscriptionTitle","name","text","subscriptionAmount","nextChargeDate","frequency","Fragment","style","display","typePaymentMethod","paymentDate","referenceNumber","cardLastFour","paymentMethodName","selectedBankId","onSubmit","args","renderForm","submit","errors","userInfo","isBreakpointBelow","displayedComponents","flexDirection","gap","enabledPaymentMethods","defaultSelected","errorComponent","showErrorComponent","PaymentErrorMapper","getErrorTitle","getErrorMessage","cardError","showCardInvalid","documentTypeError","documentNumberError","showDocument","icon","variant","colorIcon","COLORS_ENUM","PRIMARY","banks","getFieldValues","defaultSelectedBankId","countryOptions","label","isoCountryCode","billingView","referenceId","undefined","qrCodeData","qrCode","providerName","expirationDate","Date","setDate","getDate","toISOString","redirectUrl","url","isLoading","isRenewal","trialPeriodDays","timeToRedirect","isDisabled","fetchingInstallments"],"sources":["src/components/renewal/utils/getRequiredFieldsRenewal.ts","src/components/renewal/rebill-renewal.css?tag=rebill-renewal","src/components/renewal/rebill-renewal.tsx"],"sourcesContent":["import { api } from '../../../api';\nimport { PAYMENT_METHOD_ENUM } from '../../../models/enums/payment-methods.enum';\nimport { renewalState } from '../../../store/renewal.store';\nimport { PaymentMethodMapper } from '../../../utils/payment-method-mapper';\nimport { mapRequiredFields, RequiredField } from '../../../utils/required-fields-mappers';\n\nexport interface RequiredFieldsResult {\n fields: string[];\n original: RequiredField[];\n}\n\nexport interface AllRequiredFieldsMap {\n [key: string]: RequiredFieldsResult;\n}\n\nconst getRequiredFields = async (\n currency: string,\n method: string,\n organizationId: string,\n): Promise<RequiredFieldsResult> => {\n const requiredFieldsResponse = await api.checkout.getRequiredFields(\n {\n currency,\n method,\n },\n organizationId,\n );\n\n return {\n fields: mapRequiredFields(requiredFieldsResponse.data),\n original: requiredFieldsResponse.data,\n };\n};\n\nexport const getAllRequiredFieldsRenewal = async (): Promise<AllRequiredFieldsMap> => {\n const paymentMethods = [\n ...new Set(renewalState.data.paymentMethods.map(pm => pm.type as PAYMENT_METHOD_ENUM)),\n ];\n const promises = paymentMethods.map(async paymentMethod => {\n try {\n const apiPaymentMethod = PaymentMethodMapper.mapToAPMPaymentMethod(\n paymentMethod,\n renewalState.data.price.country,\n );\n\n const result = await getRequiredFields(\n renewalState.data.price.currency,\n apiPaymentMethod,\n renewalState.data.organization.id,\n );\n\n return {\n paymentMethod,\n ...result,\n };\n } catch (error) {\n console.error(`Error getting required fields for ${paymentMethod}:`, error);\n return {\n paymentMethod,\n fields: [],\n original: [],\n };\n }\n });\n\n const results = await Promise.all(promises);\n const fieldsMap: AllRequiredFieldsMap = {};\n\n results.forEach(result => {\n fieldsMap[result.paymentMethod] = {\n fields: result.fields,\n original: result.original,\n };\n });\n return fieldsMap;\n};\n\nexport const getRequiredFieldsForMethod = (\n paymentMethod: PAYMENT_METHOD_ENUM,\n allRequiredFields: AllRequiredFieldsMap,\n): RequiredFieldsResult => {\n const storedFields = allRequiredFields[paymentMethod];\n if (storedFields) {\n return storedFields;\n } else {\n return {\n fields: [],\n original: [],\n };\n }\n};\n","@import '../../styles/variables.css';\n\n@media (max-width: 1024px) {\n .rebill-checkout-renewal {\n flex-direction: column;\n gap: 0;\n justify-content: flex-start;\n background: var(--rebill-color-background);\n padding: 20px;\n }\n .right-section .left-section {\n width: 100%;\n height: 100%;\n background: var(--rebill-color-background);\n }\n .checkout-form-section {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n gap: 24px;\n height: 100%;\n margin-top: 24px;\n }\n .otp-container {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n gap: 24px;\n }\n}\n\n@media (min-width: 1025px) {\n .rebill-checkout-renewal {\n width: 100vw;\n min-height: 100vh;\n display: flex;\n flex-direction: row;\n justify-content: center;\n overflow-y: auto;\n }\n\n .left-section {\n display: flex;\n width: 60%;\n background: var(--rebill-color-background-left);\n justify-content: space-around;\n }\n\n .right-section {\n display: flex;\n padding-top: 72px;\n width: 40%;\n background: var(--rebill-color-background-right);\n position: sticky;\n top: 0;\n\n justify-content: center;\n }\n\n .checkout-form-section {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n margin-bottom: 36px;\n margin-top: 24px;\n gap: 32px;\n }\n .left-section-container {\n max-width: 450px;\n min-width: 450px;\n margin: 2.5rem 2rem 1.5rem 2rem;\n display: flex;\n flex-direction: column;\n }\n\n .checkout-summary-section {\n max-width: 450px;\n min-width: 350px;\n margin: 0rem 2rem;\n background: var(--rebill-color-background-right);\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n width: 100%;\n }\n\n .checkout-form-section user-information,\n .checkout-form-section payment-method-selector,\n .checkout-form-section rebill-address,\n .checkout-summary-section rebill-summary {\n width: 100%;\n }\n\n /* Google Maps Autocomplete Styles */\n .pac-container {\n border-radius: 4px;\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\n border: 1px solid #e0e0e0;\n margin-top: 4px;\n font-family: inherit;\n }\n\n .pac-item {\n padding: 10px 12px;\n cursor: pointer;\n border-top: none;\n }\n\n .pac-item:first-child {\n border-top: none;\n }\n\n .pac-item:hover {\n background-color: #f5f5f5;\n }\n\n .pac-item-query {\n font-weight: 500;\n }\n\n .pac-icon {\n display: none;\n }\n}\n\n.payment-button-container {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 16px;\n}\n/* Animaciones para componentes condicionales */\n.animated-component {\n transition: all 0.3s ease-in-out;\n overflow: visible;\n}\n\n/* Keep overflow hidden only for sliding height animations */\n/* .animated-component.slide-in {\n overflow: hidden;\n} */\n\n.fade-in {\n animation: fadeIn 0.4s ease-in-out;\n}\n\n.slide-in {\n animation: slideIn 0.5s ease-out;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideIn {\n from {\n opacity: 0;\n transform: translateX(-20px);\n max-height: 0;\n }\n to {\n opacity: 1;\n transform: translateX(0);\n max-height: 450px;\n }\n}\n\n/* Animación para cuando se ocultan los componentes */\n.animated-component.hide {\n animation: fadeOut 0.3s ease-in-out forwards;\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(20px);\n }\n}\n\n/* Test Mode Chip Positioning */\nrebill-mode-sandbox {\n position: fixed;\n bottom: 50px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 1000;\n}\n\n/* Ensure the chip is visible on all screen sizes */\n@media (max-width: 1024px) {\n rebill-test-mode-chip {\n bottom: 46px;\n }\n}\n\n@media (min-width: 1025px) {\n rebill-test-mode-chip {\n bottom: 46px;\n }\n}\n.mode-sandbox-mobile-container {\n display: flex;\n align-items: center;\n width: 100%;\n\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n/* Desktop grande - mantener tamaños originales */\n@media (min-width: 1451px) {\n .left-section-container {\n min-width: 450px;\n margin: 2.5rem 5rem 1.5rem 5rem;\n }\n\n .checkout-summary-section {\n min-width: 450px;\n margin: 0rem 5rem;\n }\n}\n","import { Component, Event, EventEmitter, h, Listen, Prop, State } from '@stencil/core';\nimport * as yup from 'yup';\nimport { api, Country } from '../../api';\nimport { SavedCard } from '../../api/entities/cards/types';\nimport {\n CheckoutStatusE,\n CreateAPMCheckoutRequest,\n CreateAPMCheckoutResponse,\n CreateCardCheckoutRequest,\n} from '../../api/entities/checkout/types';\nimport '../../components/checkout/apm/apm-checkout/apm-checkout';\nimport '../../components/checkout/processing-payment/processing-payment';\nimport { I18nService } from '../../i18n/i18n.service';\n\nimport { PaymentMethodNameE } from '../../models/enums/payment-method-name.enum';\nimport { PAYMENT_METHOD_ENUM } from '../../models/enums/payment-methods.enum';\nimport { PaymentMessageE } from '../../models/enums/payment-status.enum';\nimport { onChange as renewalOnChange, renewalState, RenewalStore } from '../../store/renewal.store';\nimport { BREAKPOINT_ENUM, getBreakpoint, isBreakpointBelow } from '../../utils/breakpoint';\nimport { COLORS_ENUM } from '../../utils/color-class-mapper';\nimport { generateIdempotencyKey } from '../../utils/generate-idempotency-key';\nimport { GoogleMapsService } from '../../utils/google-maps.service';\nimport { AlertErrorKeys, PaymentErrorMapper } from '../../utils/payment-error-mapper';\nimport { PaymentMethodMapper } from '../../utils/payment-method-mapper';\nimport { getFieldValues, isFieldRequired } from '../../utils/required-fields-mappers';\nimport {\n AllRequiredFieldsMap,\n getAllRequiredFieldsRenewal,\n getRequiredFieldsForMethod,\n} from './utils/getRequiredFieldsRenewal';\n\n@Component({\n tag: 'rebill-renewal',\n styleUrl: 'rebill-renewal.css',\n shadow: false,\n})\nexport class RebillRenewal {\n @Prop() renewalData!: string;\n @Prop() renewalToken!: string;\n\n @State() currentPaymentMethod: PAYMENT_METHOD_ENUM = PAYMENT_METHOD_ENUM.CARD;\n @State() isSubmitting: boolean = false;\n @State() isCardSubmitting: boolean = false;\n @State() isCardSuccess: boolean = false;\n @State() errorMessage: AlertErrorKeys | null = null;\n @State() breakpoint: BREAKPOINT_ENUM = BREAKPOINT_ENUM.DESKTOP;\n @State() errorPaymentCard: boolean = false;\n @State() errorPaymentAPM: boolean = false;\n @State() initialData: any = {};\n @State() checkoutResponse: CreateAPMCheckoutResponse | null = null;\n @State() currentApmPaymentMethod: PaymentMethodNameE | null = null;\n @State() countries: Country[] = [];\n @State() allRequiredFields: AllRequiredFieldsMap = {};\n @State() currentRequiredFields: string[] = [];\n @State() errorCardInvalid: boolean = false;\n @State() cardMode: 'input' | 'select' | null = 'select';\n\n @Event() success: EventEmitter<any>;\n @Event() paymentError: EventEmitter<any>;\n @Event() paymentMethodSelected: EventEmitter<PAYMENT_METHOD_ENUM>;\n\n private validationSchema = {\n 'phoneNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('phoneNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.phoneRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-country': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-country', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.countryRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-state': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-state', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.stateRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-address': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-address', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.addressRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-city': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-city', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.cityRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-zip': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-zip', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.zipRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'bankId': yup.string().when([], {\n is: () => isFieldRequired('bankId', this.currentRequiredFields),\n then: schema => schema.required('validation.bankRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentType': yup.string().when([], {\n is: () =>\n isFieldRequired('documentType', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.documentTypeRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('documentNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema =>\n schema.required('validation.documentNumberRequired').min(7, 'validation.documentInvalid'),\n otherwise: schema => schema.notRequired(),\n }),\n };\n\n private resizeHandler = () => {\n this.breakpoint = getBreakpoint(window.innerWidth);\n };\n\n async componentWillLoad() {\n this.resizeHandler();\n window.addEventListener('resize', this.resizeHandler);\n\n const renewalProps =\n typeof this.renewalData === 'string' ? JSON.parse(this.renewalData) : this.renewalData;\n\n RenewalStore.initializeRenewal({\n ...renewalProps,\n token: this.renewalToken,\n });\n\n // Load Google Maps script for address autocomplete\n GoogleMapsService.loadGoogleMapsScript();\n\n // Load countries data\n try {\n const response = await api.data.getCountries();\n this.countries = response.data;\n } catch (error) {\n console.error('Error loading countries:', error);\n }\n\n // Load required fields data\n try {\n this.allRequiredFields = await getAllRequiredFieldsRenewal();\n } catch (error) {\n console.error('Error loading required fields:', error);\n }\n\n if (renewalState.data.paymentMethods.length > 0) {\n const firstPaymentMethod = renewalState.data.paymentMethods[0].type as PAYMENT_METHOD_ENUM;\n this.currentPaymentMethod = firstPaymentMethod;\n RenewalStore.setSelectedPaymentMethod(firstPaymentMethod);\n\n // Set required fields for the initial payment method\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n firstPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n // Initialize fingerprint for the first payment method\n await this.initializeFingerprint(firstPaymentMethod);\n }\n\n this.initialData = this.getInitialData();\n\n this.cardMode = renewalState.cardMode;\n renewalOnChange('cardMode', () => {\n this.cardMode = renewalState.cardMode;\n });\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.resizeHandler);\n }\n\n @Listen('paymentMethodSelected')\n async handlePaymentMethodSelected(event: CustomEvent<PAYMENT_METHOD_ENUM>) {\n event.stopPropagation();\n\n if (this.currentPaymentMethod === event.detail) {\n return;\n }\n\n this.currentPaymentMethod = event.detail;\n RenewalStore.setSelectedPaymentMethod(this.currentPaymentMethod);\n\n // Change cardMode to 'input' if payment method is not CARD\n if (this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD) {\n this.cardMode = 'input';\n RenewalStore.setCardMode('input');\n }\n\n // Update required fields for the new payment method\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n this.currentPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n // Note: Fingerprint is handled in componentWillLoad\n\n // Initialize fingerprint for the new payment method\n await this.initializeFingerprint(this.currentPaymentMethod);\n\n this.paymentMethodSelected.emit(event.detail);\n }\n\n private async initializeFingerprint(paymentMethod: PAYMENT_METHOD_ENUM) {\n // Only initialize fingerprint for card payments and if not already generated\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD && !renewalState.deviceId) {\n try {\n const uuid = crypto.randomUUID();\n const fingerprintResponse = await api.fingerPrint.getFingerPrint(uuid);\n RenewalStore.setDeviceId(uuid);\n const script = fingerprintResponse.result.script;\n const scriptElement = document.createElement('script');\n scriptElement.innerHTML = script;\n document.body.appendChild(scriptElement);\n } catch (error) {\n console.error('Failed to initialize fingerprint:', error);\n }\n }\n }\n\n @Listen('bankSelected')\n handleBankSelected(event: CustomEvent<string>) {\n event.stopPropagation();\n RenewalStore.setSelectedBankId(event.detail);\n }\n\n @Listen('cardSelected')\n handleCardSelected(event: CustomEvent<{ card: SavedCard; cvv?: string }>) {\n const { card, cvv } = event.detail;\n RenewalStore.setSelectedCard(card);\n RenewalStore.setCvv(cvv || '');\n }\n\n private get currentPaymentError(): boolean {\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return this.errorPaymentCard;\n } else if (\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ) {\n return this.errorPaymentAPM;\n }\n return false;\n }\n\n private async handleSubmit(event?: CustomEvent) {\n if (this.isSubmitting) {\n return;\n }\n\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n await this.handleCardRenewal(event);\n } else {\n await this.handleAPMRenewal(event);\n }\n }\n\n private async handleCardRenewal(event?: CustomEvent) {\n const formData = event?.detail || this.getInitialData();\n\n if (!renewalState.data.cardId && !renewalState.data.cardTokenId) {\n this.errorCardInvalid = true;\n return;\n }\n if (!renewalState.data.cardInformation && !renewalState.data.cardId) {\n this.errorCardInvalid = true;\n return;\n }\n this.errorCardInvalid = false;\n this.isSubmitting = true;\n this.isCardSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const renewalRequest: CreateCardCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n ...(renewalState.data.cardId && { cardId: renewalState.data.cardId }),\n ...(renewalState.data.cardTokenId && { cardTokenId: renewalState.data.cardTokenId }),\n customAttributes: {\n ...(renewalState.deviceId && { deviceId: renewalState.deviceId }),\n },\n ...(this.cardMode === 'input' && {\n customer: {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName?.split(' ')[0],\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName?.split(' ').slice(1).join(' '),\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n },\n billingDetails: {\n address: {\n lineOne: formData['billing-address'] || '',\n city: formData['billing-city'] || '',\n state: formData['billing-state'] || '',\n country: formData['billing-country'] || '',\n zipCode: formData['billing-zip'] || '',\n },\n identification: {\n type: formData.documentType || '',\n value: formData.documentNumber || '',\n },\n },\n }),\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createCardCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n renewalState.token,\n );\n\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.isCardSuccess = false;\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: response.data.error?.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: error.data?.error?.message as PaymentMessageE,\n };\n }\n }\n\n private async handleAPMRenewal(event?: CustomEvent) {\n this.isSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const apmPaymentMethod = PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n );\n\n // Get form data for billing details and customer info\n const formData = event?.detail || this.getFormData();\n\n // Transform form data to match CreateAPMCheckoutRequest structure\n const billingDetails = {\n address: {\n country: formData['billing-country'],\n state: formData['billing-state'] || '',\n city: formData['billing-city'] || '',\n zipCode: formData['billing-zip'] || '',\n lineOne: formData['billing-address'] || '',\n },\n identification: {\n type: formData.documentType || 'dni',\n value: formData.documentNumber || '',\n },\n };\n\n const renewalRequest: CreateAPMCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n method: apmPaymentMethod,\n billingDetails,\n redirect: {\n approved: window.location.origin + '/renewal/success',\n rejected: window.location.origin + '/renewal/failure',\n },\n paymentMetadata: {\n orderId: renewalState.data.id,\n source: 'renewal-web',\n },\n customAttributes: {\n bank: formData.bankId || '',\n },\n // Remove targetCurrency for PSE payments as it's not supported\n ...(apmPaymentMethod !== PaymentMethodNameE.CO_TRANSFERENCE_PSE && {\n targetCurrency: renewalState.data.price.currency,\n }),\n };\n\n // Add customer data for renewal\n renewalRequest.customer = {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName.split(' ')[0] ||\n '',\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName.split(' ').slice(1).join(' ') ||\n '',\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createAPMCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n );\n\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n this.checkoutResponse = response.data;\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.paymentError.emit(response.data);\n RenewalStore.setCheckoutResponse(response.data);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: response.data?.error?.message as PaymentMessageE,\n message: response.data.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n this.paymentError.emit(error);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: error.data?.error?.message as PaymentMessageE,\n message: error.data?.error?.message,\n };\n }\n }\n\n private getFormData = () => {\n return this.initialData;\n };\n\n private getInitialData = () => {\n return {\n 'email': renewalState.data.subscription.customerEmail,\n 'fullName': renewalState.data.subscription.customerName,\n 'card': '',\n 'billing-country': '',\n 'billing-state': '',\n 'billing-address': '',\n 'billing-city': '',\n 'billing-zip': '',\n 'bankId': '',\n 'phoneNumber': '',\n 'countryCodePhoneNumber': '',\n 'documentType': '',\n 'documentNumber': '',\n };\n };\n\n private hasPrefilledAddress = () => {\n const billingFields = [\n 'billing-country',\n 'billing-state',\n 'billing-address',\n 'billing-city',\n 'billing-zip',\n ];\n return billingFields.some(key => {\n const value = this.initialData[key];\n return value && value.trim() !== '';\n });\n };\n\n private getPaymentDate = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n\n if ('date' in payment) {\n return payment.date as string;\n }\n\n return '';\n };\n\n private getReferenceNumber = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n if ('traceId' in payment) {\n return payment.traceId as string;\n }\n\n return '';\n };\n\n render() {\n if (!renewalState.isInitialized) {\n return <div class=\"loading\">{I18nService.translate('renewal.loading')}</div>;\n }\n\n const renderRenewalSummary = props => (\n <renewal-summary\n totalAmount={renewalState.data.price.amount}\n currency={renewalState.data.price.currency}\n subscriptionTitle={renewalState.data.subscription.name[0]?.text || 'Subscription'}\n subscriptionAmount={renewalState.data.subscription.amount}\n nextChargeDate={renewalState.data.subscription.nextChargeDate}\n frequency={renewalState.data.subscription.frequency}\n {...props}\n />\n );\n\n return (\n <>\n <rebill-processing-payment style={{ display: this.isCardSubmitting ? 'block' : 'none' }} />\n {this.isCardSuccess ? (\n <renewal-success-page\n typePaymentMethod={this.currentPaymentMethod}\n paymentDate={this.getPaymentDate()}\n referenceNumber={this.getReferenceNumber()}\n cardLastFour={renewalState.data.subscription.cardLastFour}\n country={renewalState.data.price.country}\n paymentMethodName={PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data?.price?.country,\n )}\n bank={renewalState.form?.selectedBankId || ''}\n />\n ) : (\n <rebill-checkout-form\n style={{ display: this.isCardSubmitting || this.isCardSuccess ? 'none' : 'block' }}\n validationSchema={this.validationSchema}\n initialData={this.initialData}\n onSubmit={(args: any) => this.handleSubmit(args)}\n renderForm={({ submit, formData, errors }) => (\n <div class=\"rebill-checkout-renewal\">\n <div class=\"left-section\">\n <div class=\"left-section-container\">\n <organization-logo organization={renewalState.data.organization} />\n\n <div class=\"checkout-form-section\">\n {/* Customer Information - Readonly */}\n <user-information-static\n userInfo={{\n customerName: renewalState.data.subscription.customerName,\n customerEmail: renewalState.data.subscription.customerEmail,\n }}\n />\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'header',\n })}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'details',\n })}\n\n {/* Payment Method Selection */}\n <div style={{ display: 'flex', flexDirection: 'column', gap: '32px' }}>\n <payment-method-selector\n enabledPaymentMethods={[\n ...new Set(\n renewalState.data.paymentMethods.map(\n pm => pm.type as PAYMENT_METHOD_ENUM,\n ),\n ),\n ]}\n defaultSelected={this.currentPaymentMethod}\n errorComponent={{\n showErrorComponent: this.currentPaymentError,\n alertTitle: PaymentErrorMapper.getErrorTitle(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n this.errorMessage?.alertTitle,\n ),\n message: PaymentErrorMapper.getErrorMessage(\n this.errorMessage?.message,\n this.currentPaymentMethod,\n renewalState.data.price.country,\n ),\n }}\n cardError={{\n showCardInvalid: this.errorCardInvalid,\n type: null,\n }}\n country={renewalState.data.price.country}\n documentTypeError={errors?.documentType}\n documentNumberError={errors?.documentNumber}\n showDocument={\n this.cardMode === 'input' &&\n (isFieldRequired('documentType', this.currentRequiredFields) ||\n isFieldRequired('documentNumber', this.currentRequiredFields))\n }\n />\n {/* Alert for non-card payment methods */}\n {this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD && (\n <rebill-alert\n type=\"info\"\n message={I18nService.translate('renewal.paymentMethodAlert', {\n cardLastFour: renewalState.data.subscription.cardLastFour || '****',\n })}\n icon=\"calendar-edit\"\n variant=\"outlined\"\n colorIcon={COLORS_ENUM.PRIMARY}\n />\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('bankId', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <rebill-bank-selector\n banks={\n getFieldValues(\n 'bank',\n this.allRequiredFields[this.currentPaymentMethod]?.original,\n ) || []\n }\n defaultSelectedBankId={formData.bankId || ''}\n error={errors?.bankId}\n />\n </div>\n )}\n </div>\n {this.cardMode === 'input' &&\n (isFieldRequired('billing-country', this.currentRequiredFields) ||\n isFieldRequired('billing-state', this.currentRequiredFields) ||\n isFieldRequired('billing-address', this.currentRequiredFields) ||\n isFieldRequired('billing-city', this.currentRequiredFields) ||\n isFieldRequired('billing-zip', this.currentRequiredFields)) && (\n <div class=\"animated-component slide-in\">\n <rebill-address\n countryOptions={this.countries.map(country => ({\n label: country.country,\n value: country.isoCountryCode,\n }))}\n billingView={this.hasPrefilledAddress() ? 'form' : 'search'}\n errors={{\n 'billing-country': errors['billing-country'],\n 'billing-state': errors['billing-state'],\n 'billing-address': errors['billing-address'],\n 'billing-city': errors['billing-city'],\n 'billing-zip': errors['billing-zip'],\n }}\n />\n </div>\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('phoneNumber', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <user-information-phone error={errors?.phoneNumber} />\n </div>\n )}\n\n {/* Show APM checkout response after successful payment submission */}\n {this.checkoutResponse?.result &&\n (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) && (\n <apm-checkout\n paymentMethod={this.currentPaymentMethod}\n referenceId={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH\n ? this.checkoutResponse.result.data.referenceId\n : undefined\n }\n qrCodeData={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ? this.checkoutResponse.result.data.qrCode\n : undefined\n }\n providerName={renewalState.data.organization?.name || ''}\n expirationDate={(() => {\n const expirationDate = new Date();\n expirationDate.setDate(expirationDate.getDate() + 30);\n return expirationDate.toISOString();\n })()}\n country={renewalState.data.price.country}\n redirectUrl={this.checkoutResponse.result.data.url}\n />\n )}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'summary',\n })}\n\n <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>\n {/* Payment Button */}\n <payment-button\n paymentMethod={this.currentPaymentMethod}\n isLoading={this.isSubmitting}\n isRenewal={true}\n trialPeriodDays={renewalState.data.subscription.trialPeriodDays}\n redirectUrl={!!this.checkoutResponse?.result?.data?.url}\n timeToRedirect={5000}\n country={renewalState.data.price.country}\n isDisabled={renewalState.fetchingInstallments}\n onSubmit={() => submit()}\n />\n\n {/* Disabled Button Below */}\n <rebill-alert\n type=\"secure\"\n variant=\"variant-secure\"\n icon=\"lock-outline\"\n message={I18nService.translate('otp.secureMessage')}\n />\n </div>\n </div>\n <rebill-footer />\n </div>\n </div>\n\n {/* Desktop Summary */}\n {!isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) && (\n <div class=\"right-section\">\n <div class=\"checkout-summary-section\">\n {renderRenewalSummary({\n displayedComponents: ['header', 'details', 'summary'],\n })}\n </div>\n </div>\n )}\n </div>\n )}\n />\n )}\n </>\n );\n }\n}\n"],"mappings":"8kBAeA,MAAMA,EAAoBC,MACxBC,EACAC,EACAC,KAEA,MAAMC,QAA+BC,EAAIC,SAASP,kBAChD,CACEE,WACAC,UAEFC,GAGF,MAAO,CACLI,OAAQC,EAAkBJ,EAAuBK,MACjDC,SAAUN,EAAuBK,KAClC,EAGI,MAAME,EAA8BX,UACzC,MAAMY,EA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qBACpB2O,UAAW/M,KAAKzB,aAChByO,UAAW,KACXC,gBAAiBzQ,EAAaL,KAAK8I,aAAagI,gBAChDJ,cAAe7M,KAAKf,kBAAkB9B,QAAQhB,MAAM2Q,IACpDI,eAAgB,IAChBhQ,QAASV,EAAaL,KAAKc,MAAMC,QACjCiQ,WAAY3Q,EAAa4Q,qBACzBnD,SAAU,IAAMG,MAIlB1B,EACE,gBAAA/L,KAAK,SACL6O,QAAQ,iBACRD,KAAK,eACL3E,QAASgC,EAAYC,UAAU,yBAIrCH,EAAA,yBAKF6B,EAAkBvK,KAAKrB,WAAYC,EAAgBC,UACnD6J,EAAK,OAAAC,MAAM,iBACTD,EAAA,OAAKC,MAAM,4BACRG,EAAqB,CACpB0B,oBAAqB,CAAC,SAAU,UAAW,kB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import{r as e,c as a,h as i,g as t,H as o}from"./p-DyaDabZ4.js";import{a as r}from"./p-C6wUNEUc.js";import{s,S as l,I as n,i as c,P as d,a as b,b as p}from"./p-B2B19LUC.js";import{C as f}from"./p-DA598vBj.js";import{c as m}from"./p-bcHxwlBu.js";import{c as h}from"./p-DITRI28D.js";export{R as rebill_mode_sandbox,S as rebill_summary}from"./p-DITRI28D.js";import{e as g,E as y,c as u}from"./p-nnABddO1.js";import"./p-BFhvUZPU.js";import"./p-BYrqevT1.js";import{P as x}from"./p-UlyTyHvM.js";import{g as _}from"./p-Bf6g23G6.js";import{f as v}from"./p-C67uAF9_.js";import"./p-uZj1dMLQ.js";import{B as k,g as w,i as C}from"./p-Do_vNuMa.js";import{g as j}from"./p-DUlU_fi_.js";import"./p-BFTU3MAI.js";import"./p-B2LDUv1-.js";const D=".otp__otp-container{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;position:relative;margin-top:2rem}.otp__user-information{display:flex;align-items:center;justify-content:center;flex-direction:column;width:100%;gap:8px}.otp__otp-description-container{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:4px}.otp__change-email{cursor:pointer;text-decoration:underline;margin-left:0}.otp__change-email:hover{color:var(--rebill-primary-color);text-decoration:underline}.otp__alternative{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:16px;margin:32px;width:100%}.otp__rebill-alert{width:100%}.otp__guest-options{display:flex;flex-direction:column;width:100%;gap:8px;margin-top:auto}.otp__verifying-container{display:flex;align-items:center;justify-content:center;gap:16px;margin:8px 0}.otp__code-resent-container rebill-typography{display:flex;line-height:1}.otp__code-resent-container rebill-icon{flex-shrink:0;display:inline-flex;vertical-align:middle;margin-right:8px}.otp__spinner{width:15px;height:15px;border:2px solid rgba(255, 255, 255, 0.3);border-radius:50%;border-top-color:var(--rebill-color-primary);animation:spin 1s linear infinite;display:inline-block}@keyframes spin{to{transform:rotate(360deg)}}@media (max-width: 1024px){.otp__otp-container{min-height:calc(100vh - 40px)}.otp__guest-options{margin-top:32px}}@media (min-width: 1025px){.otp__otp-container{justify-content:flex-start}.otp__guest-options{margin-top:auto;padding-bottom:2rem}}";const T=class{constructor(i){e(this,i);this.changeEmailClick=a(this,"changeEmailClick");this.returnForm=a(this,"returnForm");this.codeVerified=a(this,"codeVerified")}changeEmailClick;timeLeft=59;isTimerRunning=false;codeResent=false;isVerifying=false;otpValue="";returnForm;codeVerified;error=false;timer=m({duration:59,onTick:e=>{this.timeLeft=e},onComplete:()=>{this.isTimerRunning=false}});messageTimer=m({duration:5,onComplete:()=>{this.codeResent=false}});disconnectedCallback(){this.timer.stop()}startTimer(){this.timer.start();this.isTimerRunning=true}handleResendCode=async()=>{if(!this.isTimerRunning){await r.otp.generate(s.data.sessionId,{email:s.data.userInformation.email});this.codeResent=true;this.messageTimer.start();this.startTimer();this.error=false}};handleOtpChange=e=>{this.otpValue=e;if(e.length===6){this.handleVerifyOtp(e);this.error=false}};handleVerifyOtp=async e=>{this.isVerifying=true;try{const a=await r.otp.verify(s.data.sessionId,{email:s.data.userInformation.email,code:e});this.codeVerified.emit(a.data);l.setUserInformation({...a.data.customer,fullName:`${a.data.customer.firstName} ${a.data.customer.lastName}`.trim(),phoneNumber:{number:a.data.customer.phoneNumbers[0].number,countryCode:a.data.customer.phoneNumbers[0].countryCode},address:{billingAddress:{address:a.data.customer.addresses[0].lineOne,zip:a.data.customer.addresses[0].zipCode,city:a.data.customer.addresses[0].city,state:a.data.customer.addresses[0].state,country:a.data.customer.addresses[0].country}},documentType:a.data.customer.identifications[0].type,documentNumber:a.data.customer.identifications[0].value});l.setAccessToken(a.data.accessToken);l.setCustomerId(a.data.customer.id);this.otpValue="";this.error=false}catch(e){this.error=true}finally{this.isVerifying=false}};render(){return i("div",{key:"342b5631b2dfe15cc24880cf7d6d77b6c10ab12d",class:"otp__otp-container"},i("div",{key:"c6bf7502fa3f9c1940d1d07360a47c17cc2fdeb2",class:"otp__user-information"},i("div",{key:"078a4cb4dd563ff1ddfbc02f70e8c923f6973d0f",class:"otp__otp-description-container"},i("rebill-typography",{key:"d8ae4e71ee4e35b033347c6bc99200e48e5b9705",variant:"body2",class:"otp__otp-description"},n.translate("otp.description")),i("rebill-typography",{key:"2466a357c835bcd8314aa5f53aefabb474fdf55f",variant:"subtitle-bold",class:"otp__otp-description-digits"}," ",i("strong",{key:"3a4263b93f5ad7f9aec482f1d1eef76952cf60d3"},n.translate("otp.descriptionDigits"))," "),i("rebill-typography",{key:"d77b23e3581d353e2fdd73debe4fbc0e987376c4",variant:"body2",class:"otp__otp-description-email"},n.translate("otp.descriptionEmail"))),i("rebill-typography",{key:"723a510062706eed71186cf6b1a252f58554a4fc",variant:"body2",class:"otp__otp-email-line"},s.data.userInformation.email," ",!s.data.prefilledData?.email&&i("span",{key:"46fb8563cb20d2ae7a6d8bc8d369d8a985ff85f3",class:"otp__change-email",onClick:()=>{this.otpValue="";this.error=false;this.returnForm.emit(false)}},n.translate("otp.change")))),i("input-otp",{key:"8ed8dc00b9131753f6f23178e607049e6bc4ea72",otp:this.otpValue,onOtpChange:e=>this.handleOtpChange(e.detail),error:this.error?n.translate("otp.error"):""}),this.isVerifying&&i("div",{key:"364e208afc986a3272bf24b282c169fb243b86db",class:"otp__verifying-container"},i("rebill-typography",{key:"02cec9d49145d0f953b84d9ee0fbf015f5004d8d",variant:"subtitle2",color:f.PRIMARY},n.translate("otp.verifyingCode")),i("div",{key:"b436acb222dd7db455a86e4063567519e309d85e",class:"otp__spinner"})),i("rebill-button",{key:"ac5bcb96f2fac2426579ac33ca2f84f36e3dda51",type:"button",variant:"outline",theme:this.isTimerRunning?"secondary":"primary",disabled:this.isTimerRunning,onClick:this.handleResendCode,size:"small",style:{height:"24px",marginBottom:"8px"}},this.isTimerRunning?`${n.translate("otp.resendCodeIn")} (${this.timer.getFormattedTime()})`:n.translate("otp.resendCode")),this.codeResent&&i("div",{key:"b5f54b7f537c0e382d2c1a3ff79a24f2cf4e63a9",class:"otp__code-resent-container"},i("rebill-typography",{key:"4aeaeb7d4d37eab63ca63419dccb54e1b7d2fda8",variant:"subtitle2",color:f.GREEN},i("rebill-icon",{key:"4fea914f167a28bb06e0cf69d833fda493752d55",name:"check-radio"}),n.translate("otp.codeResent"))),i("rebill-alert",{key:"a8bcbdbc5af7a9e6a12bc842dd8142812638f3fa",class:"otp__rebill-alert",type:"secure",variant:"variant-info",message:n.translate("otp.infoMessage"),icon:"circle-info",alertTitle:n.translate("otp.infoTitle"),colorIcon:f.PRIMARY_DARK_LIGHT}),i("div",{key:"9ff81fa5dce0deaec0a292d2e25d396f559a27a5",class:"otp__alternative"},i("rebill-typography",{key:"b8e4f23db473f1049f4f6eae5a489722053aa24a",variant:"body2",color:f.PRIMARY_DARK},"o")),i("div",{key:"87a52e07d7c709c95517f0f3606d843c6580f9bf",class:"otp__guest-options"},i("rebill-button",{key:"3fb138f038065cb6ec2852f313de1eae3d194748",type:"button",variant:"outline",theme:"secondary",size:"medium",onClick:()=>{this.otpValue="";this.error=false;this.returnForm.emit(false)}},n.translate("otp.continueAsGuest")),i("rebill-alert",{key:"3bd11b6a8a91c2690998c2f7af36e872e485fffe",type:"secure",variant:"variant-secure",icon:"lock-outline",message:n.translate("otp.secureMessage")})))}};T.style=D;const L=".modal-overlay{position:fixed;top:0;left:0;right:0;background-color:transparent;display:flex;align-items:center;justify-content:center;z-index:10000;padding:12px 16px;box-sizing:border-box}.modal-content{background:white;border-radius:8px;padding:16px 20px;width:350px;box-shadow:0 4px 12px -2px rgba(0, 0, 0, 0.15),\n 0 2px 4px -1px rgba(0, 0, 0, 0.1);position:relative;display:flex;align-items:center;gap:12px}.modal-content .alert{margin:0;flex:1;padding:0;background:transparent;border:none;box-shadow:none}.modal-content .alert{background-color:transparent !important;border-color:transparent !important}.modal-content .alert-message{display:flex;flex-direction:column;gap:4px}.modal-content .close-button{position:absolute;top:8px;right:8px;width:20px;height:20px;border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:50%;transition:background-color 0.2s ease;padding:0;margin:0;outline:none;box-shadow:none;line-height:1}.modal-content .close-button:focus{outline:none;box-shadow:none}.modal-content .close-button:hover{background-color:#f0f0f0}.modal-content .close-button rebill-icon{width:16px;height:16px;display:flex;align-items:center;justify-content:center}@media (max-width: 768px){.modal-overlay{padding:8px 12px}.modal-content{padding:12px 16px;flex-direction:column;gap:8px;text-align:center}.modal-content .close-button{width:100%}}";const I=class{constructor(a){e(this,a)}visible=true;languageUpdateTrigger=0;unsubscribeCurrentLocaleStore;autoCloseTimer;componentDidLoad(){this.unsubscribeCurrentLocaleStore=l.onChange("currentLocale",(()=>{this.languageUpdateTrigger++}));this.autoCloseTimer=m({duration:30,onComplete:()=>{this.closeModal()}});this.autoCloseTimer.start()}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}if(this.autoCloseTimer){this.autoCloseTimer.stop()}}closeModal=()=>{this.visible=false;if(this.autoCloseTimer){this.autoCloseTimer.stop()}};render(){if(!this.visible)return null;return i("div",{class:"modal-overlay"},i("div",{class:"modal-content"},i("div",{class:"alert info filled medium"},i("div",{class:"alert-icon"},i("rebill-icon",{name:"circle-info",size:"16px",color:f.ORANGE})),i("div",{class:"alert-message"},i("div",{class:"alert-title"},i("rebill-typography",{variant:"subtitle-bold",color:f.PRIMARY_DARK},n.translate("session.refreshedTitle"))),i("div",{class:"alert-message-text"},i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},n.translate("session.refreshedMessage"))))),i("button",{onClick:this.closeModal,class:"close-button",type:"button"},i("rebill-icon",{name:"close",size:"20px"}))))}};I.style=L;const M=":host{display:flex;position:relative;width:100%;justify-content:center;align-items:center}.mode-sandbox-mobile__test-mode-container{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.mode-sandbox-mobile__overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0, 0, 0, 0.5);z-index:5;animation:fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);pointer-events:auto;cursor:pointer}.mode-sandbox-mobile__test-mode-chip-mobile{display:flex;width:100%;min-width:auto;max-width:100%;height:40px;background:#ffffff;border:1px solid #e5e7eb;border-radius:20px;box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);overflow:hidden;position:relative;z-index:20}.mode-sandbox-mobile__chip-content-mobile{display:flex;align-items:center;gap:2px;justify-content:flex-end;min-height:24px;flex-shrink:0;width:100%;margin:8px}.mode-sandbox-mobile__info-icon{display:flex;align-items:center}.mode-sandbox-mobile__test-mode-chip-mobile.expanded .mode-sandbox-mobile__chip-content-mobile{justify-content:flex-end;width:100%}.mode-sandbox-mobile__cards-dropdown-panel-header{display:flex;align-items:center;gap:8px;padding:8px}.mode-sandbox-mobile__docs-section{display:flex;align-items:center;gap:8px;cursor:pointer;margin-left:0;transition:background-color 0.2s ease;justify-content:flex-end;padding:8px;margin-top:8px}.mode-sandbox-mobile__cards-dropdown-panel{position:absolute;top:100%;left:0;right:0;width:100%;background:#ffffff;border-top:none;border-left:1px solid #e5e7eb;border-right:1px solid #e5e7eb;border-bottom:1px solid #e5e7eb;margin-top:16px;z-index:25;animation:expandDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);transform-origin:top center}.mode-sandbox-mobile__card-section{display:flex;flex-direction:column;justify-content:space-between}.mode-sandbox-mobile__header-content{display:flex;align-items:center;gap:8px;margin:8px}.mode-sandbox-mobile__card-details{background:#fafafa;border-radius:8px;border:1px solid #e5e7eb;margin:8px;min-height:208px;display:flex;flex-direction:column}.mode-sandbox-mobile__card-row{display:flex;gap:12px;align-items:stretch;background:#ffffff;justify-content:space-around;border-radius:8px;border:1px solid #e5e7eb;height:auto;padding:8px;margin:8px}.mode-sandbox-mobile__card-value{display:flex;flex-direction:column;gap:6px;flex:1}.mode-sandbox-mobile__field-value{display:flex;flex-direction:row;align-items:center;gap:8px;max-height:20px}.mode-sandbox-mobile__copy-button{align-items:center;margin-left:auto;margin-right:0}.mode-sandbox-mobile__icon-button{margin-left:auto;margin-right:16px}@keyframes expandDown{from{opacity:0;transform:translateY(-10px) scaleY(0.9)}to{opacity:1;transform:translateY(0) scaleY(1)}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}";const $=class{constructor(a){e(this,a)}get el(){return t(this)}isPanelVisible=false;currentLanguage=n.getCurrentLanguage();componentWillLoad(){c.on("languageChanged",this.handleLanguageChange)}disconnectedCallback(){c.off("languageChanged",this.handleLanguageChange)}handleLanguageChange=()=>{this.currentLanguage=n.getCurrentLanguage()};togglePanel=()=>{this.isPanelVisible=!this.isPanelVisible};handleCopy=e=>{h(e);this.isPanelVisible=false};handleDocsClick=()=>{window.open("https://v3.docs.rebill.com/sdk/checkout","_blank")};renderBasicChip(){return i("div",{class:"mode-sandbox-mobile__chip-content-mobile"},i("div",{class:"mode-sandbox-mobile__info-icon"},i("rebill-icon",{name:"circle-info",size:"24px",color:f.ORANGE})),i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},n.translate("sandbox.testMode")),i("div",{class:"mode-sandbox-mobile__icon-button"},i("rebill-button",{variant:"text",size:"small",onClick:this.togglePanel},i("rebill-icon",{name:"hamburger"}))))}renderCardsPanel(){return i("div",{class:"mode-sandbox-mobile__cards-dropdown-panel"},i("div",{class:"mode-sandbox-mobile__cards-dropdown-panel-header"},i("rebill-icon",{name:"card-test"}),i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},n.translate("sandbox.cardTest"))),i("div",{class:"mode-sandbox-mobile__card-details"},i("div",{class:"mode-sandbox-mobile__card-section"},i("div",{class:"mode-sandbox-mobile__header-content"},i("rebill-icon",{name:"succes",color:f.GREEN}),i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},n.translate("sandbox.successPayment"))),i("div",{class:"mode-sandbox-mobile__card-row"},i("div",{class:"mode-sandbox-mobile__card-value"},i("rebill-typography",{variant:"subtitle3",color:f.GREY_700},n.translate("sandbox.cardNumber")),i("div",{class:"mode-sandbox-mobile__field-value"},i("rebill-icon",{name:"visa"}),i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},"4539148803436467"))),i("div",{class:"mode-sandbox-mobile__card-value"},i("rebill-typography",{variant:"subtitle3",color:f.GREY_700},n.translate("sandbox.exp")),i("div",{class:"mode-sandbox-mobile__field-value"},i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},"01/99"))),i("div",{class:"mode-sandbox-mobile__card-value"},i("rebill-typography",{variant:"subtitle3",color:f.GREY_700},n.translate("sandbox.cvv")),i("div",{class:"mode-sandbox-mobile__field-value mode-sandbox-mobile__field-value-with-copy"},i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},"123"),i("div",{class:"mode-sandbox-mobile__copy-button"},i("rebill-button",{variant:"text",size:"small",onClick:()=>this.handleCopy("4539148803436467 01/99 123")},i("rebill-icon",{name:"copy"}))))))),i("div",{class:"mode-sandbox-mobile__card-section"},i("div",{class:"mode-sandbox-mobile__header-content"},i("rebill-icon",{name:"rejected",color:f.ERROR}),i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},n.translate("sandbox.rejectedPayment"))),i("div",{class:"mode-sandbox-mobile__card-row"},i("div",{class:"mode-sandbox-mobile__card-value"},i("rebill-typography",{variant:"subtitle3",color:f.GREY_700},n.translate("sandbox.cardNumber")),i("div",{class:"mode-sandbox-mobile__field-value"},i("rebill-icon",{name:"visa"}),i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},"4485364739527352"))),i("div",{class:"mode-sandbox-mobile__card-value"},i("rebill-typography",{variant:"subtitle3",color:f.GREY_700},n.translate("sandbox.exp")),i("div",{class:"mode-sandbox-mobile__field-value"},i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},"01/99"))),i("div",{class:"mode-sandbox-mobile__card-value"},i("rebill-typography",{variant:"subtitle3",color:f.GREY_700},n.translate("sandbox.cvv")),i("div",{class:"mode-sandbox-mobile__field-value mode-sandbox-mobile__field-value-with-copy"},i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY_DARK},"123"),i("div",{class:"mode-sandbox-mobile__copy-button"},i("rebill-button",{variant:"text",size:"small",onClick:()=>this.handleCopy("4485364739527352 01/99 123")},i("rebill-icon",{name:"copy"})))))))),i("div",{class:"mode-sandbox-mobile__docs-section",onClick:this.handleDocsClick},i("rebill-typography",{variant:"subtitle2",color:f.PRIMARY},n.translate("sandbox.docs")),i("rebill-icon",{name:"external-link"})))}render(){return i("div",{key:"2051c42d557dcdfc491dc679684aa585e6b8375a",class:`mode-sandbox-mobile__test-mode-container ${this.isPanelVisible?"cards-visible":""}`},this.isPanelVisible&&i("div",{key:"90291e86c59667a2055457ad99aad90deb8f1dd7",class:"mode-sandbox-mobile__overlay"}),i("div",{key:"c405adb07262da6175badba97245914469480905",class:`mode-sandbox-mobile__test-mode-chip-mobile ${this.isPanelVisible?"expanded":""}`},this.renderBasicChip()),this.isPanelVisible&&this.renderCardsPanel())}};$.style=M;const z=":root{--rebill-color-primary:#3b82f6;--rebill-color-primary-light:rgba(59, 130, 246, 0.1);--rebill-color-primary-hover:#2563eb;--rebill-color-primary-dark:#001131;--rebill-color-primary-dark-text:#000000;--rebill-color-primary-dark-hover:#001c4a;--rebill-color-primary-dark-light:rgba(0, 17, 49, 0.1);--rebill-color-error:#ef4444;--rebill-color-error-background:#fef2f2;--rebill-color-error-light:rgba(239, 68, 68, 0.1);--rebill-color-error-dark:#6f101b;--rebill-color-background:#ffffff;--rebill-color-background-left:#fafafa;--rebill-color-background-right:#f4f5f6;--rebill-color-background-secondary:#f7f8fa;--rebill-color-border:#ebedef;--rebill-color-timeline-connector:#c4c8cf;--rebill-color-neutrals-700:#58616e;--rebill-color-neutrals-500:#9ca3af;--rebill-color-border-primary:#e4e4e7;--rebill-color-text-primary:#3b4049;--rebill-color-text-secondary:#6b7280;--rebill-color-grey-700:#7d7d7d;--rebill-color-text-secondary-light:#a1a1aa;--rebill-color-text-on-primary:#ffffff;--rebill-color-disabled:#9ca3af;--rebill-color-shadow:rgba(0, 0, 0, 0.1);--rebill-color-green:#10b981;--rebill-color-green-text:#257c67;--rebill-color-green-light:rgba(183, 233, 221, 0.15);--rebill-color-green-light-2:rgba(183, 233, 221, 1);--rebill-color-info-background:#d5e4ff;--rebill-color-info-border:#0156f6;--rebill-color-info-text:#172b85;--rebill-color-background-secondary-light:#f7f8fa;--rebill-breakpoint-mobile:768px;--rebill-breakpoint-tablet:1024px;--rebill-breakpoint-desktop:1025px;--rebill-color-orange:#ff9400;--rebill-color-black:#1e2025;--rebill-color-grey-300:#3b4049;--rebill-color-grey-100:#aeaeae}.qr-container,.qr-image,.qr-image svg,.qr-image img,[class*='qr-'],[class*='success'],[class*='receipt']{transition:none !important;animation:none !important;will-change:auto !important}button:active,button:focus,button:hover{isolation:isolate}.success-page__text-content{margin-bottom:2rem;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}.success-page__success-content{display:flex;flex-direction:column;align-items:center;gap:1rem;width:100%;overflow-x:hidden;box-sizing:border-box}.success-page__lottie-container{width:80px;height:80px}.success-page__success-content rebill-typography[variant='h3']{margin:0 !important;padding:0 !important}.success-page__success-icon{display:flex;justify-content:center;margin:0.5rem 0}.success-page__info-card{padding:24px;gap:16px;width:100%;max-width:450px;border:1px solid #ebedef;border-radius:8px;display:flex;flex-direction:column;box-sizing:border-box}.success-page__card-row{display:flex;justify-content:space-between;align-items:start;min-height:20px;gap:15%}.success-page__card-row:last-of-type{margin-bottom:0}.success-page__card-value{display:flex;align-items:center;gap:0.5rem}.success-page__payment-method-display{display:flex;align-items:center;gap:8px;justify-content:center}.success-page__payment-method-display rebill-card-icon{display:inline-block;flex-shrink:0;margin-right:8px;vertical-align:middle}.success-page__payment-method-display rebill-card-icon svg{display:block}.success-page__payment-method-display rebill-icon{display:inline-block;vertical-align:middle;margin-right:8px}.success-page__payment-method-display rebill-icon div{display:block}.success-page__card-divider{height:1px;background:#e5e7eb}.success-page__download-container{display:flex;align-items:center;justify-content:flex-start;gap:2px;text-decoration:none;cursor:pointer}.success-page__contact-info{text-align:left}.success-page__reference-number{word-break:break-all;overflow-wrap:break-word;hyphens:auto;max-width:100%;text-align:right}.success-page__total-amount-container{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-direction:row}.success-page__trial-pill{background-color:var(--rebill-color-green-light-2);border-radius:4px;padding:4px 6px 4px 6px;display:flex;align-items:center;justify-content:center}.success-page__next-charge-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px}.success-page__next-charge-details{display:flex;justify-content:space-between;align-items:flex-start}.success-page__next-charge-amount{display:flex;flex-direction:row;align-items:center;gap:4px}.success-page__next-charge-date{text-align:right}.success-page__next-charge-section{margin-top:12px;padding-top:12px}@media (max-width: 1024px){.success-page__success-content{max-width:100%;gap:1.5rem;margin-left:16px;margin-right:16px}.success-page__info-card{width:100%;max-width:100%;padding:12px}.success-page__text-content{gap:12px}}@media (max-width: 767px){.success-page__info-card{padding:12px}.success-page__processing-container{padding:0 16px}}";const B=class{constructor(i){e(this,i);this.successRedirect=a(this,"successRedirect")}typePaymentMethod=d.CARD;country="";bank="";paymentMethodName="";cardLastFour="";paymentDate="";referenceNumber="";trialPeriodDays=0;debitDay=0;planAmount=0;currentLocale=s.currentLocale;breakpoint=k.DESKTOP;successRedirect;loaderProgress=0;isLoadingLottie=true;showRedirectMessage=false;timeToRedirect=3e3;progressInterval;lottieContainer;lottieAnimation;unsubscribeCurrentLocaleStore;successDisplayTimeout;applyStartCaseToBrand=e=>{if(!e)return"";return e.toLowerCase().split(/[\s-]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")};getPaymentDate=()=>{const e=s?.data?.payment;if(!e)return"";if("createdAt"in e){return e.createdAt}return""};componentWillLoad(){this.breakpoint=w(window.innerWidth);this.unsubscribeCurrentLocaleStore=l.onChange("currentLocale",(()=>{this.currentLocale=s.currentLocale}));if(s.data?.itemInformation?.redirectSuccess){this.successDisplayTimeout=window.setTimeout((()=>{this.showRedirectMessage=true;this.loadLottieAnimation()}),1500);setTimeout((()=>{let e=s.data?.itemInformation?.redirectSuccess;if(e){this.successRedirect.emit({redirectUrl:e});this.stopLoaderAnimation()}}),this.timeToRedirect)}}componentDidLoad(){window.addEventListener("resize",this.handleResize);if(!s.data?.itemInformation?.redirectSuccess||this.showRedirectMessage){this.loadLottieAnimation()}}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}if(this.successDisplayTimeout){clearTimeout(this.successDisplayTimeout)}window.removeEventListener("resize",this.handleResize);this.stopLoaderAnimation()}handleResize=()=>{this.breakpoint=w(window.innerWidth)};loadLottieAnimation=async()=>{try{const e=await import("./p-DdEjhWUP.js").then((function(e){return e.l}));const a=await fetch(_(`loader-redirect1.json`));const i=await a.json();if(this.lottieContainer){this.lottieAnimation=e.default.loadAnimation({container:this.lottieContainer,renderer:"svg",loop:true,autoplay:true,animationData:i})}else{this.startLoaderAnimation()}}catch(e){this.startLoaderAnimation()}};startLoaderAnimation=()=>{const e=3e3;const a=50;const i=a/e*100;this.progressInterval=window.setInterval((()=>{this.loaderProgress=Math.min(this.loaderProgress+i,100);if(this.loaderProgress>=100){this.stopLoaderAnimation()}}),a)};stopLoaderAnimation=()=>{if(this.progressInterval){clearInterval(this.progressInterval);this.progressInterval=undefined}if(this.lottieAnimation){this.lottieAnimation.destroy();this.lottieAnimation=undefined}};handleDownloadReceipt=async()=>{try{await x.generateAndDownloadReceipt({paymentMethod:this.typePaymentMethod===d.CARD?this.textPaymentMethodCard():this.paymentMethodName,...this.typePaymentMethod===d.BANK_TRANSFER&&{bank:this.bank},...this.typePaymentMethod===d.CARD&&{cardBrand:this.applyStartCaseToBrand(s.data.cardInformation?.brand||"")},...this.typePaymentMethod===d.CARD&&{cardLastFour:this.cardLastFour??s.data.cardInformation?.lastFour},paymentDate:v(this.getPaymentDate())||"",email:s?.data?.userInformation?.email||"",referenceNumber:this.referenceNumber,productTitle:s?.data?.itemInformation?.title||"",subtotal:this.getFormattedSubtotal(),total:this.getFormattedTotal(),currency:s?.data?.pricing?.currency||" ",installments:s?.data?.pricing?.installments&&s?.data?.cardInformation?.installments?.selectedInstallment?`${g(s.data?.cardInformation?.installments?.selectedInstallment?.installment,u(s.data?.cardInformation?.installments?.selectedInstallment?.installmentAmount||0),s.data?.pricing?.currency,s.data?.cardInformation?.installments?.selectedInstallment?.cft,s.data?.cardInformation?.installments?.selectedInstallment?.model)}\n( ${n.translate("processing.purchaseTotal")}: ${this.getFormattedTotal()} )${s.data.cardInformation?.installments?.installments.find((e=>e.installment===s.data.cardInformation?.installments?.selectedInstallment?.installment))?.model===y.CUSTOMER_FINANCED?`\n${n.translate("installments.interest")}`:""}`:"",discountAmount:this.getFormattedDiscountAmount(),trialPeriodDays:this.trialPeriodDays||s.data?.itemInformation?.trial?.trialPeriodDays,debitDay:this.debitDay||s.data?.itemInformation?.debitDay,planAmount:this.getFormattedSubtotal(this.planAmount),trialEndDate:this.hasFreeTrial()?this.getTrialEndDateFormatted():undefined,debitDate:this.hasDebitDay()?this.getDebitDateFormatted():undefined,isBankTransfer:this.typePaymentMethod===d.BANK_TRANSFER})}catch(e){console.error("Error downloading receipt:",e)}};getFormattedDiscountAmount=()=>{if(s?.data?.pricing?.discountAmount>0){const e=b(s.data?.pricing?.discountAmount,s.data?.pricing?.currency);return`-${e}`}return undefined};getFormattedSubtotal=(e=null)=>b(e||s?.data?.pricing?.subtotal,s?.data?.pricing?.currency);getFormattedTotal=()=>{if(this.trialPeriodDays>0){return b(0,s?.data?.pricing?.currency)}return b(s?.data?.pricing?.total,s?.data?.pricing?.currency)};hasFreeTrial=()=>s.data?.itemInformation?.type===p.PLAN&&s.data?.itemInformation?.trial?.trialPeriodDays&&s.data?.itemInformation?.trial?.trialPeriodDays>0;hasDebitDay=()=>{const e=s.data?.itemInformation?.debitDay;return e&&e>0};getTrialEndDateFormatted=()=>{const e=s.data?.itemInformation?.trial?.trialPeriodEndsAt;if(!e)return"";const a=new Date(e);const i=n.getCurrentLanguage();const t=i==="es"?"es-ES":i==="pt"?"pt-BR":"en-US";if(i==="en"){return`${a.toLocaleDateString(t,{month:"long"})} ${a.getDate()}`}else{return`${a.getDate()} de ${a.toLocaleDateString(t,{month:"long"})}`}};getDebitDateFormatted=()=>{const e=s.data?.itemInformation?.debitDay;if(!e||e<=0)return"";const a=new Date;const i=new Date(a);const t=n.getCurrentLanguage();const o=t==="es"?"es-ES":t==="pt"?"pt-BR":"en-US";if(e<a.getDate()){i.setMonth(a.getMonth()+1)}i.setDate(e);while(i.getDate()!==e){i.setDate(i.getDate()-1)}if(t==="en"){return`${i.toLocaleDateString(o,{month:"long"})} ${i.getDate()}`}else{return`${i.getDate()} de ${i.toLocaleDateString(o,{month:"long"})}`}};textPaymentMethodCard=()=>{const e=s.data?.cardInformation?.brand;const a=this.cardLastFour||s?.data?.cardInformation?.lastFour;const i=this.applyStartCaseToBrand(e||"");return e&&a?`${i} - ${a}`:i};render(){const e=s.data?.itemInformation?.redirectSuccess;return i("rebill-checkout-single-column",{key:"d8a814c5353cd2dcaa053ea6c205be11870f7629"},i("div",{key:"cf05e7f864a87a41db23b76f366c7c8516a721c0",class:"success-page__success-content"},i("rebill-typography",{key:"729d64601641e56b8551d5c3d74daae3a18b6b0a",variant:"h3",color:f.PRIMARY_DARK_TEXT},e&&this.showRedirectMessage?n.translate("processing.redirectMessage"):n.translate("processing.successTitle")),e&&this.showRedirectMessage?i("div",{class:"redirect-message"},i("div",{class:"success-page__lottie-container"},i("div",{ref:e=>this.lottieContainer=e,class:"lottie-animation"}))):i("div",{class:"success-page__success-icon"},i("svg",{width:C(this.breakpoint,k.DESKTOP)?"64":"96",height:C(this.breakpoint,k.DESKTOP)?"64":"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.99219 47.998C7.99219 25.9067 25.9008 7.99805 47.9922 7.99805C70.0836 7.99805 87.9922 25.9067 87.9922 47.998C87.9922 70.0894 70.0836 87.998 47.9922 87.998C25.9008 87.998 7.99219 70.0894 7.99219 47.998ZM61.5401 39.2645C62.2396 38.4096 62.1136 37.1496 61.2587 36.4501C60.4038 35.7507 59.1437 35.8767 58.4443 36.7316L41.8437 57.0211L35.4064 50.5838C34.6254 49.8028 33.359 49.8028 32.578 50.5838C31.7969 51.3649 31.7969 52.6312 32.578 53.4123L40.578 61.4123C40.9775 61.8118 41.5275 62.0237 42.0918 61.9956C42.6562 61.9674 43.1823 61.7019 43.5401 61.2645L61.5401 39.2645Z",fill:"#35B093"}))),i("div",{key:"cb7dc105388b2db7c3b34057c5c4ffd98910bee2",class:"success-page__info-card"},i("div",{key:"00819afd49ef6aeef2411dff4f942385c80ba07e",class:"success-page__card-row"},i("rebill-typography",{key:"4a9a03c161b12037b47e1eae87e22c5160806e2c",variant:"body2",color:f.SECONDARY},n.translate("processing.paymentMethod")),i("div",{key:"dc27668c563154151bdaec58410b8c73086f61fd",class:"success-page__card-value"},i("div",{key:"7c96a29c17134201c004cd65fb515de5cf691340",class:"success-page__payment-method-display"},this.typePaymentMethod===d.CARD&&i(i.Fragment,null,i("rebill-card-icon",{key:"530f18b793bbf92cf2a9e61eaad6f68a609dc1a7","card-brand":s.data?.cardInformation?.brand||""}),i("rebill-typography",{key:"52e4866e3a05a30e5bb7cd715720178bb787c600",variant:"body2",color:f.PRIMARY_DARK_TEXT},this.textPaymentMethodCard())),this.typePaymentMethod===d.BANK_TRANSFER&&i("div",{key:"acfeb7d49fb573410f7f9df7f794c784b119accd",style:{display:"flex",alignItems:"center",gap:"8px"}},i("rebill-icon",{key:"dec188702fe1c02ea3aa01697b466564c3cce778",name:j(d.BANK_TRANSFER,this.country)?.toLowerCase()||"card"}),i("rebill-typography",{key:"2e2a40216a852b0fbc40670e92fd639f9b3af795",variant:"body2",color:f.PRIMARY_DARK_TEXT},n.translate("paymentMethods.bank_transfer")))))),s?.data?.pricing?.installments&&s?.data?.cardInformation?.installments?.selectedInstallment&&i("div",{key:"ea79aae58cfaaeb3df39224ed29189aa14d82f45"},i("div",{key:"4335fe58d7e4f4f91881f9dd629cf7ae93945a54",class:"success-page__card-row"},i("rebill-typography",{key:"ef6fbe06758da4e54f3dfd529f7c188167ef70de",variant:"body2",color:f.SECONDARY},n.translate("summary.installments")),i("div",{key:"6881217b5feea6fa09bee824d4b7aace4950f603",style:{display:"flex",flexDirection:"column",gap:"10px",alignItems:"end"}},i("rebill-typography",{key:"e8225b7a2450e67e46902263af208633e21c852d",variant:"body2",color:f.PRIMARY_DARK_TEXT,style:{textAlign:"end"}},g(s.data?.cardInformation?.installments?.selectedInstallment?.installment,u(s.data?.cardInformation?.installments?.selectedInstallment?.installmentAmount||0),s.data?.pricing?.currency,s.data?.cardInformation?.installments?.selectedInstallment?.cft,s.data?.cardInformation?.installments?.selectedInstallment?.model)),i("rebill-typography",{key:"fb989d76d8ed0ef97e74e5a9a9f2be4ebc36b044",variant:"body2",color:f.PRIMARY_DARK_TEXT},`( ${n.translate("processing.purchaseTotal")}: ${this.getFormattedTotal()} )`),s.data.cardInformation?.installments?.installments.find((e=>e.installment===s.data.cardInformation?.installments?.selectedInstallment?.installment))?.model===y.CUSTOMER_FINANCED&&i("rebill-typography",{key:"5a278b1b9a0ead71519bccf12d80f5a0f6d6c667",variant:"italic",color:f.SECONDARY,style:{textAlign:"end"}},`${n.translate("installments.interest")}`)))),i("div",{key:"4ca2babffc451d62f60da51dfaf8cf5ef903ee6b",class:"success-page__card-row"},i("rebill-typography",{key:"6e20687a11a8cac9cb519978bee200ca846b6bf4",variant:"body2",color:f.SECONDARY},n.translate("processing.paymentDate")),i("rebill-typography",{key:"eae77c8ddcadc04f4c359aee9cf2d663889d4f82",variant:"body2",color:f.PRIMARY_DARK_TEXT},v(this.paymentDate||this.getPaymentDate()||s.createdAt)||"")),i("div",{key:"72ae70f80bbf27fa7ab72107d3075ba13721c8f2",class:"success-page__card-row"},i("rebill-typography",{key:"d85fbe86c79e7c18186bd23e2ab7123525f67ca6",variant:"body2",color:f.SECONDARY},n.translate("processing.paymentEmail")),i("rebill-typography",{key:"8f4db224d31ad6294badbef2c05344b11887fa27",variant:"body2",color:f.PRIMARY_DARK_TEXT},s?.data?.userInformation?.email)),i("div",{key:"05e205e63cb7958a749b0fe8297ccde914f421e1",class:"success-page__card-row"},i("rebill-typography",{key:"63c726338cb62abff925f7787a2d6b0d731133a0",variant:"body2",color:f.SECONDARY},n.translate("processing.paymentReference")),i("rebill-typography",{key:"12186b7939c0ebbdb2548c4513af1822aebb67c8",variant:"body2",color:f.PRIMARY_DARK_TEXT,class:"success-page__reference-number"},this.referenceNumber||""))),i("div",{key:"00d9b3804dd02addd8011e29533929a56d7aa58c",class:"success-page__info-card"},i("rebill-typography",{key:"ed5ae2237d800cf0cac6e9f880a9c7b6ec9bd8a3",variant:"subtitle-bold",color:f.PRIMARY_DARK_TEXT},n.translate("processing.purchaseDetails")),i("div",{key:"d13b348ce1ee55c83db8c10d0b3b4aca972b7f3a",class:"success-page__card-row"},i("rebill-typography",{key:"55d16b897fe8c34131eeec05587cef14313bfd62",variant:"body2",color:f.SECONDARY},n.translate("processing.purchaseDetail")),i("rebill-typography",{key:"97123778ac864648a4e330915bafe84514460d24",variant:"body2",color:f.PRIMARY_DARK_TEXT},s?.data?.itemInformation?.title||"")),!this.trialPeriodDays&&i("div",{key:"537f89e71e8fb8c6079befb71ff1a61e99187cf6",class:"success-page__card-row"},i("rebill-typography",{key:"0e9e1cf4ae6d5bca97dfd51ed4a12b275d19719a",variant:"body2",color:f.SECONDARY},n.translate("processing.purchaseSubtotal")),i("rebill-typography",{key:"d45380840cdf35ffc18ecd618cb94c0f0eb5bdd3",variant:"body2",color:f.PRIMARY_DARK_TEXT},this.getFormattedSubtotal())),s?.data?.pricing?.discountAmount>0&&i("div",{key:"c34df5787398ba9c6339ac1348052c4a47fc7c79",class:"success-page__card-row"},i("rebill-typography",{key:"a733017918477463f73cd32a6475e8d2e4c37781",variant:"body2",color:f.SECONDARY},n.translate("summary.discount")),i("rebill-typography",{key:"ccb6e46656104b12c8f93ba34c96f3bc97c836ed",variant:"body2",color:f.PRIMARY_DARK_TEXT},this.getFormattedDiscountAmount())),i("div",{key:"03c41ca60d1306aac047efb56a7fcec0e8842b17",class:"success-page__card-row"},i("rebill-typography",{key:"0418a54826aaea0d2b878d9da6f3093494e53ad3",variant:"body2",color:f.SECONDARY},n.translate("processing.purchaseMontoTotal")),i("div",{key:"14d58e7438a6d3cc621753568d83da25585eb5e0",class:"success-page__total-amount-container"},this.trialPeriodDays>0&&i("div",{key:"eecdaa2ca9577bbedf05e35d0518353a88952e17",class:"success-page__trial-pill"},i("rebill-typography",{key:"4ec8fbe451b03ab6489db62abb44725a3f42ccfc",variant:"body2",align:"center",color:f.GREEN_TEXT},n.translate("processing.trialPill",{days:this.trialPeriodDays,count:this.trialPeriodDays}))),i("rebill-typography",{key:"d6e12a5401f68e01d2c7ea1706cf6c885a69e021",variant:"body2",color:f.PRIMARY_DARK_TEXT},this.getFormattedTotal()))),(this.trialPeriodDays||this.hasDebitDay())&&i("div",{key:"a7ee99c9416ad1d995c59927909214300e021491",class:"success-page__card-divider"}),(this.hasFreeTrial()||this.hasDebitDay())&&i("div",{key:"c167a90f0ce8da005833a89f3acaebf1e8079b19",class:"success-page__next-charge-section"},i("div",{key:"c0817733aa17655d5578c96c07a87b5a3d847c03",class:"success-page__next-charge-header"},i("rebill-typography",{key:"3e218d2bbe78b3542e7f53d784d735b6e4480c34",variant:"subtitle-bold",color:f.PRIMARY_DARK_TEXT},n.translate("processing.nextCharge")),i("rebill-typography",{key:"03a7c5048d6e952b7532fb45974dcb47512d34dd",variant:"subtitle-bold",color:f.PRIMARY_DARK_TEXT},n.translate("processing.onDate",{date:this.hasFreeTrial()?this.getTrialEndDateFormatted():this.getDebitDateFormatted()}))),i("div",{key:"ac92777a58bd9fd68b16c3c545718f2885893253",class:"success-page__card-row"},i("rebill-typography",{key:"680b1b3386cff3bdc72e059cbfd5901fe65a86ce",variant:"body2",color:f.PRIMARY_DARK_TEXT},this.hasFreeTrial()?n.translate("processing.atEndOfTrial"):""),i("rebill-typography",{key:"9dc76d0befc14922fda0a3ba66fd020cf08098f6",variant:"body2",color:f.PRIMARY_DARK_TEXT},this.getFormattedSubtotal(this.planAmount)," ",n.translate("processing.perMonth")))),i("div",{key:"6c91add3a1941d5aeef60406841391cf2a420ea8",class:"success-page__card-divider"}),i("div",{key:"f8f64653e37c1a2c2b8540adf6175168789d6bdb",class:"success-page__download-container"},i("svg",{key:"d865caf674a68d00550b8312d941fec103879ca6",class:"download-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{key:"b3b7b7042666e928af0e1928b46a4289049ff03a",d:"M13.498 9.83333V12.1667C13.498 12.903 12.9011 13.5 12.1647 13.5H3.83138C3.095 13.5 2.49805 12.903 2.49805 12.1667V9.83333M7.99804 10V2.5M7.99804 10L5.66471 7.66667M7.99804 10L10.3314 7.66667",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})),i("rebill-button",{key:"437f61a8a544e8681c84b09dabb18afbfcd01fb8",type:"button",variant:"download",size:"small",onClick:this.handleDownloadReceipt},i("rebill-typography",{key:"7613ff0df859a82ebd04f36829378a28d5f789de",variant:"overline",color:f.PRIMARY_DARK_TEXT},n.translate("processing.download")))),i("div",{key:"6c4c9be607a1007244c4ce8b97c0d25d28723575",class:"success-page__contact-info"},i("rebill-typography",{key:"ce01fffce36a31c6a30672c552a438805276201b",variant:"information-text",color:f.SECONDARY},n.translate("processing.downloadDescription"))))))}};B.style=z;const P=":host{display:block}.inputs-container{display:flex;flex-direction:column;gap:16px;width:100%}.customer-exists{display:flex;justify-content:flex-end;margin-bottom:16px}";const A=class{constructor(i){e(this,i);this.onRebillAccountClick=a(this,"onRebillAccountClick")}userInformation={email:"",fullName:"",countryCode:""};errors=null;customerExists=false;disabled=false;onRebillAccountClick;translateError(e){if(!e)return"";if(e.includes("validation.")||e.includes("paymentErrors.")){return n.translate(e)}return e}handleInputChange(e){if(!e.detail)return;const{id:a,value:i}=e.detail;l.setUserInformation({[a]:i})}handleBlur(e){if(!e.detail)return;const{id:a,value:i}=e.detail;l.setUserInformation({[a]:i})}getCardLabels(){const e=[];if(s.data.prefilledData.email){e.push({label:n.translate("userInformation.emailPlaceholder"),value:s.data.prefilledData.email});l.setUserInformation({...s.data.userInformation,email:s.data.prefilledData.email})}if(s.data.prefilledData.fullName){e.push({label:n.translate("userInformation.fullNamePlaceholder"),value:s.data.prefilledData.fullName});l.setUserInformation({...s.data.userInformation,fullName:s.data.prefilledData.fullName})}return e}async handleRebillAccountClick(){r.otp.generate(s.data.sessionId,{email:s.data.userInformation.email});this.onRebillAccountClick.emit(true)}renderInputs(){const e=s.data.prefilledData.email;const a=s.data.prefilledData.fullName;const t=[];if(!e){t.push(i("rebill-input-text",{id:"email",variant:"floating",label:n.translate("userInformation.emailPlaceholder"),placeholder:n.translate("userInformation.emailPlaceholder"),"left-icon":"email",clearable:true,disabled:this.disabled,error:this.translateError(this.errors?.email)}))}if(!a){t.push(i("rebill-input-text",{id:"fullName",variant:"floating",label:n.translate("userInformation.fullNamePlaceholder"),placeholder:n.translate("userInformation.fullNamePlaceholder"),disabled:this.disabled,error:this.translateError(this.errors?.fullName)}))}return t.length>0?i("div",{class:"inputs-container",style:{marginTop:t.length>0&&(e||a)?"1rem":"0"}},t):null}render(){const e=i("div",{key:"46bb2f98219e56c8723289e3348514c4f27b4a53",class:"customer-exists"},i("rebill-button",{key:"eb6f81a732df9ef04a4c278588cd57998cbb6c25",style:{visibility:this.customerExists?"visible":"hidden",opacity:this.customerExists?"1":"0",transition:"opacity 0.3s ease-in-out"},variant:"text",size:"small",onClick:()=>this.handleRebillAccountClick(),icon:"lock"},n.translate("userInformation.rebillAccount"),i("rebill-icon",{key:"d270f5d5f8e2fecb9a6b39d439172c99233cc86d",name:"arrow-right"})));const a=s.data.prefilledData.email;const t=s.data.prefilledData.fullName;const r=a||t;return i(o,{key:"97e0d4dd9b6d3c798eee919274d4ed9be854319d"},e,r&&i("rebill-card",{key:"18f3d53e0386be0b4dff09bcfdcf69885d0093e7",cardTitle:n.translate("userInformation.personalInformation"),cardLabels:this.getCardLabels()}),this.renderInputs())}};A.style=P;export{T as otp_component,I as rebill_modal_overlay,$ as rebill_mode_sandbox_mobile,B as success_page,A as user_information};
2
+ //# sourceMappingURL=p-836f16da.entry.js.map