rebill-web-components-sdk 1.10.2 → 1.10.3

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 (53) hide show
  1. package/dist/cjs/apm-checkout_14.cjs.entry.js +1 -1
  2. package/dist/cjs/{getRequiredFieldsRenewal-CbdwDHvS.js → getRequiredFieldsRenewal-S1zgGVzU.js} +3 -3
  3. package/dist/cjs/{getRequiredFieldsRenewal-CbdwDHvS.js.map → getRequiredFieldsRenewal-S1zgGVzU.js.map} +1 -1
  4. package/dist/cjs/index-C-VTnc0I.js.map +1 -1
  5. package/dist/cjs/{payment-method-mapper-SX2GAp3v.js → payment-method-mapper-CCccaBqJ.js} +23 -23
  6. package/dist/cjs/{payment-method-mapper-SX2GAp3v.js.map → payment-method-mapper-CCccaBqJ.js.map} +1 -1
  7. package/dist/cjs/rebill-change-card.cjs.entry.js +2 -2
  8. package/dist/cjs/rebill-checkout.cjs.entry.js +1 -1
  9. package/dist/cjs/rebill-renewal.cjs.entry.js +2 -6
  10. package/dist/cjs/rebill-renewal.entry.cjs.js.map +1 -1
  11. package/dist/collection/components/renewal/rebill-renewal.js +0 -5
  12. package/dist/collection/components/renewal/rebill-renewal.js.map +1 -1
  13. package/dist/components/apm-checkout.js +1 -1
  14. package/dist/components/p-8BpuJ_V5.js.map +1 -1
  15. package/dist/components/{p-D6BBWEtT.js → p-BCZx8qGH.js} +3 -3
  16. package/dist/components/p-BCZx8qGH.js.map +1 -0
  17. package/dist/components/{p-_qxwSXk5.js → p-B_7NHmMu.js} +3 -3
  18. package/dist/components/{p-_qxwSXk5.js.map → p-B_7NHmMu.js.map} +1 -1
  19. package/dist/components/{p-bje2YiqT.js → p-BeRSpY1d.js} +3 -3
  20. package/dist/components/{p-bje2YiqT.js.map → p-BeRSpY1d.js.map} +1 -1
  21. package/dist/components/rebill-change-card.js +1 -1
  22. package/dist/components/rebill-checkout.js +2 -2
  23. package/dist/components/rebill-renewal.js +3 -7
  24. package/dist/components/rebill-renewal.js.map +1 -1
  25. package/dist/esm/apm-checkout_14.entry.js +1 -1
  26. package/dist/esm/{getRequiredFieldsRenewal-CGWPMyXM.js → getRequiredFieldsRenewal-C0UAn-x-.js} +3 -3
  27. package/dist/esm/{getRequiredFieldsRenewal-CGWPMyXM.js.map → getRequiredFieldsRenewal-C0UAn-x-.js.map} +1 -1
  28. package/dist/esm/index-BTZ7D7jU.js.map +1 -1
  29. package/dist/esm/{payment-method-mapper-tJN7_grx.js → payment-method-mapper-CI2asQKD.js} +3 -3
  30. package/dist/esm/{payment-method-mapper-tJN7_grx.js.map → payment-method-mapper-CI2asQKD.js.map} +1 -1
  31. package/dist/esm/rebill-change-card.entry.js +2 -2
  32. package/dist/esm/rebill-checkout.entry.js +1 -1
  33. package/dist/esm/rebill-renewal.entry.js +2 -6
  34. package/dist/esm/rebill-renewal.entry.js.map +1 -1
  35. package/dist/rebill-web-components-sdk/{p-2285b4f3.entry.js → p-14fb1c5c.entry.js} +2 -2
  36. package/dist/rebill-web-components-sdk/p-4d19f254.entry.js +2 -0
  37. package/dist/rebill-web-components-sdk/p-4d19f254.entry.js.map +1 -0
  38. package/dist/rebill-web-components-sdk/p-BTZ7D7jU.js.map +1 -1
  39. package/dist/rebill-web-components-sdk/{p-B-y-nhqq.js → p-BpAHEeyu.js} +2 -2
  40. package/dist/rebill-web-components-sdk/{p-B-y-nhqq.js.map → p-BpAHEeyu.js.map} +1 -1
  41. package/dist/rebill-web-components-sdk/{p-BZFTAShB.js → p-DnJ3mmmK.js} +2 -2
  42. package/dist/rebill-web-components-sdk/{p-BZFTAShB.js.map → p-DnJ3mmmK.js.map} +1 -1
  43. package/dist/rebill-web-components-sdk/{p-20020285.entry.js → p-a8726b6d.entry.js} +2 -2
  44. package/dist/rebill-web-components-sdk/{p-7f01ba37.entry.js → p-f4588c0f.entry.js} +2 -2
  45. package/dist/rebill-web-components-sdk/rebill-renewal.entry.esm.js.map +1 -1
  46. package/dist/rebill-web-components-sdk/rebill-web-components-sdk.esm.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/components/p-D6BBWEtT.js.map +0 -1
  49. package/dist/rebill-web-components-sdk/p-0850283b.entry.js +0 -2
  50. package/dist/rebill-web-components-sdk/p-0850283b.entry.js.map +0 -1
  51. /package/dist/rebill-web-components-sdk/{p-2285b4f3.entry.js.map → p-14fb1c5c.entry.js.map} +0 -0
  52. /package/dist/rebill-web-components-sdk/{p-20020285.entry.js.map → p-a8726b6d.entry.js.map} +0 -0
  53. /package/dist/rebill-web-components-sdk/{p-7f01ba37.entry.js.map → p-f4588c0f.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as r}from"./p-CV0wqtJM.js";import{r as t}from"./p-CgrJ7D7V.js";import{P as o}from"./p-BZFTAShB.js";import{m as s}from"./p-B076eOjt.js";const n=async(t,o,n)=>{const e=await r.checkout.getRequiredFields({currency:t,method:o},n);return{fields:s(e.data),original:e.data}};const e=async()=>{const r=[...new Set(t.data.paymentMethods.map((r=>r.type)))];const s=r.map((async r=>{try{const s=o.mapToAPMPaymentMethod(r,t.data.price.country);const e=await n(t.data.price.currency,s,t.data.organization.id);return{paymentMethod:r,...e}}catch(t){console.error(`Error getting required fields for ${r}:`,t);return{paymentMethod:r,fields:[],original:[]}}}));const e=await Promise.all(s);const a={};e.forEach((r=>{a[r.paymentMethod]={fields:r.fields,original:r.original}}));return a};const a=(r,t)=>{const o=t[r];if(o){return o}else{return{fields:[],original:[]}}};export{a,e as g};
2
- //# sourceMappingURL=p-B-y-nhqq.js.map
1
+ import{a as r}from"./p-CV0wqtJM.js";import{r as t}from"./p-CgrJ7D7V.js";import{P as o}from"./p-DnJ3mmmK.js";import{m as s}from"./p-B076eOjt.js";const n=async(t,o,n)=>{const e=await r.checkout.getRequiredFields({currency:t,method:o},n);return{fields:s(e.data),original:e.data}};const e=async()=>{const r=[...new Set(t.data.paymentMethods.map((r=>r.type)))];const s=r.map((async r=>{try{const s=o.mapToAPMPaymentMethod(r,t.data.price.country);const e=await n(t.data.price.currency,s,t.data.organization.id);return{paymentMethod:r,...e}}catch(t){console.error(`Error getting required fields for ${r}:`,t);return{paymentMethod:r,fields:[],original:[]}}}));const e=await Promise.all(s);const a={};e.forEach((r=>{a[r.paymentMethod]={fields:r.fields,original:r.original}}));return a};const a=(r,t)=>{const o=t[r];if(o){return o}else{return{fields:[],original:[]}}};export{a,e as g};
2
+ //# sourceMappingURL=p-BpAHEeyu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"p-B-y-nhqq.js","sources":["src/components/renewal/utils/getRequiredFieldsRenewal.ts"],"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"],"names":[],"mappings":";;;;;AAeA,MAAM,iBAAiB,GAAG,OACxB,QAAgB,EAChB,MAAc,EACd,cAAsB,KACW;IACjC,MAAM,sBAAsB,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CACjE;QACE,QAAQ;QACR,MAAM;KACP,EACD,cAAc,CACf;IAED,OAAO;AACL,QAAA,MAAM,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,IAAI,CAAC;QACtD,QAAQ,EAAE,sBAAsB,CAAC,IAAI;KACtC;AACH,CAAC;AAEY,MAAA,2BAA2B,GAAG,YAA0C;AACnF,IAAA,MAAM,cAAc,GAAG;AACrB,QAAA,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,IAA2B,CAAC,CAAC;KACvF;IACD,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,OAAM,aAAa,KAAG;AACxD,QAAA,IAAI;AACF,YAAA,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,qBAAqB,CAChE,aAAa,EACb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAChC;YAED,MAAM,MAAM,GAAG,MAAM,iBAAiB,CACpC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAChC,gBAAgB,EAChB,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAClC;YAED,OAAO;gBACL,aAAa;AACb,gBAAA,GAAG,MAAM;aACV;;QACD,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,CAAA,kCAAA,EAAqC,aAAa,CAAG,CAAA,CAAA,EAAE,KAAK,CAAC;YAC3E,OAAO;gBACL,aAAa;AACb,gBAAA,MAAM,EAAE,EAAE;AACV,gBAAA,QAAQ,EAAE,EAAE;aACb;;AAEL,KAAC,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,SAAS,GAAyB,EAAE;AAE1C,IAAA,OAAO,CAAC,OAAO,CAAC,MAAM,IAAG;AACvB,QAAA,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;YAChC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B;AACH,KAAC,CAAC;AACF,IAAA,OAAO,SAAS;AAClB;MAEa,0BAA0B,GAAG,CACxC,aAAkC,EAClC,iBAAuC,KACf;AACxB,IAAA,MAAM,YAAY,GAAG,iBAAiB,CAAC,aAAa,CAAC;IACrD,IAAI,YAAY,EAAE;AAChB,QAAA,OAAO,YAAY;;SACd;QACL,OAAO;AACL,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,QAAQ,EAAE,EAAE;SACb;;AAEL;;;;"}
1
+ {"version":3,"file":"p-BpAHEeyu.js","sources":["src/components/renewal/utils/getRequiredFieldsRenewal.ts"],"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"],"names":[],"mappings":";;;;;AAeA,MAAM,iBAAiB,GAAG,OACxB,QAAgB,EAChB,MAAc,EACd,cAAsB,KACW;IACjC,MAAM,sBAAsB,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CACjE;QACE,QAAQ;QACR,MAAM;KACP,EACD,cAAc,CACf;IAED,OAAO;AACL,QAAA,MAAM,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,IAAI,CAAC;QACtD,QAAQ,EAAE,sBAAsB,CAAC,IAAI;KACtC;AACH,CAAC;AAEY,MAAA,2BAA2B,GAAG,YAA0C;AACnF,IAAA,MAAM,cAAc,GAAG;AACrB,QAAA,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,IAA2B,CAAC,CAAC;KACvF;IACD,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,OAAM,aAAa,KAAG;AACxD,QAAA,IAAI;AACF,YAAA,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,qBAAqB,CAChE,aAAa,EACb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAChC;YAED,MAAM,MAAM,GAAG,MAAM,iBAAiB,CACpC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAChC,gBAAgB,EAChB,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAClC;YAED,OAAO;gBACL,aAAa;AACb,gBAAA,GAAG,MAAM;aACV;;QACD,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,CAAA,kCAAA,EAAqC,aAAa,CAAG,CAAA,CAAA,EAAE,KAAK,CAAC;YAC3E,OAAO;gBACL,aAAa;AACb,gBAAA,MAAM,EAAE,EAAE;AACV,gBAAA,QAAQ,EAAE,EAAE;aACb;;AAEL,KAAC,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,SAAS,GAAyB,EAAE;AAE1C,IAAA,OAAO,CAAC,OAAO,CAAC,MAAM,IAAG;AACvB,QAAA,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;YAChC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B;AACH,KAAC,CAAC;AACF,IAAA,OAAO,SAAS;AAClB;MAEa,0BAA0B,GAAG,CACxC,aAAkC,EAClC,iBAAuC,KACf;AACxB,IAAA,MAAM,YAAY,GAAG,iBAAiB,CAAC,aAAa,CAAC;IACrD,IAAI,YAAY,EAAE;AAChB,QAAA,OAAO,YAAY;;SACd;QACL,OAAO;AACL,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,QAAQ,EAAE,EAAE;SACb;;AAEL;;;;"}
@@ -1,2 +1,2 @@
1
- import{P as r,s as e}from"./p-Bkzz9eGU.js";var a;(function(r){r["CARD"]="card";r["BR_TRANSFERENCE_PIX"]="br-bank_transfer-pix";r["BR_CASH_BOLETO"]="br-cash-boleto";r["AR_CASH_PAGOFACIL"]="ar-cash-pagofacil";r["AR_TRANSFERENCE_QR"]="ar-bank_transfer-qr";r["CO_TRANSFERENCE_PSE"]="co-bank_transfer-pse";r["MX_TRANSFERENCE_SPEI"]="mx-bank_transfer-spei";r["CL_TRANSFERENCE_ETPAY"]="cl-bank_transfer-etpay"})(a||(a={}));class t{static mapToAPMPaymentMethod(t,s){if(t===r.CARD){return a.CARD}const n=s||e.data?.pricing?.country;if(t===r.CASH){switch(n){case"BR":return a.BR_CASH_BOLETO;case"AR":return a.AR_CASH_PAGOFACIL;default:return a.BR_CASH_BOLETO}}if(t===r.BANK_TRANSFER){switch(n){case"BR":return a.BR_TRANSFERENCE_PIX;case"AR":return a.AR_TRANSFERENCE_QR;case"CO":return a.CO_TRANSFERENCE_PSE;case"MX":return a.MX_TRANSFERENCE_SPEI;case"CL":return a.CL_TRANSFERENCE_ETPAY;default:return a.BR_TRANSFERENCE_PIX}}return a.CARD}static getDisplayName(r){switch(r){case a.CARD:return"Card";case a.BR_TRANSFERENCE_PIX:return"PIX";case a.BR_CASH_BOLETO:return"Boleto Bancário";case a.AR_CASH_PAGOFACIL:return"PagoFácil";case a.AR_TRANSFERENCE_QR:return"QR";case a.CO_TRANSFERENCE_PSE:return"PSE";case a.MX_TRANSFERENCE_SPEI:return"SPEI";case a.CL_TRANSFERENCE_ETPAY:return"Etpay";default:return"Payment"}}static isAPMPaymentMethod(e){return e===r.CASH||e===r.BANK_TRANSFER}}export{t as P,a};
2
- //# sourceMappingURL=p-BZFTAShB.js.map
1
+ import{P as r,s as e}from"./p-Bkzz9eGU.js";var a;(function(r){r["CARD"]="card";r["BR_TRANSFERENCE_PIX"]="br-bank_transfer-pix";r["BR_CASH_BOLETO"]="br-cash-boleto";r["AR_CASH_PAGOFACIL"]="ar-cash-pagofacil";r["AR_TRANSFERENCE_QR"]="ar-bank_transfer-qr";r["CO_TRANSFERENCE_PSE"]="co-bank_transfer-pse";r["MX_TRANSFERENCE_SPEI"]="mx-bank_transfer-spei";r["CL_TRANSFERENCE_ETPAY"]="cl-bank_transfer-etpay"})(a||(a={}));class t{static mapToAPMPaymentMethod(t,s){if(t===r.CARD){return a.CARD}const n=s||e.data?.pricing?.country;if(t===r.CASH){switch(n){case"BR":return a.BR_CASH_BOLETO;case"AR":return a.AR_CASH_PAGOFACIL;default:return a.BR_CASH_BOLETO}}if(t===r.BANK_TRANSFER){switch(n){case"BR":return a.BR_TRANSFERENCE_PIX;case"AR":return a.AR_TRANSFERENCE_QR;case"CO":return a.CO_TRANSFERENCE_PSE;case"MX":return a.MX_TRANSFERENCE_SPEI;case"CL":return a.CL_TRANSFERENCE_ETPAY;default:return a.BR_TRANSFERENCE_PIX}}return a.CARD}static getDisplayName(r){switch(r){case a.CARD:return"Card";case a.BR_TRANSFERENCE_PIX:return"PIX";case a.BR_CASH_BOLETO:return"Boleto Bancário";case a.AR_CASH_PAGOFACIL:return"PagoFácil";case a.AR_TRANSFERENCE_QR:return"QR";case a.CO_TRANSFERENCE_PSE:return"PSE";case a.MX_TRANSFERENCE_SPEI:return"SPEI";case a.CL_TRANSFERENCE_ETPAY:return"Etpay";default:return"Payment"}}static isAPMPaymentMethod(e){return e===r.CASH||e===r.BANK_TRANSFER}}export{t as P};
2
+ //# sourceMappingURL=p-DnJ3mmmK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"p-BZFTAShB.js","sources":["src/models/enums/payment-method-name.enum.ts","src/utils/payment-method-mapper.ts"],"sourcesContent":["export enum PaymentMethodNameE {\n CARD = 'card',\n BR_TRANSFERENCE_PIX = 'br-bank_transfer-pix',\n BR_CASH_BOLETO = 'br-cash-boleto',\n AR_CASH_PAGOFACIL = 'ar-cash-pagofacil',\n AR_TRANSFERENCE_QR = 'ar-bank_transfer-qr',\n CO_TRANSFERENCE_PSE = 'co-bank_transfer-pse',\n MX_TRANSFERENCE_SPEI = 'mx-bank_transfer-spei',\n CL_TRANSFERENCE_ETPAY = 'cl-bank_transfer-etpay',\n}\n","import { PaymentMethodNameE } from '../models/enums/payment-method-name.enum';\nimport { PAYMENT_METHOD_ENUM } from '../models/enums/payment-methods.enum';\nimport { sessionState } from '../store/session.store';\n\n/**\n * Maps the current payment method enum to the specific APM payment method name\n * based on the country and payment method type\n */\nexport class PaymentMethodMapper {\n /**\n * Maps generic payment method to specific APM payment method name\n * @param paymentMethod - Generic payment method (cash, transference, card)\n * @param country - Country code (BR, AR, CO, MX, etc.)\n * @returns Specific payment method name for APM API\n */\n static mapToAPMPaymentMethod(\n paymentMethod: PAYMENT_METHOD_ENUM,\n country?: string,\n ): PaymentMethodNameE {\n // If card, return card\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return PaymentMethodNameE.CARD;\n }\n\n // Use country from session state if not provided\n const countryCode = country || sessionState.data?.pricing?.country;\n\n // Map cash payment methods by country\n if (paymentMethod === PAYMENT_METHOD_ENUM.CASH) {\n switch (countryCode) {\n case 'BR':\n return PaymentMethodNameE.BR_CASH_BOLETO;\n case 'AR':\n return PaymentMethodNameE.AR_CASH_PAGOFACIL;\n default:\n // Default to Brazilian boleto if country not supported\n return PaymentMethodNameE.BR_CASH_BOLETO;\n }\n }\n\n // Map transfer payment methods by country\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n switch (countryCode) {\n case 'BR':\n return PaymentMethodNameE.BR_TRANSFERENCE_PIX;\n case 'AR':\n return PaymentMethodNameE.AR_TRANSFERENCE_QR;\n case 'CO':\n return PaymentMethodNameE.CO_TRANSFERENCE_PSE;\n case 'MX':\n return PaymentMethodNameE.MX_TRANSFERENCE_SPEI;\n case 'CL':\n return PaymentMethodNameE.CL_TRANSFERENCE_ETPAY;\n default:\n // Default to Brazilian PIX if country not supported\n return PaymentMethodNameE.BR_TRANSFERENCE_PIX;\n }\n }\n\n // Fallback to card\n return PaymentMethodNameE.CARD;\n }\n\n /**\n * Converts PaymentMethodNameE enum to a user-friendly display name\n * @param paymentMethodName - Payment method enum value\n * @returns User-friendly display name (e.g., \"PSE\", \"PIX\", \"Boleto\")\n */\n static getDisplayName(paymentMethodName: PaymentMethodNameE): string {\n switch (paymentMethodName) {\n case PaymentMethodNameE.CARD:\n return 'Card';\n case PaymentMethodNameE.BR_TRANSFERENCE_PIX:\n return 'PIX';\n case PaymentMethodNameE.BR_CASH_BOLETO:\n return 'Boleto Bancário';\n case PaymentMethodNameE.AR_CASH_PAGOFACIL:\n return 'PagoFácil';\n case PaymentMethodNameE.AR_TRANSFERENCE_QR:\n return 'QR';\n case PaymentMethodNameE.CO_TRANSFERENCE_PSE:\n return 'PSE';\n case PaymentMethodNameE.MX_TRANSFERENCE_SPEI:\n return 'SPEI';\n case PaymentMethodNameE.CL_TRANSFERENCE_ETPAY:\n return 'Etpay';\n default:\n return 'Payment';\n }\n }\n\n /**\n * Checks if a payment method is an APM (Alternative Payment Method)\n * @param paymentMethod - Payment method to check\n * @returns True if APM, false if card\n */\n static isAPMPaymentMethod(paymentMethod: PAYMENT_METHOD_ENUM): boolean {\n return (\n paymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n );\n }\n}\n"],"names":["sessionState"],"mappings":";;AAAY,IAAA;AAAZ,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,kBAAA,CAAA,qBAAA,CAAA,GAAA,sBAA4C;AAC5C,IAAA,kBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAiC;AACjC,IAAA,kBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACvC,IAAA,kBAAA,CAAA,oBAAA,CAAA,GAAA,qBAA0C;AAC1C,IAAA,kBAAA,CAAA,qBAAA,CAAA,GAAA,sBAA4C;AAC5C,IAAA,kBAAA,CAAA,sBAAA,CAAA,GAAA,uBAA8C;AAC9C,IAAA,kBAAA,CAAA,uBAAA,CAAA,GAAA,wBAAgD;AAClD,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,GAS7B,EAAA,CAAA,CAAA;;ACLD;;;AAGG;MACU,mBAAmB,CAAA;AAC9B;;;;;AAKG;AACH,IAAA,OAAO,qBAAqB,CAC1B,aAAkC,EAClC,OAAgB,EAAA;;AAGhB,QAAA,IAAI,aAAa,KAAK,mBAAmB,CAAC,IAAI,EAAE;YAC9C,OAAO,kBAAkB,CAAC,IAAI;;;QAIhC,MAAM,WAAW,GAAG,OAAO,IAAIA,KAAY,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO;;AAGlE,QAAA,IAAI,aAAa,KAAK,mBAAmB,CAAC,IAAI,EAAE;YAC9C,QAAQ,WAAW;AACjB,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,cAAc;AAC1C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,iBAAiB;AAC7C,gBAAA;;oBAEE,OAAO,kBAAkB,CAAC,cAAc;;;;AAK9C,QAAA,IAAI,aAAa,KAAK,mBAAmB,CAAC,aAAa,EAAE;YACvD,QAAQ,WAAW;AACjB,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,mBAAmB;AAC/C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,kBAAkB;AAC9C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,mBAAmB;AAC/C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,oBAAoB;AAChD,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,qBAAqB;AACjD,gBAAA;;oBAEE,OAAO,kBAAkB,CAAC,mBAAmB;;;;QAKnD,OAAO,kBAAkB,CAAC,IAAI;;AAGhC;;;;AAIG;IACH,OAAO,cAAc,CAAC,iBAAqC,EAAA;QACzD,QAAQ,iBAAiB;YACvB,KAAK,kBAAkB,CAAC,IAAI;AAC1B,gBAAA,OAAO,MAAM;YACf,KAAK,kBAAkB,CAAC,mBAAmB;AACzC,gBAAA,OAAO,KAAK;YACd,KAAK,kBAAkB,CAAC,cAAc;AACpC,gBAAA,OAAO,iBAAiB;YAC1B,KAAK,kBAAkB,CAAC,iBAAiB;AACvC,gBAAA,OAAO,WAAW;YACpB,KAAK,kBAAkB,CAAC,kBAAkB;AACxC,gBAAA,OAAO,IAAI;YACb,KAAK,kBAAkB,CAAC,mBAAmB;AACzC,gBAAA,OAAO,KAAK;YACd,KAAK,kBAAkB,CAAC,oBAAoB;AAC1C,gBAAA,OAAO,MAAM;YACf,KAAK,kBAAkB,CAAC,qBAAqB;AAC3C,gBAAA,OAAO,OAAO;AAChB,YAAA;AACE,gBAAA,OAAO,SAAS;;;AAItB;;;;AAIG;IACH,OAAO,kBAAkB,CAAC,aAAkC,EAAA;AAC1D,QAAA,QACE,aAAa,KAAK,mBAAmB,CAAC,IAAI;AAC1C,YAAA,aAAa,KAAK,mBAAmB,CAAC,aAAa;;AAGxD;;;;"}
1
+ {"version":3,"file":"p-DnJ3mmmK.js","sources":["src/models/enums/payment-method-name.enum.ts","src/utils/payment-method-mapper.ts"],"sourcesContent":["export enum PaymentMethodNameE {\n CARD = 'card',\n BR_TRANSFERENCE_PIX = 'br-bank_transfer-pix',\n BR_CASH_BOLETO = 'br-cash-boleto',\n AR_CASH_PAGOFACIL = 'ar-cash-pagofacil',\n AR_TRANSFERENCE_QR = 'ar-bank_transfer-qr',\n CO_TRANSFERENCE_PSE = 'co-bank_transfer-pse',\n MX_TRANSFERENCE_SPEI = 'mx-bank_transfer-spei',\n CL_TRANSFERENCE_ETPAY = 'cl-bank_transfer-etpay',\n}\n","import { PaymentMethodNameE } from '../models/enums/payment-method-name.enum';\nimport { PAYMENT_METHOD_ENUM } from '../models/enums/payment-methods.enum';\nimport { sessionState } from '../store/session.store';\n\n/**\n * Maps the current payment method enum to the specific APM payment method name\n * based on the country and payment method type\n */\nexport class PaymentMethodMapper {\n /**\n * Maps generic payment method to specific APM payment method name\n * @param paymentMethod - Generic payment method (cash, transference, card)\n * @param country - Country code (BR, AR, CO, MX, etc.)\n * @returns Specific payment method name for APM API\n */\n static mapToAPMPaymentMethod(\n paymentMethod: PAYMENT_METHOD_ENUM,\n country?: string,\n ): PaymentMethodNameE {\n // If card, return card\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return PaymentMethodNameE.CARD;\n }\n\n // Use country from session state if not provided\n const countryCode = country || sessionState.data?.pricing?.country;\n\n // Map cash payment methods by country\n if (paymentMethod === PAYMENT_METHOD_ENUM.CASH) {\n switch (countryCode) {\n case 'BR':\n return PaymentMethodNameE.BR_CASH_BOLETO;\n case 'AR':\n return PaymentMethodNameE.AR_CASH_PAGOFACIL;\n default:\n // Default to Brazilian boleto if country not supported\n return PaymentMethodNameE.BR_CASH_BOLETO;\n }\n }\n\n // Map transfer payment methods by country\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n switch (countryCode) {\n case 'BR':\n return PaymentMethodNameE.BR_TRANSFERENCE_PIX;\n case 'AR':\n return PaymentMethodNameE.AR_TRANSFERENCE_QR;\n case 'CO':\n return PaymentMethodNameE.CO_TRANSFERENCE_PSE;\n case 'MX':\n return PaymentMethodNameE.MX_TRANSFERENCE_SPEI;\n case 'CL':\n return PaymentMethodNameE.CL_TRANSFERENCE_ETPAY;\n default:\n // Default to Brazilian PIX if country not supported\n return PaymentMethodNameE.BR_TRANSFERENCE_PIX;\n }\n }\n\n // Fallback to card\n return PaymentMethodNameE.CARD;\n }\n\n /**\n * Converts PaymentMethodNameE enum to a user-friendly display name\n * @param paymentMethodName - Payment method enum value\n * @returns User-friendly display name (e.g., \"PSE\", \"PIX\", \"Boleto\")\n */\n static getDisplayName(paymentMethodName: PaymentMethodNameE): string {\n switch (paymentMethodName) {\n case PaymentMethodNameE.CARD:\n return 'Card';\n case PaymentMethodNameE.BR_TRANSFERENCE_PIX:\n return 'PIX';\n case PaymentMethodNameE.BR_CASH_BOLETO:\n return 'Boleto Bancário';\n case PaymentMethodNameE.AR_CASH_PAGOFACIL:\n return 'PagoFácil';\n case PaymentMethodNameE.AR_TRANSFERENCE_QR:\n return 'QR';\n case PaymentMethodNameE.CO_TRANSFERENCE_PSE:\n return 'PSE';\n case PaymentMethodNameE.MX_TRANSFERENCE_SPEI:\n return 'SPEI';\n case PaymentMethodNameE.CL_TRANSFERENCE_ETPAY:\n return 'Etpay';\n default:\n return 'Payment';\n }\n }\n\n /**\n * Checks if a payment method is an APM (Alternative Payment Method)\n * @param paymentMethod - Payment method to check\n * @returns True if APM, false if card\n */\n static isAPMPaymentMethod(paymentMethod: PAYMENT_METHOD_ENUM): boolean {\n return (\n paymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n );\n }\n}\n"],"names":["sessionState"],"mappings":";;AAAA,IAAY,kBASX;AATD,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,kBAAA,CAAA,qBAAA,CAAA,GAAA,sBAA4C;AAC5C,IAAA,kBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAiC;AACjC,IAAA,kBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC;AACvC,IAAA,kBAAA,CAAA,oBAAA,CAAA,GAAA,qBAA0C;AAC1C,IAAA,kBAAA,CAAA,qBAAA,CAAA,GAAA,sBAA4C;AAC5C,IAAA,kBAAA,CAAA,sBAAA,CAAA,GAAA,uBAA8C;AAC9C,IAAA,kBAAA,CAAA,uBAAA,CAAA,GAAA,wBAAgD;AAClD,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,GAS7B,EAAA,CAAA,CAAA;;ACLD;;;AAGG;MACU,mBAAmB,CAAA;AAC9B;;;;;AAKG;AACH,IAAA,OAAO,qBAAqB,CAC1B,aAAkC,EAClC,OAAgB,EAAA;;AAGhB,QAAA,IAAI,aAAa,KAAK,mBAAmB,CAAC,IAAI,EAAE;YAC9C,OAAO,kBAAkB,CAAC,IAAI;;;QAIhC,MAAM,WAAW,GAAG,OAAO,IAAIA,KAAY,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO;;AAGlE,QAAA,IAAI,aAAa,KAAK,mBAAmB,CAAC,IAAI,EAAE;YAC9C,QAAQ,WAAW;AACjB,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,cAAc;AAC1C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,iBAAiB;AAC7C,gBAAA;;oBAEE,OAAO,kBAAkB,CAAC,cAAc;;;;AAK9C,QAAA,IAAI,aAAa,KAAK,mBAAmB,CAAC,aAAa,EAAE;YACvD,QAAQ,WAAW;AACjB,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,mBAAmB;AAC/C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,kBAAkB;AAC9C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,mBAAmB;AAC/C,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,oBAAoB;AAChD,gBAAA,KAAK,IAAI;oBACP,OAAO,kBAAkB,CAAC,qBAAqB;AACjD,gBAAA;;oBAEE,OAAO,kBAAkB,CAAC,mBAAmB;;;;QAKnD,OAAO,kBAAkB,CAAC,IAAI;;AAGhC;;;;AAIG;IACH,OAAO,cAAc,CAAC,iBAAqC,EAAA;QACzD,QAAQ,iBAAiB;YACvB,KAAK,kBAAkB,CAAC,IAAI;AAC1B,gBAAA,OAAO,MAAM;YACf,KAAK,kBAAkB,CAAC,mBAAmB;AACzC,gBAAA,OAAO,KAAK;YACd,KAAK,kBAAkB,CAAC,cAAc;AACpC,gBAAA,OAAO,iBAAiB;YAC1B,KAAK,kBAAkB,CAAC,iBAAiB;AACvC,gBAAA,OAAO,WAAW;YACpB,KAAK,kBAAkB,CAAC,kBAAkB;AACxC,gBAAA,OAAO,IAAI;YACb,KAAK,kBAAkB,CAAC,mBAAmB;AACzC,gBAAA,OAAO,KAAK;YACd,KAAK,kBAAkB,CAAC,oBAAoB;AAC1C,gBAAA,OAAO,MAAM;YACf,KAAK,kBAAkB,CAAC,qBAAqB;AAC3C,gBAAA,OAAO,OAAO;AAChB,YAAA;AACE,gBAAA,OAAO,SAAS;;;AAItB;;;;AAIG;IACH,OAAO,kBAAkB,CAAC,aAAkC,EAAA;AAC1D,QAAA,QACE,aAAa,KAAK,mBAAmB,CAAC,IAAI;AAC1C,YAAA,aAAa,KAAK,mBAAmB,CAAC,aAAa;;AAGxD;;;;"}
@@ -1,2 +1,2 @@
1
- import{r as t,c as i,h as e}from"./p-BTZ7D7jU.js";import{c as s}from"./p-MMCcKmy_.js";import{a as n}from"./p-CV0wqtJM.js";import{g as a,P as o,C as r,a as l}from"./p-BRbb4VbD.js";import{s as c,a as h,I as d,S as u,i as m,P as p,o as f,b as y}from"./p-Bkzz9eGU.js";import{S as b}from"./p-vsLqF4hk.js";import{B as g,g as w,i as k}from"./p-Do_vNuMa.js";import{G as x}from"./p-CMSUR2TZ.js";import{P as v}from"./p-BZFTAShB.js";import{m as C,i as I,g as P}from"./p-B076eOjt.js";import"./p-E-ZsRS8r.js";import"./p-CzeVW03r.js";const S={checkoutSummary:true,submitButton:true,billingAddress:true,customerInformation:true,discountCode:true,logo:true,footer:true,sandboxMode:true,processingPayment:true,successPage:true,errorMessage:true,useAddressSearch:true};var M;(function(t){t["BAMBOO"]="bamboo_payment";t["FISERV"]="fiserv";t["KUSHKI"]="kushki";t["PAYWAY"]="payway";t["DOCK"]="dock";t["KLAP"]="klap";t["MOVII"]="movii";t["STRIPE"]="stripe";t["DECIDIR"]="decidir"})(M||(M={}));const N=async(t,i,e)=>{const s=await n.checkout.getRequiredFields({currency:t,method:i},e);return{fields:C(s.data),original:s.data}};const j=async()=>{const t=c.data?.itemInformation?.paymentMethods;const i=t.map((async t=>{try{const i=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);const e=await N(c.data.pricing.currency,i,c.data.organization.id);return{paymentMethod:t,...e}}catch(i){console.error(`Error getting required fields for ${t}:`,i);return{paymentMethod:t,fields:[],original:[]}}}));const e=await Promise.all(i);const s={};e.forEach((t=>{s[t.paymentMethod]={fields:t.fields,original:t.original}}));return s};const R=(t,i)=>{const e=i[t];if(e){return e}else{return{fields:[],original:[]}}};const T=t=>typeof t==="string"?JSON.parse(t):t;const D=t=>T(t);const z=()=>"190.188.127.250";const q=async({publicKey:t,instantProduct:i,instantPlan:e})=>{const s=T(i?i:e);const o=await n.sessions.createSDKInstantSessionRequest(s,a(),z(),t);const r={...o.data,...o.data.plan&&{plan:{...o.data.plan,description:s.description||[]}},...o.data.product&&{product:{...o.data.product,description:s.description||[]}}};const l=r;return l};const A=async({publicKey:t,productId:i,planId:e})=>{const s=await n.sessions.createSDKItemSessionRequest({...i?{productId:i}:{},...e?{planId:e}:{},idempotencyKey:a(),deviceId:"123123123",clientIP:z(),publicKey:t});const o=s.data;return o};const E=async({publicKey:t,checkoutLandingSession:i,instantProduct:e,instantPlan:s,productId:n,planId:a})=>{if(i){const t=await D(i);return{session:t,type:h.CHECKOUT_LANDING}}if(e||s){const i=await q({publicKey:t,instantProduct:e,instantPlan:s});return{session:i,type:h.INSTANT}}if(n||a){const i=await A({publicKey:t,productId:n,planId:a});return{session:i,type:h.SDK_ITEM}}};const B="@media (max-width: 1024px){.rebill-checkout{width:100%;flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section-checkout .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%}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}.rebill-checkout.full-width-layout .left-section{width:100%}.rebill-checkout.full-width-layout .left-section-container{max-width:none;width:100%}}@media (min-width: 1025px){.rebill-checkout{width:100%;min-height:600px;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-checkout{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;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%}.rebill-checkout.full-width-layout .left-section{width:100%;justify-content:stretch}.rebill-checkout.full-width-layout .left-section-container{max-width:none;min-width:auto;width:100%;margin:2.5rem 2rem 1.5rem 2rem}.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 O=class{constructor(e){t(this,e);this.error=i(this,"error");this.success=i(this,"success");this.successRedirect=i(this,"successRedirect");this.formChange=i(this,"formChange");this.paymentMethodSelected=i(this,"paymentMethodSelected")}productId;planId;publicKey;instantProduct;instantPlan;display;customerInformation;oneClickCheckout=true;css;language;async handleLanguageChange(t,i){if(t&&t!==i){try{await d.changeLanguage(t);u.changeLanguage(t);console.log(`[RebillCheckout] Language changed from ${i} to ${t}`)}catch(t){console.error("[RebillCheckout] Failed to change language:",t)}}}error;success;successRedirect;formChange;checkoutLandingSession;externalPayment;rejectedPaymentCard=false;rejectedPaymentAPM=false;countries=[];currentPaymentMethod;checkoutResponse=null;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;isAPMSubmitting=false;isAPMSuccess=false;storedCheckoutResults=new Map;alertErrorKeys=null;currentApmPaymentMethod=null;breakpoint=g.DESKTOP;showRefreshModal=false;cardError={showCardInvalid:false,type:null};initialData={};allRequiredFields={};currentRequiredFields=[];customerExists=false;showOtp=false;otpVerified=false;responseCheckoutCard=null;cardMode=null;formElement;emailDebounceTimeout=null;injectedStyleElement=null;get displayConfig(){if(!this.display){return S}if(typeof this.display==="string"){try{const t=JSON.parse(this.display);return{...S,...t}}catch(t){console.warn("Invalid display configuration string, using defaults:",t);return S}}return{...S,...this.display}}get parsedCustomerInformation(){if(!this.customerInformation){return null}if(typeof this.customerInformation==="string"){try{return JSON.parse(this.customerInformation)}catch(t){console.warn("Invalid customerInformation configuration string, ignoring:",t);return null}}return this.customerInformation}get filteredPaymentMethods(){const t=c.data?.itemInformation?.paymentMethods||[];const i=this.displayConfig.excludePaymentMethods;if(!i||i.length===0){return t}return t.filter((t=>!i.includes(t)))}getCombinedUserData(t={}){const i=c.data.userInformation;const e=this.parsedCustomerInformation;return{email:t?.email||e?.email||i.email,fullName:t?.fullName||e?.fullName||i.fullName,countryCodePhoneNumber:t?.countryCodePhoneNumber||e?.phoneNumber?.countryCode||e?.countryCode||i.countryCode,phoneNumber:t?.phoneNumber||e?.phoneNumber?.number||i.phoneNumber,documentType:t?.documentType||e?.documentType||i.documentType,documentNumber:t?.documentNumber||e?.documentNumber||i.documentNumber,"billing-country":t?.["billing-country"]||e?.address?.billingAddress?.country||i.address?.billingAddress?.country,"billing-state":t?.["billing-state"]||e?.address?.billingAddress?.state||i.address?.billingAddress?.state,"billing-address":t?.["billing-address"]||e?.address?.billingAddress?.address||i.address?.billingAddress?.address,"billing-city":t?.["billing-city"]||e?.address?.billingAddress?.city||i.address?.billingAddress?.city,"billing-zip":t?.["billing-zip"]||e?.address?.billingAddress?.zip||i.address?.billingAddress?.zip,"billing-addInformation":t?.["billing-addInformation"]||e?.address?.billingAddress?.addInformation||i.address?.billingAddress?.addInformation}}injectCustomCSS(){if(!this.css){return}this.cleanupInjectedCSS();const t=`rebill-checkout-css-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;if(this.css.startsWith("http://")||this.css.startsWith("https://")||this.css.startsWith("//")){const i=document.createElement("link");i.rel="stylesheet";i.href=this.css;i.id=t;i.setAttribute("data-rebill-injected","true");document.head.appendChild(i);this.injectedStyleElement=i}else{const i=document.createElement("style");i.id=t;i.setAttribute("data-rebill-injected","true");i.textContent=this.css;document.head.appendChild(i);this.injectedStyleElement=i}}cleanupInjectedCSS(){if(this.injectedStyleElement){try{this.injectedStyleElement.remove()}catch(t){console.warn("Error removing injected CSS:",t)}this.injectedStyleElement=null}}timeToRedirectAPM=5e3;resizeHandler=()=>{const t=w(window.innerWidth);if(t!==this.breakpoint){this.breakpoint=t}};disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler);if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout);this.emailDebounceTimeout=null}this.cleanupInjectedCSS()}async componentWillLoad(){try{this.resizeHandler();window.addEventListener("resize",this.resizeHandler);this.injectCustomCSS();if(this.language){await d.changeLanguage(this.language)}else{m()}const{session:t,type:i}=await E({publicKey:this.publicKey,checkoutLandingSession:this.checkoutLandingSession,instantProduct:this.instantProduct,instantPlan:this.instantPlan,productId:this.productId,planId:this.planId});u.initializeSession({session:t,type:i,payment:typeof this.externalPayment==="string"?JSON.parse(this.externalPayment):this.externalPayment});if(c.sessionRefreshed){this.showRefreshModal=true}x.loadGoogleMapsScript();const e=await n.data.getCountries();this.countries=e.data;if(this.parsedCustomerInformation){u.setUserInformation(this.parsedCustomerInformation)}this.initialData=this.getInitialData();this.allRequiredFields=await j();if(this.filteredPaymentMethods.length>0){if(c.data.paymentStatus===o.REJECTED||c.data.paymentStatus===o.APPROVED&&this.filteredPaymentMethods.includes(p.BANK_TRANSFER)){const t=this.filteredPaymentMethods.find((t=>t===p.BANK_TRANSFER));if(t){this.changePaymentMethod(t);u.setPaymentMethodSelected(t)}}else{this.changePaymentMethod(this.filteredPaymentMethods[0])}}if(this.oneClickCheckout){n.customers.exists({email:c.data?.prefilledData?.email},this.publicKey).then((t=>{this.customerExists=t.data.exists}))}this.cardMode=c.cardMode;f("cardMode",(()=>{this.cardMode=c.cardMode}))}catch(t){console.error("Error initializing checkout:",t)}}componentWillUpdate(){this.injectCustomCSS()}async changePaymentMethod(t){if(t!==this.currentPaymentMethod&&this.filteredPaymentMethods.includes(t)){if(this.checkoutResponse){this.checkoutResponse=null;u.clearCheckoutResponse()}this.currentPaymentMethod=t;u.setPaymentMethodSelected(t);if(t!==p.CARD){this.cardMode="input";u.setCardMode("input")}this.isSubmitting=false;this.currentApmPaymentMethod=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);if(t!==p.CASH&&t!==p.BANK_TRANSFER){this.checkoutResponse=null;u.clearCheckoutResponse()}else{this.checkoutResponse=null;u.clearCheckoutResponse()}this.paymentMethodSelected.emit(t);try{this.currentRequiredFields=R(t,this.allRequiredFields).fields;const i=await n.sessions.updateCurrentSessionPaymentMethod(c.data.sessionId,{paymentMethodName:v.mapToAPMPaymentMethod(t,c.data.pricing.country),paymentMethodType:t,currency:c.data.pricing.currency});u.setProviderKey(i.providerKey);if(i.providerKey===M.DECIDIR||c.data.providerKey===M.DECIDIR){const t=crypto.randomUUID();const i=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const e=i.result.script;const s=document.createElement("script");s.innerHTML=e;document.body.appendChild(s)}}catch(t){console.error("Failed to update payment method or get required fields:",t)}}}get currentPaymentError(){if(this.currentPaymentMethod===p.CARD){return this.rejectedPaymentCard}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){return this.rejectedPaymentAPM}return false}paymentMethodSelected;async handlePaymentMethodSelected(t){t.stopPropagation();const i=t.detail;this.changePaymentMethod(i);if(this.formElement){this.formElement.resetValidation()}}async handleSubmit(t){if(this.isSubmitting){return}this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false;if(this.currentPaymentMethod===p.CARD){this.handleSubmitCard(t)}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){this.handleSubmitAPM(t)}}handleFormChange(t){const i=t.detail;let e=true;let s={};if(this.formElement?.errors){s=this.formElement.errors;e=Object.keys(s).length===0}this.formChange.emit({data:i,isValid:e,errors:Object.keys(s).length>0?s:undefined})}async handleSubmitCard(t){const i=t.detail;const e=this.getCombinedUserData(i);if(!c.data.cardTokenId&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"card_error"};return}if(!c.data.cardInformation&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"tokenization_error"};return}this.cardError={showCardInvalid:false,type:null};const s={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},installments:Number(i.installments||c.data.cardInformation?.installments?.selectedInstallment?.installment),...c.data.cardTokenId&&{cardTokenId:c.data.cardTokenId,...c.data?.itemInformation?.type!==y.PLAN&&{saveCard:c.saveCard}},...c.data.cardId&&{cardId:c.data.cardId},...(!this.otpVerified||this.cardMode==="input")&&{customer:{firstName:e.fullName?.split(" ")[0],lastName:e.fullName?.split(" ").slice(1).join(" "),email:e.email,phone:{countryCode:e.countryCodePhoneNumber,number:e.phoneNumber}}},billingDetails:{address:{lineOne:e["billing-address"],city:e["billing-city"],state:e["billing-state"],country:e["billing-country"],zipCode:e["billing-zip"],lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}},customAttributes:{...c.deviceId&&{deviceId:c.deviceId}},...c.metadata&&{paymentMetadata:c.metadata}};const l=a();this.isSubmitting=true;this.isCardSubmitting=true;try{const t=await n.checkout.createCardCheckoutRequest(c.data.sessionId,l,s,c.data.accessToken||undefined);u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;if(t.data.result?.status.toUpperCase()===r.APPROVED){this.isCardSuccess=true;u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:t.data});c.data.cardInformation.lastFour=t.data.result?.cardLastFour}else{this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data.result?.statusDetail.toLowerCase()??t.data.error?.error?.message?.toLowerCase()}}}catch(t){this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()}}finally{this.isSubmitting=false;this.isCardSubmitting=false}}async handleSubmitAPM(t){if(this.currentPaymentMethod!==p.CASH&&this.currentPaymentMethod!==p.BANK_TRANSFER){return}this.isSubmitting=true;const i=t.detail;const e=this.getCombinedUserData(i);try{const t={address:{country:e["billing-country"]||"",state:e["billing-state"]||"",city:e["billing-city"]||"",zipCode:e["billing-zip"]||"",lineOne:e["billing-address"]||"",lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}};const s=this.currentApmPaymentMethod||v.mapToAPMPaymentMethod(this.currentPaymentMethod,c.data?.pricing?.country);const o={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},method:s,billingDetails:t,redirect:{approved:window.location.origin+"/payment/success",rejected:window.location.origin+"/payment/failure"},paymentMetadata:c.metadata,customAttributes:{bank:i.bankId||c.data?.bankId?.code}};{o.customer={firstName:e.fullName?.split(" ")[0]||"",lastName:e.fullName?.split(" ").slice(1).join(" ")||"",email:e.email,phone:{countryCode:e.countryCodePhoneNumber||"",number:e.phoneNumber||""}}}const r=a();const l=await n.checkout.createAPMCheckoutRequest(c.data.sessionId,r,o);this.isSubmitting=false;this.checkoutResponse=l.data;this.storedCheckoutResults.set(this.currentPaymentMethod,l.data);if(l.data?.date){c.data.paymentDate=l.data.date;c.createdAt=l.data.date}if(l.data?.traceId){c.data.paymentReference=l.data.traceId}}catch(t){this.isSubmitting=false;this.checkoutResponse=t.data;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()};this.rejectedPaymentAPM=true}}async submit(){if(this.formElement&&typeof this.formElement.submit==="function"){this.formElement.submit()}else{await this.handleSubmit({detail:{}})}}handlePaymentStatusChange=t=>{if(t.isCompleted){if(t.status===b.APPROVED){u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:this.checkoutResponse})}else if(t.status===b.REJECTED){u.setPaymentStatus(o.REJECTED);this.alertErrorKeys={alertTitle:o.APM_ERROR_GENERIC,message:o.APM_MESSAGE_ERROR}}}};async handleInputChange(t){if(t?.detail?.id==="email"&&this.oneClickCheckout){if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout)}if(!t.detail.value||t.detail.value.trim()===""){this.customerExists=false;u.clearCustomerIdAndToken();return}this.emailDebounceTimeout=setTimeout((async()=>{try{const t=await n.customers.exists({email:c.data.userInformation.email},this.publicKey);this.customerExists=t.data.exists}catch(t){this.customerExists=false}}),500)}}validationSchema={email:s().when([],{is:()=>!this.otpVerified,then:t=>t.email("validation.emailInvalid").matches(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"validation.emailInvalid").required("validation.emailRequired"),otherwise:t=>t.notRequired()}),fullName:s().when([],{is:()=>!this.otpVerified,then:t=>t.required("validation.fullNameRequired").matches(/^[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}\s+[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}$/,"validation.fullNameInvalid"),otherwise:t=>t.notRequired()}),isValidPhoneNumber:s().when([],{is:()=>I("phoneNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.equals(["true"],"validation.phoneRequired"),otherwise:t=>t.notRequired()}),"billing-country":s().when([],{is:()=>I("billing-country",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.countryRequired"),otherwise:t=>t.notRequired()}),"billing-state":s().when([],{is:()=>I("billing-state",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.stateRequired"),otherwise:t=>t.notRequired()}),"billing-address":s().when([],{is:()=>I("billing-address",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.addressRequired"),otherwise:t=>t.notRequired()}),"billing-city":s().when([],{is:()=>I("billing-city",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.cityRequired"),otherwise:t=>t.notRequired()}),"billing-zip":s().when([],{is:()=>I("billing-zip",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.zipRequired"),otherwise:t=>t.notRequired()}),bankId:s().when([],{is:()=>I("bankId",this.currentRequiredFields),then:t=>t.required("validation.bankRequired"),otherwise:t=>t.notRequired()}),installments:s().when([],{is:()=>this.currentPaymentMethod===p.CARD&&c.data.cardInformation.installments.isAvailableInstallments&&c.data.cardInformation?.installments?.installments.length>0&&c.data.itemInformation.type!==y.PLAN,then:t=>t.required("validation.installmentsRequired"),otherwise:t=>t.notRequired()}),documentType:s().when([],{is:()=>I("documentType",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.documentTypeRequired"),otherwise:t=>t.notRequired()}),documentNumber:s().when([],{is:()=>I("documentNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>{const i=t.required("validation.documentNumberRequired").min(7,"validation.documentInvalid");if(c.data?.pricing?.country==="BR"){return i.test("numeric-only","validation.documentNumberNumericOnly",(t=>{if(!t)return true;return/^\d+$/.test(t)}))}return i},otherwise:t=>t.notRequired()})};getInitialData=()=>({email:c.data.userInformation.email||"",fullName:c.data.userInformation.fullName||"",phoneNumber:c.data.userInformation.phoneNumber?.number||"",countryCodePhoneNumber:c.data.userInformation.countryCode||"",documentType:"",documentNumber:"","billing-country":c.data.userInformation.address?.billingAddress?.country||"","billing-state":c.data.userInformation?.address?.billingAddress?.state||"","billing-address":c.data.userInformation?.address?.billingAddress?.address||"","billing-city":c.data.userInformation?.address?.billingAddress?.city||"","billing-zip":c.data.userInformation?.address?.billingAddress?.zip||"",bankId:c.data.bankId?.code||"",card:"",installments:c.data.cardInformation?.installments?.selectedInstallment?.installment?.toString()||""});hasPrefilledAddress=()=>{const t=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return t.some((t=>{const i=this.initialData[t];return i&&i.trim()!==""}))};get isQrCodeVisible(){return!!this.checkoutResponse?.result?.data?.qrCode}get isBankTransferVisible(){return!!this.checkoutResponse?.result?.data?.account&&!!this.checkoutResponse?.result?.data?.bankName&&!!this.checkoutResponse?.result?.data?.reference}get isBoletoVisible(){return this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&!!this.checkoutResponse?.result?.data?.barcode}isPaymentApproved=()=>{if(c.data.paymentStatus===o.APPROVED){return true}return false};handleRebillAccountClick(t){this.showOtp=t.detail}handleReturnForm(t){this.showOtp=t.detail;u.clearCustomerIdAndToken()}handleSignOut(){this.showOtp=false;this.otpVerified=false;if(!c?.data?.prefilledData?.email){this.customerExists=false}u.clearCustomerIdAndToken();u.clearUserInformation();this.cardError={showCardInvalid:false,type:null};this.alertErrorKeys=null;this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false}handleCodeVerified(){this.otpVerified=true;this.showOtp=false;this.rejectedPaymentCard=false;this.alertErrorKeys=null;this.cardError={showCardInvalid:false,type:null};if(this.formElement){this.formElement.resetValidation()}}isPaymentRejected(){return c.data.paymentStatus===o.REJECTED&&this.currentPaymentMethod===p.BANK_TRANSFER}render(){const t=this.countries.map((t=>({label:t.country,value:t.isoCountryCode})));const i=(t={})=>e("rebill-summary",{key:"54af32d7bb0d51734d8066cd7a1c2d608948304c",totalAmount:c.data.pricing.total,currency:c.data.pricing.currency,itemTitle:c._session?.getTitle(),itemDescription:c._session?.getDescription(),itemAmount:c.data.pricing.subtotal,subtotal:c.data.pricing.subtotal,allowCoupon:c._session?.getAllowCoupon(this.displayConfig),currentBreakpoint:this.breakpoint,planFrequency:c._session?.getPlanFrequency(),planFrequencyCount:c._session?.getPlanFrequencyCount(),discountType:c.data.discount.discountType,discountedPercentage:c.data.discount.discountedPercentage,discountDuration:c.data.discount.discountDuration,discountAmount:c.data.discount.discountAmount,...t});return c.isInitialized&&e(e.Fragment,null,this.showRefreshModal&&e("rebill-modal-overlay",{key:"f62b661e9ebd58c3d8187d05820f2e1b778cc73a"}),this.displayConfig.processingPayment&&e("rebill-processing-payment",{key:"a2611d09bdfeb17a499b1f1c590342975cbe25cf",style:{display:this.isCardSubmitting?"block":"none"}}),this.displayConfig.successPage&&this.isPaymentApproved()&&c.isInitialized?e("success-page",{typePaymentMethod:c.data.paymentMethodSelected,paymentMethodName:v.mapToAPMPaymentMethod(c.data.paymentMethodSelected||c.data.payment?.paymentMethodType,c.data?.pricing?.country),country:c.data?.pricing?.country,bank:c.data.payment?.paymentMethodMetadata?.bank||c.data.payment?.paymentMethodMetadata?.bank,cardLastFour:this.responseCheckoutCard?.result?.cardLastFour||c.data.cardInformation?.lastFour,paymentDate:c.data.paymentDate||this.responseCheckoutCard?.date||c.data.payment?.createdAt||this.checkoutResponse?.result?.data?.createdAt,referenceNumber:c.data.paymentReference||c.data.payment?.traceId||this.responseCheckoutCard?.traceId,onSuccessRedirect:t=>{this.successRedirect.emit(t.detail)},trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,debitDay:c.data?.itemInformation?.debitDay,planAmount:c.data?.pricing?.planAmount}):e(e.Fragment,null,this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&k(this.breakpoint,g.DESKTOP)&&e("div",{class:"mode-sandbox-mobile-container",style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"}},e("rebill-mode-sandbox-mobile",null)),e("rebill-checkout-form",{ref:t=>this.formElement=t,style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:t=>this.handleSubmit(t),onChange:t=>this.handleFormChange(t),renderForm:({submit:s,formData:n,errors:a})=>{const o=!this.isCardSuccess&&this.checkoutResponse?.result&&(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER);return e("div",{class:`rebill-checkout ${!this.displayConfig.checkoutSummary?"full-width-layout":""}`},e("div",{class:"left-section"},e("div",{class:"left-section-container"},this.displayConfig.logo&&e("organization-logo",{organization:c.data.organization}),e("div",{class:"otp-container",style:{display:this.showOtp?"block":"none"}},e("otp-component",null)),e("div",{style:{display:this.showOtp?"none":"block"}},e("div",{class:"checkout-form-section"},this.displayConfig.checkoutSummary&&e("div",{class:"summary-mobile-tablet",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["totalAmount","discount","timelineFreeTrial","timelineDebitDay","itemDetails"]})),!this.otpVerified&&this.displayConfig.customerInformation&&e("user-information",{customerExists:this.customerExists,disabled:this.isSubmitting,errors:{email:a.email,fullName:a.fullName}}),this.otpVerified&&this.displayConfig.customerInformation&&e("user-information-static",{variant:"otp",userInfo:{customerName:c.data.userInformation.fullName?.split(" ")[0],customerEmail:c.data.userInformation.email}}),e("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e("payment-method-selector",{enabledPaymentMethods:this.filteredPaymentMethods,defaultSelected:this.currentPaymentMethod,disabled:this.isSubmitting,errorComponent:{showErrorComponent:this.displayConfig.errorMessage&&(this.currentPaymentError||this.isPaymentRejected()),alertTitle:l.getErrorTitle(this.currentPaymentMethod,c.data?.pricing?.country||"",this.alertErrorKeys?.alertTitle),message:l.getErrorMessage(this.alertErrorKeys?.message,this.currentPaymentMethod,c.data?.pricing?.country)},country:c.data?.pricing?.country,installmentsError:a.installments,showDocument:(!this.otpVerified||this.otpVerified&&this.cardMode==="input")&&!o&&!this.isQrCodeVisible&&(I("documentNumber",this.currentRequiredFields)||I("documentType",this.currentRequiredFields)),documentTypeError:a.documentType,documentNumberError:a.documentNumber,cardError:this.cardError,customCSS:this.css}),!o&&(()=>{const t=I("bankId",this.currentRequiredFields);return t})()&&e("div",{class:"animated-component fade-in"},e("rebill-bank-selector",{banks:P("bank",this.allRequiredFields[this.currentPaymentMethod].original)||[],defaultSelectedBankId:n.bankId||"",error:a?.bankId,disabled:this.isSubmitting}))),!o&&(!this.otpVerified||this.cardMode==="input")&&e(e.Fragment,null,this.displayConfig.billingAddress&&(I("billing-country",this.currentRequiredFields)||I("billing-state",this.currentRequiredFields)||I("billing-address",this.currentRequiredFields)||I("billing-city",this.currentRequiredFields)||I("billing-zip",this.currentRequiredFields))&&e("div",{class:"animated-component slide-in"},e("rebill-address",{disabled:this.isSubmitting,countryOptions:t,billingView:(()=>{if(this.displayConfig.useAddressSearch!==undefined&&this.displayConfig.useAddressSearch===false){return"form"}return this.hasPrefilledAddress()?"form":"search"})(),errors:{"billing-country":a["billing-country"],"billing-state":a["billing-state"],"billing-address":a["billing-address"],"billing-city":a["billing-city"],"billing-zip":a["billing-zip"]}})),this.displayConfig.customerInformation&&I("phoneNumber",this.currentRequiredFields)&&e("div",{class:"animated-component fade-in"},e("user-information-phone",{disabled:this.isSubmitting,error:a?.phoneNumber,countryCode:c.data.userInformation?.countryCode||c.data.country}))),o&&(()=>{const t=this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&this.checkoutResponse?.result?.data?.barcode;return e("apm-checkout",{paymentMethod:this.currentPaymentMethod,barcode:t?this.checkoutResponse?.result?.data?.barcode:undefined,referenceId:this.currentPaymentMethod===p.CASH&&!t?this.checkoutResponse?.result?.data?.referenceId:undefined,qrCodeData:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.qrCode:undefined,code:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.code:undefined,checkoutRequestId:this.checkoutResponse?.result?.checkoutRequestId,providerName:c.data.providerKey,expirationDate:(()=>{const t=new Date;t.setDate(t.getDate()+30);return t.toISOString()})(),onPaymentStatusChange:t=>this.handlePaymentStatusChange(t.detail),country:c.data?.pricing?.country,redirectUrl:this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,bearerToken:this.checkoutResponse?.result?.data?.bearerToken,bankTransferData:this.checkoutResponse?.result?.data?.account&&this.checkoutResponse?.result?.data?.bankName&&this.checkoutResponse?.result?.data?.reference?{account:this.checkoutResponse.result.data.account,bankName:this.checkoutResponse.result.data.bankName,reference:this.checkoutResponse.result.data.reference}:undefined})})(),this.displayConfig.checkoutSummary&&e("div",{class:"summary-price-details",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["priceDetails"]})),this.displayConfig.submitButton&&!(o&&(this.isQrCodeVisible||this.isBankTransferVisible||this.isBoletoVisible))&&e("div",{class:"payment-button-container"},e("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,onSubmit:()=>{s()},redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,isDisabled:c.data.fetchingInstallments,country:c.data?.pricing?.country}),e("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:d.translate("otp.secureMessage")}))),this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&!k(this.breakpoint,g.DESKTOP)&&e("rebill-mode-sandbox",null)),this.displayConfig.footer&&e("rebill-footer",{style:{marginTop:k(this.breakpoint,g.DESKTOP)?"24px":"auto"}}))),this.displayConfig.checkoutSummary&&e("div",{class:"right-section-checkout"},e("div",{class:"checkout-summary-section"},e("div",{class:"summary-desktop",style:{display:!k(this.breakpoint,g.DESKTOP)?"block":"none"}},i()))))}})))}static get watchers(){return{language:["handleLanguageChange"]}}};O.style=B;export{O as rebill_checkout};
2
- //# sourceMappingURL=p-20020285.entry.js.map
1
+ import{r as t,c as i,h as e}from"./p-BTZ7D7jU.js";import{c as s}from"./p-MMCcKmy_.js";import{a as n}from"./p-CV0wqtJM.js";import{g as a,P as o,C as r,a as l}from"./p-BRbb4VbD.js";import{s as c,a as h,I as d,S as u,i as m,P as p,o as f,b as y}from"./p-Bkzz9eGU.js";import{S as b}from"./p-vsLqF4hk.js";import{B as g,g as w,i as k}from"./p-Do_vNuMa.js";import{G as x}from"./p-CMSUR2TZ.js";import{P as v}from"./p-DnJ3mmmK.js";import{m as C,i as I,g as P}from"./p-B076eOjt.js";import"./p-E-ZsRS8r.js";import"./p-CzeVW03r.js";const S={checkoutSummary:true,submitButton:true,billingAddress:true,customerInformation:true,discountCode:true,logo:true,footer:true,sandboxMode:true,processingPayment:true,successPage:true,errorMessage:true,useAddressSearch:true};var M;(function(t){t["BAMBOO"]="bamboo_payment";t["FISERV"]="fiserv";t["KUSHKI"]="kushki";t["PAYWAY"]="payway";t["DOCK"]="dock";t["KLAP"]="klap";t["MOVII"]="movii";t["STRIPE"]="stripe";t["DECIDIR"]="decidir"})(M||(M={}));const N=async(t,i,e)=>{const s=await n.checkout.getRequiredFields({currency:t,method:i},e);return{fields:C(s.data),original:s.data}};const j=async()=>{const t=c.data?.itemInformation?.paymentMethods;const i=t.map((async t=>{try{const i=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);const e=await N(c.data.pricing.currency,i,c.data.organization.id);return{paymentMethod:t,...e}}catch(i){console.error(`Error getting required fields for ${t}:`,i);return{paymentMethod:t,fields:[],original:[]}}}));const e=await Promise.all(i);const s={};e.forEach((t=>{s[t.paymentMethod]={fields:t.fields,original:t.original}}));return s};const R=(t,i)=>{const e=i[t];if(e){return e}else{return{fields:[],original:[]}}};const D=t=>typeof t==="string"?JSON.parse(t):t;const T=t=>D(t);const z=()=>"190.188.127.250";const q=async({publicKey:t,instantProduct:i,instantPlan:e})=>{const s=D(i?i:e);const o=await n.sessions.createSDKInstantSessionRequest(s,a(),z(),t);const r={...o.data,...o.data.plan&&{plan:{...o.data.plan,description:s.description||[]}},...o.data.product&&{product:{...o.data.product,description:s.description||[]}}};const l=r;return l};const A=async({publicKey:t,productId:i,planId:e})=>{const s=await n.sessions.createSDKItemSessionRequest({...i?{productId:i}:{},...e?{planId:e}:{},idempotencyKey:a(),deviceId:"123123123",clientIP:z(),publicKey:t});const o=s.data;return o};const E=async({publicKey:t,checkoutLandingSession:i,instantProduct:e,instantPlan:s,productId:n,planId:a})=>{if(i){const t=await T(i);return{session:t,type:h.CHECKOUT_LANDING}}if(e||s){const i=await q({publicKey:t,instantProduct:e,instantPlan:s});return{session:i,type:h.INSTANT}}if(n||a){const i=await A({publicKey:t,productId:n,planId:a});return{session:i,type:h.SDK_ITEM}}};const O="@media (max-width: 1024px){.rebill-checkout{width:100%;flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section-checkout .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%}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}.rebill-checkout.full-width-layout .left-section{width:100%}.rebill-checkout.full-width-layout .left-section-container{max-width:none;width:100%}}@media (min-width: 1025px){.rebill-checkout{width:100%;min-height:600px;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-checkout{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;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%}.rebill-checkout.full-width-layout .left-section{width:100%;justify-content:stretch}.rebill-checkout.full-width-layout .left-section-container{max-width:none;min-width:auto;width:100%;margin:2.5rem 2rem 1.5rem 2rem}.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 B=class{constructor(e){t(this,e);this.error=i(this,"error");this.success=i(this,"success");this.successRedirect=i(this,"successRedirect");this.formChange=i(this,"formChange");this.paymentMethodSelected=i(this,"paymentMethodSelected")}productId;planId;publicKey;instantProduct;instantPlan;display;customerInformation;oneClickCheckout=true;css;language;async handleLanguageChange(t,i){if(t&&t!==i){try{await d.changeLanguage(t);u.changeLanguage(t);console.log(`[RebillCheckout] Language changed from ${i} to ${t}`)}catch(t){console.error("[RebillCheckout] Failed to change language:",t)}}}error;success;successRedirect;formChange;checkoutLandingSession;externalPayment;rejectedPaymentCard=false;rejectedPaymentAPM=false;countries=[];currentPaymentMethod;checkoutResponse=null;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;isAPMSubmitting=false;isAPMSuccess=false;storedCheckoutResults=new Map;alertErrorKeys=null;currentApmPaymentMethod=null;breakpoint=g.DESKTOP;showRefreshModal=false;cardError={showCardInvalid:false,type:null};initialData={};allRequiredFields={};currentRequiredFields=[];customerExists=false;showOtp=false;otpVerified=false;responseCheckoutCard=null;cardMode=null;formElement;emailDebounceTimeout=null;injectedStyleElement=null;get displayConfig(){if(!this.display){return S}if(typeof this.display==="string"){try{const t=JSON.parse(this.display);return{...S,...t}}catch(t){console.warn("Invalid display configuration string, using defaults:",t);return S}}return{...S,...this.display}}get parsedCustomerInformation(){if(!this.customerInformation){return null}if(typeof this.customerInformation==="string"){try{return JSON.parse(this.customerInformation)}catch(t){console.warn("Invalid customerInformation configuration string, ignoring:",t);return null}}return this.customerInformation}get filteredPaymentMethods(){const t=c.data?.itemInformation?.paymentMethods||[];const i=this.displayConfig.excludePaymentMethods;if(!i||i.length===0){return t}return t.filter((t=>!i.includes(t)))}getCombinedUserData(t={}){const i=c.data.userInformation;const e=this.parsedCustomerInformation;return{email:t?.email||e?.email||i.email,fullName:t?.fullName||e?.fullName||i.fullName,countryCodePhoneNumber:t?.countryCodePhoneNumber||e?.phoneNumber?.countryCode||e?.countryCode||i.countryCode,phoneNumber:t?.phoneNumber||e?.phoneNumber?.number||i.phoneNumber,documentType:t?.documentType||e?.documentType||i.documentType,documentNumber:t?.documentNumber||e?.documentNumber||i.documentNumber,"billing-country":t?.["billing-country"]||e?.address?.billingAddress?.country||i.address?.billingAddress?.country,"billing-state":t?.["billing-state"]||e?.address?.billingAddress?.state||i.address?.billingAddress?.state,"billing-address":t?.["billing-address"]||e?.address?.billingAddress?.address||i.address?.billingAddress?.address,"billing-city":t?.["billing-city"]||e?.address?.billingAddress?.city||i.address?.billingAddress?.city,"billing-zip":t?.["billing-zip"]||e?.address?.billingAddress?.zip||i.address?.billingAddress?.zip,"billing-addInformation":t?.["billing-addInformation"]||e?.address?.billingAddress?.addInformation||i.address?.billingAddress?.addInformation}}injectCustomCSS(){if(!this.css){return}this.cleanupInjectedCSS();const t=`rebill-checkout-css-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;if(this.css.startsWith("http://")||this.css.startsWith("https://")||this.css.startsWith("//")){const i=document.createElement("link");i.rel="stylesheet";i.href=this.css;i.id=t;i.setAttribute("data-rebill-injected","true");document.head.appendChild(i);this.injectedStyleElement=i}else{const i=document.createElement("style");i.id=t;i.setAttribute("data-rebill-injected","true");i.textContent=this.css;document.head.appendChild(i);this.injectedStyleElement=i}}cleanupInjectedCSS(){if(this.injectedStyleElement){try{this.injectedStyleElement.remove()}catch(t){console.warn("Error removing injected CSS:",t)}this.injectedStyleElement=null}}timeToRedirectAPM=5e3;resizeHandler=()=>{const t=w(window.innerWidth);if(t!==this.breakpoint){this.breakpoint=t}};disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler);if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout);this.emailDebounceTimeout=null}this.cleanupInjectedCSS()}async componentWillLoad(){try{this.resizeHandler();window.addEventListener("resize",this.resizeHandler);this.injectCustomCSS();if(this.language){await d.changeLanguage(this.language)}else{m()}const{session:t,type:i}=await E({publicKey:this.publicKey,checkoutLandingSession:this.checkoutLandingSession,instantProduct:this.instantProduct,instantPlan:this.instantPlan,productId:this.productId,planId:this.planId});u.initializeSession({session:t,type:i,payment:typeof this.externalPayment==="string"?JSON.parse(this.externalPayment):this.externalPayment});if(c.sessionRefreshed){this.showRefreshModal=true}x.loadGoogleMapsScript();const e=await n.data.getCountries();this.countries=e.data;if(this.parsedCustomerInformation){u.setUserInformation(this.parsedCustomerInformation)}this.initialData=this.getInitialData();this.allRequiredFields=await j();if(this.filteredPaymentMethods.length>0){if(c.data.paymentStatus===o.REJECTED||c.data.paymentStatus===o.APPROVED&&this.filteredPaymentMethods.includes(p.BANK_TRANSFER)){const t=this.filteredPaymentMethods.find((t=>t===p.BANK_TRANSFER));if(t){this.changePaymentMethod(t);u.setPaymentMethodSelected(t)}}else{this.changePaymentMethod(this.filteredPaymentMethods[0])}}if(this.oneClickCheckout){n.customers.exists({email:c.data?.prefilledData?.email},this.publicKey).then((t=>{this.customerExists=t.data.exists}))}this.cardMode=c.cardMode;f("cardMode",(()=>{this.cardMode=c.cardMode}))}catch(t){console.error("Error initializing checkout:",t)}}componentWillUpdate(){this.injectCustomCSS()}async changePaymentMethod(t){if(t!==this.currentPaymentMethod&&this.filteredPaymentMethods.includes(t)){if(this.checkoutResponse){this.checkoutResponse=null;u.clearCheckoutResponse()}this.currentPaymentMethod=t;u.setPaymentMethodSelected(t);if(t!==p.CARD){this.cardMode="input";u.setCardMode("input")}this.isSubmitting=false;this.currentApmPaymentMethod=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);if(t!==p.CASH&&t!==p.BANK_TRANSFER){this.checkoutResponse=null;u.clearCheckoutResponse()}else{this.checkoutResponse=null;u.clearCheckoutResponse()}this.paymentMethodSelected.emit(t);try{this.currentRequiredFields=R(t,this.allRequiredFields).fields;const i=await n.sessions.updateCurrentSessionPaymentMethod(c.data.sessionId,{paymentMethodName:v.mapToAPMPaymentMethod(t,c.data.pricing.country),paymentMethodType:t,currency:c.data.pricing.currency});u.setProviderKey(i.providerKey);if(i.providerKey===M.DECIDIR||c.data.providerKey===M.DECIDIR){const t=crypto.randomUUID();const i=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const e=i.result.script;const s=document.createElement("script");s.innerHTML=e;document.body.appendChild(s)}}catch(t){console.error("Failed to update payment method or get required fields:",t)}}}get currentPaymentError(){if(this.currentPaymentMethod===p.CARD){return this.rejectedPaymentCard}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){return this.rejectedPaymentAPM}return false}paymentMethodSelected;async handlePaymentMethodSelected(t){t.stopPropagation();const i=t.detail;this.changePaymentMethod(i);if(this.formElement){this.formElement.resetValidation()}}async handleSubmit(t){if(this.isSubmitting){return}this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false;if(this.currentPaymentMethod===p.CARD){this.handleSubmitCard(t)}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){this.handleSubmitAPM(t)}}handleFormChange(t){const i=t.detail;let e=true;let s={};if(this.formElement?.errors){s=this.formElement.errors;e=Object.keys(s).length===0}this.formChange.emit({data:i,isValid:e,errors:Object.keys(s).length>0?s:undefined})}async handleSubmitCard(t){const i=t.detail;const e=this.getCombinedUserData(i);if(!c.data.cardTokenId&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"card_error"};return}if(!c.data.cardInformation&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"tokenization_error"};return}this.cardError={showCardInvalid:false,type:null};const s={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},installments:Number(i.installments||c.data.cardInformation?.installments?.selectedInstallment?.installment),...c.data.cardTokenId&&{cardTokenId:c.data.cardTokenId,...c.data?.itemInformation?.type!==y.PLAN&&{saveCard:c.saveCard}},...c.data.cardId&&{cardId:c.data.cardId},...(!this.otpVerified||this.cardMode==="input")&&{customer:{firstName:e.fullName?.split(" ")[0],lastName:e.fullName?.split(" ").slice(1).join(" "),email:e.email,phone:{countryCode:e.countryCodePhoneNumber,number:e.phoneNumber}}},billingDetails:{address:{lineOne:e["billing-address"],city:e["billing-city"],state:e["billing-state"],country:e["billing-country"],zipCode:e["billing-zip"],lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}},customAttributes:{...c.deviceId&&{deviceId:c.deviceId}},...c.metadata&&{paymentMetadata:c.metadata}};const l=a();this.isSubmitting=true;this.isCardSubmitting=true;try{const t=await n.checkout.createCardCheckoutRequest(c.data.sessionId,l,s,c.data.accessToken||undefined);u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;if(t.data.result?.status.toUpperCase()===r.APPROVED){this.isCardSuccess=true;u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:t.data});c.data.cardInformation.lastFour=t.data.result?.cardLastFour}else{this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data.result?.statusDetail.toLowerCase()??t.data.error?.error?.message?.toLowerCase()}}}catch(t){this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()}}finally{this.isSubmitting=false;this.isCardSubmitting=false}}async handleSubmitAPM(t){if(this.currentPaymentMethod!==p.CASH&&this.currentPaymentMethod!==p.BANK_TRANSFER){return}this.isSubmitting=true;const i=t.detail;const e=this.getCombinedUserData(i);try{const t={address:{country:e["billing-country"]||"",state:e["billing-state"]||"",city:e["billing-city"]||"",zipCode:e["billing-zip"]||"",lineOne:e["billing-address"]||"",lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}};const s=this.currentApmPaymentMethod||v.mapToAPMPaymentMethod(this.currentPaymentMethod,c.data?.pricing?.country);const o={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},method:s,billingDetails:t,redirect:{approved:window.location.origin+"/payment/success",rejected:window.location.origin+"/payment/failure"},paymentMetadata:c.metadata,customAttributes:{bank:i.bankId||c.data?.bankId?.code}};{o.customer={firstName:e.fullName?.split(" ")[0]||"",lastName:e.fullName?.split(" ").slice(1).join(" ")||"",email:e.email,phone:{countryCode:e.countryCodePhoneNumber||"",number:e.phoneNumber||""}}}const r=a();const l=await n.checkout.createAPMCheckoutRequest(c.data.sessionId,r,o);this.isSubmitting=false;this.checkoutResponse=l.data;this.storedCheckoutResults.set(this.currentPaymentMethod,l.data);if(l.data?.date){c.data.paymentDate=l.data.date;c.createdAt=l.data.date}if(l.data?.traceId){c.data.paymentReference=l.data.traceId}}catch(t){this.isSubmitting=false;this.checkoutResponse=t.data;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()};this.rejectedPaymentAPM=true}}async submit(){if(this.formElement&&typeof this.formElement.submit==="function"){this.formElement.submit()}else{await this.handleSubmit({detail:{}})}}handlePaymentStatusChange=t=>{if(t.isCompleted){if(t.status===b.APPROVED){u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:this.checkoutResponse})}else if(t.status===b.REJECTED){u.setPaymentStatus(o.REJECTED);this.alertErrorKeys={alertTitle:o.APM_ERROR_GENERIC,message:o.APM_MESSAGE_ERROR}}}};async handleInputChange(t){if(t?.detail?.id==="email"&&this.oneClickCheckout){if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout)}if(!t.detail.value||t.detail.value.trim()===""){this.customerExists=false;u.clearCustomerIdAndToken();return}this.emailDebounceTimeout=setTimeout((async()=>{try{const t=await n.customers.exists({email:c.data.userInformation.email},this.publicKey);this.customerExists=t.data.exists}catch(t){this.customerExists=false}}),500)}}validationSchema={email:s().when([],{is:()=>!this.otpVerified,then:t=>t.email("validation.emailInvalid").matches(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"validation.emailInvalid").required("validation.emailRequired"),otherwise:t=>t.notRequired()}),fullName:s().when([],{is:()=>!this.otpVerified,then:t=>t.required("validation.fullNameRequired").matches(/^[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}\s+[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}$/,"validation.fullNameInvalid"),otherwise:t=>t.notRequired()}),isValidPhoneNumber:s().when([],{is:()=>I("phoneNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.equals(["true"],"validation.phoneRequired"),otherwise:t=>t.notRequired()}),"billing-country":s().when([],{is:()=>I("billing-country",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.countryRequired"),otherwise:t=>t.notRequired()}),"billing-state":s().when([],{is:()=>I("billing-state",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.stateRequired"),otherwise:t=>t.notRequired()}),"billing-address":s().when([],{is:()=>I("billing-address",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.addressRequired"),otherwise:t=>t.notRequired()}),"billing-city":s().when([],{is:()=>I("billing-city",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.cityRequired"),otherwise:t=>t.notRequired()}),"billing-zip":s().when([],{is:()=>I("billing-zip",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.zipRequired"),otherwise:t=>t.notRequired()}),bankId:s().when([],{is:()=>I("bankId",this.currentRequiredFields),then:t=>t.required("validation.bankRequired"),otherwise:t=>t.notRequired()}),installments:s().when([],{is:()=>this.currentPaymentMethod===p.CARD&&c.data.cardInformation.installments.isAvailableInstallments&&c.data.cardInformation?.installments?.installments.length>0&&c.data.itemInformation.type!==y.PLAN,then:t=>t.required("validation.installmentsRequired"),otherwise:t=>t.notRequired()}),documentType:s().when([],{is:()=>I("documentType",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.documentTypeRequired"),otherwise:t=>t.notRequired()}),documentNumber:s().when([],{is:()=>I("documentNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>{const i=t.required("validation.documentNumberRequired").min(7,"validation.documentInvalid");if(c.data?.pricing?.country==="BR"){return i.test("numeric-only","validation.documentNumberNumericOnly",(t=>{if(!t)return true;return/^\d+$/.test(t)}))}return i},otherwise:t=>t.notRequired()})};getInitialData=()=>({email:c.data.userInformation.email||"",fullName:c.data.userInformation.fullName||"",phoneNumber:c.data.userInformation.phoneNumber?.number||"",countryCodePhoneNumber:c.data.userInformation.countryCode||"",documentType:"",documentNumber:"","billing-country":c.data.userInformation.address?.billingAddress?.country||"","billing-state":c.data.userInformation?.address?.billingAddress?.state||"","billing-address":c.data.userInformation?.address?.billingAddress?.address||"","billing-city":c.data.userInformation?.address?.billingAddress?.city||"","billing-zip":c.data.userInformation?.address?.billingAddress?.zip||"",bankId:c.data.bankId?.code||"",card:"",installments:c.data.cardInformation?.installments?.selectedInstallment?.installment?.toString()||""});hasPrefilledAddress=()=>{const t=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return t.some((t=>{const i=this.initialData[t];return i&&i.trim()!==""}))};get isQrCodeVisible(){return!!this.checkoutResponse?.result?.data?.qrCode}get isBankTransferVisible(){return!!this.checkoutResponse?.result?.data?.account&&!!this.checkoutResponse?.result?.data?.bankName&&!!this.checkoutResponse?.result?.data?.reference}get isBoletoVisible(){return this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&!!this.checkoutResponse?.result?.data?.barcode}isPaymentApproved=()=>{if(c.data.paymentStatus===o.APPROVED){return true}return false};handleRebillAccountClick(t){this.showOtp=t.detail}handleReturnForm(t){this.showOtp=t.detail;u.clearCustomerIdAndToken()}handleSignOut(){this.showOtp=false;this.otpVerified=false;if(!c?.data?.prefilledData?.email){this.customerExists=false}u.clearCustomerIdAndToken();u.clearUserInformation();this.cardError={showCardInvalid:false,type:null};this.alertErrorKeys=null;this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false}handleCodeVerified(){this.otpVerified=true;this.showOtp=false;this.rejectedPaymentCard=false;this.alertErrorKeys=null;this.cardError={showCardInvalid:false,type:null};if(this.formElement){this.formElement.resetValidation()}}isPaymentRejected(){return c.data.paymentStatus===o.REJECTED&&this.currentPaymentMethod===p.BANK_TRANSFER}render(){const t=this.countries.map((t=>({label:t.country,value:t.isoCountryCode})));const i=(t={})=>e("rebill-summary",{key:"54af32d7bb0d51734d8066cd7a1c2d608948304c",totalAmount:c.data.pricing.total,currency:c.data.pricing.currency,itemTitle:c._session?.getTitle(),itemDescription:c._session?.getDescription(),itemAmount:c.data.pricing.subtotal,subtotal:c.data.pricing.subtotal,allowCoupon:c._session?.getAllowCoupon(this.displayConfig),currentBreakpoint:this.breakpoint,planFrequency:c._session?.getPlanFrequency(),planFrequencyCount:c._session?.getPlanFrequencyCount(),discountType:c.data.discount.discountType,discountedPercentage:c.data.discount.discountedPercentage,discountDuration:c.data.discount.discountDuration,discountAmount:c.data.discount.discountAmount,...t});return c.isInitialized&&e(e.Fragment,null,this.showRefreshModal&&e("rebill-modal-overlay",{key:"f62b661e9ebd58c3d8187d05820f2e1b778cc73a"}),this.displayConfig.processingPayment&&e("rebill-processing-payment",{key:"a2611d09bdfeb17a499b1f1c590342975cbe25cf",style:{display:this.isCardSubmitting?"block":"none"}}),this.displayConfig.successPage&&this.isPaymentApproved()&&c.isInitialized?e("success-page",{typePaymentMethod:c.data.paymentMethodSelected,paymentMethodName:v.mapToAPMPaymentMethod(c.data.paymentMethodSelected||c.data.payment?.paymentMethodType,c.data?.pricing?.country),country:c.data?.pricing?.country,bank:c.data.payment?.paymentMethodMetadata?.bank||c.data.payment?.paymentMethodMetadata?.bank,cardLastFour:this.responseCheckoutCard?.result?.cardLastFour||c.data.cardInformation?.lastFour,paymentDate:c.data.paymentDate||this.responseCheckoutCard?.date||c.data.payment?.createdAt||this.checkoutResponse?.result?.data?.createdAt,referenceNumber:c.data.paymentReference||c.data.payment?.traceId||this.responseCheckoutCard?.traceId,onSuccessRedirect:t=>{this.successRedirect.emit(t.detail)},trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,debitDay:c.data?.itemInformation?.debitDay,planAmount:c.data?.pricing?.planAmount}):e(e.Fragment,null,this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&k(this.breakpoint,g.DESKTOP)&&e("div",{class:"mode-sandbox-mobile-container",style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"}},e("rebill-mode-sandbox-mobile",null)),e("rebill-checkout-form",{ref:t=>this.formElement=t,style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:t=>this.handleSubmit(t),onChange:t=>this.handleFormChange(t),renderForm:({submit:s,formData:n,errors:a})=>{const o=!this.isCardSuccess&&this.checkoutResponse?.result&&(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER);return e("div",{class:`rebill-checkout ${!this.displayConfig.checkoutSummary?"full-width-layout":""}`},e("div",{class:"left-section"},e("div",{class:"left-section-container"},this.displayConfig.logo&&e("organization-logo",{organization:c.data.organization}),e("div",{class:"otp-container",style:{display:this.showOtp?"block":"none"}},e("otp-component",null)),e("div",{style:{display:this.showOtp?"none":"block"}},e("div",{class:"checkout-form-section"},this.displayConfig.checkoutSummary&&e("div",{class:"summary-mobile-tablet",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["totalAmount","discount","timelineFreeTrial","timelineDebitDay","itemDetails"]})),!this.otpVerified&&this.displayConfig.customerInformation&&e("user-information",{customerExists:this.customerExists,disabled:this.isSubmitting,errors:{email:a.email,fullName:a.fullName}}),this.otpVerified&&this.displayConfig.customerInformation&&e("user-information-static",{variant:"otp",userInfo:{customerName:c.data.userInformation.fullName?.split(" ")[0],customerEmail:c.data.userInformation.email}}),e("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e("payment-method-selector",{enabledPaymentMethods:this.filteredPaymentMethods,defaultSelected:this.currentPaymentMethod,disabled:this.isSubmitting,errorComponent:{showErrorComponent:this.displayConfig.errorMessage&&(this.currentPaymentError||this.isPaymentRejected()),alertTitle:l.getErrorTitle(this.currentPaymentMethod,c.data?.pricing?.country||"",this.alertErrorKeys?.alertTitle),message:l.getErrorMessage(this.alertErrorKeys?.message,this.currentPaymentMethod,c.data?.pricing?.country)},country:c.data?.pricing?.country,installmentsError:a.installments,showDocument:(!this.otpVerified||this.otpVerified&&this.cardMode==="input")&&!o&&!this.isQrCodeVisible&&(I("documentNumber",this.currentRequiredFields)||I("documentType",this.currentRequiredFields)),documentTypeError:a.documentType,documentNumberError:a.documentNumber,cardError:this.cardError,customCSS:this.css}),!o&&(()=>{const t=I("bankId",this.currentRequiredFields);return t})()&&e("div",{class:"animated-component fade-in"},e("rebill-bank-selector",{banks:P("bank",this.allRequiredFields[this.currentPaymentMethod].original)||[],defaultSelectedBankId:n.bankId||"",error:a?.bankId,disabled:this.isSubmitting}))),!o&&(!this.otpVerified||this.cardMode==="input")&&e(e.Fragment,null,this.displayConfig.billingAddress&&(I("billing-country",this.currentRequiredFields)||I("billing-state",this.currentRequiredFields)||I("billing-address",this.currentRequiredFields)||I("billing-city",this.currentRequiredFields)||I("billing-zip",this.currentRequiredFields))&&e("div",{class:"animated-component slide-in"},e("rebill-address",{disabled:this.isSubmitting,countryOptions:t,billingView:(()=>{if(this.displayConfig.useAddressSearch!==undefined&&this.displayConfig.useAddressSearch===false){return"form"}return this.hasPrefilledAddress()?"form":"search"})(),errors:{"billing-country":a["billing-country"],"billing-state":a["billing-state"],"billing-address":a["billing-address"],"billing-city":a["billing-city"],"billing-zip":a["billing-zip"]}})),this.displayConfig.customerInformation&&I("phoneNumber",this.currentRequiredFields)&&e("div",{class:"animated-component fade-in"},e("user-information-phone",{disabled:this.isSubmitting,error:a?.phoneNumber,countryCode:c.data.userInformation?.countryCode||c.data.country}))),o&&(()=>{const t=this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&this.checkoutResponse?.result?.data?.barcode;return e("apm-checkout",{paymentMethod:this.currentPaymentMethod,barcode:t?this.checkoutResponse?.result?.data?.barcode:undefined,referenceId:this.currentPaymentMethod===p.CASH&&!t?this.checkoutResponse?.result?.data?.referenceId:undefined,qrCodeData:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.qrCode:undefined,code:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.code:undefined,checkoutRequestId:this.checkoutResponse?.result?.checkoutRequestId,providerName:c.data.providerKey,expirationDate:(()=>{const t=new Date;t.setDate(t.getDate()+30);return t.toISOString()})(),onPaymentStatusChange:t=>this.handlePaymentStatusChange(t.detail),country:c.data?.pricing?.country,redirectUrl:this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,bearerToken:this.checkoutResponse?.result?.data?.bearerToken,bankTransferData:this.checkoutResponse?.result?.data?.account&&this.checkoutResponse?.result?.data?.bankName&&this.checkoutResponse?.result?.data?.reference?{account:this.checkoutResponse.result.data.account,bankName:this.checkoutResponse.result.data.bankName,reference:this.checkoutResponse.result.data.reference}:undefined})})(),this.displayConfig.checkoutSummary&&e("div",{class:"summary-price-details",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["priceDetails"]})),this.displayConfig.submitButton&&!(o&&(this.isQrCodeVisible||this.isBankTransferVisible||this.isBoletoVisible))&&e("div",{class:"payment-button-container"},e("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,onSubmit:()=>{s()},redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,isDisabled:c.data.fetchingInstallments,country:c.data?.pricing?.country}),e("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:d.translate("otp.secureMessage")}))),this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&!k(this.breakpoint,g.DESKTOP)&&e("rebill-mode-sandbox",null)),this.displayConfig.footer&&e("rebill-footer",{style:{marginTop:k(this.breakpoint,g.DESKTOP)?"24px":"auto"}}))),this.displayConfig.checkoutSummary&&e("div",{class:"right-section-checkout"},e("div",{class:"checkout-summary-section"},e("div",{class:"summary-desktop",style:{display:!k(this.breakpoint,g.DESKTOP)?"block":"none"}},i()))))}})))}static get watchers(){return{language:["handleLanguageChange"]}}};B.style=O;export{B as rebill_checkout};
2
+ //# sourceMappingURL=p-a8726b6d.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,c as t,d as i,h as n,H as r}from"./p-BTZ7D7jU.js";import{a}from"./p-CV0wqtJM.js";import{I as o,P as s,e as l,s as c,b as d,S as p,g as b,o as h}from"./p-Bkzz9eGU.js";import{S as f}from"./p-vsLqF4hk.js";import{g as u,J as g,P as m,i as y,d as x,a as k,b as v}from"./p-DUn0QSYi.js";import{C as w}from"./p-C5Pu-n-i.js";import{P as C}from"./p-BZFTAShB.js";import{c as S}from"./p-OxmhgFET.js";import{a as D,g as I}from"./p-pXX5rSDt.js";import{c as j,f as z}from"./p-bcHxwlBu.js";import{g as q}from"./p-DWY12C3E.js";import{B as L,g as T}from"./p-Do_vNuMa.js";import"./p-E-ZsRS8r.js";import"./p-CzeVW03r.js";const P=async(e,t)=>{try{const i=await a.checkout.getCheckoutRequestPaymentAPM(e,t);return i.data}catch(e){throw e}};const M=".apm-checkout{display:flex;flex-direction:column}.apm-content{margin-bottom:0}.apm-content .reference-code,.apm-content .qr-code,.apm-content .boleto-payment{margin-top:0;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.apm-actions{display:flex;gap:12px;padding:20px 0}.apm-actions rebill-button,.apm-actions payment-button{flex:1;width:100%}.apm-actions rebill-button .button-content,.apm-actions payment-button .button-content{display:flex;align-items:center;gap:12px;overflow:hidden}.apm-actions rebill-button .button-content rebill-icon{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;flex-shrink:0}.apm-checkout.redirect-message{justify-content:center;align-items:center;text-align:center}.redirect-content{background:var(--rebill-color-background);border:1px solid var(--rebill-color-background-right);padding:16px}.redirect-content .payment-method-name{font-weight:600 !important}.bank-transfer-data-container{margin-top:16px;display:flex;flex-direction:column;gap:12px}.bank-transfer-data{padding:0;background:transparent;border:none;border-radius:0}.instruction-step{display:flex;align-items:flex-start;gap:8px;margin-bottom:8px}.instruction-step:last-child{margin-bottom:0}.step-number{background:var(--rebill-color-background-right);width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.step-number rebill-typography{display:flex;align-items:center;justify-content:center;width:100%;height:100%;margin:0;padding:0}.instruction-text{display:flex;flex-direction:column;gap:8px;flex:1}.instruction-content{flex:1}.bank-data-item{display:flex;gap:8px;align-items:center;border-bottom:none}.value-with-copy{display:flex;align-items:center;gap:2px}.bank-transfer-simple-container{padding:16px;background:var(--rebill-color-background);border:1px solid var(--rebill-color-background-right);border-radius:8px}.instruction-text{margin-bottom:16px}.data-section{margin-bottom:16px}.bank-transfer-simple{margin-bottom:16px}.bank-transfer-simple:last-child{margin-bottom:0}.bank-data-simple{display:flex;flex-direction:column;gap:4px}.bank-data-item-simple{display:flex;justify-content:space-between;align-items:center;padding:4px 0}@media (max-width: 768px){.apm-actions{flex-direction:column;gap:12px;padding:16px 0}.apm-actions rebill-button{width:100%;flex:none}}";const E=5e3;const N=3e3;const B=300;const R=class{constructor(i){e(this,i);this.paymentStatusChange=t(this,"paymentStatusChange")}get el(){return i(this)}paymentMethod;referenceId;qrCodeData;code;providerName;expirationDate;country;redirectUrl;timeToRedirect=E;checkoutRequestId;bearerToken;bankTransferData;barcode;showRedirectMessage=false;isPolling=false;minutesLeft;qrStartTime;downloadData;paymentStatusChange;redirectTimeoutId;pollingIntervalId;pollingDelayTimeoutId;pollingAttempts=0;componentWillLoad(){this.qrStartTime=new Date;this.downloadData=this.generateDownloadData();if(this.redirectUrl){this.handleRedirect()}if(this.checkoutRequestId&&(this.qrCodeData||this.bankTransferData)){this.startPolling()}}componentDidLoad(){const e=this.el?.querySelector("payment-button");if(e){e.addEventListener("submit",this.handleRedirect)}}disconnectedCallback(){if(this.redirectTimeoutId){clearTimeout(this.redirectTimeoutId);this.redirectTimeoutId=undefined}if(this.pollingDelayTimeoutId){clearTimeout(this.pollingDelayTimeoutId);this.pollingDelayTimeoutId=undefined}if(this.pollingIntervalId){clearInterval(this.pollingIntervalId);this.pollingIntervalId=undefined}const e=this.el?.querySelector("payment-button");if(e){e.removeEventListener("submit",this.handleRedirect)}}handleRedirect=()=>{if(this.redirectTimeoutId){clearTimeout(this.redirectTimeoutId)}this.showRedirectMessage=true;this.redirectTimeoutId=window.setTimeout((()=>{window.open(this.redirectUrl,"_self")}),this.timeToRedirect)};handleViewBranches=()=>{window.open("https://www.pagofacil.com.ar/","_blank")};handleTimeUpdate=e=>{this.minutesLeft=e.detail};startPolling=()=>{if(!this.qrCodeData&&!this.bankTransferData||!this.checkoutRequestId||this.isPolling){return}this.isPolling=true;this.pollingAttempts=0;this.pollingIntervalId=window.setInterval((()=>{this.checkPaymentStatus()}),N)};stopPolling=()=>{if(this.pollingIntervalId){clearInterval(this.pollingIntervalId);this.pollingIntervalId=undefined}this.isPolling=false};checkPaymentStatus=async()=>{if(!this.checkoutRequestId){return}try{this.pollingAttempts++;const e=await P(this.checkoutRequestId,this.bearerToken);const t=e.status===f.APPROVED||e.status===f.REJECTED;this.paymentStatusChange.emit({status:e.status,isCompleted:t,data:e.data});if(t){this.stopPolling();return}if(this.pollingAttempts>=B){this.stopPolling();return}}catch(e){console.error("Error checking payment status:",e)}};generateDownloadData(){const e={paymentMethod:this.paymentMethod,referenceId:this.referenceId,providerName:this.providerName,expirationDate:this.expirationDate,country:this.country,minutesLeft:this.minutesLeft};if(this.bankTransferData){e.bankTransferData={bankName:this.bankTransferData.bankName,accountNumber:this.bankTransferData.account||this.bankTransferData.bbvAccountNumber,reference:this.bankTransferData.reference,clabe:this.bankTransferData.account||this.bankTransferData.clabe,destinationBank:this.bankTransferData.bankName,paymentReference:this.bankTransferData.reference,instructions:this.bankTransferData.instructions}}else if(this.qrCodeData){e.qrCodeData=this.qrCodeData}else if(this.barcode){e.barcode=this.barcode}return e}renderResponse(){if(this.redirectUrl&&this.showRedirectMessage){const e=C.mapToAPMPaymentMethod(this.paymentMethod,this.country);const t=C.getDisplayName(e);return n("div",{class:"redirect-content"},n("div",{class:"redirect-text"},n("rebill-typography",{variant:"body2",color:w.GREY_300},o.translate("apmCheckout.redirectMessagePrefix")," ",n("rebill-typography",{variant:"overline",color:w.GREY_300},t)," ",o.translate("apmCheckout.redirectMessageSuffix"))))}if(this.barcode){const e=u();return n("boleto-payment",{barcode:this.barcode,referenceId:this.referenceId,providerName:this.providerName,expirationDate:this.expirationDate,instructions:e})}if(this.referenceId){return n("reference-code",{referenceId:this.referenceId,providerName:this.providerName,expirationDate:this.expirationDate})}if(this.qrCodeData){return n("qr-code",{qrCodeData:this.qrCodeData,code:this.code,providerName:this.providerName,expirationDate:this.expirationDate,paymentMethod:this.paymentMethod,onTimeUpdate:this.handleTimeUpdate})}if(this.bankTransferData){return n("bank-transfer",{bankTransferData:this.bankTransferData})}return null}render(){const e=this.redirectUrl&&this.showRedirectMessage;const t=this.paymentMethod===s.CASH;const i=t&&this.country==="AR";return n("div",{key:"c2066dc10a6272c5b306c0a88fa65c016d108b20",class:`apm-checkout ${e?"redirect-message":""}`},n("div",{key:"b838019d533b6ab6d36988413046108d57e7cc9e",class:"apm-content"},this.renderResponse()),n("div",{key:"4551e1f196ada083e687b258c9780824fe4e6a94",class:"apm-actions"},!e&&i&&n("rebill-button",{key:"e6ded8a243e10704aeac3ecdf49936547019df2f",type:"button",variant:"outline",theme:"primary",onClick:this.handleViewBranches},n("span",{key:"78579393e08e7505ddcc766ac1f98563500ee46d",class:"button-content"},n("span",{key:"ca81340319916ca89c94dfa308d68407155fb419"},o.translate("apmCheckout.viewBranches")),n("rebill-icon",{key:"ae5b00b40a0cf4f6607749e384df669d11c8c2c7",name:"square-arrow-top-right"}))),!e&&n("apm-download",{key:"67a6386c1e4d055c011f199a8d091ba010f7404d",data:this.downloadData})))}};R.style=M;const _="";const F=class{constructor(i){e(this,i);this.submit=t(this,"submit")}isDisabled=false;isLoading=false;paymentMethod;isRenewal=false;isChangeCard=false;trialPeriodDays;redirectUrl;timeToRedirect;country;currentLanguage=o.getCurrentLanguage();countdownSeconds=0;paymentMethodDisplayName="";submit;onRedirectPropsChange(){this.initializeCountdown()}countdownTimer=null;lastPaymentMethod=undefined;lastCountry=undefined;componentWillLoad(){l.on("languageChanged",this.handleLanguageChange);this.updatePaymentMethodDisplayName()}componentDidLoad(){this.initializeCountdown()}componentWillUpdate(){if(this.paymentMethod!==this.lastPaymentMethod||this.country!==this.lastCountry){this.lastPaymentMethod=this.paymentMethod;this.lastCountry=this.country;this.updatePaymentMethodDisplayName()}}disconnectedCallback(){l.off("languageChanged",this.handleLanguageChange);this.stopCountdown()}handleLanguageChange=()=>{this.currentLanguage=o.getCurrentLanguage()};updatePaymentMethodDisplayName=()=>{this.paymentMethodDisplayName=D(this.paymentMethod,this.country)};handleSubmit=()=>{this.submit.emit()};initializeCountdown=()=>{if(this.redirectUrl===true&&this.timeToRedirect!=null){const e=Math.ceil(this.timeToRedirect/1e3);this.countdownSeconds=e;this.stopCountdown();this.countdownTimer=j({duration:e,onTick:e=>{this.countdownSeconds=e},onComplete:()=>{this.countdownSeconds=0}});this.countdownTimer.start()}else{this.stopCountdown();this.countdownSeconds=0}};stopCountdown=()=>{if(this.countdownTimer){this.countdownTimer.stop();this.countdownTimer=null}};shouldShowLoading=()=>this.isLoading||this.redirectUrl===true&&this.timeToRedirect!=null;getButtonText=()=>{if(this.redirectUrl===true&&this.timeToRedirect!=null){return o.translate("buttons.redirecting",{seconds:this.countdownSeconds})}if(this.trialPeriodDays){return o.translate("buttons.startTrial",{trialDays:c.data?.itemInformation?.trial?.trialPeriodDays})}if(this.paymentMethod===s.CASH||this.paymentMethod===s.BANK_TRANSFER){if(this.paymentMethodDisplayName){return o.translate("buttons.continueWithPaymentMethod",{paymentMethod:this.paymentMethodDisplayName})}else{return o.translate("buttons.continue")}}if(this.isChangeCard){return o.translate("buttons.updateCard")}if(this.isRenewal){return o.translate("buttons.renewSubscription")}if(c.data?.itemInformation?.type===d.PLAN){return o.translate("buttons.subscribe")}return o.translate("buttons.payNow")};render(){return n("rebill-button",{key:"bda5ad37779ac592971c5990591fb3e43b1e570f",type:"button",disabled:this.isDisabled,loading:this.shouldShowLoading(),showSpinnerWithText:this.redirectUrl===true&&this.timeToRedirect!=null,nonClickable:this.redirectUrl===true&&this.timeToRedirect!=null,variant:"filled",theme:"primary-dark",onClick:this.handleSubmit,id:"payment-button"},this.getButtonText())}static get watchers(){return{redirectUrl:["onRedirectPropsChange"],timeToRedirect:["onRedirectPropsChange"]}}};F.style=_;const U=".payment-method-selector{width:100%;display:flex;flex-direction:column;gap:8px}.card-description-container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;width:100%}";const A=class{constructor(i){e(this,i);this.paymentMethodSelected=t(this,"paymentMethodSelected")}enabledPaymentMethods=[];defaultSelected;showErrorComponent=false;cardError;country;installmentsError;documentTypeError;showDocument;documentNumberError;customCSS;errorComponent;disabled=false;icon="";selectedPaymentMethod;saveCard=false;paymentMethodSelected;componentWillLoad(){if(this.enabledPaymentMethods.length>0){this.selectedPaymentMethod=this.defaultSelected||this.enabledPaymentMethods[0];if(this.enabledPaymentMethods.length===1){this.paymentMethodSelected.emit(this.selectedPaymentMethod)}}this.getPaymentMethodIcon(this.selectedPaymentMethod)}componentWillUpdate(){if(this.defaultSelected&&this.selectedPaymentMethod!==this.defaultSelected){this.selectedPaymentMethod=this.defaultSelected}}getPaymentMethodConfig(e){const t=this.country?I(this.country):null;const i=t?.find((t=>t.type===e));const n=e===s.CASH&&this.country==="BR"?D(s.CASH,this.country)||o.translate("paymentMethods.cash"):o.translate("paymentMethods.cash");const r={[s.CARD]:{key:s.CARD,label:o.translate("paymentMethods.card"),icons:["doblecard"]},[s.CASH]:{key:s.CASH,label:n,icons:["pago-facil"]},[s.BANK_TRANSFER]:{key:s.BANK_TRANSFER,label:this.country==="AR"?o.translate("paymentMethods.bank_transfer_qr"):o.translate("paymentMethods.bank_transfer"),icons:["plus"]}};const a=r[e];return{...a,icons:i?.icons||a.icons}}getPaymentMethodIcon(e){this.icon=D(e,this.country)?.toLowerCase()||"card";return this.icon}handlePaymentMethodSelected(e){if(this.disabled){return}this.selectedPaymentMethod=e;this.paymentMethodSelected.emit(e)}handleSelectableCardClick(e){if(this.disabled){return}const t=e.detail;this.handlePaymentMethodSelected(t)}render(){if(this.enabledPaymentMethods.length===0){return null}return n("div",{class:"payment-method-selector"},n("div",{style:{display:"flex",flexDirection:"row",gap:"8px",width:"100%",justifyContent:"space-between"}},this.enabledPaymentMethods.length===1&&(()=>{const e=this.getPaymentMethodConfig(this.enabledPaymentMethods[0]);return n("single-payment-method",{paymentMethod:this.enabledPaymentMethods[0],currencyCountry:this.country,paymentMethodDetails:[],icons:e.icons,style:{display:"flex",flex:"1 1 0"}})})(),this.enabledPaymentMethods.length>1&&this.enabledPaymentMethods.map((e=>{const t=this.getPaymentMethodConfig(e);return n("selectable-card",{style:{flex:"1 1 0"},selected:this.selectedPaymentMethod===e,"card-key":t.key,label:t.label,disabled:this.disabled},n("span",{slot:"icon"},n("div",{style:{display:"flex",alignItems:"center",gap:"8px",height:"24px"}},t.icons.map((t=>n("rebill-icon",{name:t,color:this.disabled&&e===s.CARD?w.NEUTRALS_500:"currentColor"}))))))}))),n("div",null,this.cardError.showCardInvalid&&this.selectedPaymentMethod===s.CARD?n("rebill-alert",{type:"error",alertTitle:this.cardError.type==="tokenization_error"?o.translate("validation.tokenError"):o.translate("validation.cardInvalid"),variant:"outlined",message:this.cardError.type==="tokenization_error"?o.translate("validation.tokenErrorDescription"):o.translate("validation.cardInvalidDescription"),icon:"error"}):this.errorComponent.showErrorComponent?n("rebill-alert",{type:"error",alertTitle:this.errorComponent.alertTitle,message:this.errorComponent.message,variant:"outlined",icon:"error"}):null),this.enabledPaymentMethods.length>1&&this.selectedPaymentMethod===s.CARD&&c.data?.itemInformation?.type!==d.PLAN&&n("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"}}),this.selectedPaymentMethod===s.CARD&&n(n.Fragment,null,n("div",null,n("card-fields-wrapper",{installmentsError:this.installmentsError,documentTypeError:this.documentTypeError,documentNumberError:this.documentNumberError,showDocument:this.showDocument,customCSS:this.customCSS}))),(this.selectedPaymentMethod===s.BANK_TRANSFER||this.selectedPaymentMethod===s.CASH)&&this.showDocument&&n("div",null,n("card-identification",{documentTypeError:this.documentTypeError,documentNumberError:this.documentNumberError,disabled:this.disabled})))}};A.style=U;const W=".lottie-container{margin-bottom:2rem;display:flex;justify-content:center;align-items:center}.lottie-animation{width:166px;height:165px;display:flex;justify-content:center;align-items:center}.text-content{margin-bottom:2rem;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}.security-badge{width:100%;max-width:450px;height:40px;display:flex;align-items:center;justify-content:center;background:#ebedef;border-radius:8px;box-sizing:border-box}.lock-icon{width:16px;height:16px;color:var(--rebill-color-text-secondary, #6b7280)}@keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.05);opacity:0.8}}.contact-info{text-align:left}@media (max-width: 1024px){.security-badge{width:100%;max-width:100%}.lottie-animation{width:166px;height:165px}.text-content{gap:12px}}@media (max-width: 767px){.processing-container{padding:0 16px}}.processing-container{width:100%;max-width:100%;overflow-x:hidden;box-sizing:border-box}";const V=class{constructor(t){e(this,t)}titleKey="processing.processingTitle";subtitleKey="processing.processingSubtitle";currentLocale=c.currentLocale;breakpoint=L.DESKTOP;loaderProgress=0;isLoadingLottie=true;unsubscribeCurrentLocaleStore;progressInterval;lottieContainer;lottieAnimation;componentWillLoad(){this.breakpoint=T(window.innerWidth);this.unsubscribeCurrentLocaleStore=p.onChange("currentLocale",(()=>{this.currentLocale=c.currentLocale}))}componentDidLoad(){window.addEventListener("resize",this.handleResize);this.loadLottieAnimation()}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}window.removeEventListener("resize",this.handleResize);this.stopLoaderAnimation()}handleResize=()=>{this.breakpoint=T(window.innerWidth)};loadLottieAnimation=async()=>{try{const e=await import("./p-GK75wIKe.js").then((function(e){return e.l}));const t=await fetch(q(`loader-card-v2.json`));const i=await t.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=2e3;const t=50;const i=t/e*100;this.progressInterval=window.setInterval((()=>{this.loaderProgress=Math.min(this.loaderProgress+i,100);if(this.loaderProgress>=100){this.stopLoaderAnimation()}}),t)};stopLoaderAnimation=()=>{if(this.progressInterval){clearInterval(this.progressInterval);this.progressInterval=undefined}if(this.lottieAnimation){this.lottieAnimation.destroy();this.lottieAnimation=undefined}};render(){return n("rebill-checkout-single-column",{key:"05536f6464213fb012e29ef8f6b7a19fc882bf08"},n("div",{key:"cb2a9dc211cbfbbf3041c517ffd7257d54ec8979",class:"processing-container"},n("div",{key:"66b2d5d8b8617e19fe12db4a267d04a0ef64bb14",class:"lottie-container"},n("div",{key:"a6c6b5ef3eccface4ff7f63b9f936c077274e116",ref:e=>this.lottieContainer=e,class:"lottie-animation"})),n("div",{key:"c5cdb16b2131ca9c389d71970a13eb3ac0501ab7",class:"text-content"},n("rebill-typography",{key:"be877839826c880103c092561434d448d7607d22",variant:"h3",color:w.PRIMARY_DARK_TEXT},o.translate(this.titleKey)),n("rebill-typography",{key:"8985b4cda5906e01e61447f0c8b190f1ebf6438c",variant:"subtitle-bold",color:w.PRIMARY_DARK_TEXT},o.translate(this.subtitleKey))),n("rebill-alert",{key:"6e77ddb54087d0f4cd6a64160ea6236300c07e32",type:"secure",variant:"variant-secure",icon:"lock-outline",message:o.translate("otp.secureMessage")})))}};V.style=W;const O=".boleto-payment{border:1px solid var(--rebill-color-border, #f4f5f6);border-radius:8px;background:var(--rebill-color-background, #ffffff);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.boleto-header{padding:16px 24px;background:var(--rebill-color-background-left);border-bottom:1px solid var(--rebill-color-background-right)}.expiration-section{display:flex;align-items:center;gap:8px;justify-content:center}.expiration-section rebill-icon{width:16px;height:16px;flex-shrink:0}.expiration-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-secondary, #3b4049);line-height:24px;text-align:center}.boleto-content{padding:16px 0px 16px 0px;background:#ffffff !important}.barcode-section{display:flex;flex-direction:column;gap:16px;align-items:center;width:100%;padding:0 16px;box-sizing:border-box}.barcode-number{font-size:12px;font-weight:500;color:var(--rebill-color-text-primary, #000000);text-align:center;line-height:24px;margin:0;word-break:break-all;font-family:'SF Pro Display',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif;padding:0;width:100%;box-sizing:border-box}.barcode-image-container{width:100%;display:flex;justify-content:center;align-items:center;padding:16px;box-sizing:border-box}.barcode-image{max-width:100%;height:auto;display:block}.copy-button{width:100%;margin:0;padding:8px 16px;background:var(--rebill-color-background, #ffffff);border:1px solid var(--rebill-color-border, #f4f5f6);border-radius:8px;display:flex;align-items:center;justify-content:center;gap:12px;cursor:pointer;transition:background-color 0.2s ease;font-family:var(--rebill-font-family);box-sizing:border-box}.copy-button:hover{background:var(--rebill-color-background-secondary, #fafafa)}.copy-button-text{font-size:14px;font-weight:500;color:var(--rebill-color-primary-dark-blue, #001131);line-height:1;display:flex;align-items:center;font-family:'SF Pro Display',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif}.copy-button rebill-icon{width:20px;height:20px;flex-shrink:0;display:flex;align-items:center;justify-content:center}.copy-button svg{flex-shrink:0;display:flex;align-items:center;justify-content:center}.instructions-section{background:var(--rebill-color-background-secondary)}.instructions-toggle{width:100%;padding:8px 16px;background:none;border:none;display:flex;justify-content:space-between;align-items:center;cursor:pointer;font-size:14px;font-weight:400;color:var(--rebill-color-text-primary, #000000);transition:background-color 0.2s ease;font-family:'Inter',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif;letter-spacing:0.14px;line-height:26px}.instructions-toggle:hover{background:rgba(174, 174, 174, 0.1)}.instructions-toggle rebill-icon{width:18px;height:18px;flex-shrink:0;transition:transform 0.2s ease;color:rgba(174, 174, 174, 1);display:flex;align-items:center;justify-content:center}.instructions-toggle .chevron-open{transform:rotate(180deg)}.instructions-toggle .chevron-closed{transform:rotate(0deg)}.instructions-content{padding:0 16px;background:var(--rebill-color-background);max-height:0;overflow:hidden;transition:max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),\n padding 0.35s cubic-bezier(0.4, 0, 0.2, 1)}.instructions-content.open{max-height:2000px;padding:16px}.instructions-list{display:flex;flex-direction:column;gap:8px;margin:0;padding:0}.instruction-item{display:flex;align-items:flex-start;gap:8px;width:100%}.instruction-number{background:var(--rebill-color-background-right);width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.instruction-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-primary, #000000);line-height:normal;margin:0;flex:1;font-family:'Inter',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif;white-space:pre-wrap}@media (max-width: 768px){.boleto-content{padding:16px}.barcode-number{font-size:12px}.instructions-toggle{padding:8px 16px}.instructions-content{padding:16px}}";const $=class{constructor(t){e(this,t)}get el(){return i(this)}barcode;referenceId;providerName;expirationDate;instructions=[];showInstructions=true;hasCopied=false;toggleInstructions=()=>{this.showInstructions=!this.showInstructions};getExpirationDate=()=>{const e=new Date;const t=new Date(e);t.setTime(e.getTime()+7*24*60*60*1e3);return t.toISOString()};formatExpirationDateTime=e=>{try{const t=new Date(e);if(isNaN(t.getTime())){return e}const i=o.getCurrentLanguage();const n=i==="es"?"es-ES":i==="pt"?"pt-BR":"en-US";const r=t.toLocaleDateString(n,{day:"2-digit",month:"2-digit"});const a=t.toLocaleTimeString(n,{hour:"2-digit",minute:"2-digit",hour12:false});return`${r} ${a}`}catch(t){return e}};getCurrentLanguageInstructions=()=>{const e=o.getCurrentLanguage();const t=this.instructions.find((t=>t.language===e));const i=t?.text||this.instructions[0]?.text||"";return i.split("\n").filter((e=>e.trim().length>0))};componentDidLoad(){this.generateBarcode()}componentDidUpdate(){this.generateBarcode()}generateBarcode=()=>{if(!this.barcode)return;const e=this.el.querySelector(".barcode-image");if(!e)return;try{g(e,this.barcode,{format:"CODE128",displayValue:false,width:2,height:60,margin:0})}catch(e){console.error("Failed to generate barcode:",e)}};handleCopyCode=async()=>{if(!this.barcode)return;try{await S(this.barcode);this.hasCopied=true;setTimeout((()=>{this.hasCopied=false}),2e3)}catch(e){console.error("Failed to copy barcode:",e)}};render(){const e=this.getCurrentLanguageInstructions();const t=o.getCurrentLanguage();const i=t==="es"?"Pagar antes del":t==="pt"?"Pagar antes de":"Pay before";return n("div",{key:"b67183a79afa67cbce044af10da4d42527a5fb20",class:"boleto-payment"},n("div",{key:"cb72a78917f6ff6080de5e0913634a18e1d1484c",class:"boleto-header"},n("div",{key:"6a9a5e1582e25e5bea72c11d5a44005667d55498",class:"expiration-section"},n("rebill-icon",{key:"4b100808d19a473dbd542f506bc01325c000a04f",name:"calendar-clock"}),n("span",{key:"a46df4d1ee34fb2d325ed0a65880ceb47a489ed0",class:"expiration-text"},i," ",this.formatExpirationDateTime(this.getExpirationDate())))),n("div",{key:"8f935f95463de92ec38631d62f5a0eee61e82bd4",class:"boleto-content"},n("div",{key:"0f902722498a31c82564a490262e7b13a9f457c2",class:"barcode-section"},this.barcode&&n(n.Fragment,null,n("p",{key:"bb9bcf27e9fe2a9a55d206e74199c6ea4581e275",class:"barcode-number"},this.barcode),n("div",{key:"535890a52ef6ca03cfe6f6a28178fc715d7f1ba2",class:"barcode-image-container"},n("svg",{key:"43db95db47b75e8006e18190900c69c89484e1ac",class:"barcode-image","aria-label":"Boleto barcode"})),n("button",{key:"8adc226f4412dd9bd8096a591eac3cb4c0941506",class:"copy-button",onClick:this.handleCopyCode,type:"button"},n("span",{key:"efeba3d10b8b5e588b52eb3fcb0f6af76567f974",class:"copy-button-text"},o.translate("qrCode.copyCode")||"Copiar código"),this.hasCopied?n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M5.62256 10.8855L8.24756 13.5418L14.3726 6.45844",stroke:"#35B093","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})):n("rebill-icon",{name:"copy"}))))),this.instructions.length>0&&n("div",{key:"899929c9e2109484140ce888ea1fabdd0704faff",class:"instructions-section"},n("button",{key:"992906964dcb6062c42782f7ee66a70c44905733",class:"instructions-toggle",onClick:this.toggleInstructions,type:"button","aria-expanded":this.showInstructions.toString(),"aria-controls":"instructions-content"},n("span",{key:"efff8244043fe9d171a4008932635ca74e4c1e3c"},o.translate("qrCode.instructionsLabel")||"Ver instrucciones"),n("rebill-icon",{key:"a39d58397a22417d864a79fb84b1f1487192411e",name:"chevron-down",class:this.showInstructions?"chevron-open":"chevron-closed"})),n("div",{key:"c10471014c2de29b6c0cca3950095bc5fdb3a51f",class:`instructions-content ${this.showInstructions?"open":""}`,id:"instructions-content",role:"region","aria-labelledby":"instructions-toggle"},n("div",{key:"19748e384da15980c56c2b777542475ee8470041",class:"instructions-list"},e.map(((e,t)=>n("div",{key:t,class:"instruction-item"},n("div",{class:"instruction-number"},t+1),n("p",{class:"instruction-text"},e))))))))}};$.style=O;const K=".user-information-static{width:100%;display:flex;gap:16px;justify-content:space-between;font-size:14px}.user-information-static.otp{flex-direction:column;gap:12px;justify-content:flex-start}.user-information-static-content.otp{display:flex;justify-content:space-between;align-items:center;gap:8px}.user-information-static-content.otp rebill-button{gap:8px;display:flex;align-items:center;justify-content:center}";const H=class{constructor(i){e(this,i);this.signOut=t(this,"signOut")}userInfo;variant="renewal";signOut;handleSignOut(){this.signOut.emit(false)}render(){return n("div",{key:"66131bc9fa1b999835c836fd70c0970b3268b5a1",class:`user-information-static ${this.variant}`},n("div",{key:"fd59e3fcfb8430413010514eebd6ad4cc9b632d7",class:`user-information-static-content ${this.variant}`},n("rebill-typography",{key:"8160a40c1e6aeaa572c3dd692d158fc951f36ead",variant:"subtitle-bold",class:"greeting"},o.translate("userInformation.greeting",{name:this.userInfo.customerName})),this.variant==="otp"&&n("rebill-button",{key:"4372a16bb6421eb3151a3678267935461976ba3a",variant:"text",size:"small",onClick:()=>this.handleSignOut()},n("div",{key:"daaeeac65e79736bb83b4b4f8e95f115f03bf1d2",style:{display:"flex",alignItems:"center",gap:"8px"}},n("rebill-typography",{key:"5ddf5f0c41006a49e5c55fc301aef5fbde7dda9a",variant:"subtitle-bold",color:w.PRIMARY_DARK},o.translate("userInformation.signOut")),n("rebill-icon",{key:"425d8b7058b6992f1060c89a34648665ea65e93a",name:"logout",size:"12px"})))),n("span",{key:"1815edff76f0a1e4d49aa154483a5a4b2e6915b3",style:{display:"flex",alignItems:"center",gap:"7px"}},n("rebill-icon",{key:"ed6c497ed876aa0058652e4bb1edee96df36f2d3",name:"email",size:"12px",color:w.GREY_700}),this.userInfo.customerEmail))}};H.style=K;const Y="apm-download{flex:1;display:block}apm-download rebill-button{width:100%}.button-content{display:flex;align-items:center;gap:12px;overflow:hidden}.button-content rebill-icon{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;flex-shrink:0}";const Q=class{constructor(t){e(this,t)}data;handleDownload=async()=>{if(!this.data)return;try{let e=60;if(this.data.minutesLeft!==undefined){e=this.data.minutesLeft}await m.generateAndDownloadPDF({paymentMethod:this.data.paymentMethod,referenceId:this.data.referenceId,qrCodeData:this.data.qrCodeData,barcode:this.data.barcode,bankTransferData:this.data.bankTransferData,providerName:this.data.providerName||"",expirationDate:this.data.expirationDate||"",minutesLeft:e,country:this.data.country,amount:this.data.amount,currency:this.data.currency})}catch(e){console.error("Error downloading APM instructions:",e)}};render(){if(!this.data)return null;return n("rebill-button",{type:"button",variant:"filled",theme:"primary-dark",onClick:this.handleDownload},n("span",{class:"button-content"},n("span",null,o.translate("apmCheckout.download")),n("rebill-icon",{name:"download"})))}};Q.style=Y;const Z=":host{display:block;width:100%}.bank-transfer-data-container{display:flex;flex-direction:column;gap:16px;width:100%}.bank-transfer-data{padding:0 16px;background:transparent;border:none;border-radius:0}.bank-transfer-steps{display:flex;flex-direction:column;gap:16px}.instruction-step{display:flex;align-items:flex-start;gap:8px;margin-bottom:8px}.step-number{background:var(--rebill-color-background-right);width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.step-number rebill-typography{display:flex;align-items:center;justify-content:center;width:100%;height:100%;margin:0;padding:0}.step-content{flex:1;display:flex;flex-direction:column;gap:8px}.bank-data-item{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 0;border-bottom:none}.value-with-copy{display:flex;align-items:center;gap:8px}.bank-data-simple{display:flex;flex-direction:column;gap:4px;padding:0 16px}.instruction-text{margin-bottom:16px}.data-section{margin-bottom:16px}.transfer-data-title{text-align:center;margin-bottom:16px;padding-bottom:8px}.bank-data-item-simple{display:flex;justify-content:space-between;align-items:center}.bank-logos-container{margin-top:16px;padding-top:16px}.bank-logos-row{display:flex;justify-content:center;align-items:center;align-content:center;gap:11px;align-self:stretch;flex-wrap:wrap}.bank-logo{display:flex;align-items:center;justify-content:center;padding:8px;border-radius:4px;background:var(--rebill-color-background);border:1px solid var(--rebill-color-border);transition:all 0.2s ease}.bank-logo:hover{background:var(--rebill-color-background-secondary);transform:translateY(-1px)}.bank-transfer-data-container{border:1px solid var(--rebill-color-background-right);border-radius:8px;background:var(--rebill-color-background);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.transfer-data-header{display:flex;padding:16px 0;flex-direction:column;align-items:center;gap:var(--Spacing-s, 8px);align-self:stretch;border:1px solid var(--Neutrals-Neutrals-50, #f4f5f6);background:var(--Primary-Base-White, #fafafa)}.transfer-data-header rebill-typography{color:var(--Primary-Base-Black, #000) !important;text-align:center;font-family:Inter;font-size:12px;font-style:normal;font-weight:500;line-height:normal}@media (max-width: 768px){.bank-transfer-data-container{gap:12px}.instruction-step{gap:6px}.step-number{width:18px;height:18px}.bank-logos-row{gap:8px}.bank-logo{padding:6px}}";const G=class{constructor(t){e(this,t)}bankTransferData;renderSimpleBankData(e){return n("div",{class:"bank-data-simple"},n("div",{class:"bank-data-item-simple"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.clabe")),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},e.account),n("rebill-button",{variant:"text",size:"small",onClick:()=>S(e.account),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))),n("div",{class:"bank-data-item-simple",style:{height:"32px",boxSizing:"border-box"}},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.nameSurname")),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},"Rebill Payments"),n("rebill-button",{variant:"text",size:"small",onClick:()=>S("Rebill Payments"),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))),n("div",{class:"bank-data-item-simple"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("summary.totalAmount"),": "),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},b(c.data?.pricing?.total,c.data?.pricing?.currency)),n("rebill-button",{variant:"text",size:"small",onClick:()=>S(b(c.data?.pricing?.total,c.data?.pricing?.currency)),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))),n("div",{class:"bank-data-item-simple",style:{height:"32px",boxSizing:"border-box"}},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.destinationBank")),n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.paymentTransferSystem"))),n("div",{class:"bank-data-item-simple"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.paymentReference")),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},e.reference),n("rebill-button",{variant:"text",size:"small",onClick:()=>S(e.reference),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))))}renderInstructions(){const e=[o.translate("bankTransfer.step1Instruction"),o.translate("bankTransfer.step2Instruction"),o.translate("bankTransfer.step3Instruction"),o.translate("bankTransfer.step4Instruction"),o.translate("bankTransfer.step5Instruction"),o.translate("bankTransfer.step6Instruction")];return n("div",{class:"bank-transfer-steps"},e.map(((e,t)=>n("div",{class:"instruction-step",key:t},n("div",{class:"step-number"},n("rebill-typography",{variant:"caption",color:w.PRIMARY_DARK_TEXT},t+1)),n("div",{class:"step-content"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},e))))))}renderBankLogos(){const e=["banco-azteca","banamex","inbursa","banco-santander","banorte","hsbc","scotiabank"];return n("div",{class:"bank-logos-container"},n("div",{class:"bank-logos-row"},e.map((e=>n("div",{class:"bank-logo",key:e},n("rebill-icon",{name:e,size:"32px"}))))))}render(){if(!this.bankTransferData){return null}const e=Array.isArray(this.bankTransferData)?this.bankTransferData:[this.bankTransferData];if(e.length===0){return null}return n("div",{class:"bank-transfer-data-container"},n("div",{class:"transfer-data-header"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT,align:"center"},o.translate("bankTransfer.transferData"))),n("div",{class:"bank-transfer-data"},this.renderSimpleBankData(e[0])),n("collapsible-card",{header:o.translate("apmCheckout.viewInstructions"),open:true,variant:"flat"},this.renderInstructions(),this.renderBankLogos()))}};G.style=Z;const J=".qr-code{border:1px solid var(--rebill-color-background-right);border-radius:8px;background:var(--rebill-color-background);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.qr-code-header{padding:16px 24px;background:var(--rebill-color-background-left);border-bottom:1px solid var(--rebill-color-background-right)}.expiration-section{display:flex;align-items:center;gap:8px;justify-content:center}.expiration-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-secondary)}.qr-code-content{padding:16px 0px 16px 0px;background:#ffffff !important}.qr-section{display:flex;flex-direction:column;align-items:center;gap:16px;background:#ffffff !important}.qr-container{display:flex;justify-content:center;align-items:center;padding:16px;background:var(--rebill-color-background);position:relative;border-radius:8px}.qr-container::before,.qr-container::after{content:'';position:absolute;width:32px;height:32px;border:2px solid var(--rebill-color-green)}.qr-container::before{top:-2px;left:-2px;border-right:none;border-bottom:none;border-top-left-radius:8px}.qr-container::after{top:-2px;right:-2px;border-left:none;border-bottom:none;border-top-right-radius:8px}.corner-bottom-left,.corner-bottom-right{position:absolute;width:32px;height:32px;border:2px solid var(--rebill-color-green)}.corner-bottom-left{bottom:-2px;left:-2px;border-right:none;border-top:none;border-bottom-left-radius:8px}.corner-bottom-right{bottom:-2px;right:-2px;border-left:none;border-top:none;border-bottom-right-radius:8px}.qr-image{display:flex;justify-content:center;align-items:center;width:146px;height:146px;background:#ffffff !important;border-radius:4px}.qr-image svg{width:146px;height:146px;border-radius:4px;background:#ffffff !important}.qr-image img{width:146px;height:146px;border-radius:4px;background:#ffffff !important}.scanner-line{position:absolute;top:0;left:0;right:0;height:2px;background:linear-gradient(90deg, transparent, var(--rebill-color-green), transparent);box-shadow:0 0 10px var(--rebill-color-green);animation:scanDown 2s ease-in-out;animation-fill-mode:forwards;z-index:10}@keyframes scanDown{0%{top:100%;opacity:0}10%{opacity:1}90%{opacity:1}100%{top:0;opacity:0}}.qr-instruction{display:flex;justify-content:center;align-items:center}.instructions-section{background:var(--rebill-color-background-secondary)}.instructions-content{padding:16px 16px 16px 16px;background:var(--rebill-color-background)}.instructions-list{list-style:none;padding:0;margin:0}.instruction-item{display:flex;align-items:flex-start;gap:8px;text-align:left}.instruction-item:not(:last-child){margin-bottom:8px}.instruction-number{background:var(--rebill-color-background-right);width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.instruction-number rebill-typography{display:flex;align-items:center;justify-content:center;width:100%;height:100%;margin:0;padding:0}.instruction-text{flex:1}.copy-btn{display:flex;padding:var(--padding-base, 6px) var(--padding-xl, 10px);justify-content:center;align-items:center;gap:var(--padding-lg, 8px)}";const X=class{constructor(i){e(this,i);this.timeUpdate=t(this,"timeUpdate")}qrCodeData;providerName;expirationDate;paymentMethod;code;qrCodeSvg="";isImage=false;timeLeft=3600;formattedTime="59:60";hasCopied=false;timeUpdate;countdownTimer=null;async componentWillLoad(){await this.generateQRCode();this.startCountdownTimer();this.timeUpdate.emit(60)}async componentWillUpdate(){await this.generateQRCode()}disconnectedCallback(){if(this.countdownTimer){this.countdownTimer.stop()}}async generateQRCode(){try{if(!this.qrCodeData){this.qrCodeSvg="";this.isImage=false;return}if(y(this.qrCodeData)){this.isImage=true;this.qrCodeSvg="";return}this.isImage=false;const e=x(this.qrCodeData);const t=await k(e);this.qrCodeSvg=t}catch(e){console.error("Error generating QR code:",e);this.qrCodeSvg="";this.isImage=false}}startCountdownTimer=()=>{if(this.countdownTimer){this.countdownTimer.stop()}this.countdownTimer=j({duration:3600,onTick:e=>{this.timeLeft=e;this.formattedTime=z(e);const t=Math.ceil(e/60);this.timeUpdate.emit(t)},onComplete:()=>{this.timeLeft=0;this.formattedTime="00:00";this.timeUpdate.emit(0)}});this.countdownTimer.start()};getCurrentLanguageInstructions=()=>{const e=o.getCurrentLanguage();const t=c.data.pricing.country;return v(t,e)};render(){const e=this.getCurrentLanguageInstructions();return n("div",{key:"af12b0e17de3e9d15b3d50f6a775cfec0634c57d",class:"qr-code"},n("div",{key:"049ac6a40747350848ab4de7b733ce0c3264b63d",class:"qr-code-header"},n("div",{key:"25014acd9e5bfd42b7e67abc035b52703929732c",class:"expiration-section"},n("rebill-icon",{key:"f4892dd1c4e6cbfc58fe9a0768e72e3afa286010",name:"calendar-clock"}),n("span",{key:"74395a35eb90ab22fa8efcc763b5819e2b465b57",class:"expiration-text"},o.translate("qrCode.expirationLabel",{time:this.formattedTime})))),n("div",{key:"27b777bbba15c3a224e9c9d07ec6194f40caaa7b",class:"qr-code-content"},n("div",{key:"38862683c888d46db81a5df22345024fdcc22fcc",class:"qr-section"},n("div",{key:"2abcbbfad2d8031b2cfd0eca9daab29e8c65b2f7",class:"qr-instruction"},n("rebill-typography",{key:"79f2500a17995c2f5b66be7a3afeab8ff1df01e9",variant:"subtitle-bold",style:{fontSize:"12px"},color:w.GREY_300},o.translate("qrCode.scanInstruction"))),n("div",{key:"181bd27896fb77c5afa1614a622242bb8b399167",class:"qr-container"},this.isImage?n("img",{src:`data:image/png;base64,${this.qrCodeData}`,alt:"QR Code",class:"qr-image"}):n("div",{class:"qr-image",innerHTML:this.qrCodeSvg}),n("div",{key:"44a910457a4462bce56ee04fd7421b38c80f5701",class:"scanner-line"}),n("div",{key:"5ab93aeea71f4288525cc5c0ef7e864d322d625f",class:"corner-bottom-left"}),n("div",{key:"2dfa93e3952df855b38692caa5e446e67477ba78",class:"corner-bottom-right"})),this.code&&n("rebill-button",{key:"1a6e620bb374c27dccf12b910864920f2c7151ac",class:"copy-btn",variant:"secondary",size:"small",onClick:async()=>{if(!this.code)return;await S(this.code);this.hasCopied=true;setTimeout((()=>this.hasCopied=false),2e3)},type:"button"},n("rebill-typography",{key:"0bd8ad17dd4010b231889a3781686911638ad96d",variant:"subtitle2",color:w.PRIMARY_DARK_TEXT},o.translate("qrCode.copyCode")),this.hasCopied?n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M5.62256 10.8855L8.24756 13.5418L14.3726 6.45844",stroke:"#35B093","stroke-linecap":"round","stroke-linejoin":"round"})):n("rebill-icon",{name:"copy",size:"16px"})))),e.length>0&&n("collapsible-card",{key:"4e69b59086fab349bdbe54aaa7908d03f6af72e2",variant:"flat",header:o.translate("qrCode.instructionsLabel"),open:false},n("div",{key:"a535d50416b7d0ad635c5c24f7c35258bf3ebbac"},n("ol",{key:"0bcae653181b6f9bb62d43417d8811226ad135db",class:"instructions-list"},e.map(((e,t)=>n("li",{key:t,class:"instruction-item"},n("div",{class:"instruction-number"},n("rebill-typography",{variant:"subtitle2",color:w.GREY_300},t+1)),n("div",{class:"instruction-text"},n("rebill-typography",{variant:"subtitle2",color:w.GREY_300},e)))))))))}};X.style=J;const ee=":root{--rebill-color-primary:#3b82f6;--rebill-color-primary-light:rgba(59, 130, 246, 0.1);--rebill-color-primary-hover:#2563eb;--rebill-color-primary-dark-hover:#001c4a;--rebill-color-info-border:#0156f6;--rebill-color-info-text:#172b85;--rebill-color-link:#0056f6;--rebill-color-primary-dark:#001131;--rebill-color-primary-dark-text:#000000;--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-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}:host{display:block}.billing-header-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.address-container{display:flex;flex-direction:column;gap:16px;width:100%}.state-zip-row{display:grid;grid-template-columns:1fr 1fr;gap:16px}.search-link{background:none;border:none;text-decoration:underline;font-size:14px;cursor:pointer;padding:4px 0;text-decoration-color:var(--rebill-color-primary)}.state-zip-row rebill-input-select,.state-zip-row rebill-input-text{flex:1}.search-input-container{margin-top:8px}.manual-entry-link-wrapper{margin-top:8px;text-align:left}.same-as-shipping-section{margin:24px 0;padding:16px 0}.shipping-address-section{margin-top:24px;padding-top:24px}";const te=class{constructor(i){e(this,i);this.searchRequested=t(this,"searchRequested");this.addressUpdated=t(this,"addressUpdated")}get el(){return i(this)}billingView="search";currentBillingStateOptions=[];isLoadingAddress=false;disabled=false;searchRequested;countryOptions=[];errors=null;unsubscribeAddressStore;translateError(e){if(!e)return"";if(e.includes("validation.")||e.includes("paymentErrors.")){return o.translate(e)}return e}addressUpdated;componentDidLoad(){this.unsubscribeAddressStore=h("data",(()=>{const e=c.data.userInformation.address?.billingAddress;if(e){const t={country:e.country||"",state:e.state||"",address:e.address||"",city:e.city||"",zip:e.zip||"",addInformation:e.addInformation||""};this.emitInputEventsForAddress(t)}}))}disconnectedCallback(){if(this.unsubscribeAddressStore){this.unsubscribeAddressStore()}}async handleAddressSelected(e){this.isLoadingAddress=true;const t=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\./g,"").replace(/\s+/g," ").trim();this.billingView="form";if(e.country){await this.loadStatesForCountry(e.country);if(e.state&&this.currentBillingStateOptions.length>0){const i=this.currentBillingStateOptions.find((t=>t.value.toLowerCase()===e.state.toLowerCase()));const n=this.currentBillingStateOptions.find((t=>t.value.toLowerCase().includes(e.state.toLowerCase())||e.state.toLowerCase().includes(t.value.toLowerCase())));const r=t(e.state).replace("ciudad de ","").replace("estado de ","").replace("provincia de ","");const a=this.currentBillingStateOptions.find((e=>{const i=t(e.value).replace("ciudad de ","").replace("estado de ","").replace("provincia de ","");const n=i===r||i.startsWith(r+" ")||r.startsWith(i+" ");return n}));if(i){e.state=i.value}else if(a){e.state=a.value}else if(n){e.state=n.value}else{e.state=undefined}}}p.setBillingAddress(e);this.addressUpdated.emit({country:e.country||"",address:e.address||"",city:e.city||"",state:e.state||undefined,zip:e.zip||"",addInformation:e.addInformation||""});requestAnimationFrame((()=>{this.emitInputEventsForAddress(e);setTimeout((()=>{this.isLoadingAddress=false}),500)}))}emitInputEventsForAddress(e){const t=[{id:`billing-country`,value:e.country},{id:`billing-address`,value:e.address},{id:`billing-city`,value:e.city},{id:`billing-state`,value:e.state},{id:`billing-zip`,value:e.zip},{id:`billing-addInformation`,value:e.addInformation}];t.forEach((e=>{if(e.value){this.emitInputEvent(e.id,e.value)}}))}emitInputEvent(e,t){if(t){const i=new CustomEvent("input",{detail:{id:e,value:t},bubbles:true,composed:true});this.el.dispatchEvent(i)}}handleSearchRequest=()=>{this.billingView="search"};async loadStatesForCountry(e){try{const t=await a.data.getStates(e);const i=t.data;const n=i&&i.states?i.states.map((e=>({label:e,value:e}))):[];this.currentBillingStateOptions=n}catch(e){this.currentBillingStateOptions=[]}}handleManualEntry=()=>{this.billingView="form"};async handleInput(e,t){if(t===undefined)return;p.setBillingAddress({[e]:t});this.emitInputEvent(`billing-${e}`,t);if(e==="country"){await this.loadStatesForCountry(t);p.setBillingAddress({state:""})}}renderAddressHeader(){return n("div",{class:"billing-header-row"},n("rebill-typography",{variant:"body2"},o.translate("billingAddress.title")),this.billingView==="form"&&n("button",{class:"search-link",type:"button",onClick:this.handleSearchRequest},n("rebill-typography",{variant:"subtitle2",color:w.LINK,class:"footer-link"},o.translate("billingAddress.searchPlaceholder","Search address"))))}renderAddressForm(){if(this.billingView==="search"){const e=this.translateError(this.errors?.["billing-address"])||this.translateError(this.errors?.["billing-country"])||this.translateError(this.errors?.["billing-state"])||this.translateError(this.errors?.["billing-city"])||this.translateError(this.errors?.["billing-zip"])||"";return n("div",null,this.renderAddressHeader(),n("rebill-address-search",{onAddressSelected:e=>this.handleAddressSelected(e.detail),onManualEntryRequested:()=>this.handleManualEntry(),error:e,disabled:this.disabled}))}const e=this.isLoadingAddress?null:this.errors;return n("div",null,this.renderAddressHeader(),n("rebill-address-form",{countryOptions:this.countryOptions,stateOptions:this.currentBillingStateOptions,errors:e,disabled:this.disabled,onFieldChanged:e=>this.handleInput(e.detail.field,e.detail.value)}))}render(){return n("div",{key:"36f540ee9f1f4dbf258e165acea5a0b51b029611"},this.renderAddressForm())}};te.style=ee;const ie=".bank-selector{margin-top:16px}";const ne=class{constructor(i){e(this,i);this.bankSelected=t(this,"bankSelected")}banks=[];defaultSelectedBankId="";error;disabled=false;selectedBankId="";languageUpdateTrigger=0;bankSelected;unsubscribeCurrentLocaleStore;handleBankSelection=e=>{const t=this.banks.find((t=>t.code===e));if(t){p.setBankId(t);this.bankSelected.emit(t.code)}};componentWillLoad(){if(this.defaultSelectedBankId){this.selectedBankId=this.defaultSelectedBankId}}componentDidLoad(){this.unsubscribeCurrentLocaleStore=p.onChange("currentLocale",(()=>{this.languageUpdateTrigger++}))}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}}render(){if(!this.banks||this.banks.length===0){return null}const e=[...this.banks].sort(((e,t)=>e.name.localeCompare(t.name)));const t=e.map((e=>({label:e.name,value:e.code})));const i=this.error&&(this.error.includes("validation.")||this.error.includes("paymentErrors."))?o.translate(this.error):this.error||"";return n("div",{class:"bank-selector"},n("rebill-input-select",{id:"bankId",options:t,placeholder:o.translate("bankSelector.placeholder"),error:i,disabled:this.disabled,onInput:e=>{const t=e.detail;if(t&&t.value){this.handleBankSelection(t.value)}},searchable:true,searchPlaceholder:o.translate("bankSelector.searchPlaceholder")}))}};ne.style=ie;function re(){const e=e=>{if(e.email!==undefined){p.setUserInformation({email:e.email})}if(e.fullName!==undefined){p.setUserInformation({fullName:e.fullName})}if(e.phoneNumber!==undefined){p.setUserPhoneNumber({number:e.phoneNumber,countryCode:e.countryCodePhoneNumber||""})}if(e.countryCodePhoneNumber!==undefined){p.setUserPhoneNumber({number:e.phoneNumber||"",countryCode:e.countryCodePhoneNumber})}if(e["billing-country"]!==undefined||e["billing-state"]!==undefined||e["billing-address"]!==undefined||e["billing-city"]!==undefined||e["billing-zip"]!==undefined||e["billing-addInformation"]!==undefined){p.setBillingAddress({country:e["billing-country"],state:e["billing-state"],address:e["billing-address"],city:e["billing-city"],zip:e["billing-zip"],addInformation:e["billing-addInformation"]})}if(e.bankId!==undefined){p.setBankId(e.bankId)}};const t=(e,t)=>{const i={...t};if(e.isValidPhoneNumber===undefined){if(e.phoneNumber&&e.phoneNumber.trim()!==""){e.isValidPhoneNumber="true"}else{e.isValidPhoneNumber="false"}}if(e.phoneNumber!==undefined){if(e?.isValidPhoneNumber==="true"||e?.isValidPhoneNumber===true){delete i.phoneNumber}else if((e.isValidPhoneNumber==="false"||e.isValidPhoneNumber===false)&&e.phoneNumber&&e.phoneNumber.trim()!==""){i.phoneNumber="validation.phoneRequired"}else if(!e.phoneNumber||e.phoneNumber.trim()===""){i.phoneNumber="validation.phoneRequired"}else if(e.isValidPhoneNumber===undefined&&e.phoneNumber&&e.phoneNumber.trim()!==""){delete i.phoneNumber}}return i};const i=(e,t)=>{const i={...t};if(e?.isValidPhoneNumber==="true"||e?.isValidPhoneNumber===true){delete i.phoneNumber}return i};const n=()=>["phoneNumber","countryCodePhoneNumber","isValidPhoneNumber"];const r=()=>["email","fullName","billing-address","billing-city","billing-state","billing-zip","billing-country"];const a=e=>{const t=n();const i=r();if(t.includes(e)){return false}return i.includes(e)};return{syncFormDataToStore:e,handlePhoneValidation:t,getPhoneRelatedFields:n,getTextFields:r,shouldValidateField:a,clearPhoneErrors:i}}const ae=class{constructor(i){e(this,i);this.submit=t(this,"submit");this.change=t(this,"change")}get el(){return i(this)}validationSchema;initialData={};submit;change;renderForm;checkoutFormHook=re();formElement;componentDidLoad(){}handleFormChange(e){const t=e.detail;if(!t||typeof t!=="object"){return}if(t?.isValidPhoneNumber==="true"&&this.formElement){this.formElement.clearError("phoneNumber")}if(t.phoneNumber!==undefined&&this.formElement&&this.formElement.hasSubmitted){if(this.checkoutFormHook.handlePhoneValidation){const e=this.checkoutFormHook.handlePhoneValidation(t,this.formElement.errors||{});this.formElement.errors=e}}}handleSubmit=e=>{this.submit.emit(e)};handleChange=e=>{this.change.emit(e)};async resetValidation(){if(this.formElement){await this.formElement.resetValidation()}}render(){return n("rebill-form",{key:"913b8b648f75c30fe3ee82b877c71b73e8e7a9ef",ref:e=>this.formElement=e,validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:e=>this.handleSubmit(e.detail),onChange:e=>this.handleChange(e.detail),renderForm:this.renderForm})}};const oe={bamboo_payment:"Bamboo Payment",fiserv:"Fiserv",kushki:"Kushki",payway:"Payway",cybersource:"Cybersource",cobre:"Cobre",yakare:"Yakare",dock:"Dock",klap:"Klap",movii:"Movii",stripe:"Stripe"};const se=e=>oe[e]||e;const le=".reference-code{border:1px solid var(--rebill-color-border);border-radius:8px;background:var(--rebill-color-background);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.reference-code-header{padding:16px 24px;background:var(--rebill-color-background-secondary);border-bottom:1px solid var(--rebill-color-border)}.expiration-section{display:flex;align-items:center;gap:8px;justify-content:center}.expiration-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-secondary)}.reference-code-content{padding:32px 24px;display:flex;justify-content:space-between;align-items:center;gap:32px;border-bottom:1px solid var(--rebill-color-border)}.reference-section{flex:1;text-align:center;position:relative}.reference-section::after{content:'';position:absolute;right:-16px;top:50%;transform:translateY(-50%);width:1px;height:60px;background:var(--rebill-color-border)}.provider-section{flex:1;text-align:center}.reference-label,.provider-label{font-size:12px;color:var(--rebill-color-text-secondary-light);margin-bottom:12px;text-transform:uppercase;font-weight:400;letter-spacing:0%}.reference-value{font-size:18px;font-weight:600;color:var(--rebill-color-text-primary)}.provider-value{font-size:18px;font-weight:600;color:var(--rebill-color-text-primary)}.instructions-section{background:var(--rebill-color-background-secondary)}.instructions-toggle{width:100%;padding:20px 24px;background:none;border:none;display:flex;justify-content:space-between;align-items:center;cursor:pointer;font-size:15px;font-weight:500;color:var(--rebill-color-text-primary);transition:background-color 0.2s ease}.instructions-toggle:hover{background:var(--rebill-color-background-secondary)}.instructions-toggle rebill-icon{transition:transform 0.2s ease}.instructions-toggle[aria-expanded='true'] rebill-icon{transform:rotate(180deg)}.instructions-content{padding:16px 16px 16px 16px;background:var(--rebill-color-background);border-top:1px solid var(--rebill-color-border)}.instructions-title{margin:20px 0 16px 0;font-size:16px;font-weight:600;color:var(--rebill-color-text-primary)}.instructions-text{color:var(--rebill-color-text-secondary)}.instructions-list{list-style:none;padding:0;margin:0;counter-reset:instruction-counter}.instructions-list li{counter-increment:instruction-counter;display:flex;align-items:flex-start;gap:12px;margin-bottom:16px;font-size:14px;line-height:1.5}.instructions-list li::before{content:counter(instruction-counter);background:#f4f5f6;color:black;width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:400;flex-shrink:0;margin-top:2px}.instructions-list li:last-child{margin-bottom:0}@media (max-width: 768px){.reference-code-content{flex-direction:column;gap:24px;padding:24px 20px}.reference-section::after{display:none}.reference-section,.provider-section{text-align:center;width:100%}.reference-section{padding-bottom:24px;border-bottom:1px solid var(--rebill-color-border)}.instructions-toggle{padding:16px 20px}.instructions-content{padding:0 20px 20px 20px}}";const ce=class{constructor(t){e(this,t)}referenceId;providerName;expirationDate;instructions=[];showInstructions=false;toggleInstructions=()=>{this.showInstructions=!this.showInstructions};formatExpirationDate=e=>{try{const t=new Date(e);return t.toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})}catch(t){return e}};getCurrentLanguageInstructions=()=>{const e=o.getCurrentLanguage();const t=this.instructions.find((t=>t.language===e));const i=t?.text||this.instructions[0]?.text||"";return i.split("\n").filter((e=>e.trim().length>0))};render(){const e=this.getCurrentLanguageInstructions();return n("div",{key:"53eee612963a28548807c9a075aba17e8d022c37",class:"reference-code"},n("div",{key:"1927fa9dd4c75a280391ba34b8d3f5900157a48f",class:"reference-code-header"},n("div",{key:"b02617217021eef14a42598f84e2c4ff20273d84",class:"expiration-section"},n("rebill-icon",{key:"784ff624d90a2a952d97d02ad13f864afaca1413",name:"calendar-clock"}),n("span",{key:"a95abc010c10f8d9d07a805d5fcd62f8069ead68",class:"expiration-text"},o.translate("referenceCode.expirationLabel")," ",this.formatExpirationDate(this.expirationDate)))),n("div",{key:"b2f86a07b2bd9067c31ddd3e58b2495fc2da7670",class:"reference-code-content"},n("div",{key:"c6bcee134d966077dcc2b06bcd32d142273c27e6",class:"reference-section"},n("div",{key:"d607744363e0b5118c59996f776cd91d91471818",class:"reference-label"},o.translate("referenceCode.referenceLabel")),n("div",{key:"c472e96e09146f2f13a476897ef92052e0a6affe",class:"reference-value"},this.referenceId)),n("div",{key:"8cfc3186e62bbefd12fda2aa52e1fbe64e1f531a",class:"provider-section"},n("div",{key:"d8bc3af4a73e6f0f6a7f70e5a2b6c10d7b1e7901",class:"provider-label"},o.translate("referenceCode.providerLabel")),n("div",{key:"82e0ffc5faca1890b56a92d2bf4c695c9b720426",class:"provider-value"},se(this.providerName)))),this.instructions.length>0&&n("div",{key:"615d197ef8278a2f1008ed9b99392b070decbcd3",class:"instructions-section"},n("button",{key:"e3cec3b4c0179b77b4d2ec5c9b992c1303e3782f",class:"instructions-toggle",onClick:this.toggleInstructions,type:"button","aria-expanded":this.showInstructions.toString(),"aria-controls":"instructions-content"},n("span",{key:"e4ce3f249d33d62db9ca4f2f15e7e86b2e5b00b4"},o.translate("referenceCode.instructionsLabel")),n("rebill-icon",{key:"3533bfaf4cd3a5847b4cf34aa5845fd280de2e0f",name:"chevron-down"})),this.showInstructions&&n("div",{key:"707ba7303831e205c3cbd248e29e336db1fc1ef7",class:"instructions-content",id:"instructions-content",role:"region","aria-labelledby":"instructions-toggle"},n("div",{key:"defce52b328d0c0a76a3ef7274d027e26a2c304a",class:"instructions-text"},n("ol",{key:"3341cdb16fa13eefd16544e1c200c3bab2e7282d",class:"instructions-list"},e.map(((e,t)=>n("li",{key:t},e))))))))}};ce.style=le;const de=":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 pe=class{constructor(t){e(this,t)}error=null;countryCode=null;languageUpdateTrigger=0;disabled=false;unsubscribeCurrentLocaleStore;componentDidLoad(){this.unsubscribeCurrentLocaleStore=p.onChange("currentLocale",(()=>{this.languageUpdateTrigger++}))}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}}render(){return n(r,{key:"22a19f5259c0c44af49eccf475a23f2184f86aa7"},n("div",{key:"936709bd5c83400535819879936335948358d0dd"},n("rebill-input-phone",{key:"65163b7395a0219ced0b86bd65041afe4ca07dee",disabled:this.disabled,validationErrorId:"isValidPhoneNumber",phoneNumberId:"phoneNumber",countryCodeId:"countryCodePhoneNumber",placeholder:o.translate("userInformation.phoneNumberPlaceholder"),"initial-country":this.countryCode?.toLowerCase()||"ar",error:this.error,required:true,searchable:true,searchPlaceholder:o.translate("userInformation.searchCountriesPlaceholder")})))}};pe.style=de;export{R as apm_checkout,Q as apm_download,G as bank_transfer,$ as boleto_payment,F as payment_button,A as payment_method_selector,X as qr_code,te as rebill_address,ne as rebill_bank_selector,ae as rebill_checkout_form,V as rebill_processing_payment,ce as reference_code,pe as user_information_phone,H as user_information_static};
2
- //# sourceMappingURL=p-7f01ba37.entry.js.map
1
+ import{r as e,c as t,d as i,h as n,H as r}from"./p-BTZ7D7jU.js";import{a}from"./p-CV0wqtJM.js";import{I as o,P as s,e as l,s as c,b as d,S as p,g as b,o as h}from"./p-Bkzz9eGU.js";import{S as f}from"./p-vsLqF4hk.js";import{g as u,J as g,P as m,i as y,d as x,a as k,b as v}from"./p-DUn0QSYi.js";import{C as w}from"./p-C5Pu-n-i.js";import{P as C}from"./p-DnJ3mmmK.js";import{c as D}from"./p-OxmhgFET.js";import{a as S,g as I}from"./p-pXX5rSDt.js";import{c as j,f as z}from"./p-bcHxwlBu.js";import{g as q}from"./p-DWY12C3E.js";import{B as L,g as T}from"./p-Do_vNuMa.js";import"./p-E-ZsRS8r.js";import"./p-CzeVW03r.js";const P=async(e,t)=>{try{const i=await a.checkout.getCheckoutRequestPaymentAPM(e,t);return i.data}catch(e){throw e}};const M=".apm-checkout{display:flex;flex-direction:column}.apm-content{margin-bottom:0}.apm-content .reference-code,.apm-content .qr-code,.apm-content .boleto-payment{margin-top:0;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.apm-actions{display:flex;gap:12px;padding:20px 0}.apm-actions rebill-button,.apm-actions payment-button{flex:1;width:100%}.apm-actions rebill-button .button-content,.apm-actions payment-button .button-content{display:flex;align-items:center;gap:12px;overflow:hidden}.apm-actions rebill-button .button-content rebill-icon{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;flex-shrink:0}.apm-checkout.redirect-message{justify-content:center;align-items:center;text-align:center}.redirect-content{background:var(--rebill-color-background);border:1px solid var(--rebill-color-background-right);padding:16px}.redirect-content .payment-method-name{font-weight:600 !important}.bank-transfer-data-container{margin-top:16px;display:flex;flex-direction:column;gap:12px}.bank-transfer-data{padding:0;background:transparent;border:none;border-radius:0}.instruction-step{display:flex;align-items:flex-start;gap:8px;margin-bottom:8px}.instruction-step:last-child{margin-bottom:0}.step-number{background:var(--rebill-color-background-right);width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.step-number rebill-typography{display:flex;align-items:center;justify-content:center;width:100%;height:100%;margin:0;padding:0}.instruction-text{display:flex;flex-direction:column;gap:8px;flex:1}.instruction-content{flex:1}.bank-data-item{display:flex;gap:8px;align-items:center;border-bottom:none}.value-with-copy{display:flex;align-items:center;gap:2px}.bank-transfer-simple-container{padding:16px;background:var(--rebill-color-background);border:1px solid var(--rebill-color-background-right);border-radius:8px}.instruction-text{margin-bottom:16px}.data-section{margin-bottom:16px}.bank-transfer-simple{margin-bottom:16px}.bank-transfer-simple:last-child{margin-bottom:0}.bank-data-simple{display:flex;flex-direction:column;gap:4px}.bank-data-item-simple{display:flex;justify-content:space-between;align-items:center;padding:4px 0}@media (max-width: 768px){.apm-actions{flex-direction:column;gap:12px;padding:16px 0}.apm-actions rebill-button{width:100%;flex:none}}";const E=5e3;const N=3e3;const B=300;const R=class{constructor(i){e(this,i);this.paymentStatusChange=t(this,"paymentStatusChange")}get el(){return i(this)}paymentMethod;referenceId;qrCodeData;code;providerName;expirationDate;country;redirectUrl;timeToRedirect=E;checkoutRequestId;bearerToken;bankTransferData;barcode;showRedirectMessage=false;isPolling=false;minutesLeft;qrStartTime;downloadData;paymentStatusChange;redirectTimeoutId;pollingIntervalId;pollingDelayTimeoutId;pollingAttempts=0;componentWillLoad(){this.qrStartTime=new Date;this.downloadData=this.generateDownloadData();if(this.redirectUrl){this.handleRedirect()}if(this.checkoutRequestId&&(this.qrCodeData||this.bankTransferData)){this.startPolling()}}componentDidLoad(){const e=this.el?.querySelector("payment-button");if(e){e.addEventListener("submit",this.handleRedirect)}}disconnectedCallback(){if(this.redirectTimeoutId){clearTimeout(this.redirectTimeoutId);this.redirectTimeoutId=undefined}if(this.pollingDelayTimeoutId){clearTimeout(this.pollingDelayTimeoutId);this.pollingDelayTimeoutId=undefined}if(this.pollingIntervalId){clearInterval(this.pollingIntervalId);this.pollingIntervalId=undefined}const e=this.el?.querySelector("payment-button");if(e){e.removeEventListener("submit",this.handleRedirect)}}handleRedirect=()=>{if(this.redirectTimeoutId){clearTimeout(this.redirectTimeoutId)}this.showRedirectMessage=true;this.redirectTimeoutId=window.setTimeout((()=>{window.open(this.redirectUrl,"_self")}),this.timeToRedirect)};handleViewBranches=()=>{window.open("https://www.pagofacil.com.ar/","_blank")};handleTimeUpdate=e=>{this.minutesLeft=e.detail};startPolling=()=>{if(!this.qrCodeData&&!this.bankTransferData||!this.checkoutRequestId||this.isPolling){return}this.isPolling=true;this.pollingAttempts=0;this.pollingIntervalId=window.setInterval((()=>{this.checkPaymentStatus()}),N)};stopPolling=()=>{if(this.pollingIntervalId){clearInterval(this.pollingIntervalId);this.pollingIntervalId=undefined}this.isPolling=false};checkPaymentStatus=async()=>{if(!this.checkoutRequestId){return}try{this.pollingAttempts++;const e=await P(this.checkoutRequestId,this.bearerToken);const t=e.status===f.APPROVED||e.status===f.REJECTED;this.paymentStatusChange.emit({status:e.status,isCompleted:t,data:e.data});if(t){this.stopPolling();return}if(this.pollingAttempts>=B){this.stopPolling();return}}catch(e){console.error("Error checking payment status:",e)}};generateDownloadData(){const e={paymentMethod:this.paymentMethod,referenceId:this.referenceId,providerName:this.providerName,expirationDate:this.expirationDate,country:this.country,minutesLeft:this.minutesLeft};if(this.bankTransferData){e.bankTransferData={bankName:this.bankTransferData.bankName,accountNumber:this.bankTransferData.account||this.bankTransferData.bbvAccountNumber,reference:this.bankTransferData.reference,clabe:this.bankTransferData.account||this.bankTransferData.clabe,destinationBank:this.bankTransferData.bankName,paymentReference:this.bankTransferData.reference,instructions:this.bankTransferData.instructions}}else if(this.qrCodeData){e.qrCodeData=this.qrCodeData}else if(this.barcode){e.barcode=this.barcode}return e}renderResponse(){if(this.redirectUrl&&this.showRedirectMessage){const e=C.mapToAPMPaymentMethod(this.paymentMethod,this.country);const t=C.getDisplayName(e);return n("div",{class:"redirect-content"},n("div",{class:"redirect-text"},n("rebill-typography",{variant:"body2",color:w.GREY_300},o.translate("apmCheckout.redirectMessagePrefix")," ",n("rebill-typography",{variant:"overline",color:w.GREY_300},t)," ",o.translate("apmCheckout.redirectMessageSuffix"))))}if(this.barcode){const e=u();return n("boleto-payment",{barcode:this.barcode,referenceId:this.referenceId,providerName:this.providerName,expirationDate:this.expirationDate,instructions:e})}if(this.referenceId){return n("reference-code",{referenceId:this.referenceId,providerName:this.providerName,expirationDate:this.expirationDate})}if(this.qrCodeData){return n("qr-code",{qrCodeData:this.qrCodeData,code:this.code,providerName:this.providerName,expirationDate:this.expirationDate,paymentMethod:this.paymentMethod,onTimeUpdate:this.handleTimeUpdate})}if(this.bankTransferData){return n("bank-transfer",{bankTransferData:this.bankTransferData})}return null}render(){const e=this.redirectUrl&&this.showRedirectMessage;const t=this.paymentMethod===s.CASH;const i=t&&this.country==="AR";return n("div",{key:"c2066dc10a6272c5b306c0a88fa65c016d108b20",class:`apm-checkout ${e?"redirect-message":""}`},n("div",{key:"b838019d533b6ab6d36988413046108d57e7cc9e",class:"apm-content"},this.renderResponse()),n("div",{key:"4551e1f196ada083e687b258c9780824fe4e6a94",class:"apm-actions"},!e&&i&&n("rebill-button",{key:"e6ded8a243e10704aeac3ecdf49936547019df2f",type:"button",variant:"outline",theme:"primary",onClick:this.handleViewBranches},n("span",{key:"78579393e08e7505ddcc766ac1f98563500ee46d",class:"button-content"},n("span",{key:"ca81340319916ca89c94dfa308d68407155fb419"},o.translate("apmCheckout.viewBranches")),n("rebill-icon",{key:"ae5b00b40a0cf4f6607749e384df669d11c8c2c7",name:"square-arrow-top-right"}))),!e&&n("apm-download",{key:"67a6386c1e4d055c011f199a8d091ba010f7404d",data:this.downloadData})))}};R.style=M;const _="";const F=class{constructor(i){e(this,i);this.submit=t(this,"submit")}isDisabled=false;isLoading=false;paymentMethod;isRenewal=false;isChangeCard=false;trialPeriodDays;redirectUrl;timeToRedirect;country;currentLanguage=o.getCurrentLanguage();countdownSeconds=0;paymentMethodDisplayName="";submit;onRedirectPropsChange(){this.initializeCountdown()}countdownTimer=null;lastPaymentMethod=undefined;lastCountry=undefined;componentWillLoad(){l.on("languageChanged",this.handleLanguageChange);this.updatePaymentMethodDisplayName()}componentDidLoad(){this.initializeCountdown()}componentWillUpdate(){if(this.paymentMethod!==this.lastPaymentMethod||this.country!==this.lastCountry){this.lastPaymentMethod=this.paymentMethod;this.lastCountry=this.country;this.updatePaymentMethodDisplayName()}}disconnectedCallback(){l.off("languageChanged",this.handleLanguageChange);this.stopCountdown()}handleLanguageChange=()=>{this.currentLanguage=o.getCurrentLanguage()};updatePaymentMethodDisplayName=()=>{this.paymentMethodDisplayName=S(this.paymentMethod,this.country)};handleSubmit=()=>{this.submit.emit()};initializeCountdown=()=>{if(this.redirectUrl===true&&this.timeToRedirect!=null){const e=Math.ceil(this.timeToRedirect/1e3);this.countdownSeconds=e;this.stopCountdown();this.countdownTimer=j({duration:e,onTick:e=>{this.countdownSeconds=e},onComplete:()=>{this.countdownSeconds=0}});this.countdownTimer.start()}else{this.stopCountdown();this.countdownSeconds=0}};stopCountdown=()=>{if(this.countdownTimer){this.countdownTimer.stop();this.countdownTimer=null}};shouldShowLoading=()=>this.isLoading||this.redirectUrl===true&&this.timeToRedirect!=null;getButtonText=()=>{if(this.redirectUrl===true&&this.timeToRedirect!=null){return o.translate("buttons.redirecting",{seconds:this.countdownSeconds})}if(this.trialPeriodDays){return o.translate("buttons.startTrial",{trialDays:c.data?.itemInformation?.trial?.trialPeriodDays})}if(this.paymentMethod===s.CASH||this.paymentMethod===s.BANK_TRANSFER){if(this.paymentMethodDisplayName){return o.translate("buttons.continueWithPaymentMethod",{paymentMethod:this.paymentMethodDisplayName})}else{return o.translate("buttons.continue")}}if(this.isChangeCard){return o.translate("buttons.updateCard")}if(this.isRenewal){return o.translate("buttons.renewSubscription")}if(c.data?.itemInformation?.type===d.PLAN){return o.translate("buttons.subscribe")}return o.translate("buttons.payNow")};render(){return n("rebill-button",{key:"bda5ad37779ac592971c5990591fb3e43b1e570f",type:"button",disabled:this.isDisabled,loading:this.shouldShowLoading(),showSpinnerWithText:this.redirectUrl===true&&this.timeToRedirect!=null,nonClickable:this.redirectUrl===true&&this.timeToRedirect!=null,variant:"filled",theme:"primary-dark",onClick:this.handleSubmit,id:"payment-button"},this.getButtonText())}static get watchers(){return{redirectUrl:["onRedirectPropsChange"],timeToRedirect:["onRedirectPropsChange"]}}};F.style=_;const U=".payment-method-selector{width:100%;display:flex;flex-direction:column;gap:8px}.card-description-container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;width:100%}";const A=class{constructor(i){e(this,i);this.paymentMethodSelected=t(this,"paymentMethodSelected")}enabledPaymentMethods=[];defaultSelected;showErrorComponent=false;cardError;country;installmentsError;documentTypeError;showDocument;documentNumberError;customCSS;errorComponent;disabled=false;icon="";selectedPaymentMethod;saveCard=false;paymentMethodSelected;componentWillLoad(){if(this.enabledPaymentMethods.length>0){this.selectedPaymentMethod=this.defaultSelected||this.enabledPaymentMethods[0];if(this.enabledPaymentMethods.length===1){this.paymentMethodSelected.emit(this.selectedPaymentMethod)}}this.getPaymentMethodIcon(this.selectedPaymentMethod)}componentWillUpdate(){if(this.defaultSelected&&this.selectedPaymentMethod!==this.defaultSelected){this.selectedPaymentMethod=this.defaultSelected}}getPaymentMethodConfig(e){const t=this.country?I(this.country):null;const i=t?.find((t=>t.type===e));const n=e===s.CASH&&this.country==="BR"?S(s.CASH,this.country)||o.translate("paymentMethods.cash"):o.translate("paymentMethods.cash");const r={[s.CARD]:{key:s.CARD,label:o.translate("paymentMethods.card"),icons:["doblecard"]},[s.CASH]:{key:s.CASH,label:n,icons:["pago-facil"]},[s.BANK_TRANSFER]:{key:s.BANK_TRANSFER,label:this.country==="AR"?o.translate("paymentMethods.bank_transfer_qr"):o.translate("paymentMethods.bank_transfer"),icons:["plus"]}};const a=r[e];return{...a,icons:i?.icons||a.icons}}getPaymentMethodIcon(e){this.icon=S(e,this.country)?.toLowerCase()||"card";return this.icon}handlePaymentMethodSelected(e){if(this.disabled){return}this.selectedPaymentMethod=e;this.paymentMethodSelected.emit(e)}handleSelectableCardClick(e){if(this.disabled){return}const t=e.detail;this.handlePaymentMethodSelected(t)}render(){if(this.enabledPaymentMethods.length===0){return null}return n("div",{class:"payment-method-selector"},n("div",{style:{display:"flex",flexDirection:"row",gap:"8px",width:"100%",justifyContent:"space-between"}},this.enabledPaymentMethods.length===1&&(()=>{const e=this.getPaymentMethodConfig(this.enabledPaymentMethods[0]);return n("single-payment-method",{paymentMethod:this.enabledPaymentMethods[0],currencyCountry:this.country,paymentMethodDetails:[],icons:e.icons,style:{display:"flex",flex:"1 1 0"}})})(),this.enabledPaymentMethods.length>1&&this.enabledPaymentMethods.map((e=>{const t=this.getPaymentMethodConfig(e);return n("selectable-card",{style:{flex:"1 1 0"},selected:this.selectedPaymentMethod===e,"card-key":t.key,label:t.label,disabled:this.disabled},n("span",{slot:"icon"},n("div",{style:{display:"flex",alignItems:"center",gap:"8px",height:"24px"}},t.icons.map((t=>n("rebill-icon",{name:t,color:this.disabled&&e===s.CARD?w.NEUTRALS_500:"currentColor"}))))))}))),n("div",null,this.cardError.showCardInvalid&&this.selectedPaymentMethod===s.CARD?n("rebill-alert",{type:"error",alertTitle:this.cardError.type==="tokenization_error"?o.translate("validation.tokenError"):o.translate("validation.cardInvalid"),variant:"outlined",message:this.cardError.type==="tokenization_error"?o.translate("validation.tokenErrorDescription"):o.translate("validation.cardInvalidDescription"),icon:"error"}):this.errorComponent.showErrorComponent?n("rebill-alert",{type:"error",alertTitle:this.errorComponent.alertTitle,message:this.errorComponent.message,variant:"outlined",icon:"error"}):null),this.enabledPaymentMethods.length>1&&this.selectedPaymentMethod===s.CARD&&c.data?.itemInformation?.type!==d.PLAN&&n("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"}}),this.selectedPaymentMethod===s.CARD&&n(n.Fragment,null,n("div",null,n("card-fields-wrapper",{installmentsError:this.installmentsError,documentTypeError:this.documentTypeError,documentNumberError:this.documentNumberError,showDocument:this.showDocument,customCSS:this.customCSS}))),(this.selectedPaymentMethod===s.BANK_TRANSFER||this.selectedPaymentMethod===s.CASH)&&this.showDocument&&n("div",null,n("card-identification",{documentTypeError:this.documentTypeError,documentNumberError:this.documentNumberError,disabled:this.disabled})))}};A.style=U;const W=".lottie-container{margin-bottom:2rem;display:flex;justify-content:center;align-items:center}.lottie-animation{width:166px;height:165px;display:flex;justify-content:center;align-items:center}.text-content{margin-bottom:2rem;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}.security-badge{width:100%;max-width:450px;height:40px;display:flex;align-items:center;justify-content:center;background:#ebedef;border-radius:8px;box-sizing:border-box}.lock-icon{width:16px;height:16px;color:var(--rebill-color-text-secondary, #6b7280)}@keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.05);opacity:0.8}}.contact-info{text-align:left}@media (max-width: 1024px){.security-badge{width:100%;max-width:100%}.lottie-animation{width:166px;height:165px}.text-content{gap:12px}}@media (max-width: 767px){.processing-container{padding:0 16px}}.processing-container{width:100%;max-width:100%;overflow-x:hidden;box-sizing:border-box}";const V=class{constructor(t){e(this,t)}titleKey="processing.processingTitle";subtitleKey="processing.processingSubtitle";currentLocale=c.currentLocale;breakpoint=L.DESKTOP;loaderProgress=0;isLoadingLottie=true;unsubscribeCurrentLocaleStore;progressInterval;lottieContainer;lottieAnimation;componentWillLoad(){this.breakpoint=T(window.innerWidth);this.unsubscribeCurrentLocaleStore=p.onChange("currentLocale",(()=>{this.currentLocale=c.currentLocale}))}componentDidLoad(){window.addEventListener("resize",this.handleResize);this.loadLottieAnimation()}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}window.removeEventListener("resize",this.handleResize);this.stopLoaderAnimation()}handleResize=()=>{this.breakpoint=T(window.innerWidth)};loadLottieAnimation=async()=>{try{const e=await import("./p-GK75wIKe.js").then((function(e){return e.l}));const t=await fetch(q(`loader-card-v2.json`));const i=await t.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=2e3;const t=50;const i=t/e*100;this.progressInterval=window.setInterval((()=>{this.loaderProgress=Math.min(this.loaderProgress+i,100);if(this.loaderProgress>=100){this.stopLoaderAnimation()}}),t)};stopLoaderAnimation=()=>{if(this.progressInterval){clearInterval(this.progressInterval);this.progressInterval=undefined}if(this.lottieAnimation){this.lottieAnimation.destroy();this.lottieAnimation=undefined}};render(){return n("rebill-checkout-single-column",{key:"05536f6464213fb012e29ef8f6b7a19fc882bf08"},n("div",{key:"cb2a9dc211cbfbbf3041c517ffd7257d54ec8979",class:"processing-container"},n("div",{key:"66b2d5d8b8617e19fe12db4a267d04a0ef64bb14",class:"lottie-container"},n("div",{key:"a6c6b5ef3eccface4ff7f63b9f936c077274e116",ref:e=>this.lottieContainer=e,class:"lottie-animation"})),n("div",{key:"c5cdb16b2131ca9c389d71970a13eb3ac0501ab7",class:"text-content"},n("rebill-typography",{key:"be877839826c880103c092561434d448d7607d22",variant:"h3",color:w.PRIMARY_DARK_TEXT},o.translate(this.titleKey)),n("rebill-typography",{key:"8985b4cda5906e01e61447f0c8b190f1ebf6438c",variant:"subtitle-bold",color:w.PRIMARY_DARK_TEXT},o.translate(this.subtitleKey))),n("rebill-alert",{key:"6e77ddb54087d0f4cd6a64160ea6236300c07e32",type:"secure",variant:"variant-secure",icon:"lock-outline",message:o.translate("otp.secureMessage")})))}};V.style=W;const O=".boleto-payment{border:1px solid var(--rebill-color-border, #f4f5f6);border-radius:8px;background:var(--rebill-color-background, #ffffff);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.boleto-header{padding:16px 24px;background:var(--rebill-color-background-left);border-bottom:1px solid var(--rebill-color-background-right)}.expiration-section{display:flex;align-items:center;gap:8px;justify-content:center}.expiration-section rebill-icon{width:16px;height:16px;flex-shrink:0}.expiration-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-secondary, #3b4049);line-height:24px;text-align:center}.boleto-content{padding:16px 0px 16px 0px;background:#ffffff !important}.barcode-section{display:flex;flex-direction:column;gap:16px;align-items:center;width:100%;padding:0 16px;box-sizing:border-box}.barcode-number{font-size:12px;font-weight:500;color:var(--rebill-color-text-primary, #000000);text-align:center;line-height:24px;margin:0;word-break:break-all;font-family:'SF Pro Display',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif;padding:0;width:100%;box-sizing:border-box}.barcode-image-container{width:100%;display:flex;justify-content:center;align-items:center;padding:16px;box-sizing:border-box}.barcode-image{max-width:100%;height:auto;display:block}.copy-button{width:100%;margin:0;padding:8px 16px;background:var(--rebill-color-background, #ffffff);border:1px solid var(--rebill-color-border, #f4f5f6);border-radius:8px;display:flex;align-items:center;justify-content:center;gap:12px;cursor:pointer;transition:background-color 0.2s ease;font-family:var(--rebill-font-family);box-sizing:border-box}.copy-button:hover{background:var(--rebill-color-background-secondary, #fafafa)}.copy-button-text{font-size:14px;font-weight:500;color:var(--rebill-color-primary-dark-blue, #001131);line-height:1;display:flex;align-items:center;font-family:'SF Pro Display',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif}.copy-button rebill-icon{width:20px;height:20px;flex-shrink:0;display:flex;align-items:center;justify-content:center}.copy-button svg{flex-shrink:0;display:flex;align-items:center;justify-content:center}.instructions-section{background:var(--rebill-color-background-secondary)}.instructions-toggle{width:100%;padding:8px 16px;background:none;border:none;display:flex;justify-content:space-between;align-items:center;cursor:pointer;font-size:14px;font-weight:400;color:var(--rebill-color-text-primary, #000000);transition:background-color 0.2s ease;font-family:'Inter',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif;letter-spacing:0.14px;line-height:26px}.instructions-toggle:hover{background:rgba(174, 174, 174, 0.1)}.instructions-toggle rebill-icon{width:18px;height:18px;flex-shrink:0;transition:transform 0.2s ease;color:rgba(174, 174, 174, 1);display:flex;align-items:center;justify-content:center}.instructions-toggle .chevron-open{transform:rotate(180deg)}.instructions-toggle .chevron-closed{transform:rotate(0deg)}.instructions-content{padding:0 16px;background:var(--rebill-color-background);max-height:0;overflow:hidden;transition:max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),\n padding 0.35s cubic-bezier(0.4, 0, 0.2, 1)}.instructions-content.open{max-height:2000px;padding:16px}.instructions-list{display:flex;flex-direction:column;gap:8px;margin:0;padding:0}.instruction-item{display:flex;align-items:flex-start;gap:8px;width:100%}.instruction-number{background:var(--rebill-color-background-right);width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.instruction-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-primary, #000000);line-height:normal;margin:0;flex:1;font-family:'Inter',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n sans-serif;white-space:pre-wrap}@media (max-width: 768px){.boleto-content{padding:16px}.barcode-number{font-size:12px}.instructions-toggle{padding:8px 16px}.instructions-content{padding:16px}}";const $=class{constructor(t){e(this,t)}get el(){return i(this)}barcode;referenceId;providerName;expirationDate;instructions=[];showInstructions=true;hasCopied=false;toggleInstructions=()=>{this.showInstructions=!this.showInstructions};getExpirationDate=()=>{const e=new Date;const t=new Date(e);t.setTime(e.getTime()+7*24*60*60*1e3);return t.toISOString()};formatExpirationDateTime=e=>{try{const t=new Date(e);if(isNaN(t.getTime())){return e}const i=o.getCurrentLanguage();const n=i==="es"?"es-ES":i==="pt"?"pt-BR":"en-US";const r=t.toLocaleDateString(n,{day:"2-digit",month:"2-digit"});const a=t.toLocaleTimeString(n,{hour:"2-digit",minute:"2-digit",hour12:false});return`${r} ${a}`}catch(t){return e}};getCurrentLanguageInstructions=()=>{const e=o.getCurrentLanguage();const t=this.instructions.find((t=>t.language===e));const i=t?.text||this.instructions[0]?.text||"";return i.split("\n").filter((e=>e.trim().length>0))};componentDidLoad(){this.generateBarcode()}componentDidUpdate(){this.generateBarcode()}generateBarcode=()=>{if(!this.barcode)return;const e=this.el.querySelector(".barcode-image");if(!e)return;try{g(e,this.barcode,{format:"CODE128",displayValue:false,width:2,height:60,margin:0})}catch(e){console.error("Failed to generate barcode:",e)}};handleCopyCode=async()=>{if(!this.barcode)return;try{await D(this.barcode);this.hasCopied=true;setTimeout((()=>{this.hasCopied=false}),2e3)}catch(e){console.error("Failed to copy barcode:",e)}};render(){const e=this.getCurrentLanguageInstructions();const t=o.getCurrentLanguage();const i=t==="es"?"Pagar antes del":t==="pt"?"Pagar antes de":"Pay before";return n("div",{key:"b67183a79afa67cbce044af10da4d42527a5fb20",class:"boleto-payment"},n("div",{key:"cb72a78917f6ff6080de5e0913634a18e1d1484c",class:"boleto-header"},n("div",{key:"6a9a5e1582e25e5bea72c11d5a44005667d55498",class:"expiration-section"},n("rebill-icon",{key:"4b100808d19a473dbd542f506bc01325c000a04f",name:"calendar-clock"}),n("span",{key:"a46df4d1ee34fb2d325ed0a65880ceb47a489ed0",class:"expiration-text"},i," ",this.formatExpirationDateTime(this.getExpirationDate())))),n("div",{key:"8f935f95463de92ec38631d62f5a0eee61e82bd4",class:"boleto-content"},n("div",{key:"0f902722498a31c82564a490262e7b13a9f457c2",class:"barcode-section"},this.barcode&&n(n.Fragment,null,n("p",{key:"bb9bcf27e9fe2a9a55d206e74199c6ea4581e275",class:"barcode-number"},this.barcode),n("div",{key:"535890a52ef6ca03cfe6f6a28178fc715d7f1ba2",class:"barcode-image-container"},n("svg",{key:"43db95db47b75e8006e18190900c69c89484e1ac",class:"barcode-image","aria-label":"Boleto barcode"})),n("button",{key:"8adc226f4412dd9bd8096a591eac3cb4c0941506",class:"copy-button",onClick:this.handleCopyCode,type:"button"},n("span",{key:"efeba3d10b8b5e588b52eb3fcb0f6af76567f974",class:"copy-button-text"},o.translate("qrCode.copyCode")||"Copiar código"),this.hasCopied?n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M5.62256 10.8855L8.24756 13.5418L14.3726 6.45844",stroke:"#35B093","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})):n("rebill-icon",{name:"copy"}))))),this.instructions.length>0&&n("div",{key:"899929c9e2109484140ce888ea1fabdd0704faff",class:"instructions-section"},n("button",{key:"992906964dcb6062c42782f7ee66a70c44905733",class:"instructions-toggle",onClick:this.toggleInstructions,type:"button","aria-expanded":this.showInstructions.toString(),"aria-controls":"instructions-content"},n("span",{key:"efff8244043fe9d171a4008932635ca74e4c1e3c"},o.translate("qrCode.instructionsLabel")||"Ver instrucciones"),n("rebill-icon",{key:"a39d58397a22417d864a79fb84b1f1487192411e",name:"chevron-down",class:this.showInstructions?"chevron-open":"chevron-closed"})),n("div",{key:"c10471014c2de29b6c0cca3950095bc5fdb3a51f",class:`instructions-content ${this.showInstructions?"open":""}`,id:"instructions-content",role:"region","aria-labelledby":"instructions-toggle"},n("div",{key:"19748e384da15980c56c2b777542475ee8470041",class:"instructions-list"},e.map(((e,t)=>n("div",{key:t,class:"instruction-item"},n("div",{class:"instruction-number"},t+1),n("p",{class:"instruction-text"},e))))))))}};$.style=O;const K=".user-information-static{width:100%;display:flex;gap:16px;justify-content:space-between;font-size:14px}.user-information-static.otp{flex-direction:column;gap:12px;justify-content:flex-start}.user-information-static-content.otp{display:flex;justify-content:space-between;align-items:center;gap:8px}.user-information-static-content.otp rebill-button{gap:8px;display:flex;align-items:center;justify-content:center}";const H=class{constructor(i){e(this,i);this.signOut=t(this,"signOut")}userInfo;variant="renewal";signOut;handleSignOut(){this.signOut.emit(false)}render(){return n("div",{key:"66131bc9fa1b999835c836fd70c0970b3268b5a1",class:`user-information-static ${this.variant}`},n("div",{key:"fd59e3fcfb8430413010514eebd6ad4cc9b632d7",class:`user-information-static-content ${this.variant}`},n("rebill-typography",{key:"8160a40c1e6aeaa572c3dd692d158fc951f36ead",variant:"subtitle-bold",class:"greeting"},o.translate("userInformation.greeting",{name:this.userInfo.customerName})),this.variant==="otp"&&n("rebill-button",{key:"4372a16bb6421eb3151a3678267935461976ba3a",variant:"text",size:"small",onClick:()=>this.handleSignOut()},n("div",{key:"daaeeac65e79736bb83b4b4f8e95f115f03bf1d2",style:{display:"flex",alignItems:"center",gap:"8px"}},n("rebill-typography",{key:"5ddf5f0c41006a49e5c55fc301aef5fbde7dda9a",variant:"subtitle-bold",color:w.PRIMARY_DARK},o.translate("userInformation.signOut")),n("rebill-icon",{key:"425d8b7058b6992f1060c89a34648665ea65e93a",name:"logout",size:"12px"})))),n("span",{key:"1815edff76f0a1e4d49aa154483a5a4b2e6915b3",style:{display:"flex",alignItems:"center",gap:"7px"}},n("rebill-icon",{key:"ed6c497ed876aa0058652e4bb1edee96df36f2d3",name:"email",size:"12px",color:w.GREY_700}),this.userInfo.customerEmail))}};H.style=K;const Y="apm-download{flex:1;display:block}apm-download rebill-button{width:100%}.button-content{display:flex;align-items:center;gap:12px;overflow:hidden}.button-content rebill-icon{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;flex-shrink:0}";const Q=class{constructor(t){e(this,t)}data;handleDownload=async()=>{if(!this.data)return;try{let e=60;if(this.data.minutesLeft!==undefined){e=this.data.minutesLeft}await m.generateAndDownloadPDF({paymentMethod:this.data.paymentMethod,referenceId:this.data.referenceId,qrCodeData:this.data.qrCodeData,barcode:this.data.barcode,bankTransferData:this.data.bankTransferData,providerName:this.data.providerName||"",expirationDate:this.data.expirationDate||"",minutesLeft:e,country:this.data.country,amount:this.data.amount,currency:this.data.currency})}catch(e){console.error("Error downloading APM instructions:",e)}};render(){if(!this.data)return null;return n("rebill-button",{type:"button",variant:"filled",theme:"primary-dark",onClick:this.handleDownload},n("span",{class:"button-content"},n("span",null,o.translate("apmCheckout.download")),n("rebill-icon",{name:"download"})))}};Q.style=Y;const J=":host{display:block;width:100%}.bank-transfer-data-container{display:flex;flex-direction:column;gap:16px;width:100%}.bank-transfer-data{padding:0 16px;background:transparent;border:none;border-radius:0}.bank-transfer-steps{display:flex;flex-direction:column;gap:16px}.instruction-step{display:flex;align-items:flex-start;gap:8px;margin-bottom:8px}.step-number{background:var(--rebill-color-background-right);width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.step-number rebill-typography{display:flex;align-items:center;justify-content:center;width:100%;height:100%;margin:0;padding:0}.step-content{flex:1;display:flex;flex-direction:column;gap:8px}.bank-data-item{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 0;border-bottom:none}.value-with-copy{display:flex;align-items:center;gap:8px}.bank-data-simple{display:flex;flex-direction:column;gap:4px;padding:0 16px}.instruction-text{margin-bottom:16px}.data-section{margin-bottom:16px}.transfer-data-title{text-align:center;margin-bottom:16px;padding-bottom:8px}.bank-data-item-simple{display:flex;justify-content:space-between;align-items:center}.bank-logos-container{margin-top:16px;padding-top:16px}.bank-logos-row{display:flex;justify-content:center;align-items:center;align-content:center;gap:11px;align-self:stretch;flex-wrap:wrap}.bank-logo{display:flex;align-items:center;justify-content:center;padding:8px;border-radius:4px;background:var(--rebill-color-background);border:1px solid var(--rebill-color-border);transition:all 0.2s ease}.bank-logo:hover{background:var(--rebill-color-background-secondary);transform:translateY(-1px)}.bank-transfer-data-container{border:1px solid var(--rebill-color-background-right);border-radius:8px;background:var(--rebill-color-background);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.transfer-data-header{display:flex;padding:16px 0;flex-direction:column;align-items:center;gap:var(--Spacing-s, 8px);align-self:stretch;border:1px solid var(--Neutrals-Neutrals-50, #f4f5f6);background:var(--Primary-Base-White, #fafafa)}.transfer-data-header rebill-typography{color:var(--Primary-Base-Black, #000) !important;text-align:center;font-family:Inter;font-size:12px;font-style:normal;font-weight:500;line-height:normal}@media (max-width: 768px){.bank-transfer-data-container{gap:12px}.instruction-step{gap:6px}.step-number{width:18px;height:18px}.bank-logos-row{gap:8px}.bank-logo{padding:6px}}";const G=class{constructor(t){e(this,t)}bankTransferData;renderSimpleBankData(e){return n("div",{class:"bank-data-simple"},n("div",{class:"bank-data-item-simple"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.clabe")),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},e.account),n("rebill-button",{variant:"text",size:"small",onClick:()=>D(e.account),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))),n("div",{class:"bank-data-item-simple",style:{height:"32px",boxSizing:"border-box"}},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.nameSurname")),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},"Rebill Payments"),n("rebill-button",{variant:"text",size:"small",onClick:()=>D("Rebill Payments"),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))),n("div",{class:"bank-data-item-simple"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("summary.totalAmount"),": "),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},b(c.data?.pricing?.total,c.data?.pricing?.currency)),n("rebill-button",{variant:"text",size:"small",onClick:()=>D(b(c.data?.pricing?.total,c.data?.pricing?.currency)),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))),n("div",{class:"bank-data-item-simple",style:{height:"32px",boxSizing:"border-box"}},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.destinationBank")),n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.paymentTransferSystem"))),n("div",{class:"bank-data-item-simple"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},o.translate("apmCheckout.paymentReference")),n("div",{class:"value-with-copy"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},e.reference),n("rebill-button",{variant:"text",size:"small",onClick:()=>D(e.reference),type:"button"},n("rebill-icon",{name:"copy",size:"16px"})))))}renderInstructions(){const e=[o.translate("bankTransfer.step1Instruction"),o.translate("bankTransfer.step2Instruction"),o.translate("bankTransfer.step3Instruction"),o.translate("bankTransfer.step4Instruction"),o.translate("bankTransfer.step5Instruction"),o.translate("bankTransfer.step6Instruction")];return n("div",{class:"bank-transfer-steps"},e.map(((e,t)=>n("div",{class:"instruction-step",key:t},n("div",{class:"step-number"},n("rebill-typography",{variant:"caption",color:w.PRIMARY_DARK_TEXT},t+1)),n("div",{class:"step-content"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT},e))))))}renderBankLogos(){const e=["banco-azteca","banamex","inbursa","banco-santander","banorte","hsbc","scotiabank"];return n("div",{class:"bank-logos-container"},n("div",{class:"bank-logos-row"},e.map((e=>n("div",{class:"bank-logo",key:e},n("rebill-icon",{name:e,size:"32px"}))))))}render(){if(!this.bankTransferData){return null}const e=Array.isArray(this.bankTransferData)?this.bankTransferData:[this.bankTransferData];if(e.length===0){return null}return n("div",{class:"bank-transfer-data-container"},n("div",{class:"transfer-data-header"},n("rebill-typography",{variant:"body2",color:w.PRIMARY_DARK_TEXT,align:"center"},o.translate("bankTransfer.transferData"))),n("div",{class:"bank-transfer-data"},this.renderSimpleBankData(e[0])),n("collapsible-card",{header:o.translate("apmCheckout.viewInstructions"),open:true,variant:"flat"},this.renderInstructions(),this.renderBankLogos()))}};G.style=J;const X=".qr-code{border:1px solid var(--rebill-color-background-right);border-radius:8px;background:var(--rebill-color-background);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.qr-code-header{padding:16px 24px;background:var(--rebill-color-background-left);border-bottom:1px solid var(--rebill-color-background-right)}.expiration-section{display:flex;align-items:center;gap:8px;justify-content:center}.expiration-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-secondary)}.qr-code-content{padding:16px 0px 16px 0px;background:#ffffff !important}.qr-section{display:flex;flex-direction:column;align-items:center;gap:16px;background:#ffffff !important}.qr-container{display:flex;justify-content:center;align-items:center;padding:16px;background:var(--rebill-color-background);position:relative;border-radius:8px}.qr-container::before,.qr-container::after{content:'';position:absolute;width:32px;height:32px;border:2px solid var(--rebill-color-green)}.qr-container::before{top:-2px;left:-2px;border-right:none;border-bottom:none;border-top-left-radius:8px}.qr-container::after{top:-2px;right:-2px;border-left:none;border-bottom:none;border-top-right-radius:8px}.corner-bottom-left,.corner-bottom-right{position:absolute;width:32px;height:32px;border:2px solid var(--rebill-color-green)}.corner-bottom-left{bottom:-2px;left:-2px;border-right:none;border-top:none;border-bottom-left-radius:8px}.corner-bottom-right{bottom:-2px;right:-2px;border-left:none;border-top:none;border-bottom-right-radius:8px}.qr-image{display:flex;justify-content:center;align-items:center;width:146px;height:146px;background:#ffffff !important;border-radius:4px}.qr-image svg{width:146px;height:146px;border-radius:4px;background:#ffffff !important}.qr-image img{width:146px;height:146px;border-radius:4px;background:#ffffff !important}.scanner-line{position:absolute;top:0;left:0;right:0;height:2px;background:linear-gradient(90deg, transparent, var(--rebill-color-green), transparent);box-shadow:0 0 10px var(--rebill-color-green);animation:scanDown 2s ease-in-out;animation-fill-mode:forwards;z-index:10}@keyframes scanDown{0%{top:100%;opacity:0}10%{opacity:1}90%{opacity:1}100%{top:0;opacity:0}}.qr-instruction{display:flex;justify-content:center;align-items:center}.instructions-section{background:var(--rebill-color-background-secondary)}.instructions-content{padding:16px 16px 16px 16px;background:var(--rebill-color-background)}.instructions-list{list-style:none;padding:0;margin:0}.instruction-item{display:flex;align-items:flex-start;gap:8px;text-align:left}.instruction-item:not(:last-child){margin-bottom:8px}.instruction-number{background:var(--rebill-color-background-right);width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;text-align:center;line-height:1}.instruction-number rebill-typography{display:flex;align-items:center;justify-content:center;width:100%;height:100%;margin:0;padding:0}.instruction-text{flex:1}.copy-btn{display:flex;padding:var(--padding-base, 6px) var(--padding-xl, 10px);justify-content:center;align-items:center;gap:var(--padding-lg, 8px)}";const Z=class{constructor(i){e(this,i);this.timeUpdate=t(this,"timeUpdate")}qrCodeData;providerName;expirationDate;paymentMethod;code;qrCodeSvg="";isImage=false;timeLeft=3600;formattedTime="59:60";hasCopied=false;timeUpdate;countdownTimer=null;async componentWillLoad(){await this.generateQRCode();this.startCountdownTimer();this.timeUpdate.emit(60)}async componentWillUpdate(){await this.generateQRCode()}disconnectedCallback(){if(this.countdownTimer){this.countdownTimer.stop()}}async generateQRCode(){try{if(!this.qrCodeData){this.qrCodeSvg="";this.isImage=false;return}if(y(this.qrCodeData)){this.isImage=true;this.qrCodeSvg="";return}this.isImage=false;const e=x(this.qrCodeData);const t=await k(e);this.qrCodeSvg=t}catch(e){console.error("Error generating QR code:",e);this.qrCodeSvg="";this.isImage=false}}startCountdownTimer=()=>{if(this.countdownTimer){this.countdownTimer.stop()}this.countdownTimer=j({duration:3600,onTick:e=>{this.timeLeft=e;this.formattedTime=z(e);const t=Math.ceil(e/60);this.timeUpdate.emit(t)},onComplete:()=>{this.timeLeft=0;this.formattedTime="00:00";this.timeUpdate.emit(0)}});this.countdownTimer.start()};getCurrentLanguageInstructions=()=>{const e=o.getCurrentLanguage();const t=c.data.pricing.country;return v(t,e)};render(){const e=this.getCurrentLanguageInstructions();return n("div",{key:"af12b0e17de3e9d15b3d50f6a775cfec0634c57d",class:"qr-code"},n("div",{key:"049ac6a40747350848ab4de7b733ce0c3264b63d",class:"qr-code-header"},n("div",{key:"25014acd9e5bfd42b7e67abc035b52703929732c",class:"expiration-section"},n("rebill-icon",{key:"f4892dd1c4e6cbfc58fe9a0768e72e3afa286010",name:"calendar-clock"}),n("span",{key:"74395a35eb90ab22fa8efcc763b5819e2b465b57",class:"expiration-text"},o.translate("qrCode.expirationLabel",{time:this.formattedTime})))),n("div",{key:"27b777bbba15c3a224e9c9d07ec6194f40caaa7b",class:"qr-code-content"},n("div",{key:"38862683c888d46db81a5df22345024fdcc22fcc",class:"qr-section"},n("div",{key:"2abcbbfad2d8031b2cfd0eca9daab29e8c65b2f7",class:"qr-instruction"},n("rebill-typography",{key:"79f2500a17995c2f5b66be7a3afeab8ff1df01e9",variant:"subtitle-bold",style:{fontSize:"12px"},color:w.GREY_300},o.translate("qrCode.scanInstruction"))),n("div",{key:"181bd27896fb77c5afa1614a622242bb8b399167",class:"qr-container"},this.isImage?n("img",{src:`data:image/png;base64,${this.qrCodeData}`,alt:"QR Code",class:"qr-image"}):n("div",{class:"qr-image",innerHTML:this.qrCodeSvg}),n("div",{key:"44a910457a4462bce56ee04fd7421b38c80f5701",class:"scanner-line"}),n("div",{key:"5ab93aeea71f4288525cc5c0ef7e864d322d625f",class:"corner-bottom-left"}),n("div",{key:"2dfa93e3952df855b38692caa5e446e67477ba78",class:"corner-bottom-right"})),this.code&&n("rebill-button",{key:"1a6e620bb374c27dccf12b910864920f2c7151ac",class:"copy-btn",variant:"secondary",size:"small",onClick:async()=>{if(!this.code)return;await D(this.code);this.hasCopied=true;setTimeout((()=>this.hasCopied=false),2e3)},type:"button"},n("rebill-typography",{key:"0bd8ad17dd4010b231889a3781686911638ad96d",variant:"subtitle2",color:w.PRIMARY_DARK_TEXT},o.translate("qrCode.copyCode")),this.hasCopied?n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M5.62256 10.8855L8.24756 13.5418L14.3726 6.45844",stroke:"#35B093","stroke-linecap":"round","stroke-linejoin":"round"})):n("rebill-icon",{name:"copy",size:"16px"})))),e.length>0&&n("collapsible-card",{key:"4e69b59086fab349bdbe54aaa7908d03f6af72e2",variant:"flat",header:o.translate("qrCode.instructionsLabel"),open:false},n("div",{key:"a535d50416b7d0ad635c5c24f7c35258bf3ebbac"},n("ol",{key:"0bcae653181b6f9bb62d43417d8811226ad135db",class:"instructions-list"},e.map(((e,t)=>n("li",{key:t,class:"instruction-item"},n("div",{class:"instruction-number"},n("rebill-typography",{variant:"subtitle2",color:w.GREY_300},t+1)),n("div",{class:"instruction-text"},n("rebill-typography",{variant:"subtitle2",color:w.GREY_300},e)))))))))}};Z.style=X;const ee=":root{--rebill-color-primary:#3b82f6;--rebill-color-primary-light:rgba(59, 130, 246, 0.1);--rebill-color-primary-hover:#2563eb;--rebill-color-primary-dark-hover:#001c4a;--rebill-color-info-border:#0156f6;--rebill-color-info-text:#172b85;--rebill-color-link:#0056f6;--rebill-color-primary-dark:#001131;--rebill-color-primary-dark-text:#000000;--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-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}:host{display:block}.billing-header-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.address-container{display:flex;flex-direction:column;gap:16px;width:100%}.state-zip-row{display:grid;grid-template-columns:1fr 1fr;gap:16px}.search-link{background:none;border:none;text-decoration:underline;font-size:14px;cursor:pointer;padding:4px 0;text-decoration-color:var(--rebill-color-primary)}.state-zip-row rebill-input-select,.state-zip-row rebill-input-text{flex:1}.search-input-container{margin-top:8px}.manual-entry-link-wrapper{margin-top:8px;text-align:left}.same-as-shipping-section{margin:24px 0;padding:16px 0}.shipping-address-section{margin-top:24px;padding-top:24px}";const te=class{constructor(i){e(this,i);this.searchRequested=t(this,"searchRequested");this.addressUpdated=t(this,"addressUpdated")}get el(){return i(this)}billingView="search";currentBillingStateOptions=[];isLoadingAddress=false;disabled=false;searchRequested;countryOptions=[];errors=null;unsubscribeAddressStore;translateError(e){if(!e)return"";if(e.includes("validation.")||e.includes("paymentErrors.")){return o.translate(e)}return e}addressUpdated;componentDidLoad(){this.unsubscribeAddressStore=h("data",(()=>{const e=c.data.userInformation.address?.billingAddress;if(e){const t={country:e.country||"",state:e.state||"",address:e.address||"",city:e.city||"",zip:e.zip||"",addInformation:e.addInformation||""};this.emitInputEventsForAddress(t)}}))}disconnectedCallback(){if(this.unsubscribeAddressStore){this.unsubscribeAddressStore()}}async handleAddressSelected(e){this.isLoadingAddress=true;const t=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\./g,"").replace(/\s+/g," ").trim();this.billingView="form";if(e.country){await this.loadStatesForCountry(e.country);if(e.state&&this.currentBillingStateOptions.length>0){const i=this.currentBillingStateOptions.find((t=>t.value.toLowerCase()===e.state.toLowerCase()));const n=this.currentBillingStateOptions.find((t=>t.value.toLowerCase().includes(e.state.toLowerCase())||e.state.toLowerCase().includes(t.value.toLowerCase())));const r=t(e.state).replace("ciudad de ","").replace("estado de ","").replace("provincia de ","");const a=this.currentBillingStateOptions.find((e=>{const i=t(e.value).replace("ciudad de ","").replace("estado de ","").replace("provincia de ","");const n=i===r||i.startsWith(r+" ")||r.startsWith(i+" ");return n}));if(i){e.state=i.value}else if(a){e.state=a.value}else if(n){e.state=n.value}else{e.state=undefined}}}p.setBillingAddress(e);this.addressUpdated.emit({country:e.country||"",address:e.address||"",city:e.city||"",state:e.state||undefined,zip:e.zip||"",addInformation:e.addInformation||""});requestAnimationFrame((()=>{this.emitInputEventsForAddress(e);setTimeout((()=>{this.isLoadingAddress=false}),500)}))}emitInputEventsForAddress(e){const t=[{id:`billing-country`,value:e.country},{id:`billing-address`,value:e.address},{id:`billing-city`,value:e.city},{id:`billing-state`,value:e.state},{id:`billing-zip`,value:e.zip},{id:`billing-addInformation`,value:e.addInformation}];t.forEach((e=>{if(e.value){this.emitInputEvent(e.id,e.value)}}))}emitInputEvent(e,t){if(t){const i=new CustomEvent("input",{detail:{id:e,value:t},bubbles:true,composed:true});this.el.dispatchEvent(i)}}handleSearchRequest=()=>{this.billingView="search"};async loadStatesForCountry(e){try{const t=await a.data.getStates(e);const i=t.data;const n=i&&i.states?i.states.map((e=>({label:e,value:e}))):[];this.currentBillingStateOptions=n}catch(e){this.currentBillingStateOptions=[]}}handleManualEntry=()=>{this.billingView="form"};async handleInput(e,t){if(t===undefined)return;p.setBillingAddress({[e]:t});this.emitInputEvent(`billing-${e}`,t);if(e==="country"){await this.loadStatesForCountry(t);p.setBillingAddress({state:""})}}renderAddressHeader(){return n("div",{class:"billing-header-row"},n("rebill-typography",{variant:"body2"},o.translate("billingAddress.title")),this.billingView==="form"&&n("button",{class:"search-link",type:"button",onClick:this.handleSearchRequest},n("rebill-typography",{variant:"subtitle2",color:w.LINK,class:"footer-link"},o.translate("billingAddress.searchPlaceholder","Search address"))))}renderAddressForm(){if(this.billingView==="search"){const e=this.translateError(this.errors?.["billing-address"])||this.translateError(this.errors?.["billing-country"])||this.translateError(this.errors?.["billing-state"])||this.translateError(this.errors?.["billing-city"])||this.translateError(this.errors?.["billing-zip"])||"";return n("div",null,this.renderAddressHeader(),n("rebill-address-search",{onAddressSelected:e=>this.handleAddressSelected(e.detail),onManualEntryRequested:()=>this.handleManualEntry(),error:e,disabled:this.disabled}))}const e=this.isLoadingAddress?null:this.errors;return n("div",null,this.renderAddressHeader(),n("rebill-address-form",{countryOptions:this.countryOptions,stateOptions:this.currentBillingStateOptions,errors:e,disabled:this.disabled,onFieldChanged:e=>this.handleInput(e.detail.field,e.detail.value)}))}render(){return n("div",{key:"36f540ee9f1f4dbf258e165acea5a0b51b029611"},this.renderAddressForm())}};te.style=ee;const ie=".bank-selector{margin-top:16px}";const ne=class{constructor(i){e(this,i);this.bankSelected=t(this,"bankSelected")}banks=[];defaultSelectedBankId="";error;disabled=false;selectedBankId="";languageUpdateTrigger=0;bankSelected;unsubscribeCurrentLocaleStore;handleBankSelection=e=>{const t=this.banks.find((t=>t.code===e));if(t){p.setBankId(t);this.bankSelected.emit(t.code)}};componentWillLoad(){if(this.defaultSelectedBankId){this.selectedBankId=this.defaultSelectedBankId}}componentDidLoad(){this.unsubscribeCurrentLocaleStore=p.onChange("currentLocale",(()=>{this.languageUpdateTrigger++}))}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}}render(){if(!this.banks||this.banks.length===0){return null}const e=[...this.banks].sort(((e,t)=>e.name.localeCompare(t.name)));const t=e.map((e=>({label:e.name,value:e.code})));const i=this.error&&(this.error.includes("validation.")||this.error.includes("paymentErrors."))?o.translate(this.error):this.error||"";return n("div",{class:"bank-selector"},n("rebill-input-select",{id:"bankId",options:t,placeholder:o.translate("bankSelector.placeholder"),error:i,disabled:this.disabled,onInput:e=>{const t=e.detail;if(t&&t.value){this.handleBankSelection(t.value)}},searchable:true,searchPlaceholder:o.translate("bankSelector.searchPlaceholder")}))}};ne.style=ie;function re(){const e=e=>{if(e.email!==undefined){p.setUserInformation({email:e.email})}if(e.fullName!==undefined){p.setUserInformation({fullName:e.fullName})}if(e.phoneNumber!==undefined){p.setUserPhoneNumber({number:e.phoneNumber,countryCode:e.countryCodePhoneNumber||""})}if(e.countryCodePhoneNumber!==undefined){p.setUserPhoneNumber({number:e.phoneNumber||"",countryCode:e.countryCodePhoneNumber})}if(e["billing-country"]!==undefined||e["billing-state"]!==undefined||e["billing-address"]!==undefined||e["billing-city"]!==undefined||e["billing-zip"]!==undefined||e["billing-addInformation"]!==undefined){p.setBillingAddress({country:e["billing-country"],state:e["billing-state"],address:e["billing-address"],city:e["billing-city"],zip:e["billing-zip"],addInformation:e["billing-addInformation"]})}if(e.bankId!==undefined){p.setBankId(e.bankId)}};const t=(e,t)=>{const i={...t};if(e.isValidPhoneNumber===undefined){if(e.phoneNumber&&e.phoneNumber.trim()!==""){e.isValidPhoneNumber="true"}else{e.isValidPhoneNumber="false"}}if(e.phoneNumber!==undefined){if(e?.isValidPhoneNumber==="true"||e?.isValidPhoneNumber===true){delete i.phoneNumber}else if((e.isValidPhoneNumber==="false"||e.isValidPhoneNumber===false)&&e.phoneNumber&&e.phoneNumber.trim()!==""){i.phoneNumber="validation.phoneRequired"}else if(!e.phoneNumber||e.phoneNumber.trim()===""){i.phoneNumber="validation.phoneRequired"}else if(e.isValidPhoneNumber===undefined&&e.phoneNumber&&e.phoneNumber.trim()!==""){delete i.phoneNumber}}return i};const i=(e,t)=>{const i={...t};if(e?.isValidPhoneNumber==="true"||e?.isValidPhoneNumber===true){delete i.phoneNumber}return i};const n=()=>["phoneNumber","countryCodePhoneNumber","isValidPhoneNumber"];const r=()=>["email","fullName","billing-address","billing-city","billing-state","billing-zip","billing-country"];const a=e=>{const t=n();const i=r();if(t.includes(e)){return false}return i.includes(e)};return{syncFormDataToStore:e,handlePhoneValidation:t,getPhoneRelatedFields:n,getTextFields:r,shouldValidateField:a,clearPhoneErrors:i}}const ae=class{constructor(i){e(this,i);this.submit=t(this,"submit");this.change=t(this,"change")}get el(){return i(this)}validationSchema;initialData={};submit;change;renderForm;checkoutFormHook=re();formElement;componentDidLoad(){}handleFormChange(e){const t=e.detail;if(!t||typeof t!=="object"){return}if(t?.isValidPhoneNumber==="true"&&this.formElement){this.formElement.clearError("phoneNumber")}if(t.phoneNumber!==undefined&&this.formElement&&this.formElement.hasSubmitted){if(this.checkoutFormHook.handlePhoneValidation){const e=this.checkoutFormHook.handlePhoneValidation(t,this.formElement.errors||{});this.formElement.errors=e}}}handleSubmit=e=>{this.submit.emit(e)};handleChange=e=>{this.change.emit(e)};async resetValidation(){if(this.formElement){await this.formElement.resetValidation()}}render(){return n("rebill-form",{key:"913b8b648f75c30fe3ee82b877c71b73e8e7a9ef",ref:e=>this.formElement=e,validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:e=>this.handleSubmit(e.detail),onChange:e=>this.handleChange(e.detail),renderForm:this.renderForm})}};const oe={bamboo_payment:"Bamboo Payment",fiserv:"Fiserv",kushki:"Kushki",payway:"Payway",cybersource:"Cybersource",cobre:"Cobre",yakare:"Yakare",dock:"Dock",klap:"Klap",movii:"Movii",stripe:"Stripe"};const se=e=>oe[e]||e;const le=".reference-code{border:1px solid var(--rebill-color-border);border-radius:8px;background:var(--rebill-color-background);overflow:hidden;font-family:var(--rebill-font-family);margin-top:24px}.reference-code-header{padding:16px 24px;background:var(--rebill-color-background-secondary);border-bottom:1px solid var(--rebill-color-border)}.expiration-section{display:flex;align-items:center;gap:8px;justify-content:center}.expiration-text{font-size:12px;font-weight:400;color:var(--rebill-color-text-secondary)}.reference-code-content{padding:32px 24px;display:flex;justify-content:space-between;align-items:center;gap:32px;border-bottom:1px solid var(--rebill-color-border)}.reference-section{flex:1;text-align:center;position:relative}.reference-section::after{content:'';position:absolute;right:-16px;top:50%;transform:translateY(-50%);width:1px;height:60px;background:var(--rebill-color-border)}.provider-section{flex:1;text-align:center}.reference-label,.provider-label{font-size:12px;color:var(--rebill-color-text-secondary-light);margin-bottom:12px;text-transform:uppercase;font-weight:400;letter-spacing:0%}.reference-value{font-size:18px;font-weight:600;color:var(--rebill-color-text-primary)}.provider-value{font-size:18px;font-weight:600;color:var(--rebill-color-text-primary)}.instructions-section{background:var(--rebill-color-background-secondary)}.instructions-toggle{width:100%;padding:20px 24px;background:none;border:none;display:flex;justify-content:space-between;align-items:center;cursor:pointer;font-size:15px;font-weight:500;color:var(--rebill-color-text-primary);transition:background-color 0.2s ease}.instructions-toggle:hover{background:var(--rebill-color-background-secondary)}.instructions-toggle rebill-icon{transition:transform 0.2s ease}.instructions-toggle[aria-expanded='true'] rebill-icon{transform:rotate(180deg)}.instructions-content{padding:16px 16px 16px 16px;background:var(--rebill-color-background);border-top:1px solid var(--rebill-color-border)}.instructions-title{margin:20px 0 16px 0;font-size:16px;font-weight:600;color:var(--rebill-color-text-primary)}.instructions-text{color:var(--rebill-color-text-secondary)}.instructions-list{list-style:none;padding:0;margin:0;counter-reset:instruction-counter}.instructions-list li{counter-increment:instruction-counter;display:flex;align-items:flex-start;gap:12px;margin-bottom:16px;font-size:14px;line-height:1.5}.instructions-list li::before{content:counter(instruction-counter);background:#f4f5f6;color:black;width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:400;flex-shrink:0;margin-top:2px}.instructions-list li:last-child{margin-bottom:0}@media (max-width: 768px){.reference-code-content{flex-direction:column;gap:24px;padding:24px 20px}.reference-section::after{display:none}.reference-section,.provider-section{text-align:center;width:100%}.reference-section{padding-bottom:24px;border-bottom:1px solid var(--rebill-color-border)}.instructions-toggle{padding:16px 20px}.instructions-content{padding:0 20px 20px 20px}}";const ce=class{constructor(t){e(this,t)}referenceId;providerName;expirationDate;instructions=[];showInstructions=false;toggleInstructions=()=>{this.showInstructions=!this.showInstructions};formatExpirationDate=e=>{try{const t=new Date(e);return t.toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})}catch(t){return e}};getCurrentLanguageInstructions=()=>{const e=o.getCurrentLanguage();const t=this.instructions.find((t=>t.language===e));const i=t?.text||this.instructions[0]?.text||"";return i.split("\n").filter((e=>e.trim().length>0))};render(){const e=this.getCurrentLanguageInstructions();return n("div",{key:"53eee612963a28548807c9a075aba17e8d022c37",class:"reference-code"},n("div",{key:"1927fa9dd4c75a280391ba34b8d3f5900157a48f",class:"reference-code-header"},n("div",{key:"b02617217021eef14a42598f84e2c4ff20273d84",class:"expiration-section"},n("rebill-icon",{key:"784ff624d90a2a952d97d02ad13f864afaca1413",name:"calendar-clock"}),n("span",{key:"a95abc010c10f8d9d07a805d5fcd62f8069ead68",class:"expiration-text"},o.translate("referenceCode.expirationLabel")," ",this.formatExpirationDate(this.expirationDate)))),n("div",{key:"b2f86a07b2bd9067c31ddd3e58b2495fc2da7670",class:"reference-code-content"},n("div",{key:"c6bcee134d966077dcc2b06bcd32d142273c27e6",class:"reference-section"},n("div",{key:"d607744363e0b5118c59996f776cd91d91471818",class:"reference-label"},o.translate("referenceCode.referenceLabel")),n("div",{key:"c472e96e09146f2f13a476897ef92052e0a6affe",class:"reference-value"},this.referenceId)),n("div",{key:"8cfc3186e62bbefd12fda2aa52e1fbe64e1f531a",class:"provider-section"},n("div",{key:"d8bc3af4a73e6f0f6a7f70e5a2b6c10d7b1e7901",class:"provider-label"},o.translate("referenceCode.providerLabel")),n("div",{key:"82e0ffc5faca1890b56a92d2bf4c695c9b720426",class:"provider-value"},se(this.providerName)))),this.instructions.length>0&&n("div",{key:"615d197ef8278a2f1008ed9b99392b070decbcd3",class:"instructions-section"},n("button",{key:"e3cec3b4c0179b77b4d2ec5c9b992c1303e3782f",class:"instructions-toggle",onClick:this.toggleInstructions,type:"button","aria-expanded":this.showInstructions.toString(),"aria-controls":"instructions-content"},n("span",{key:"e4ce3f249d33d62db9ca4f2f15e7e86b2e5b00b4"},o.translate("referenceCode.instructionsLabel")),n("rebill-icon",{key:"3533bfaf4cd3a5847b4cf34aa5845fd280de2e0f",name:"chevron-down"})),this.showInstructions&&n("div",{key:"707ba7303831e205c3cbd248e29e336db1fc1ef7",class:"instructions-content",id:"instructions-content",role:"region","aria-labelledby":"instructions-toggle"},n("div",{key:"defce52b328d0c0a76a3ef7274d027e26a2c304a",class:"instructions-text"},n("ol",{key:"3341cdb16fa13eefd16544e1c200c3bab2e7282d",class:"instructions-list"},e.map(((e,t)=>n("li",{key:t},e))))))))}};ce.style=le;const de=":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 pe=class{constructor(t){e(this,t)}error=null;countryCode=null;languageUpdateTrigger=0;disabled=false;unsubscribeCurrentLocaleStore;componentDidLoad(){this.unsubscribeCurrentLocaleStore=p.onChange("currentLocale",(()=>{this.languageUpdateTrigger++}))}disconnectedCallback(){if(this.unsubscribeCurrentLocaleStore){this.unsubscribeCurrentLocaleStore()}}render(){return n(r,{key:"22a19f5259c0c44af49eccf475a23f2184f86aa7"},n("div",{key:"936709bd5c83400535819879936335948358d0dd"},n("rebill-input-phone",{key:"65163b7395a0219ced0b86bd65041afe4ca07dee",disabled:this.disabled,validationErrorId:"isValidPhoneNumber",phoneNumberId:"phoneNumber",countryCodeId:"countryCodePhoneNumber",placeholder:o.translate("userInformation.phoneNumberPlaceholder"),"initial-country":this.countryCode?.toLowerCase()||"ar",error:this.error,required:true,searchable:true,searchPlaceholder:o.translate("userInformation.searchCountriesPlaceholder")})))}};pe.style=de;export{R as apm_checkout,Q as apm_download,G as bank_transfer,$ as boleto_payment,F as payment_button,A as payment_method_selector,Z as qr_code,te as rebill_address,ne as rebill_bank_selector,ae as rebill_checkout_form,V as rebill_processing_payment,ce as reference_code,pe as user_information_phone,H as user_information_static};
2
+ //# sourceMappingURL=p-f4588c0f.entry.js.map