rebill-web-components-sdk 1.8.34-beta.1 → 1.8.35
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.
- package/dist/cjs/apm-checkout_19.cjs.entry.js +1 -1
- package/dist/cjs/card-identification_5.cjs.entry.js +1 -1
- package/dist/cjs/discount-coupon.rebill-divider.entry.cjs.js.map +1 -1
- package/dist/cjs/discount-coupon_2.cjs.entry.js +26 -7
- package/dist/cjs/index-C-VTnc0I.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/organization-logo.rebill-card-icon.rebill-checkout-single-column.rebill-footer.entry.cjs.js.map +1 -1
- package/dist/cjs/organization-logo_4.cjs.entry.js +1 -1
- package/dist/cjs/rebill-renewal.cjs.entry.js +2 -2
- package/dist/cjs/rebill-renewal.entry.cjs.js.map +1 -1
- package/dist/cjs/rebill-web-components-sdk.cjs.js +1 -1
- package/dist/cjs/renewal-success-page.renewal-summary.entry.cjs.js.map +1 -1
- package/dist/cjs/renewal-success-page_2.cjs.entry.js +25 -57
- package/dist/cjs/{renewal.store-BaH9Id4E.js → renewal.store-3JWhB1Pi.js} +3 -2
- package/dist/cjs/renewal.store-3JWhB1Pi.js.map +1 -0
- package/dist/collection/components/checkout/discount-coupon/discount-coupon.js +26 -7
- package/dist/collection/components/checkout/discount-coupon/discount-coupon.js.map +1 -1
- package/dist/collection/components/checkout/rebill-footer/rebill-footer.css +2 -1
- package/dist/collection/components/renewal/rebill-renewal.js +1 -1
- package/dist/collection/components/renewal/rebill-renewal.js.map +1 -1
- package/dist/collection/components/renewal/renewal-success-page/renewal-success-page.js +12 -34
- package/dist/collection/components/renewal/renewal-success-page/renewal-success-page.js.map +1 -1
- package/dist/collection/components/renewal/renewal-summary/renewal-summary.js +31 -22
- package/dist/collection/components/renewal/renewal-summary/renewal-summary.js.map +1 -1
- package/dist/collection/models/renewal.model.js.map +1 -1
- package/dist/collection/store/renewal.store.js +1 -0
- package/dist/collection/store/renewal.store.js.map +1 -1
- package/dist/components/card-fields-wrapper.js +1 -1
- package/dist/components/card-identification.js +1 -1
- package/dist/components/card-iframe.js +1 -1
- package/dist/components/discount-coupon.js +1 -1
- package/dist/components/p-8BpuJ_V5.js.map +1 -1
- package/dist/components/{p-D6xIJNnb.js → p-BJUr_-ZO.js} +3 -3
- package/dist/components/{p-D6xIJNnb.js.map → p-BJUr_-ZO.js.map} +1 -1
- package/dist/components/{p-B-sufB9-.js → p-BSCSd_ch.js} +17 -39
- package/dist/components/p-BSCSd_ch.js.map +1 -0
- package/dist/components/{p-FjaOut9O.js → p-BZUoWYrL.js} +4 -4
- package/dist/components/{p-FjaOut9O.js.map → p-BZUoWYrL.js.map} +1 -1
- package/dist/components/{p-r2jtUw42.js → p-B_lR-4t9.js} +3 -3
- package/dist/components/{p-r2jtUw42.js.map → p-B_lR-4t9.js.map} +1 -1
- package/dist/components/{p-BY43VCzz.js → p-Bln3wBD6.js} +5 -5
- package/dist/components/{p-BY43VCzz.js.map → p-Bln3wBD6.js.map} +1 -1
- package/dist/components/{p-CtTqLwLn.js → p-D5TXI2Hb.js} +28 -9
- package/dist/components/p-D5TXI2Hb.js.map +1 -0
- package/dist/components/{p-dgrAtFYi.js → p-DDVDLDRI.js} +3 -3
- package/dist/components/{p-dgrAtFYi.js.map → p-DDVDLDRI.js.map} +1 -1
- package/dist/components/{p-B1lTVbgj.js → p-DPpE0kdy.js} +5 -5
- package/dist/components/{p-B1lTVbgj.js.map → p-DPpE0kdy.js.map} +1 -1
- package/dist/components/{p-BCu7Nkqb.js → p-DWIWSpMW.js} +3 -3
- package/dist/components/p-DWIWSpMW.js.map +1 -0
- package/dist/components/{p-Cnr-CyGT.js → p-Db7dntOn.js} +4 -4
- package/dist/components/{p-Cnr-CyGT.js.map → p-Db7dntOn.js.map} +1 -1
- package/dist/components/{p-rO7aLibt.js → p-VskO2WrV.js} +3 -3
- package/dist/components/{p-rO7aLibt.js.map → p-VskO2WrV.js.map} +1 -1
- package/dist/components/{p-hpg1lOUJ.js → p-b0Xc3sbS.js} +3 -2
- package/dist/components/p-b0Xc3sbS.js.map +1 -0
- package/dist/components/{p-DbfmzIIw.js → p-mqJmoJIO.js} +16 -25
- package/dist/components/p-mqJmoJIO.js.map +1 -0
- package/dist/components/payment-method-selector.js +1 -1
- package/dist/components/rebill-checkout-single-column.js +1 -1
- package/dist/components/rebill-checkout.js +10 -10
- package/dist/components/rebill-footer.js +1 -1
- package/dist/components/rebill-processing-payment.js +1 -1
- package/dist/components/rebill-renewal.js +12 -12
- package/dist/components/rebill-renewal.js.map +1 -1
- package/dist/components/rebill-summary.js +1 -1
- package/dist/components/renewal-success-page.js +1 -1
- package/dist/components/renewal-summary.js +1 -1
- package/dist/components/success-page.js +1 -1
- package/dist/esm/apm-checkout_19.entry.js +1 -1
- package/dist/esm/card-identification_5.entry.js +1 -1
- package/dist/esm/discount-coupon.rebill-divider.entry.js.map +1 -1
- package/dist/esm/discount-coupon_2.entry.js +26 -7
- package/dist/esm/index-D8cwEAmw.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/organization-logo.rebill-card-icon.rebill-checkout-single-column.rebill-footer.entry.js.map +1 -1
- package/dist/esm/organization-logo_4.entry.js +1 -1
- package/dist/esm/rebill-renewal.entry.js +2 -2
- package/dist/esm/rebill-renewal.entry.js.map +1 -1
- package/dist/esm/rebill-web-components-sdk.js +1 -1
- package/dist/esm/renewal-success-page.renewal-summary.entry.js.map +1 -1
- package/dist/esm/renewal-success-page_2.entry.js +25 -57
- package/dist/esm/{renewal.store-vAxzxA8H.js → renewal.store-jTjLDpeh.js} +3 -2
- package/dist/esm/renewal.store-jTjLDpeh.js.map +1 -0
- package/dist/rebill-web-components-sdk/discount-coupon.rebill-divider.entry.esm.js.map +1 -1
- package/dist/rebill-web-components-sdk/organization-logo.rebill-card-icon.rebill-checkout-single-column.rebill-footer.entry.esm.js.map +1 -1
- package/dist/rebill-web-components-sdk/{p-b75b53a8.entry.js → p-28d04513.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-80dcd17e.entry.js → p-392fb691.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-e242be38.entry.js → p-736d2bdc.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/p-736d2bdc.entry.js.map +1 -0
- package/dist/rebill-web-components-sdk/p-8bf5ce94.entry.js +2 -0
- package/dist/rebill-web-components-sdk/p-8bf5ce94.entry.js.map +1 -0
- package/dist/rebill-web-components-sdk/p-BOVs95c7.js +2 -0
- package/dist/rebill-web-components-sdk/p-BOVs95c7.js.map +1 -0
- package/dist/rebill-web-components-sdk/p-D8cwEAmw.js.map +1 -1
- package/dist/rebill-web-components-sdk/p-bde8f6aa.entry.js +2 -0
- package/dist/rebill-web-components-sdk/p-bde8f6aa.entry.js.map +1 -0
- package/dist/rebill-web-components-sdk/{p-e68db8f7.entry.js → p-d0636f82.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-e68db8f7.entry.js.map → p-d0636f82.entry.js.map} +1 -1
- package/dist/rebill-web-components-sdk/rebill-renewal.entry.esm.js.map +1 -1
- package/dist/rebill-web-components-sdk/rebill-web-components-sdk.esm.js +1 -1
- package/dist/rebill-web-components-sdk/renewal-success-page.renewal-summary.entry.esm.js.map +1 -1
- package/dist/types/components/checkout/discount-coupon/discount-coupon.d.ts +1 -0
- package/dist/types/components/renewal/renewal-success-page/renewal-success-page.d.ts +1 -4
- package/dist/types/components/renewal/renewal-summary/renewal-summary.d.ts +1 -2
- package/dist/types/components.d.ts +2 -0
- package/dist/types/models/renewal.model.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/renewal.store-BaH9Id4E.js.map +0 -1
- package/dist/components/p-B-sufB9-.js.map +0 -1
- package/dist/components/p-BCu7Nkqb.js.map +0 -1
- package/dist/components/p-CtTqLwLn.js.map +0 -1
- package/dist/components/p-DbfmzIIw.js.map +0 -1
- package/dist/components/p-hpg1lOUJ.js.map +0 -1
- package/dist/esm/renewal.store-vAxzxA8H.js.map +0 -1
- package/dist/rebill-web-components-sdk/p-1a748630.entry.js +0 -2
- package/dist/rebill-web-components-sdk/p-1a748630.entry.js.map +0 -1
- package/dist/rebill-web-components-sdk/p-5eda5359.entry.js +0 -2
- package/dist/rebill-web-components-sdk/p-5eda5359.entry.js.map +0 -1
- package/dist/rebill-web-components-sdk/p-e242be38.entry.js.map +0 -1
- package/dist/rebill-web-components-sdk/p-nVuaISVM.js +0 -2
- package/dist/rebill-web-components-sdk/p-nVuaISVM.js.map +0 -1
- /package/dist/rebill-web-components-sdk/{p-b75b53a8.entry.js.map → p-28d04513.entry.js.map} +0 -0
- /package/dist/rebill-web-components-sdk/{p-80dcd17e.entry.js.map → p-392fb691.entry.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renewal.store-3JWhB1Pi.js","sources":["src/store/renewal.store.ts"],"sourcesContent":["import { createStore } from '@stencil/store';\nimport { SavedCard } from '../api/entities/cards/types';\nimport {\n CreateAPMCheckoutResponse,\n CreateCardCheckoutResponse,\n} from '../api/entities/checkout/types';\nimport { ENUM_INSTALLMENT_MODEL } from '../models/enums/installment.enum';\nimport { PAYMENT_METHOD_ENUM } from '../models/enums/payment-methods.enum';\nimport { RebillRenewalProps, RenewalSession } from '../models/renewal.model';\n\nexport interface RenewalSessionState {\n token: string;\n data: RenewalSession;\n form: {\n isLoading: boolean;\n selectedPaymentMethod?: PAYMENT_METHOD_ENUM;\n selectedCard?: SavedCard;\n cvv?: string;\n savedCards: SavedCard[];\n checkoutResponse?: CreateCardCheckoutResponse | CreateAPMCheckoutResponse | null;\n userIdentification?: {\n documentType?: string;\n documentNumber?: string;\n };\n selectedBankId?: string;\n };\n isInitialized: boolean;\n fetchingInstallments: boolean;\n cardMode?: 'input' | 'select' | null;\n deviceId?: string;\n providerKey?: string;\n}\n\nconst initialRenewalState: RenewalSessionState = {\n token: '',\n data: {\n id: '',\n cardId: '',\n cardTokenId: '',\n cardInformation: {\n brand: '',\n type: '',\n isoCountry: '',\n bank: '',\n lastFour: '',\n installments: {\n isAvailableInstallments: false,\n installments: [],\n selectedInstallment: undefined,\n },\n },\n subscription: {\n id: '',\n organizationId: '',\n status: '',\n name: [],\n description: [],\n planId: null,\n amount: 0,\n subTotalAmount: 0,\n currency: '',\n isPriceFixed: false,\n targetCurrency: null,\n isProcessing: false,\n frequency: {\n count: 0,\n period: null,\n },\n repetitions: 0,\n currentRepetitions: 0,\n debitDay: null,\n type: '',\n lastChargeDate: '',\n nextChargeDate: '',\n remainingIterations: 0,\n customerId: '',\n customerName: '',\n customerEmail: '',\n paymentMethod: '',\n cardId: null,\n cardLastFour: null,\n trialPeriodDays: null,\n metadata: null,\n createdAt: '',\n },\n organization: {\n id: '',\n name: '',\n logoUrl: null,\n },\n price: {\n amount: 0,\n currency: '',\n country: '',\n paymentMethods: [],\n couponCode: null,\n discountPercentage: 0,\n discountedAmount: 0,\n },\n paymentMethods: [],\n country: '',\n createdAt: '',\n updatedAt: '',\n },\n form: {\n isLoading: false,\n savedCards: [],\n },\n isInitialized: false,\n fetchingInstallments: false,\n cardMode: 'select',\n};\n\nexport const { state: renewalState, onChange } =\n createStore<RenewalSessionState>(initialRenewalState);\n\nexport class RenewalStore {\n static initializeRenewal(renewalProps: RebillRenewalProps) {\n const { token, ...allProps } = renewalProps;\n renewalState.token = token;\n renewalState.data = allProps;\n renewalState.data.country = allProps.country;\n\n if (allProps.subscription?.cardId) {\n renewalState.data.cardId = allProps.subscription.cardId;\n }\n\n renewalState.isInitialized = true;\n }\n\n static setLoading(isLoading: boolean) {\n renewalState.form = {\n ...renewalState.form,\n isLoading,\n };\n }\n\n static setSelectedPaymentMethod(paymentMethod: PAYMENT_METHOD_ENUM) {\n renewalState.form = {\n ...renewalState.form,\n selectedPaymentMethod: paymentMethod,\n };\n }\n\n static setSelectedCard(card: SavedCard) {\n renewalState.form = {\n ...renewalState.form,\n selectedCard: card,\n };\n }\n\n static setCvv(cvv: string) {\n renewalState.form = {\n ...renewalState.form,\n cvv,\n };\n }\n\n static setSavedCards(cards: SavedCard[]) {\n renewalState.form = {\n ...renewalState.form,\n savedCards: cards,\n };\n }\n\n static setCheckoutResponse(response: CreateCardCheckoutResponse | CreateAPMCheckoutResponse) {\n renewalState.form = {\n ...renewalState.form,\n checkoutResponse: response,\n };\n }\n\n static setUserIdentification(identification: { documentType?: string; documentNumber?: string }) {\n renewalState.form = {\n ...renewalState.form,\n userIdentification: {\n ...renewalState.form.userIdentification,\n ...identification,\n },\n };\n }\n\n static clearRenewal() {\n renewalState.data = initialRenewalState.data;\n renewalState.form = initialRenewalState.form;\n renewalState.isInitialized = false;\n }\n\n static getRenewalState(): RenewalSessionState {\n return renewalState;\n }\n\n static setCardId(cardId: string) {\n renewalState.data.cardId = cardId;\n }\n\n static setCardTokenId(cardTokenId: string) {\n renewalState.data.cardTokenId = cardTokenId;\n }\n\n static setFetchingInstallments(fetchingInstallments: boolean) {\n renewalState.fetchingInstallments = fetchingInstallments;\n }\n\n static setCardInformation(cardInformation: {\n brand: string;\n type: string;\n isoCountry: string;\n bank: string;\n lastFour?: string;\n installments: {\n installments: {\n model: ENUM_INSTALLMENT_MODEL;\n cft: number;\n installment: number;\n totalAmount: number;\n installmentAmount: number;\n cftAmount: number;\n }[];\n };\n }) {\n if (cardInformation) {\n renewalState.data.cardInformation = {\n ...cardInformation,\n installments: {\n ...renewalState.data.cardInformation?.installments,\n installments: cardInformation.installments.installments,\n isAvailableInstallments: !!cardInformation.installments.installments.length,\n },\n };\n } else {\n renewalState.data.cardInformation = {\n brand: '',\n type: '',\n isoCountry: '',\n bank: '',\n lastFour: '',\n installments: {\n isAvailableInstallments: false,\n installments: [],\n selectedInstallment: undefined,\n },\n };\n }\n }\n\n static setSelectedBankId(bankId: string) {\n renewalState.form = {\n ...renewalState.form,\n selectedBankId: bankId,\n };\n }\n\n static setCardMode(cardMode: 'input' | 'select' | null) {\n renewalState.cardMode = cardMode;\n }\n\n static setDeviceId(deviceId: string) {\n renewalState.deviceId = deviceId;\n }\n\n static setProviderKey(providerKey: string) {\n renewalState.providerKey = providerKey;\n }\n}\n"],"names":["createStore"],"mappings":";;;;AAiCA,MAAM,mBAAmB,GAAwB;AAC/C,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,IAAI,EAAE;AACJ,QAAA,EAAE,EAAE,EAAE;AACN,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,WAAW,EAAE,EAAE;AACf,QAAA,eAAe,EAAE;AACf,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,UAAU,EAAE,EAAE;AACd,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,YAAY,EAAE;AACZ,gBAAA,uBAAuB,EAAE,KAAK;AAC9B,gBAAA,YAAY,EAAE,EAAE;AAChB,gBAAA,mBAAmB,EAAE,SAAS;AAC/B,aAAA;AACF,SAAA;AACD,QAAA,YAAY,EAAE;AACZ,YAAA,EAAE,EAAE,EAAE;AACN,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,WAAW,EAAE,EAAE;AACf,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,cAAc,EAAE,CAAC;AACjB,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,YAAY,EAAE,KAAK;AACnB,YAAA,cAAc,EAAE,IAAI;AACpB,YAAA,YAAY,EAAE,KAAK;AACnB,YAAA,SAAS,EAAE;AACT,gBAAA,KAAK,EAAE,CAAC;AACR,gBAAA,MAAM,EAAE,IAAI;AACb,aAAA;AACD,YAAA,WAAW,EAAE,CAAC;AACd,YAAA,kBAAkB,EAAE,CAAC;AACrB,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,cAAc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AA,uBAAuB,EAAE,KAAK;AAC9B,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,mBAAmB,EAAE,SAAS;AAC/B,iBAAA;aACF;;;IAIL,OAAO,iBAAiB,CAAC,MAAc,EAAA;QACrC,YAAY,CAAC,IAAI,GAAG;YAClB,GAAG,YAAY,CAAC,IAAI;AACpB,YAAA,cAAc,EAAE,MAAM;SACvB;;IAGH,OAAO,WAAW,CAAC,QAAmC,EAAA;AACpD,QAAA,YAAY,CAAC,QAAQ,GAAG,QAAQ;;IAGlC,OAAO,WAAW,CAAC,QAAgB,EAAA;AACjC,QAAA,YAAY,CAAC,QAAQ,GAAG,QAAQ;;IAGlC,OAAO,cAAc,CAAC,WAAmB,EAAA;AACvC,QAAA,YAAY,CAAC,WAAW,GAAG,WAAW;;AAEzC;;;;;;"}
|
|
@@ -99,11 +99,23 @@ export class DiscountCoupon {
|
|
|
99
99
|
this.couponCode = '';
|
|
100
100
|
this.isError = false;
|
|
101
101
|
}
|
|
102
|
+
renderCouponChip({ couponCode, discountAmount, currency, readonly = false, onClick, onRemove, }) {
|
|
103
|
+
if (!couponCode) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const hasDiscountAmount = typeof discountAmount === 'number';
|
|
107
|
+
return (h("div", { class: `coupon-chip${readonly ? ' coupon-chip--readonly' : ''}` }, h("rebill-icon", { name: "tag-sale", size: "16px" }), h("div", { class: "coupon-content", onClick: !readonly ? onClick : undefined }, h("rebill-typography", { variant: "overline", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, couponCode), hasDiscountAmount && (h("rebill-typography", { variant: "overline", color: COLORS_ENUM.GREEN }, "-$", formatAmountWithoutCurrency(discountAmount, currency)))), !readonly && onRemove && (h("div", { class: "coupon-close", onClick: onRemove }, h("rebill-icon", { name: "x", size: "20px", color: COLORS_ENUM.PRIMARY_DARK_TEXT })))));
|
|
108
|
+
}
|
|
102
109
|
renderReadonlyView() {
|
|
103
110
|
if (!this.readonlyCouponCode && this.readonlyDiscountAmount) {
|
|
104
111
|
return null;
|
|
105
112
|
}
|
|
106
|
-
return
|
|
113
|
+
return this.renderCouponChip({
|
|
114
|
+
couponCode: this.readonlyCouponCode,
|
|
115
|
+
discountAmount: this.readonlyDiscountAmount ?? null,
|
|
116
|
+
currency: this.readonlyCurrency ?? null,
|
|
117
|
+
readonly: true,
|
|
118
|
+
});
|
|
107
119
|
}
|
|
108
120
|
render() {
|
|
109
121
|
if (this.readonlyCouponCode) {
|
|
@@ -121,12 +133,19 @@ export class DiscountCoupon {
|
|
|
121
133
|
if (!this.couponCode.trim()) {
|
|
122
134
|
this.onCancelCoupon();
|
|
123
135
|
}
|
|
124
|
-
} }), h("rebill-button", { variant: "filled", theme: "primary-dark", size: "small", loading: this.isLoading, disabled: this.isLoading || !this.couponCode.trim(), onClick: () => this.onApplyCoupon(), style: { marginTop: this.actionStatus === ACTION_STATUS.EDITING ? '3px' : '0px' } }, I18nService.translate('discountCoupons.apply')))), this.actionStatus === ACTION_STATUS.APPLIED &&
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
} }), h("rebill-button", { variant: "filled", theme: "primary-dark", size: "small", loading: this.isLoading, disabled: this.isLoading || !this.couponCode.trim(), onClick: () => this.onApplyCoupon(), style: { marginTop: this.actionStatus === ACTION_STATUS.EDITING ? '3px' : '0px' } }, I18nService.translate('discountCoupons.apply')))), this.actionStatus === ACTION_STATUS.APPLIED &&
|
|
137
|
+
this.renderCouponChip({
|
|
138
|
+
couponCode: sessionState.data.pricing.discountCouponCode,
|
|
139
|
+
discountAmount: sessionState.data.pricing.discountAmount,
|
|
140
|
+
currency: sessionState.data.pricing.currency,
|
|
141
|
+
onClick: () => (this.actionStatus = ACTION_STATUS.EDITING),
|
|
142
|
+
onRemove: () => {
|
|
143
|
+
this.actionStatus = ACTION_STATUS.NOT_APPLIED;
|
|
144
|
+
this.couponCode = '';
|
|
145
|
+
SessionStore.setDiscount(null);
|
|
146
|
+
this.discountApplied.emit(false);
|
|
147
|
+
},
|
|
148
|
+
}))));
|
|
130
149
|
}
|
|
131
150
|
static get is() { return "discount-coupon"; }
|
|
132
151
|
static get originalStyleUrls() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discount-coupon.js","sourceRoot":"","sources":["../../../../src/components/checkout/discount-coupon/discount-coupon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,IAAK,aAIJ;AAJD,WAAK,aAAa;IAChB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;IACnB,4CAA2B,CAAA;AAC7B,CAAC,EAJI,aAAa,KAAb,aAAa,QAIjB;AAOD,MAAM,OAAO,cAAc;IACd,EAAE,CAAc;IACnB,SAAS,GAAY,KAAK,CAAC;IAC3B,WAAW,GAA4B,UAAU,CAAC;IAClD,kBAAkB,CAAU;IAC5B,sBAAsB,CAAU;IAChC,gBAAgB,CAAU;IACzB,UAAU,GAAW,EAAE,CAAC;IACxB,YAAY,GAAkB,aAAa,CAAC,WAAW,CAAC;IACxD,SAAS,GAAY,KAAK,CAAC;IAC3B,OAAO,GAAY,KAAK,CAAC;IACzB,aAAa,GAAW,YAAY,CAAC,aAAa,CAAC;IACnD,eAAe,CAAwB;IACxC,QAAQ,CAA6B;IACrC,6BAA6B,CAAc;IAEnD,iBAAiB;QACf,IAAI,CAAC,6BAA6B,GAAG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AY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;4BAC/B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;wBACnC,CAAC;wBAED,mBAAa,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,GAAI,CACtE,CACF,CACP,CACG,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Prop, State } from '@stencil/core';\nimport { api } from '../../../api';\nimport { I18nService } from '../../../i18n/i18n.service';\nimport { sessionState, SessionStore } from '../../../store/session.store';\nimport { formatAmountWithoutCurrency } from '../../../utils';\nimport { COLORS_ENUM } from '../../../utils/color-class-mapper';\n\nenum ACTION_STATUS {\n EDITING = 'editing',\n APPLIED = 'applied',\n NOT_APPLIED = 'not_applied',\n}\n\n@Component({\n tag: 'discount-coupon',\n styleUrl: 'discount-coupon.css',\n shadow: false,\n})\nexport class DiscountCoupon {\n @Element() el: HTMLElement;\n @Prop() hideLabel: boolean = false;\n @Prop() displayMode: 'editable' | 'readonly' = 'editable';\n @Prop() readonlyCouponCode?: string;\n @Prop() readonlyDiscountAmount?: number;\n @Prop() readonlyCurrency?: string;\n @State() couponCode: string = '';\n @State() actionStatus: ACTION_STATUS = ACTION_STATUS.NOT_APPLIED;\n @State() isLoading: boolean = false;\n @State() isError: boolean = false;\n @State() currentLocale: string = sessionState.currentLocale;\n @Event() discountApplied: EventEmitter<boolean>;\n private inputRef: HTMLRebillInputTextElement;\n private unsubscribeCurrentLocaleStore?: () => void;\n\n componentWillLoad() {\n this.unsubscribeCurrentLocaleStore = SessionStore.onChange('currentLocale', () => {\n this.currentLocale = sessionState.currentLocale;\n });\n\n if (this.readonlyCouponCode) {\n return;\n }\n\n if (\n sessionState.data.pricing.discountCouponCode &&\n sessionState.data.pricing.discountAmount > 0\n ) {\n this.actionStatus = ACTION_STATUS.APPLIED;\n this.couponCode = sessionState.data.pricing.discountCouponCode;\n }\n }\n\n disconnectedCallback() {\n if (this.unsubscribeCurrentLocaleStore) {\n this.unsubscribeCurrentLocaleStore();\n }\n }\n componentDidUpdate() {\n if (this.readonlyCouponCode) {\n return;\n }\n\n if (this.actionStatus === ACTION_STATUS.EDITING && this.inputRef) {\n setTimeout(async () => {\n const inputElement = await this.inputRef.getInputElement();\n if (inputElement) {\n inputElement.focus();\n }\n }, 0);\n }\n }\n\n private async onApplyCoupon() {\n if (this.readonlyCouponCode) return;\n const sessionId = sessionState.data.sessionId;\n if (!sessionId) {\n return;\n }\n this.isLoading = true;\n try {\n const response = await api.discountCoupon.applyDiscountCoupon({\n couponCode: this.couponCode,\n quantity: 1,\n sessionId: sessionId,\n organizationId: sessionState.data.organization.id,\n });\n this.actionStatus = ACTION_STATUS.APPLIED;\n SessionStore.setDiscount({\n couponCode: this.couponCode,\n amount: response.amount,\n discountType: response.discountType,\n discountAmount: response.discountedAmount,\n discountedPercentage: response?.discountedPercentage || 0,\n discountDuration: response?.discountDuration || null,\n });\n this.discountApplied.emit(true);\n } catch (error) {\n this.actionStatus = ACTION_STATUS.EDITING;\n this.discountApplied.emit(false);\n this.isError = true;\n SessionStore.setDiscount(null);\n } finally {\n this.isLoading = false;\n }\n }\n\n private onCancelCoupon() {\n if (this.readonlyCouponCode) return;\n this.actionStatus = ACTION_STATUS.NOT_APPLIED;\n this.couponCode = '';\n this.isError = false;\n }\n\n private renderReadonlyView() {\n if (!this.readonlyCouponCode && this.readonlyDiscountAmount) {\n return null;\n }\n\n return (\n <div class=\"coupon-chip coupon-chip--readonly\">\n <rebill-icon name=\"tag-sale\" size=\"16px\" />\n <div class=\"coupon-content\">\n <rebill-typography variant=\"overline\" color={COLORS_ENUM.PRIMARY_DARK_TEXT}>\n {this.readonlyCouponCode}\n </rebill-typography>\n {this.readonlyDiscountAmount && (\n <rebill-typography variant=\"overline\" color={COLORS_ENUM.GREEN}>\n -$\n {formatAmountWithoutCurrency(\n this.readonlyDiscountAmount,\n this.readonlyCurrency as any,\n )}\n </rebill-typography>\n )}\n </div>\n </div>\n );\n }\n\n render() {\n if (this.readonlyCouponCode) {\n return this.renderReadonlyView();\n }\n\n return (\n <div>\n <div\n class=\"summary-row\"\n style={{\n alignItems: this.actionStatus === ACTION_STATUS.EDITING ? 'flex-start' : 'center',\n display: 'flex',\n }}\n >\n {!this.hideLabel && (\n <rebill-typography\n variant=\"body2\"\n style={{ marginTop: this.actionStatus === ACTION_STATUS.EDITING ? '7px' : '0px' }}\n >\n {I18nService.translate('discountCoupons.discount')}\n </rebill-typography>\n )}\n {this.actionStatus === ACTION_STATUS.NOT_APPLIED && (\n <rebill-button\n variant=\"filled\"\n size=\"small\"\n theme=\"primary-dark\"\n onClick={() => (this.actionStatus = ACTION_STATUS.EDITING)}\n >\n {I18nService.translate('discountCoupons.addDiscount')}\n </rebill-button>\n )}\n {this.actionStatus === ACTION_STATUS.EDITING && (\n <div class=\"summary-row\" style={{ alignItems: 'flex-start', display: 'flex' }}>\n <rebill-input-text\n ref={el => (this.inputRef = el)}\n id=\"discountCoupon\"\n value={this.couponCode}\n placeholder={I18nService.translate('discountCoupons.addDiscount')}\n disabled={this.isLoading}\n error={this.isError ? I18nService.translate('discountCoupons.error') : ''}\n clearable={true}\n uppercase={true}\n onInput={e => {\n e.stopPropagation();\n if (e.detail && e.detail.value !== undefined) {\n this.couponCode = e.detail.value;\n }\n }}\n onBlur={() => {\n if (!this.couponCode.trim()) {\n this.onCancelCoupon();\n }\n }}\n />\n <rebill-button\n variant=\"filled\"\n theme=\"primary-dark\"\n size=\"small\"\n loading={this.isLoading}\n disabled={this.isLoading || !this.couponCode.trim()}\n onClick={() => this.onApplyCoupon()}\n style={{ marginTop: this.actionStatus === ACTION_STATUS.EDITING ? '3px' : '0px' }}\n >\n {I18nService.translate('discountCoupons.apply')}\n </rebill-button>\n </div>\n )}\n {this.actionStatus === ACTION_STATUS.APPLIED && (\n <div class=\"coupon-chip\">\n <rebill-icon name=\"tag-sale\" size=\"16px\" />\n <div\n class=\"coupon-content\"\n onClick={() => (this.actionStatus = ACTION_STATUS.EDITING)}\n >\n <rebill-typography variant=\"overline\" color={COLORS_ENUM.PRIMARY_DARK_TEXT}>\n {sessionState.data.pricing.discountCouponCode}\n </rebill-typography>\n <rebill-typography variant=\"overline\" color={COLORS_ENUM.GREEN}>\n -$\n {formatAmountWithoutCurrency(\n sessionState.data.pricing.discountAmount,\n sessionState.data.pricing.currency,\n )}\n </rebill-typography>\n </div>\n <div\n class=\"coupon-close\"\n onClick={() => {\n this.actionStatus = ACTION_STATUS.NOT_APPLIED;\n this.couponCode = '';\n SessionStore.setDiscount(null);\n this.discountApplied.emit(false);\n }}\n >\n <rebill-icon name=\"x\" size=\"20px\" color={COLORS_ENUM.PRIMARY_DARK_TEXT} />\n </div>\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"discount-coupon.js","sourceRoot":"","sources":["../../../../src/components/checkout/discount-coupon/discount-coupon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAO,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,IAAK,aAIJ;AAJD,WAAK,aAAa;IAChB,oCAAmB,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, JSX, Prop, State } from '@stencil/core';\nimport { api } from '../../../api';\nimport { I18nService } from '../../../i18n/i18n.service';\nimport { sessionState, SessionStore } from '../../../store/session.store';\nimport { formatAmountWithoutCurrency } from '../../../utils';\nimport { COLORS_ENUM } from '../../../utils/color-class-mapper';\n\nenum ACTION_STATUS {\n EDITING = 'editing',\n APPLIED = 'applied',\n NOT_APPLIED = 'not_applied',\n}\n\n@Component({\n tag: 'discount-coupon',\n styleUrl: 'discount-coupon.css',\n shadow: false,\n})\nexport class DiscountCoupon {\n @Element() el: HTMLElement;\n @Prop() hideLabel: boolean = false;\n @Prop() displayMode: 'editable' | 'readonly' = 'editable';\n @Prop() readonlyCouponCode?: string;\n @Prop() readonlyDiscountAmount?: number;\n @Prop() readonlyCurrency?: string;\n @State() couponCode: string = '';\n @State() actionStatus: ACTION_STATUS = ACTION_STATUS.NOT_APPLIED;\n @State() isLoading: boolean = false;\n @State() isError: boolean = false;\n @State() currentLocale: string = sessionState.currentLocale;\n @Event() discountApplied: EventEmitter<boolean>;\n private inputRef: HTMLRebillInputTextElement;\n private unsubscribeCurrentLocaleStore?: () => void;\n\n componentWillLoad() {\n this.unsubscribeCurrentLocaleStore = SessionStore.onChange('currentLocale', () => {\n this.currentLocale = sessionState.currentLocale;\n });\n\n if (this.readonlyCouponCode) {\n return;\n }\n\n if (\n sessionState.data.pricing.discountCouponCode &&\n sessionState.data.pricing.discountAmount > 0\n ) {\n this.actionStatus = ACTION_STATUS.APPLIED;\n this.couponCode = sessionState.data.pricing.discountCouponCode;\n }\n }\n\n disconnectedCallback() {\n if (this.unsubscribeCurrentLocaleStore) {\n this.unsubscribeCurrentLocaleStore();\n }\n }\n componentDidUpdate() {\n if (this.readonlyCouponCode) {\n return;\n }\n\n if (this.actionStatus === ACTION_STATUS.EDITING && this.inputRef) {\n setTimeout(async () => {\n const inputElement = await this.inputRef.getInputElement();\n if (inputElement) {\n inputElement.focus();\n }\n }, 0);\n }\n }\n\n private async onApplyCoupon() {\n if (this.readonlyCouponCode) return;\n const sessionId = sessionState.data.sessionId;\n if (!sessionId) {\n return;\n }\n this.isLoading = true;\n try {\n const response = await api.discountCoupon.applyDiscountCoupon({\n couponCode: this.couponCode,\n quantity: 1,\n sessionId: sessionId,\n organizationId: sessionState.data.organization.id,\n });\n this.actionStatus = ACTION_STATUS.APPLIED;\n SessionStore.setDiscount({\n couponCode: this.couponCode,\n amount: response.amount,\n discountType: response.discountType,\n discountAmount: response.discountedAmount,\n discountedPercentage: response?.discountedPercentage || 0,\n discountDuration: response?.discountDuration || null,\n });\n this.discountApplied.emit(true);\n } catch (error) {\n this.actionStatus = ACTION_STATUS.EDITING;\n this.discountApplied.emit(false);\n this.isError = true;\n SessionStore.setDiscount(null);\n } finally {\n this.isLoading = false;\n }\n }\n\n private onCancelCoupon() {\n if (this.readonlyCouponCode) return;\n this.actionStatus = ACTION_STATUS.NOT_APPLIED;\n this.couponCode = '';\n this.isError = false;\n }\n\n private renderCouponChip({\n couponCode,\n discountAmount,\n currency,\n readonly = false,\n onClick,\n onRemove,\n }: {\n couponCode?: string;\n discountAmount?: number | null;\n currency?: string | null;\n readonly?: boolean;\n onClick?: () => void;\n onRemove?: () => void;\n }): JSX.Element | null {\n if (!couponCode) {\n return null;\n }\n\n const hasDiscountAmount = typeof discountAmount === 'number';\n\n return (\n <div class={`coupon-chip${readonly ? ' coupon-chip--readonly' : ''}`}>\n <rebill-icon name=\"tag-sale\" size=\"16px\" />\n <div class=\"coupon-content\" onClick={!readonly ? onClick : undefined}>\n <rebill-typography variant=\"overline\" color={COLORS_ENUM.PRIMARY_DARK_TEXT}>\n {couponCode}\n </rebill-typography>\n {hasDiscountAmount && (\n <rebill-typography variant=\"overline\" color={COLORS_ENUM.GREEN}>\n -$\n {formatAmountWithoutCurrency(discountAmount as number, currency as any)}\n </rebill-typography>\n )}\n </div>\n {!readonly && onRemove && (\n <div class=\"coupon-close\" onClick={onRemove}>\n <rebill-icon name=\"x\" size=\"20px\" color={COLORS_ENUM.PRIMARY_DARK_TEXT} />\n </div>\n )}\n </div>\n );\n }\n\n private renderReadonlyView() {\n if (!this.readonlyCouponCode && this.readonlyDiscountAmount) {\n return null;\n }\n\n return this.renderCouponChip({\n couponCode: this.readonlyCouponCode,\n discountAmount: this.readonlyDiscountAmount ?? null,\n currency: this.readonlyCurrency ?? null,\n readonly: true,\n });\n }\n\n render() {\n if (this.readonlyCouponCode) {\n return this.renderReadonlyView();\n }\n\n return (\n <div>\n <div\n class=\"summary-row\"\n style={{\n alignItems: this.actionStatus === ACTION_STATUS.EDITING ? 'flex-start' : 'center',\n display: 'flex',\n }}\n >\n {!this.hideLabel && (\n <rebill-typography\n variant=\"body2\"\n style={{ marginTop: this.actionStatus === ACTION_STATUS.EDITING ? '7px' : '0px' }}\n >\n {I18nService.translate('discountCoupons.discount')}\n </rebill-typography>\n )}\n {this.actionStatus === ACTION_STATUS.NOT_APPLIED && (\n <rebill-button\n variant=\"filled\"\n size=\"small\"\n theme=\"primary-dark\"\n onClick={() => (this.actionStatus = ACTION_STATUS.EDITING)}\n >\n {I18nService.translate('discountCoupons.addDiscount')}\n </rebill-button>\n )}\n {this.actionStatus === ACTION_STATUS.EDITING && (\n <div class=\"summary-row\" style={{ alignItems: 'flex-start', display: 'flex' }}>\n <rebill-input-text\n ref={el => (this.inputRef = el)}\n id=\"discountCoupon\"\n value={this.couponCode}\n placeholder={I18nService.translate('discountCoupons.addDiscount')}\n disabled={this.isLoading}\n error={this.isError ? I18nService.translate('discountCoupons.error') : ''}\n clearable={true}\n uppercase={true}\n onInput={e => {\n e.stopPropagation();\n if (e.detail && e.detail.value !== undefined) {\n this.couponCode = e.detail.value;\n }\n }}\n onBlur={() => {\n if (!this.couponCode.trim()) {\n this.onCancelCoupon();\n }\n }}\n />\n <rebill-button\n variant=\"filled\"\n theme=\"primary-dark\"\n size=\"small\"\n loading={this.isLoading}\n disabled={this.isLoading || !this.couponCode.trim()}\n onClick={() => this.onApplyCoupon()}\n style={{ marginTop: this.actionStatus === ACTION_STATUS.EDITING ? '3px' : '0px' }}\n >\n {I18nService.translate('discountCoupons.apply')}\n </rebill-button>\n </div>\n )}\n {this.actionStatus === ACTION_STATUS.APPLIED &&\n this.renderCouponChip({\n couponCode: sessionState.data.pricing.discountCouponCode,\n discountAmount: sessionState.data.pricing.discountAmount,\n currency: sessionState.data.pricing.currency,\n onClick: () => (this.actionStatus = ACTION_STATUS.EDITING),\n onRemove: () => {\n this.actionStatus = ACTION_STATUS.NOT_APPLIED;\n this.couponCode = '';\n SessionStore.setDiscount(null);\n this.discountApplied.emit(false);\n },\n })}\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -445,7 +445,7 @@ export class RebillRenewal {
|
|
|
445
445
|
if (!renewalState.isInitialized) {
|
|
446
446
|
return h("div", { class: "loading" }, I18nService.translate('renewal.loading'));
|
|
447
447
|
}
|
|
448
|
-
const renderRenewalSummary = props => (h("renewal-summary", { totalAmount: renewalState.data.price.amount, currency: renewalState.data.price.currency, subscriptionTitle: renewalState.data.subscription.name[0]?.text || 'Subscription', subscriptionAmount: renewalState.data.subscription.amount, nextChargeDate: renewalState.data.subscription.nextChargeDate, frequency: renewalState.data.subscription.frequency, couponCode: renewalState.data.price.couponCode, discountAmount: renewalState.data.price.discountedAmount, discountPercentage: renewalState.data.price.discountPercentage, ...props }));
|
|
448
|
+
const renderRenewalSummary = props => (h("renewal-summary", { totalAmount: renewalState.data.price.amount, subTotalAmount: renewalState.data.subscription.subTotalAmount, currency: renewalState.data.price.currency, subscriptionTitle: renewalState.data.subscription.name[0]?.text || 'Subscription', subscriptionAmount: renewalState.data.subscription.amount, nextChargeDate: renewalState.data.subscription.nextChargeDate, frequency: renewalState.data.subscription.frequency, couponCode: renewalState.data.price.couponCode, discountAmount: renewalState.data.price.discountedAmount, discountPercentage: renewalState.data.price.discountPercentage, ...props }));
|
|
449
449
|
return (h(h.Fragment, null, h("rebill-processing-payment", { style: { display: this.isCardSubmitting ? 'block' : 'none' } }), this.isCardSuccess ? (h("renewal-success-page", { typePaymentMethod: this.currentPaymentMethod, paymentDate: this.getPaymentDate(), referenceNumber: this.getReferenceNumber(), cardLastFour: renewalState.data.subscription.cardLastFour, country: renewalState.data.price.country, paymentMethodName: PaymentMethodMapper.mapToAPMPaymentMethod(this.currentPaymentMethod, renewalState.data?.price?.country), bank: renewalState.form?.selectedBankId || '' })) : (h("rebill-checkout-form", { style: { display: this.isCardSubmitting || this.isCardSuccess ? 'none' : 'block' }, validationSchema: this.validationSchema, initialData: this.initialData, onSubmit: (args) => this.handleSubmit(args), renderForm: ({ submit, formData, errors }) => (h("div", { class: "rebill-checkout-renewal" }, h("div", { class: "left-section" }, h("div", { class: "left-section-container" }, h("organization-logo", { organization: renewalState.data.organization }), h("div", { class: "checkout-form-section" }, h("user-information-static", { userInfo: {
|
|
450
450
|
customerName: renewalState.data.subscription.customerName,
|
|
451
451
|
customerEmail: renewalState.data.subscription.customerEmail,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rebill-renewal.js","sourceRoot":"","sources":["../../../src/components/renewal/rebill-renewal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAW,MAAM,WAAW,CAAC;AAEzC,OAAO,EACL,eAAe,GAIhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,yDAAyD,CAAC;AACjE,OAAO,iEAAiE,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,M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AAM,EAAE,GACxB;oCAGF,oBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,gBAAgB,EACxB,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,mBAAmB,CAAC,GACnD,CACE,CACF;4BACN,qBACE,KAAK,EAAE;oCACL,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC;wCACpE,CAAC,CAAC,MAAM;wCACR,CAAC,CAAC,MAAM;iCACX,GACD,CACE,CACF;oBAGL,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAC/D,WAAK,KAAK,EAAC,eAAe;wBACxB,WAAK,KAAK,EAAC,0BAA0B,IAClC,oBAAoB,CAAC;4BACpB,mBAAmB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;yBACtD,CAAC,CACE,CACF,CACP,CACG,CACP,GACD,CACH,CACA,CACJ,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Prop, State } from '@stencil/core';\nimport * as yup from 'yup';\nimport { api, Country } from '../../api';\nimport { SavedCard } from '../../api/entities/cards/types';\nimport {\n CheckoutStatusE,\n CreateAPMCheckoutRequest,\n CreateAPMCheckoutResponse,\n CreateCardCheckoutRequest,\n} from '../../api/entities/checkout/types';\nimport '../../components/checkout/apm/apm-checkout/apm-checkout';\nimport '../../components/checkout/processing-payment/processing-payment';\nimport { I18nService } from '../../i18n/i18n.service';\n\nimport { PaymentMethodNameE } from '../../models/enums/payment-method-name.enum';\nimport { PAYMENT_METHOD_ENUM } from '../../models/enums/payment-methods.enum';\nimport { PaymentMessageE } from '../../models/enums/payment-status.enum';\nimport { onChange as renewalOnChange, renewalState, RenewalStore } from '../../store/renewal.store';\nimport { BREAKPOINT_ENUM, getBreakpoint, isBreakpointBelow } from '../../utils/breakpoint';\nimport { COLORS_ENUM } from '../../utils/color-class-mapper';\nimport { generateIdempotencyKey } from '../../utils/generate-idempotency-key';\nimport { GoogleMapsService } from '../../utils/google-maps.service';\nimport { AlertErrorKeys, PaymentErrorMapper } from '../../utils/payment-error-mapper';\nimport { PaymentMethodMapper } from '../../utils/payment-method-mapper';\nimport { getFieldValues, isFieldRequired } from '../../utils/required-fields-mappers';\nimport {\n AllRequiredFieldsMap,\n getAllRequiredFieldsRenewal,\n getRequiredFieldsForMethod,\n} from './utils/getRequiredFieldsRenewal';\n\n@Component({\n tag: 'rebill-renewal',\n styleUrl: 'rebill-renewal.css',\n shadow: false,\n})\nexport class RebillRenewal {\n @Prop() renewalData!: string;\n @Prop() renewalToken!: string;\n\n @State() currentPaymentMethod: PAYMENT_METHOD_ENUM = PAYMENT_METHOD_ENUM.CARD;\n @State() isSubmitting: boolean = false;\n @State() isCardSubmitting: boolean = false;\n @State() isCardSuccess: boolean = false;\n @State() errorMessage: AlertErrorKeys | null = null;\n @State() breakpoint: BREAKPOINT_ENUM = BREAKPOINT_ENUM.DESKTOP;\n @State() errorPaymentCard: boolean = false;\n @State() errorPaymentAPM: boolean = false;\n @State() initialData: any = {};\n @State() checkoutResponse: CreateAPMCheckoutResponse | null = null;\n @State() currentApmPaymentMethod: PaymentMethodNameE | null = null;\n @State() countries: Country[] = [];\n @State() allRequiredFields: AllRequiredFieldsMap = {};\n @State() currentRequiredFields: string[] = [];\n @State() errorCardInvalid: boolean = false;\n @State() cardMode: 'input' | 'select' | null = 'select';\n\n @Event() success: EventEmitter<any>;\n @Event() paymentError: EventEmitter<any>;\n @Event() paymentMethodSelected: EventEmitter<PAYMENT_METHOD_ENUM>;\n\n private validationSchema = {\n 'phoneNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('phoneNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.phoneRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-country': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-country', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.countryRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-state': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-state', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.stateRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-address': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-address', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.addressRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-city': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-city', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.cityRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-zip': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-zip', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.zipRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'bankId': yup.string().when([], {\n is: () => isFieldRequired('bankId', this.currentRequiredFields),\n then: schema => schema.required('validation.bankRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentType': yup.string().when([], {\n is: () =>\n isFieldRequired('documentType', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.documentTypeRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('documentNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema =>\n schema.required('validation.documentNumberRequired').min(7, 'validation.documentInvalid'),\n otherwise: schema => schema.notRequired(),\n }),\n };\n\n private resizeHandler = () => {\n this.breakpoint = getBreakpoint(window.innerWidth);\n };\n\n async componentWillLoad() {\n this.resizeHandler();\n window.addEventListener('resize', this.resizeHandler);\n\n const renewalProps =\n typeof this.renewalData === 'string' ? JSON.parse(this.renewalData) : this.renewalData;\n\n RenewalStore.initializeRenewal({\n ...renewalProps,\n token: this.renewalToken,\n });\n\n // Load Google Maps script for address autocomplete\n GoogleMapsService.loadGoogleMapsScript();\n\n // Load countries data\n try {\n const response = await api.data.getCountries();\n this.countries = response.data;\n } catch (error) {\n console.error('Error loading countries:', error);\n }\n\n // Load required fields data\n try {\n this.allRequiredFields = await getAllRequiredFieldsRenewal();\n } catch (error) {\n console.error('Error loading required fields:', error);\n }\n\n if (renewalState.data.paymentMethods.length > 0) {\n let defaultPaymentMethod: PAYMENT_METHOD_ENUM | null = null;\n\n if (renewalState.data.subscription?.paymentMethod) {\n const subscriptionPaymentMethod =\n renewalState.data.subscription.paymentMethod.toLowerCase();\n const mappedMethod =\n subscriptionPaymentMethod === 'card'\n ? PAYMENT_METHOD_ENUM.CARD\n : subscriptionPaymentMethod === 'bank_transfer'\n ? PAYMENT_METHOD_ENUM.BANK_TRANSFER\n : null;\n\n if (mappedMethod) {\n const isAvailable = renewalState.data.paymentMethods.some(pm => pm.type === mappedMethod);\n if (isAvailable) {\n defaultPaymentMethod = mappedMethod;\n }\n }\n }\n\n if (!defaultPaymentMethod) {\n defaultPaymentMethod = renewalState.data.paymentMethods[0].type as PAYMENT_METHOD_ENUM;\n }\n\n this.currentPaymentMethod = defaultPaymentMethod;\n RenewalStore.setSelectedPaymentMethod(defaultPaymentMethod);\n\n if (defaultPaymentMethod !== PAYMENT_METHOD_ENUM.CARD) {\n this.cardMode = 'input';\n RenewalStore.setCardMode('input');\n }\n\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n defaultPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n await this.initializeFingerprint(defaultPaymentMethod);\n }\n\n this.initialData = this.getInitialData();\n\n renewalOnChange('cardMode', () => {\n this.cardMode = renewalState.cardMode;\n });\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.resizeHandler);\n }\n\n @Listen('paymentMethodSelected')\n async handlePaymentMethodSelected(event: CustomEvent<PAYMENT_METHOD_ENUM>) {\n event.stopPropagation();\n\n if (this.currentPaymentMethod === event.detail) {\n return;\n }\n\n this.currentPaymentMethod = event.detail;\n RenewalStore.setSelectedPaymentMethod(this.currentPaymentMethod);\n\n // Change cardMode to 'input' if payment method is not CARD\n if (this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD) {\n this.cardMode = 'input';\n RenewalStore.setCardMode('input');\n }\n\n // Update required fields for the new payment method\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n this.currentPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n // Note: Fingerprint is handled in componentWillLoad\n\n // Initialize fingerprint for the new payment method\n await this.initializeFingerprint(this.currentPaymentMethod);\n\n this.paymentMethodSelected.emit(event.detail);\n }\n\n private async initializeFingerprint(paymentMethod: PAYMENT_METHOD_ENUM) {\n // Only initialize fingerprint for card payments and if not already generated\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD && !renewalState.deviceId) {\n try {\n const uuid = crypto.randomUUID();\n const fingerprintResponse = await api.fingerPrint.getFingerPrint(uuid);\n RenewalStore.setDeviceId(uuid);\n const script = fingerprintResponse.result.script;\n const scriptElement = document.createElement('script');\n scriptElement.innerHTML = script;\n document.body.appendChild(scriptElement);\n } catch (error) {\n console.error('Failed to initialize fingerprint:', error);\n }\n }\n }\n\n @Listen('bankSelected')\n handleBankSelected(event: CustomEvent<string>) {\n event.stopPropagation();\n RenewalStore.setSelectedBankId(event.detail);\n }\n\n @Listen('cardSelected')\n handleCardSelected(event: CustomEvent<{ card: SavedCard; cvv?: string }>) {\n const { card, cvv } = event.detail;\n RenewalStore.setSelectedCard(card);\n RenewalStore.setCvv(cvv || '');\n }\n\n private get currentPaymentError(): boolean {\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return this.errorPaymentCard;\n } else if (\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ) {\n return this.errorPaymentAPM;\n }\n return false;\n }\n\n private async handleSubmit(event?: CustomEvent) {\n if (this.isSubmitting) {\n return;\n }\n\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n await this.handleCardRenewal(event);\n } else {\n await this.handleAPMRenewal(event);\n }\n }\n\n private async handleCardRenewal(event?: CustomEvent) {\n const formData = event?.detail || this.getInitialData();\n\n if (!renewalState.data.cardId && !renewalState.data.cardTokenId) {\n this.errorCardInvalid = true;\n return;\n }\n if (!renewalState.data.cardInformation && !renewalState.data.cardId) {\n this.errorCardInvalid = true;\n return;\n }\n this.errorCardInvalid = false;\n this.isSubmitting = true;\n this.isCardSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const renewalRequest: CreateCardCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n ...(renewalState.data.cardId && { cardId: renewalState.data.cardId }),\n ...(renewalState.data.cardTokenId && { cardTokenId: renewalState.data.cardTokenId }),\n customAttributes: {\n ...(renewalState.deviceId && { deviceId: renewalState.deviceId }),\n },\n ...(this.cardMode === 'input' && {\n customer: {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName?.split(' ')[0],\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName?.split(' ').slice(1).join(' '),\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n },\n billingDetails: {\n address: {\n lineOne: formData['billing-address'] || '',\n city: formData['billing-city'] || '',\n state: formData['billing-state'] || '',\n country: formData['billing-country'] || '',\n zipCode: formData['billing-zip'] || '',\n },\n identification: {\n type: formData.documentType || '',\n value: formData.documentNumber || '',\n },\n },\n }),\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createCardCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n renewalState.token,\n );\n\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.isCardSuccess = false;\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: response.data.error?.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: error.data?.error?.message as PaymentMessageE,\n };\n }\n }\n\n private async handleAPMRenewal(event?: CustomEvent) {\n this.isSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const apmPaymentMethod = PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n );\n\n // Get form data for billing details and customer info\n const formData = event?.detail || this.getFormData();\n\n // Transform form data to match CreateAPMCheckoutRequest structure\n const billingDetails = {\n address: {\n country: formData['billing-country'],\n state: formData['billing-state'] || '',\n city: formData['billing-city'] || '',\n zipCode: formData['billing-zip'] || '',\n lineOne: formData['billing-address'] || '',\n },\n identification: {\n type: formData.documentType || 'dni',\n value: formData.documentNumber || '',\n },\n };\n\n const renewalRequest: CreateAPMCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n method: apmPaymentMethod,\n billingDetails,\n redirect: {\n approved: window.location.origin + '/renewal/success',\n rejected: window.location.origin + '/renewal/failure',\n },\n paymentMetadata: {\n orderId: renewalState.data.id,\n source: 'renewal-web',\n },\n customAttributes: {\n bank: formData.bankId || '',\n },\n // Remove targetCurrency for PSE payments as it's not supported\n ...(apmPaymentMethod !== PaymentMethodNameE.CO_TRANSFERENCE_PSE && {\n targetCurrency: renewalState.data.price.currency,\n }),\n };\n\n // Add customer data for renewal\n renewalRequest.customer = {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName.split(' ')[0] ||\n '',\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName.split(' ').slice(1).join(' ') ||\n '',\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createAPMCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n );\n\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n this.checkoutResponse = response.data;\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.paymentError.emit(response.data);\n RenewalStore.setCheckoutResponse(response.data);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: response.data?.error?.message as PaymentMessageE,\n message: response.data.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n this.paymentError.emit(error);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: error.data?.error?.message as PaymentMessageE,\n message: error.data?.error?.message,\n };\n }\n }\n\n private getFormData = () => {\n return this.initialData;\n };\n\n private getInitialData = () => {\n return {\n 'email': renewalState.data.subscription.customerEmail,\n 'fullName': renewalState.data.subscription.customerName,\n 'card': '',\n 'billing-country': '',\n 'billing-state': '',\n 'billing-address': '',\n 'billing-city': '',\n 'billing-zip': '',\n 'bankId': '',\n 'phoneNumber': '',\n 'countryCodePhoneNumber': '',\n 'documentType': '',\n 'documentNumber': '',\n };\n };\n\n private hasPrefilledAddress = () => {\n const billingFields = [\n 'billing-country',\n 'billing-state',\n 'billing-address',\n 'billing-city',\n 'billing-zip',\n ];\n return billingFields.some(key => {\n const value = this.initialData[key];\n return value && value.trim() !== '';\n });\n };\n\n private getPaymentDate = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n\n if ('date' in payment) {\n return payment.date as string;\n }\n\n return '';\n };\n\n private getReferenceNumber = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n if ('traceId' in payment) {\n return payment.traceId as string;\n }\n\n return '';\n };\n\n render() {\n if (!renewalState.isInitialized) {\n return <div class=\"loading\">{I18nService.translate('renewal.loading')}</div>;\n }\n\n const renderRenewalSummary = props => (\n <renewal-summary\n totalAmount={renewalState.data.price.amount}\n currency={renewalState.data.price.currency}\n subscriptionTitle={renewalState.data.subscription.name[0]?.text || 'Subscription'}\n subscriptionAmount={renewalState.data.subscription.amount}\n nextChargeDate={renewalState.data.subscription.nextChargeDate}\n frequency={renewalState.data.subscription.frequency}\n couponCode={renewalState.data.price.couponCode}\n discountAmount={renewalState.data.price.discountedAmount}\n discountPercentage={renewalState.data.price.discountPercentage}\n {...props}\n />\n );\n\n return (\n <>\n <rebill-processing-payment style={{ display: this.isCardSubmitting ? 'block' : 'none' }} />\n {this.isCardSuccess ? (\n <renewal-success-page\n typePaymentMethod={this.currentPaymentMethod}\n paymentDate={this.getPaymentDate()}\n referenceNumber={this.getReferenceNumber()}\n cardLastFour={renewalState.data.subscription.cardLastFour}\n country={renewalState.data.price.country}\n paymentMethodName={PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data?.price?.country,\n )}\n bank={renewalState.form?.selectedBankId || ''}\n />\n ) : (\n <rebill-checkout-form\n style={{ display: this.isCardSubmitting || this.isCardSuccess ? 'none' : 'block' }}\n validationSchema={this.validationSchema}\n initialData={this.initialData}\n onSubmit={(args: any) => this.handleSubmit(args)}\n renderForm={({ submit, formData, errors }) => (\n <div class=\"rebill-checkout-renewal\">\n <div class=\"left-section\">\n <div class=\"left-section-container\">\n <organization-logo organization={renewalState.data.organization} />\n\n <div class=\"checkout-form-section\">\n {/* Customer Information - Readonly */}\n <user-information-static\n userInfo={{\n customerName: renewalState.data.subscription.customerName,\n customerEmail: renewalState.data.subscription.customerEmail,\n }}\n />\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'header',\n })}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'details',\n })}\n\n {/* Payment Method Selection */}\n <div style={{ display: 'flex', flexDirection: 'column', gap: '32px' }}>\n <payment-method-selector\n enabledPaymentMethods={[\n ...new Set(\n renewalState.data.paymentMethods.map(\n pm => pm.type as PAYMENT_METHOD_ENUM,\n ),\n ),\n ]}\n defaultSelected={this.currentPaymentMethod}\n errorComponent={{\n showErrorComponent: this.currentPaymentError,\n alertTitle: PaymentErrorMapper.getErrorTitle(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n this.errorMessage?.alertTitle,\n ),\n message: PaymentErrorMapper.getErrorMessage(\n this.errorMessage?.message,\n this.currentPaymentMethod,\n renewalState.data.price.country,\n ),\n }}\n cardError={{\n showCardInvalid: this.errorCardInvalid,\n type: null,\n }}\n country={renewalState.data.price.country}\n documentTypeError={errors?.documentType}\n documentNumberError={errors?.documentNumber}\n showDocument={\n this.cardMode === 'input' &&\n (isFieldRequired('documentType', this.currentRequiredFields) ||\n isFieldRequired('documentNumber', this.currentRequiredFields))\n }\n />\n {/* Alert for non-card payment methods */}\n {this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD &&\n renewalState.data.subscription?.paymentMethod ===\n PAYMENT_METHOD_ENUM.CARD && (\n <rebill-alert\n type=\"info\"\n message={I18nService.translate('renewal.paymentMethodAlert', {\n cardLastFour:\n renewalState.data?.subscription?.cardLastFour || '****',\n })}\n icon=\"calendar-edit\"\n variant=\"outlined\"\n colorIcon={COLORS_ENUM.PRIMARY}\n />\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('bankId', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <rebill-bank-selector\n banks={\n getFieldValues(\n 'bank',\n this.allRequiredFields[this.currentPaymentMethod]?.original,\n ) || []\n }\n defaultSelectedBankId={formData.bankId || ''}\n error={errors?.bankId}\n />\n </div>\n )}\n </div>\n {this.cardMode === 'input' &&\n (isFieldRequired('billing-country', this.currentRequiredFields) ||\n isFieldRequired('billing-state', this.currentRequiredFields) ||\n isFieldRequired('billing-address', this.currentRequiredFields) ||\n isFieldRequired('billing-city', this.currentRequiredFields) ||\n isFieldRequired('billing-zip', this.currentRequiredFields)) && (\n <div class=\"animated-component slide-in\">\n <rebill-address\n countryOptions={this.countries.map(country => ({\n label: country.country,\n value: country.isoCountryCode,\n }))}\n billingView={this.hasPrefilledAddress() ? 'form' : 'search'}\n errors={{\n 'billing-country': errors['billing-country'],\n 'billing-state': errors['billing-state'],\n 'billing-address': errors['billing-address'],\n 'billing-city': errors['billing-city'],\n 'billing-zip': errors['billing-zip'],\n }}\n />\n </div>\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('phoneNumber', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <user-information-phone error={errors?.phoneNumber} />\n </div>\n )}\n\n {/* Show APM checkout response after successful payment submission */}\n {this.checkoutResponse?.result &&\n (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) && (\n <apm-checkout\n paymentMethod={this.currentPaymentMethod}\n referenceId={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH\n ? this.checkoutResponse.result.data.referenceId\n : undefined\n }\n qrCodeData={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ? this.checkoutResponse.result.data.qrCode\n : undefined\n }\n providerName={renewalState.data.organization?.name || ''}\n expirationDate={(() => {\n const expirationDate = new Date();\n expirationDate.setDate(expirationDate.getDate() + 30);\n return expirationDate.toISOString();\n })()}\n country={renewalState.data.price.country}\n redirectUrl={this.checkoutResponse.result.data.url}\n />\n )}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'summary',\n })}\n\n <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>\n {/* Payment Button */}\n <payment-button\n paymentMethod={this.currentPaymentMethod}\n isLoading={this.isSubmitting}\n isRenewal={true}\n trialPeriodDays={renewalState.data.subscription.trialPeriodDays}\n redirectUrl={!!this.checkoutResponse?.result?.data?.url}\n timeToRedirect={5000}\n country={renewalState.data.price.country}\n isDisabled={renewalState.fetchingInstallments}\n onSubmit={() => submit()}\n />\n\n {/* Disabled Button Below */}\n <rebill-alert\n type=\"secure\"\n variant=\"variant-secure\"\n icon=\"lock-outline\"\n message={I18nService.translate('otp.secureMessage')}\n />\n </div>\n </div>\n <rebill-footer\n style={{\n marginTop: isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP)\n ? '24px'\n : 'auto',\n }}\n />\n </div>\n </div>\n\n {/* Desktop Summary */}\n {!isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) && (\n <div class=\"right-section\">\n <div class=\"checkout-summary-section\">\n {renderRenewalSummary({\n displayedComponents: ['header', 'details', 'summary'],\n })}\n </div>\n </div>\n )}\n </div>\n )}\n />\n )}\n </>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rebill-renewal.js","sourceRoot":"","sources":["../../../src/components/renewal/rebill-renewal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAW,MAAM,WAAW,CAAC;AAEzC,OAAO,EACL,eAAe,GAIhB,MAAM,mCAAmC,CA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AAgB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EACvD,cAAc,EAAE,IAAI,EACpB,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EACxC,UAAU,EAAE,YAAY,CAAC,oBAAoB,EAC7C,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,GACxB;oCAGF,oBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,gBAAgB,EACxB,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,mBAAmB,CAAC,GACnD,CACE,CACF;4BACN,qBACE,KAAK,EAAE;oCACL,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC;wCACpE,CAAC,CAAC,MAAM;wCACR,CAAC,CAAC,MAAM;iCACX,GACD,CACE,CACF;oBAGL,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAC/D,WAAK,KAAK,EAAC,eAAe;wBACxB,WAAK,KAAK,EAAC,0BAA0B,IAClC,oBAAoB,CAAC;4BACpB,mBAAmB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;yBACtD,CAAC,CACE,CACF,CACP,CACG,CACP,GACD,CACH,CACA,CACJ,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Prop, State } from '@stencil/core';\nimport * as yup from 'yup';\nimport { api, Country } from '../../api';\nimport { SavedCard } from '../../api/entities/cards/types';\nimport {\n CheckoutStatusE,\n CreateAPMCheckoutRequest,\n CreateAPMCheckoutResponse,\n CreateCardCheckoutRequest,\n} from '../../api/entities/checkout/types';\nimport '../../components/checkout/apm/apm-checkout/apm-checkout';\nimport '../../components/checkout/processing-payment/processing-payment';\nimport { I18nService } from '../../i18n/i18n.service';\n\nimport { PaymentMethodNameE } from '../../models/enums/payment-method-name.enum';\nimport { PAYMENT_METHOD_ENUM } from '../../models/enums/payment-methods.enum';\nimport { PaymentMessageE } from '../../models/enums/payment-status.enum';\nimport { onChange as renewalOnChange, renewalState, RenewalStore } from '../../store/renewal.store';\nimport { BREAKPOINT_ENUM, getBreakpoint, isBreakpointBelow } from '../../utils/breakpoint';\nimport { COLORS_ENUM } from '../../utils/color-class-mapper';\nimport { generateIdempotencyKey } from '../../utils/generate-idempotency-key';\nimport { GoogleMapsService } from '../../utils/google-maps.service';\nimport { AlertErrorKeys, PaymentErrorMapper } from '../../utils/payment-error-mapper';\nimport { PaymentMethodMapper } from '../../utils/payment-method-mapper';\nimport { getFieldValues, isFieldRequired } from '../../utils/required-fields-mappers';\nimport {\n AllRequiredFieldsMap,\n getAllRequiredFieldsRenewal,\n getRequiredFieldsForMethod,\n} from './utils/getRequiredFieldsRenewal';\n\n@Component({\n tag: 'rebill-renewal',\n styleUrl: 'rebill-renewal.css',\n shadow: false,\n})\nexport class RebillRenewal {\n @Prop() renewalData!: string;\n @Prop() renewalToken!: string;\n\n @State() currentPaymentMethod: PAYMENT_METHOD_ENUM = PAYMENT_METHOD_ENUM.CARD;\n @State() isSubmitting: boolean = false;\n @State() isCardSubmitting: boolean = false;\n @State() isCardSuccess: boolean = false;\n @State() errorMessage: AlertErrorKeys | null = null;\n @State() breakpoint: BREAKPOINT_ENUM = BREAKPOINT_ENUM.DESKTOP;\n @State() errorPaymentCard: boolean = false;\n @State() errorPaymentAPM: boolean = false;\n @State() initialData: any = {};\n @State() checkoutResponse: CreateAPMCheckoutResponse | null = null;\n @State() currentApmPaymentMethod: PaymentMethodNameE | null = null;\n @State() countries: Country[] = [];\n @State() allRequiredFields: AllRequiredFieldsMap = {};\n @State() currentRequiredFields: string[] = [];\n @State() errorCardInvalid: boolean = false;\n @State() cardMode: 'input' | 'select' | null = 'select';\n\n @Event() success: EventEmitter<any>;\n @Event() paymentError: EventEmitter<any>;\n @Event() paymentMethodSelected: EventEmitter<PAYMENT_METHOD_ENUM>;\n\n private validationSchema = {\n 'phoneNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('phoneNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.phoneRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-country': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-country', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.countryRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-state': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-state', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.stateRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-address': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-address', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.addressRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-city': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-city', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.cityRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'billing-zip': yup.string().when([], {\n is: () =>\n isFieldRequired('billing-zip', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.zipRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'bankId': yup.string().when([], {\n is: () => isFieldRequired('bankId', this.currentRequiredFields),\n then: schema => schema.required('validation.bankRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentType': yup.string().when([], {\n is: () =>\n isFieldRequired('documentType', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema => schema.required('validation.documentTypeRequired'),\n otherwise: schema => schema.notRequired(),\n }),\n 'documentNumber': yup.string().when([], {\n is: () =>\n isFieldRequired('documentNumber', this.currentRequiredFields) && this.cardMode === 'input',\n then: schema =>\n schema.required('validation.documentNumberRequired').min(7, 'validation.documentInvalid'),\n otherwise: schema => schema.notRequired(),\n }),\n };\n\n private resizeHandler = () => {\n this.breakpoint = getBreakpoint(window.innerWidth);\n };\n\n async componentWillLoad() {\n this.resizeHandler();\n window.addEventListener('resize', this.resizeHandler);\n\n const renewalProps =\n typeof this.renewalData === 'string' ? JSON.parse(this.renewalData) : this.renewalData;\n\n RenewalStore.initializeRenewal({\n ...renewalProps,\n token: this.renewalToken,\n });\n\n // Load Google Maps script for address autocomplete\n GoogleMapsService.loadGoogleMapsScript();\n\n // Load countries data\n try {\n const response = await api.data.getCountries();\n this.countries = response.data;\n } catch (error) {\n console.error('Error loading countries:', error);\n }\n\n // Load required fields data\n try {\n this.allRequiredFields = await getAllRequiredFieldsRenewal();\n } catch (error) {\n console.error('Error loading required fields:', error);\n }\n\n if (renewalState.data.paymentMethods.length > 0) {\n let defaultPaymentMethod: PAYMENT_METHOD_ENUM | null = null;\n\n if (renewalState.data.subscription?.paymentMethod) {\n const subscriptionPaymentMethod =\n renewalState.data.subscription.paymentMethod.toLowerCase();\n const mappedMethod =\n subscriptionPaymentMethod === 'card'\n ? PAYMENT_METHOD_ENUM.CARD\n : subscriptionPaymentMethod === 'bank_transfer'\n ? PAYMENT_METHOD_ENUM.BANK_TRANSFER\n : null;\n\n if (mappedMethod) {\n const isAvailable = renewalState.data.paymentMethods.some(pm => pm.type === mappedMethod);\n if (isAvailable) {\n defaultPaymentMethod = mappedMethod;\n }\n }\n }\n\n if (!defaultPaymentMethod) {\n defaultPaymentMethod = renewalState.data.paymentMethods[0].type as PAYMENT_METHOD_ENUM;\n }\n\n this.currentPaymentMethod = defaultPaymentMethod;\n RenewalStore.setSelectedPaymentMethod(defaultPaymentMethod);\n\n if (defaultPaymentMethod !== PAYMENT_METHOD_ENUM.CARD) {\n this.cardMode = 'input';\n RenewalStore.setCardMode('input');\n }\n\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n defaultPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n await this.initializeFingerprint(defaultPaymentMethod);\n }\n\n this.initialData = this.getInitialData();\n\n renewalOnChange('cardMode', () => {\n this.cardMode = renewalState.cardMode;\n });\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.resizeHandler);\n }\n\n @Listen('paymentMethodSelected')\n async handlePaymentMethodSelected(event: CustomEvent<PAYMENT_METHOD_ENUM>) {\n event.stopPropagation();\n\n if (this.currentPaymentMethod === event.detail) {\n return;\n }\n\n this.currentPaymentMethod = event.detail;\n RenewalStore.setSelectedPaymentMethod(this.currentPaymentMethod);\n\n // Change cardMode to 'input' if payment method is not CARD\n if (this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD) {\n this.cardMode = 'input';\n RenewalStore.setCardMode('input');\n }\n\n // Update required fields for the new payment method\n try {\n this.currentRequiredFields = getRequiredFieldsForMethod(\n this.currentPaymentMethod,\n this.allRequiredFields,\n ).fields;\n } catch (error) {\n console.error('Error getting required fields for method:', error);\n }\n\n // Note: Fingerprint is handled in componentWillLoad\n\n // Initialize fingerprint for the new payment method\n await this.initializeFingerprint(this.currentPaymentMethod);\n\n this.paymentMethodSelected.emit(event.detail);\n }\n\n private async initializeFingerprint(paymentMethod: PAYMENT_METHOD_ENUM) {\n // Only initialize fingerprint for card payments and if not already generated\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD && !renewalState.deviceId) {\n try {\n const uuid = crypto.randomUUID();\n const fingerprintResponse = await api.fingerPrint.getFingerPrint(uuid);\n RenewalStore.setDeviceId(uuid);\n const script = fingerprintResponse.result.script;\n const scriptElement = document.createElement('script');\n scriptElement.innerHTML = script;\n document.body.appendChild(scriptElement);\n } catch (error) {\n console.error('Failed to initialize fingerprint:', error);\n }\n }\n }\n\n @Listen('bankSelected')\n handleBankSelected(event: CustomEvent<string>) {\n event.stopPropagation();\n RenewalStore.setSelectedBankId(event.detail);\n }\n\n @Listen('cardSelected')\n handleCardSelected(event: CustomEvent<{ card: SavedCard; cvv?: string }>) {\n const { card, cvv } = event.detail;\n RenewalStore.setSelectedCard(card);\n RenewalStore.setCvv(cvv || '');\n }\n\n private get currentPaymentError(): boolean {\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return this.errorPaymentCard;\n } else if (\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ) {\n return this.errorPaymentAPM;\n }\n return false;\n }\n\n private async handleSubmit(event?: CustomEvent) {\n if (this.isSubmitting) {\n return;\n }\n\n if (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n await this.handleCardRenewal(event);\n } else {\n await this.handleAPMRenewal(event);\n }\n }\n\n private async handleCardRenewal(event?: CustomEvent) {\n const formData = event?.detail || this.getInitialData();\n\n if (!renewalState.data.cardId && !renewalState.data.cardTokenId) {\n this.errorCardInvalid = true;\n return;\n }\n if (!renewalState.data.cardInformation && !renewalState.data.cardId) {\n this.errorCardInvalid = true;\n return;\n }\n this.errorCardInvalid = false;\n this.isSubmitting = true;\n this.isCardSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const renewalRequest: CreateCardCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n ...(renewalState.data.cardId && { cardId: renewalState.data.cardId }),\n ...(renewalState.data.cardTokenId && { cardTokenId: renewalState.data.cardTokenId }),\n customAttributes: {\n ...(renewalState.deviceId && { deviceId: renewalState.deviceId }),\n },\n ...(this.cardMode === 'input' && {\n customer: {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName?.split(' ')[0],\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName?.split(' ').slice(1).join(' '),\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n },\n billingDetails: {\n address: {\n lineOne: formData['billing-address'] || '',\n city: formData['billing-city'] || '',\n state: formData['billing-state'] || '',\n country: formData['billing-country'] || '',\n zipCode: formData['billing-zip'] || '',\n },\n identification: {\n type: formData.documentType || '',\n value: formData.documentNumber || '',\n },\n },\n }),\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createCardCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n renewalState.token,\n );\n\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.isCardSuccess = false;\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: response.data.error?.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n this.isCardSubmitting = false;\n RenewalStore.setLoading(false);\n\n this.errorPaymentCard = true;\n this.errorMessage = {\n message: error.data?.error?.message as PaymentMessageE,\n };\n }\n }\n\n private async handleAPMRenewal(event?: CustomEvent) {\n this.isSubmitting = true;\n RenewalStore.setLoading(true);\n\n try {\n const apmPaymentMethod = PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n );\n\n // Get form data for billing details and customer info\n const formData = event?.detail || this.getFormData();\n\n // Transform form data to match CreateAPMCheckoutRequest structure\n const billingDetails = {\n address: {\n country: formData['billing-country'],\n state: formData['billing-state'] || '',\n city: formData['billing-city'] || '',\n zipCode: formData['billing-zip'] || '',\n lineOne: formData['billing-address'] || '',\n },\n identification: {\n type: formData.documentType || 'dni',\n value: formData.documentNumber || '',\n },\n };\n\n const renewalRequest: CreateAPMCheckoutRequest = {\n transaction: {\n quantity: 1,\n },\n method: apmPaymentMethod,\n billingDetails,\n redirect: {\n approved: window.location.origin + '/renewal/success',\n rejected: window.location.origin + '/renewal/failure',\n },\n paymentMetadata: {\n orderId: renewalState.data.id,\n source: 'renewal-web',\n },\n customAttributes: {\n bank: formData.bankId || '',\n },\n // Remove targetCurrency for PSE payments as it's not supported\n ...(apmPaymentMethod !== PaymentMethodNameE.CO_TRANSFERENCE_PSE && {\n targetCurrency: renewalState.data.price.currency,\n }),\n };\n\n // Add customer data for renewal\n renewalRequest.customer = {\n firstName:\n formData.fullName?.split(' ')[0] ||\n renewalState.data.subscription.customerName.split(' ')[0] ||\n '',\n lastName:\n formData.fullName?.split(' ').slice(1).join(' ') ||\n renewalState.data.subscription.customerName.split(' ').slice(1).join(' ') ||\n '',\n email: formData.email || renewalState.data.subscription.customerEmail,\n phone: {\n countryCode: formData.countryCodePhoneNumber || '',\n number: formData.phoneNumber || '',\n },\n };\n\n const idempotencyKey = generateIdempotencyKey();\n const response = await api.checkout.createAPMCheckoutRequest(\n renewalState.data.id,\n idempotencyKey,\n renewalRequest,\n );\n\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n RenewalStore.setCheckoutResponse(response.data);\n this.checkoutResponse = response.data;\n if (response.data.result?.status.toUpperCase() === CheckoutStatusE.APPROVED) {\n this.isCardSuccess = true;\n } else {\n this.paymentError.emit(response.data);\n RenewalStore.setCheckoutResponse(response.data);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: response.data?.error?.message as PaymentMessageE,\n message: response.data.error?.message as PaymentMessageE,\n };\n }\n } catch (error: any) {\n this.isSubmitting = false;\n RenewalStore.setLoading(false);\n this.paymentError.emit(error);\n this.errorPaymentAPM = true;\n\n this.errorMessage = {\n alertTitle: error.data?.error?.message as PaymentMessageE,\n message: error.data?.error?.message,\n };\n }\n }\n\n private getFormData = () => {\n return this.initialData;\n };\n\n private getInitialData = () => {\n return {\n 'email': renewalState.data.subscription.customerEmail,\n 'fullName': renewalState.data.subscription.customerName,\n 'card': '',\n 'billing-country': '',\n 'billing-state': '',\n 'billing-address': '',\n 'billing-city': '',\n 'billing-zip': '',\n 'bankId': '',\n 'phoneNumber': '',\n 'countryCodePhoneNumber': '',\n 'documentType': '',\n 'documentNumber': '',\n };\n };\n\n private hasPrefilledAddress = () => {\n const billingFields = [\n 'billing-country',\n 'billing-state',\n 'billing-address',\n 'billing-city',\n 'billing-zip',\n ];\n return billingFields.some(key => {\n const value = this.initialData[key];\n return value && value.trim() !== '';\n });\n };\n\n private getPaymentDate = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n\n if ('date' in payment) {\n return payment.date as string;\n }\n\n return '';\n };\n\n private getReferenceNumber = (): string => {\n const payment = renewalState.form.checkoutResponse;\n if (!payment) return '';\n if ('traceId' in payment) {\n return payment.traceId as string;\n }\n\n return '';\n };\n\n render() {\n if (!renewalState.isInitialized) {\n return <div class=\"loading\">{I18nService.translate('renewal.loading')}</div>;\n }\n\n const renderRenewalSummary = props => (\n <renewal-summary\n totalAmount={renewalState.data.price.amount}\n subTotalAmount={renewalState.data.subscription.subTotalAmount}\n currency={renewalState.data.price.currency}\n subscriptionTitle={renewalState.data.subscription.name[0]?.text || 'Subscription'}\n subscriptionAmount={renewalState.data.subscription.amount}\n nextChargeDate={renewalState.data.subscription.nextChargeDate}\n frequency={renewalState.data.subscription.frequency}\n couponCode={renewalState.data.price.couponCode}\n discountAmount={renewalState.data.price.discountedAmount}\n discountPercentage={renewalState.data.price.discountPercentage}\n {...props}\n />\n );\n\n return (\n <>\n <rebill-processing-payment style={{ display: this.isCardSubmitting ? 'block' : 'none' }} />\n {this.isCardSuccess ? (\n <renewal-success-page\n typePaymentMethod={this.currentPaymentMethod}\n paymentDate={this.getPaymentDate()}\n referenceNumber={this.getReferenceNumber()}\n cardLastFour={renewalState.data.subscription.cardLastFour}\n country={renewalState.data.price.country}\n paymentMethodName={PaymentMethodMapper.mapToAPMPaymentMethod(\n this.currentPaymentMethod,\n renewalState.data?.price?.country,\n )}\n bank={renewalState.form?.selectedBankId || ''}\n />\n ) : (\n <rebill-checkout-form\n style={{ display: this.isCardSubmitting || this.isCardSuccess ? 'none' : 'block' }}\n validationSchema={this.validationSchema}\n initialData={this.initialData}\n onSubmit={(args: any) => this.handleSubmit(args)}\n renderForm={({ submit, formData, errors }) => (\n <div class=\"rebill-checkout-renewal\">\n <div class=\"left-section\">\n <div class=\"left-section-container\">\n <organization-logo organization={renewalState.data.organization} />\n\n <div class=\"checkout-form-section\">\n {/* Customer Information - Readonly */}\n <user-information-static\n userInfo={{\n customerName: renewalState.data.subscription.customerName,\n customerEmail: renewalState.data.subscription.customerEmail,\n }}\n />\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'header',\n })}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'details',\n })}\n\n {/* Payment Method Selection */}\n <div style={{ display: 'flex', flexDirection: 'column', gap: '32px' }}>\n <payment-method-selector\n enabledPaymentMethods={[\n ...new Set(\n renewalState.data.paymentMethods.map(\n pm => pm.type as PAYMENT_METHOD_ENUM,\n ),\n ),\n ]}\n defaultSelected={this.currentPaymentMethod}\n errorComponent={{\n showErrorComponent: this.currentPaymentError,\n alertTitle: PaymentErrorMapper.getErrorTitle(\n this.currentPaymentMethod,\n renewalState.data.price.country,\n this.errorMessage?.alertTitle,\n ),\n message: PaymentErrorMapper.getErrorMessage(\n this.errorMessage?.message,\n this.currentPaymentMethod,\n renewalState.data.price.country,\n ),\n }}\n cardError={{\n showCardInvalid: this.errorCardInvalid,\n type: null,\n }}\n country={renewalState.data.price.country}\n documentTypeError={errors?.documentType}\n documentNumberError={errors?.documentNumber}\n showDocument={\n this.cardMode === 'input' &&\n (isFieldRequired('documentType', this.currentRequiredFields) ||\n isFieldRequired('documentNumber', this.currentRequiredFields))\n }\n />\n {/* Alert for non-card payment methods */}\n {this.currentPaymentMethod !== PAYMENT_METHOD_ENUM.CARD &&\n renewalState.data.subscription?.paymentMethod ===\n PAYMENT_METHOD_ENUM.CARD && (\n <rebill-alert\n type=\"info\"\n message={I18nService.translate('renewal.paymentMethodAlert', {\n cardLastFour:\n renewalState.data?.subscription?.cardLastFour || '****',\n })}\n icon=\"calendar-edit\"\n variant=\"outlined\"\n colorIcon={COLORS_ENUM.PRIMARY}\n />\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('bankId', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <rebill-bank-selector\n banks={\n getFieldValues(\n 'bank',\n this.allRequiredFields[this.currentPaymentMethod]?.original,\n ) || []\n }\n defaultSelectedBankId={formData.bankId || ''}\n error={errors?.bankId}\n />\n </div>\n )}\n </div>\n {this.cardMode === 'input' &&\n (isFieldRequired('billing-country', this.currentRequiredFields) ||\n isFieldRequired('billing-state', this.currentRequiredFields) ||\n isFieldRequired('billing-address', this.currentRequiredFields) ||\n isFieldRequired('billing-city', this.currentRequiredFields) ||\n isFieldRequired('billing-zip', this.currentRequiredFields)) && (\n <div class=\"animated-component slide-in\">\n <rebill-address\n countryOptions={this.countries.map(country => ({\n label: country.country,\n value: country.isoCountryCode,\n }))}\n billingView={this.hasPrefilledAddress() ? 'form' : 'search'}\n errors={{\n 'billing-country': errors['billing-country'],\n 'billing-state': errors['billing-state'],\n 'billing-address': errors['billing-address'],\n 'billing-city': errors['billing-city'],\n 'billing-zip': errors['billing-zip'],\n }}\n />\n </div>\n )}\n {this.cardMode === 'input' &&\n isFieldRequired('phoneNumber', this.currentRequiredFields) && (\n <div class=\"animated-component fade-in\">\n <user-information-phone error={errors?.phoneNumber} />\n </div>\n )}\n\n {/* Show APM checkout response after successful payment submission */}\n {this.checkoutResponse?.result &&\n (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) && (\n <apm-checkout\n paymentMethod={this.currentPaymentMethod}\n referenceId={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH\n ? this.checkoutResponse.result.data.referenceId\n : undefined\n }\n qrCodeData={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER\n ? this.checkoutResponse.result.data.qrCode\n : undefined\n }\n providerName={renewalState.data.organization?.name || ''}\n expirationDate={(() => {\n const expirationDate = new Date();\n expirationDate.setDate(expirationDate.getDate() + 30);\n return expirationDate.toISOString();\n })()}\n country={renewalState.data.price.country}\n redirectUrl={this.checkoutResponse.result.data.url}\n />\n )}\n\n {isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) &&\n renderRenewalSummary({\n displayedComponents: 'summary',\n })}\n\n <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>\n {/* Payment Button */}\n <payment-button\n paymentMethod={this.currentPaymentMethod}\n isLoading={this.isSubmitting}\n isRenewal={true}\n trialPeriodDays={renewalState.data.subscription.trialPeriodDays}\n redirectUrl={!!this.checkoutResponse?.result?.data?.url}\n timeToRedirect={5000}\n country={renewalState.data.price.country}\n isDisabled={renewalState.fetchingInstallments}\n onSubmit={() => submit()}\n />\n\n {/* Disabled Button Below */}\n <rebill-alert\n type=\"secure\"\n variant=\"variant-secure\"\n icon=\"lock-outline\"\n message={I18nService.translate('otp.secureMessage')}\n />\n </div>\n </div>\n <rebill-footer\n style={{\n marginTop: isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP)\n ? '24px'\n : 'auto',\n }}\n />\n </div>\n </div>\n\n {/* Desktop Summary */}\n {!isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) && (\n <div class=\"right-section\">\n <div class=\"checkout-summary-section\">\n {renderRenewalSummary({\n displayedComponents: ['header', 'details', 'summary'],\n })}\n </div>\n </div>\n )}\n </div>\n )}\n />\n )}\n </>\n );\n }\n}\n"]}
|
|
@@ -161,13 +161,15 @@ export class RenewalSuccessPage {
|
|
|
161
161
|
email: renewalState.data.subscription.customerEmail || '',
|
|
162
162
|
referenceNumber: this.referenceNumber,
|
|
163
163
|
productTitle: renewalState.data.subscription.name[0]?.text || 'Subscription',
|
|
164
|
-
subtotal:
|
|
165
|
-
total:
|
|
164
|
+
subtotal: formatAmount(renewalState.data.subscription.subTotalAmount, renewalState.data.price.currency),
|
|
165
|
+
total: formatAmount(renewalState.data.price.amount, renewalState.data.price.currency),
|
|
166
166
|
currency: renewalState.data.price.currency || ' ',
|
|
167
|
-
|
|
167
|
+
...(this.getDiscountAmountValue() > 0 && {
|
|
168
|
+
discountAmount: formatAmount(this.getDiscountAmountValue(), renewalState.data.price.currency),
|
|
169
|
+
}),
|
|
168
170
|
trialPeriodDays: this.trialPeriodDays,
|
|
169
171
|
debitDay: this.debitDay,
|
|
170
|
-
planAmount:
|
|
172
|
+
planAmount: formatAmount(this.planAmount, renewalState.data.price.currency),
|
|
171
173
|
isBankTransfer: this.typePaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER,
|
|
172
174
|
});
|
|
173
175
|
}
|
|
@@ -176,37 +178,13 @@ export class RenewalSuccessPage {
|
|
|
176
178
|
}
|
|
177
179
|
};
|
|
178
180
|
getDiscountAmountValue = () => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return discountAmount;
|
|
182
|
-
}
|
|
183
|
-
const discountPercentage = renewalState?.data?.price?.discountPercentage;
|
|
184
|
-
if (discountPercentage && discountPercentage > 0) {
|
|
185
|
-
const subtotal = renewalState?.data?.price?.amount || 0;
|
|
186
|
-
return Math.max(0, (subtotal * discountPercentage) / 100);
|
|
181
|
+
if (renewalState?.data?.price?.amount < renewalState?.data?.subscription?.subTotalAmount) {
|
|
182
|
+
return renewalState?.data?.subscription?.subTotalAmount - renewalState?.data?.price?.amount;
|
|
187
183
|
}
|
|
188
184
|
return 0;
|
|
189
185
|
};
|
|
190
|
-
hasDiscount = () =>
|
|
191
|
-
|
|
192
|
-
if (!this.hasDiscount()) {
|
|
193
|
-
return undefined;
|
|
194
|
-
}
|
|
195
|
-
const formattedAmount = formatAmount(this.getDiscountAmountValue(), renewalState.data.price.currency);
|
|
196
|
-
return `-${formattedAmount}`;
|
|
197
|
-
};
|
|
198
|
-
getFormattedSubtotal = (planAmount) => {
|
|
199
|
-
const subtotal = planAmount ?? renewalState.data.price.amount ?? 0;
|
|
200
|
-
return formatAmount(subtotal, renewalState.data.price.currency);
|
|
201
|
-
};
|
|
202
|
-
getFormattedTotal = () => {
|
|
203
|
-
if (this.trialPeriodDays > 0) {
|
|
204
|
-
return formatAmount(0, renewalState.data.price.currency);
|
|
205
|
-
}
|
|
206
|
-
const subtotal = renewalState.data.price.amount || 0;
|
|
207
|
-
const discount = this.getDiscountAmountValue();
|
|
208
|
-
const total = Math.max(subtotal - discount, 0);
|
|
209
|
-
return formatAmount(total, renewalState.data.price.currency);
|
|
186
|
+
hasDiscount = () => {
|
|
187
|
+
return this.getDiscountAmountValue() > 0;
|
|
210
188
|
};
|
|
211
189
|
textPaymentMethodCard = () => {
|
|
212
190
|
const cardBrand = renewalState.data?.cardInformation?.brand;
|
|
@@ -215,9 +193,9 @@ export class RenewalSuccessPage {
|
|
|
215
193
|
return cardBrand && cardLastFour ? `${formattedBrand} - ${cardLastFour}` : formattedBrand;
|
|
216
194
|
};
|
|
217
195
|
render() {
|
|
218
|
-
return (h("rebill-checkout-single-column", { key: '
|
|
196
|
+
return (h("rebill-checkout-single-column", { key: 'cb90cb24d93fb4245e4eaf3cdeeab4e278b2c546' }, h("div", { key: '20e031f6307df3ffeceb32ff4bf1337ac54ad098', class: "renewal-success-page__success-content" }, h("rebill-typography", { key: '199431628bf2461d82397f04146f5f830d5ed88f', variant: "h3", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, I18nService.translate('processing.successTitle')), h("div", { key: '761a4e40d5b1653a3cd3e9b667027025b19dacf0', class: "renewal-success-page__success-icon" }, h("svg", { key: '35c1f8a00382da91c35813c086a13236ef64d150', width: isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) ? '64' : '96', height: isBreakpointBelow(this.breakpoint, BREAKPOINT_ENUM.DESKTOP) ? '64' : '96', viewBox: "0 0 96 96", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'eba561010f527546317c5a5368364e3b7d88a8d8', "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7.99219 47.998C7.99219 25.9067 25.9008 7.99805 47.9922 7.99805C70.0836 7.99805 87.9922 25.9067 87.9922 47.998C87.9922 70.0894 70.0836 87.998 47.9922 87.998C25.9008 87.998 7.99219 70.0894 7.99219 47.998ZM61.5401 39.2645C62.2396 38.4096 62.1136 37.1496 61.2587 36.4501C60.4038 35.7507 59.1437 35.8767 58.4443 36.7316L41.8437 57.0211L35.4064 50.5838C34.6254 49.8028 33.359 49.8028 32.578 50.5838C31.7969 51.3649 31.7969 52.6312 32.578 53.4123L40.578 61.4123C40.9775 61.8118 41.5275 62.0237 42.0918 61.9956C42.6562 61.9674 43.1823 61.7019 43.5401 61.2645L61.5401 39.2645Z", fill: "#35B093" }))), h("div", { key: '82ac13c8d26f7ac58c28e8b49518abe140749561', class: "renewal-success-page__info-card" }, h("div", { key: '0b1c283d679bf968265a23b67fd8821c9a1a57db', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: 'ca1a8d98b07b2a681cf630f09d047a0c60063be6', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.paymentMethod')), h("div", { key: '4449bcb86cddf6316f570bad14b240f3e328ae99', class: "renewal-success-page__card-value" }, h("div", { key: '4858d10857b00244122145864cc92906abdcd24a', class: "renewal-success-page__payment-method-display" }, this.typePaymentMethod === PAYMENT_METHOD_ENUM.CARD && (h(h.Fragment, null, h("rebill-card-icon", { key: 'b64cfc5c69e3c0627f361650f039e06329c9004e', "card-brand": renewalState.data?.cardInformation?.brand || '' }), h("rebill-typography", { key: '7ef5fc2219158df995dfbcab3ecd35291ce6d1eb', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, this.textPaymentMethodCard()))), this.typePaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER && (h("div", { key: '9759c64a9ca925f6ad3ebe5be536451a2e7b8e9c', style: { display: 'flex', alignItems: 'center', gap: '8px' } }, h("div", { key: '9b8b9987a82403e24f355fd68ca625d5ac6be0d0', style: { display: 'flex', alignItems: 'center', gap: '8px' } }, this.getPaymentMethodConfig(PAYMENT_METHOD_ENUM.BANK_TRANSFER).icons.map(iconName => {
|
|
219
197
|
return h("rebill-icon", { name: iconName, size: "24px" });
|
|
220
|
-
})), h("rebill-typography", { key: '
|
|
198
|
+
})), h("rebill-typography", { key: 'b830a51f477da38f4fad6d861d56d8473eedc1e0', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, I18nService.translate('paymentMethods.bank_transfer'))))))), h("div", { key: '9f336dc44b09b227dca8d55f7543af8d6965340e', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: '54487e54a1d044044748d39e838f0bcedc1806db', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.paymentDate')), h("rebill-typography", { key: 'f90cb87eaad022c8e4e8a7fd50b6efc98e96e5fb', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, formatDateTime(this.paymentDate || this.getPaymentDate()) || '')), h("div", { key: '4f5dd152b68e4bf8f09929fc459204c9c9316c7d', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: '977d12ffd4f81822f16e040f36380354569a38ee', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.paymentEmail')), h("rebill-typography", { key: '62e10631ec66d641f7c2a2e18aecd583d14d51d1', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, renewalState.data.subscription.customerEmail)), h("div", { key: 'ef143339c11f42d47d5c29dcb77f432a6ab522ab', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: 'd7f341310f59a3f15a112cdcd393f60dd762f742', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.paymentReference')), h("rebill-typography", { key: '06c82cbdede33d774212a283229e51a27de9526f', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT, class: "renewal-success-page__reference-number" }, this.referenceNumber || ''))), h("div", { key: '6e1dc249302831b6d86174d69c766d4149e532d0', class: "renewal-success-page__info-card" }, h("rebill-typography", { key: 'b9c21efa101829c13f8cc13518c55769fdf2f210', variant: "subtitle-bold", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, I18nService.translate('processing.purchaseDetails')), h("div", { key: '28d67a7e5b44c05d5c4d795c0293c841ee5b220f', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: '907bb77f52600cff2d1cfd9cc66653d5a62f1d8a', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.purchaseDetail')), h("rebill-typography", { key: 'ae917b6621a7e550793f363f64854cccc9c676c5', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, renewalState.data.subscription.name[0]?.text || 'Subscription')), h("div", { key: '5aee63e2757c447c31a554563bc3bfe4442e9727', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: 'dfd32d9e61e6671ae0ccd7204efc0dc957ce6f5f', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.purchaseSubtotal')), h("rebill-typography", { key: '60d4e2c5d2a9907c7676692f123b9ac809726636', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, formatAmount(renewalState.data.subscription.subTotalAmount, renewalState.data.price.currency))), this.hasDiscount() && (h("div", { key: 'c2b4d3539da9811e82e14f00e40995813642e281', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: '4cc407db9e8654592ac8961793ac16c5c8bdc650', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('summary.discount')), h("rebill-typography", { key: '8767ff24390fd66f61a3007ec5c89b23f4d15708', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, formatAmount(this.getDiscountAmountValue(), renewalState.data.price.currency)))), h("div", { key: '6f58d05abb853a328a91bfb773f2efbb46ddf766', class: "renewal-success-page__card-row" }, h("rebill-typography", { key: '1b07af9baa275addf2270e9ebb652021ba3af2ad', variant: "body2", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.purchaseMontoTotal')), h("div", { key: '01c846178f5a87baf3cebe47f373e93b415fd9fb', class: "renewal-success-page__total-amount-container" }, h("rebill-typography", { key: '570f795573812b983aacd716fc95892c16ddb66f', variant: "body2", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, formatAmount(renewalState.data.price.amount, renewalState.data.price.currency)))), h("div", { key: '101e06be84246481dd7fb120b4e64df6656382e7', class: "renewal-success-page__card-divider" }), h("div", { key: 'bad8e69d95ee7befdb613246328ff6ef9556cf9d', class: "renewal-success-page__download-container" }, h("svg", { key: '97b4a2ac69de811ce0881b577cd0c3bc39e13c14', class: "download-icon", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '31afab13c012655e05413f5cf15d2545b3ac835e', d: "M13.498 9.83333V12.1667C13.498 12.903 12.9011 13.5 12.1647 13.5H3.83138C3.095 13.5 2.49805 12.903 2.49805 12.1667V9.83333M7.99804 10V2.5M7.99804 10L5.66471 7.66667M7.99804 10L10.3314 7.66667", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round" })), h("rebill-button", { key: '335a6328a75c0474ff6983bc0c3be5f8fdd62033', type: "button", variant: "download", size: "small", onClick: this.handleDownloadReceipt }, h("rebill-typography", { key: '9d5427cb68781fe7b8202639ea9ef8f0fc13c6ed', variant: "overline", color: COLORS_ENUM.PRIMARY_DARK_TEXT }, I18nService.translate('processing.download')))), h("div", { key: '1fba619b28bac4f85e2f00a7a227c91a4352f9b7', class: "renewal-success-page__contact-info" }, h("rebill-typography", { key: '942aee63c06bc040ea304545ddf0dfc64235102a', variant: "information-text", color: COLORS_ENUM.SECONDARY }, I18nService.translate('processing.downloadDescription')))))));
|
|
221
199
|
}
|
|
222
200
|
static get is() { return "renewal-success-page"; }
|
|
223
201
|
static get originalStyleUrls() {
|