rebill-web-components-sdk 1.10.12 → 1.11.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cjs/index-C-VTnc0I.js.map +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/rebill-checkout.cjs.entry.js +147 -40
  4. package/dist/cjs/rebill-checkout.entry.cjs.js.map +1 -1
  5. package/dist/cjs/rebill-renewal.cjs.entry.js +17 -9
  6. package/dist/cjs/rebill-renewal.entry.cjs.js.map +1 -1
  7. package/dist/cjs/rebill-web-components-sdk.cjs.js +1 -1
  8. package/dist/collection/components/checkout/rebill-checkout.js +49 -40
  9. package/dist/collection/components/checkout/rebill-checkout.js.map +1 -1
  10. package/dist/collection/components/renewal/rebill-renewal.js +17 -9
  11. package/dist/collection/components/renewal/rebill-renewal.js.map +1 -1
  12. package/dist/collection/utils/index.js +2 -0
  13. package/dist/collection/utils/index.js.map +1 -1
  14. package/dist/collection/utils/resource-injector.js +118 -0
  15. package/dist/collection/utils/resource-injector.js.map +1 -0
  16. package/dist/components/p-8BpuJ_V5.js.map +1 -1
  17. package/dist/components/rebill-checkout.js +148 -40
  18. package/dist/components/rebill-checkout.js.map +1 -1
  19. package/dist/components/rebill-renewal.js +17 -9
  20. package/dist/components/rebill-renewal.js.map +1 -1
  21. package/dist/esm/index-BTZ7D7jU.js.map +1 -1
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/rebill-checkout.entry.js +147 -40
  24. package/dist/esm/rebill-checkout.entry.js.map +1 -1
  25. package/dist/esm/rebill-renewal.entry.js +17 -9
  26. package/dist/esm/rebill-renewal.entry.js.map +1 -1
  27. package/dist/esm/rebill-web-components-sdk.js +1 -1
  28. package/dist/rebill-web-components-sdk/{p-ecd698bc.entry.js → p-11b3fc35.entry.js} +2 -2
  29. package/dist/rebill-web-components-sdk/p-11b3fc35.entry.js.map +1 -0
  30. package/dist/rebill-web-components-sdk/p-457f405c.entry.js +2 -0
  31. package/dist/rebill-web-components-sdk/p-457f405c.entry.js.map +1 -0
  32. package/dist/rebill-web-components-sdk/p-BTZ7D7jU.js.map +1 -1
  33. package/dist/rebill-web-components-sdk/rebill-checkout.entry.esm.js.map +1 -1
  34. package/dist/rebill-web-components-sdk/rebill-renewal.entry.esm.js.map +1 -1
  35. package/dist/rebill-web-components-sdk/rebill-web-components-sdk.esm.js +1 -1
  36. package/dist/types/components/checkout/rebill-checkout.d.ts +14 -0
  37. package/dist/types/components.d.ts +8 -0
  38. package/dist/types/utils/index.d.ts +1 -0
  39. package/dist/types/utils/resource-injector.d.ts +29 -0
  40. package/package.json +1 -1
  41. package/dist/rebill-web-components-sdk/p-4b4e2e73.entry.js +0 -2
  42. package/dist/rebill-web-components-sdk/p-4b4e2e73.entry.js.map +0 -1
  43. package/dist/rebill-web-components-sdk/p-ecd698bc.entry.js.map +0 -1
@@ -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;AAGtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,QAAQ,IAAI,eAA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,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 { STATUS_REQ_CHECKOUT_APM } from '../../models/enums/status-req-checkout-apm.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 const baseSchema = schema.required('validation.documentNumberRequired').min(7, 'validation.documentInvalid');\n\n // For BR checkout, validate that document number contains only digits\n if (renewalState.data?.price?.country === 'BR') {\n return baseSchema.test(\n 'numeric-only',\n 'validation.documentNumberNumericOnly',\n value => {\n if (!value) return true; // Let required validation handle empty values\n return /^\\d+$/.test(value);\n }\n );\n }\n\n return baseSchema;\n },\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 };\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 const status = response.data.result?.status?.toString().toLowerCase();\n const isApproved = status === CheckoutStatusE.APPROVED.toLowerCase();\n const isPendingCustomerCharge = status === STATUS_REQ_CHECKOUT_APM.PENDING_CUSTOMER_CHARGE;\n\n if (isApproved) {\n this.isCardSuccess = true;\n this.errorPaymentAPM = false;\n this.errorMessage = null;\n } else if (isPendingCustomerCharge) {\n // Keep showing the QR/URL without showing an error for pending Pix payments\n this.isCardSuccess = false;\n this.errorPaymentAPM = false;\n this.errorMessage = null;\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 private get isAPMCheckoutVisible(): boolean {\n return (\n !this.isCardSuccess &&\n !this.errorPaymentAPM &&\n !!this.checkoutResponse?.result &&\n (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER)\n );\n }\n\n /**\n * Listen for payment status changes emitted by the APM checkout component (polling).\n * Mirrors the behavior in the main checkout flow so Pix/transfer renewals update when approved/rejected.\n */\n private handlePaymentStatusChange = (statusData: {\n status: STATUS_REQ_CHECKOUT_APM;\n isCompleted: boolean;\n data: any;\n }) => {\n if (statusData.isCompleted) {\n if (statusData.status === STATUS_REQ_CHECKOUT_APM.APPROVED) {\n this.isCardSuccess = true;\n this.errorPaymentAPM = false;\n this.errorMessage = null;\n this.success.emit({\n paymentMethod: this.currentPaymentMethod,\n data: this.checkoutResponse,\n });\n } else if (statusData.status === STATUS_REQ_CHECKOUT_APM.REJECTED) {\n this.errorPaymentAPM = true;\n this.errorMessage = {\n alertTitle: PaymentMessageE.APM_ERROR_GENERIC,\n message: PaymentMessageE.APM_MESSAGE_ERROR,\n };\n }\n }\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible && (\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 code={this.checkoutResponse?.result?.data?.code}\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 checkoutRequestId={this.checkoutResponse?.result?.checkoutRequestId}\n bearerToken={this.checkoutResponse?.result?.data?.bearerToken}\n onPaymentStatusChange={event =>\n this.handlePaymentStatusChange(event.detail)\n }\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 {!this.isAPMCheckoutVisible && (\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\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,CAAC;AAC3C,OAAO,yDAAyD,CAAC;AACjE,OAAO,iEAAiE,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpG,OA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AgB,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 { STATUS_REQ_CHECKOUT_APM } from '../../models/enums/status-req-checkout-apm.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 const baseSchema = schema.required('validation.documentNumberRequired').min(7, 'validation.documentInvalid');\n\n // For BR checkout, validate that document number contains only digits\n if (renewalState.data?.price?.country === 'BR') {\n return baseSchema.test(\n 'numeric-only',\n 'validation.documentNumberNumericOnly',\n value => {\n if (!value) return true; // Let required validation handle empty values\n return /^\\d+$/.test(value);\n }\n );\n }\n\n return baseSchema;\n },\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 };\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 const status = response.data.result?.status?.toString().toLowerCase();\n const isApproved = status === CheckoutStatusE.APPROVED.toLowerCase();\n const isPendingCustomerCharge = status === STATUS_REQ_CHECKOUT_APM.PENDING_CUSTOMER_CHARGE;\n\n if (isApproved) {\n this.isCardSuccess = true;\n this.errorPaymentAPM = false;\n this.errorMessage = null;\n } else if (isPendingCustomerCharge) {\n // Keep showing the QR/URL without showing an error for pending Pix payments\n this.isCardSuccess = false;\n this.errorPaymentAPM = false;\n this.errorMessage = null;\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 private get isAPMCheckoutVisible(): boolean {\n return (\n !this.isCardSuccess &&\n !this.errorPaymentAPM &&\n !!this.checkoutResponse?.result &&\n (this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH ||\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER)\n );\n }\n\n /**\n * Listen for payment status changes emitted by the APM checkout component (polling).\n * Mirrors the behavior in the main checkout flow so Pix/transfer renewals update when approved/rejected.\n */\n private handlePaymentStatusChange = (statusData: {\n status: STATUS_REQ_CHECKOUT_APM;\n isCompleted: boolean;\n data: any;\n }) => {\n if (statusData.isCompleted) {\n if (statusData.status === STATUS_REQ_CHECKOUT_APM.APPROVED) {\n this.isCardSuccess = true;\n this.errorPaymentAPM = false;\n this.errorMessage = null;\n this.success.emit({\n paymentMethod: this.currentPaymentMethod,\n data: this.checkoutResponse,\n });\n } else if (statusData.status === STATUS_REQ_CHECKOUT_APM.REJECTED) {\n this.errorPaymentAPM = true;\n this.errorMessage = {\n alertTitle: PaymentMessageE.APM_ERROR_GENERIC,\n message: PaymentMessageE.APM_MESSAGE_ERROR,\n };\n }\n }\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible &&\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.isAPMCheckoutVisible &&\n (() => {\n const isBoleto =\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH &&\n renewalState.data?.price?.country === 'BR' &&\n this.checkoutResponse?.result?.data?.barcode;\n\n return (\n <apm-checkout\n paymentMethod={this.currentPaymentMethod}\n barcode={\n isBoleto\n ? this.checkoutResponse?.result?.data?.barcode\n : undefined\n }\n referenceId={\n this.currentPaymentMethod === PAYMENT_METHOD_ENUM.CASH && !isBoleto\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 code={this.checkoutResponse?.result?.data?.code}\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 checkoutRequestId={this.checkoutResponse?.result?.checkoutRequestId}\n bearerToken={this.checkoutResponse?.result?.data?.bearerToken}\n onPaymentStatusChange={event =>\n this.handlePaymentStatusChange(event.detail)\n }\n />\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 {!this.isAPMCheckoutVisible && (\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\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"]}
@@ -25,4 +25,6 @@ export * from './stencil-wrapper';
25
25
  // Export email validation utilities
26
26
  export * from './email-validation';
27
27
  export * from './email-validation.constants';
28
+ // Export resource injection utilities
29
+ export * from './resource-injector';
28
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,cAAc,mBAAmB,CAAC;AAElC,uCAAuC;AACvC,cAAc,sBAAsB,CAAC;AAErC,6BAA6B;AAC7B,cAAc,uBAAuB,CAAC;AAEtC,2BAA2B;AAC3B,cAAc,WAAW,CAAC;AAE1B,kCAAkC;AAClC,cAAc,iBAAiB,CAAC;AAEhC,qCAAqC;AACrC,cAAc,qBAAqB,CAAC;AAEpC,mCAAmC;AACnC,cAAc,4BAA4B,CAAC;AAE3C,6BAA6B;AAC7B,cAAc,aAAa,CAAC;AAE5B,uBAAuB;AACvB,cAAc,SAAS,CAAC;AACxB,mCAAmC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,0BAA0B;AAC1B,cAAc,UAAU,CAAC;AAEzB,mCAAmC;AACnC,cAAc,mBAAmB,CAAC;AAElC,oCAAoC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC","sourcesContent":["// Export form validation utilities\nexport * from './form-validation';\n\n// Export currency formatting utilities\nexport * from './currency-formatter';\n\n// Export Google Maps service\nexport * from './google-maps.service';\n\n// Export QR code utilities\nexport * from './qr-code';\n\n// Export PDF generation utilities\nexport * from './pdf-generator';\n\n// Export download template utilities\nexport * from './download-template';\n\n// Export idempotency key utilities\nexport * from './generate-idempotency-key';\n\n// Export clipboard utilities\nexport * from './clipboard';\n\n// Export OTP utilities\nexport * from './timer';\n// Export date formatting utilities\nexport * from './date-formatter';\n\n// Export assets utilities\nexport * from './assets';\n\n// Export stencil wrapper utilities\nexport * from './stencil-wrapper';\n\n// Export email validation utilities\nexport * from './email-validation';\nexport * from './email-validation.constants';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,cAAc,mBAAmB,CAAC;AAElC,uCAAuC;AACvC,cAAc,sBAAsB,CAAC;AAErC,6BAA6B;AAC7B,cAAc,uBAAuB,CAAC;AAEtC,2BAA2B;AAC3B,cAAc,WAAW,CAAC;AAE1B,kCAAkC;AAClC,cAAc,iBAAiB,CAAC;AAEhC,qCAAqC;AACrC,cAAc,qBAAqB,CAAC;AAEpC,mCAAmC;AACnC,cAAc,4BAA4B,CAAC;AAE3C,6BAA6B;AAC7B,cAAc,aAAa,CAAC;AAE5B,uBAAuB;AACvB,cAAc,SAAS,CAAC;AACxB,mCAAmC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,0BAA0B;AAC1B,cAAc,UAAU,CAAC;AAEzB,mCAAmC;AACnC,cAAc,mBAAmB,CAAC;AAElC,oCAAoC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAE7C,sCAAsC;AACtC,cAAc,qBAAqB,CAAC","sourcesContent":["// Export form validation utilities\nexport * from './form-validation';\n\n// Export currency formatting utilities\nexport * from './currency-formatter';\n\n// Export Google Maps service\nexport * from './google-maps.service';\n\n// Export QR code utilities\nexport * from './qr-code';\n\n// Export PDF generation utilities\nexport * from './pdf-generator';\n\n// Export download template utilities\nexport * from './download-template';\n\n// Export idempotency key utilities\nexport * from './generate-idempotency-key';\n\n// Export clipboard utilities\nexport * from './clipboard';\n\n// Export OTP utilities\nexport * from './timer';\n// Export date formatting utilities\nexport * from './date-formatter';\n\n// Export assets utilities\nexport * from './assets';\n\n// Export stencil wrapper utilities\nexport * from './stencil-wrapper';\n\n// Export email validation utilities\nexport * from './email-validation';\nexport * from './email-validation.constants';\n\n// Export resource injection utilities\nexport * from './resource-injector';\n"]}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Utility functions for injecting custom CSS and JavaScript resources into the document
3
+ */
4
+ /**
5
+ * Checks if a string is a URL (http, https, or protocol-relative)
6
+ */
7
+ function isUrl(content) {
8
+ return (content.startsWith('http://') || content.startsWith('https://') || content.startsWith('//'));
9
+ }
10
+ /**
11
+ * Generates a unique ID for injected resources
12
+ */
13
+ function generateResourceId(prefix) {
14
+ return `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
15
+ }
16
+ /**
17
+ * Creates a CSS link element for loading CSS from a URL
18
+ */
19
+ function createCssLinkElement(url, id) {
20
+ const linkElement = document.createElement('link');
21
+ linkElement.rel = 'stylesheet';
22
+ linkElement.href = url;
23
+ linkElement.id = id;
24
+ linkElement.setAttribute('data-rebill-injected', 'true');
25
+ return linkElement;
26
+ }
27
+ /**
28
+ * Creates a style element for injecting raw CSS
29
+ */
30
+ function createStyleElement(css, id) {
31
+ const styleElement = document.createElement('style');
32
+ styleElement.id = id;
33
+ styleElement.setAttribute('data-rebill-injected', 'true');
34
+ styleElement.textContent = css;
35
+ return styleElement;
36
+ }
37
+ /**
38
+ * Creates a script element for loading JavaScript from a URL
39
+ */
40
+ function createScriptLinkElement(url, id) {
41
+ const scriptElement = document.createElement('script');
42
+ scriptElement.src = url;
43
+ scriptElement.id = id;
44
+ scriptElement.setAttribute('data-rebill-injected', 'true');
45
+ scriptElement.async = true;
46
+ return scriptElement;
47
+ }
48
+ /**
49
+ * Creates a script element for injecting raw JavaScript
50
+ */
51
+ function createScriptElement(js, id) {
52
+ const scriptElement = document.createElement('script');
53
+ scriptElement.id = id;
54
+ scriptElement.setAttribute('data-rebill-injected', 'true');
55
+ scriptElement.textContent = js;
56
+ return scriptElement;
57
+ }
58
+ /**
59
+ * Removes an injected resource element from the DOM
60
+ */
61
+ function removeInjectedResource(element) {
62
+ if (!element) {
63
+ return;
64
+ }
65
+ try {
66
+ element.remove();
67
+ }
68
+ catch (error) {
69
+ console.warn('Error removing injected resource:', error);
70
+ }
71
+ }
72
+ /**
73
+ * Injects custom CSS into the document
74
+ * @param css - CSS content (raw CSS string or URL)
75
+ * @param existingElement - Optional existing injected element to clean up first
76
+ * @returns The injected element or null if no CSS was provided
77
+ */
78
+ export function injectCSS(css, existingElement = null) {
79
+ if (!css) {
80
+ return null;
81
+ }
82
+ // Clean up existing element if provided
83
+ removeInjectedResource(existingElement);
84
+ const cssId = generateResourceId('rebill-checkout-css');
85
+ const element = isUrl(css) ? createCssLinkElement(css, cssId) : createStyleElement(css, cssId);
86
+ document.head.appendChild(element);
87
+ return element;
88
+ }
89
+ /**
90
+ * Injects custom JavaScript into the document
91
+ * @param js - JavaScript content (raw JS string or URL)
92
+ * @param existingElement - Optional existing injected element to clean up first
93
+ * @returns The injected element or null if no JS was provided
94
+ */
95
+ export function injectJS(js, existingElement = null) {
96
+ if (!js) {
97
+ return null;
98
+ }
99
+ // Clean up existing element if provided
100
+ removeInjectedResource(existingElement);
101
+ const jsId = generateResourceId('rebill-checkout-js');
102
+ const element = isUrl(js) ? createScriptLinkElement(js, jsId) : createScriptElement(js, jsId);
103
+ document.head.appendChild(element);
104
+ return element;
105
+ }
106
+ /**
107
+ * Cleans up injected CSS element
108
+ */
109
+ export function cleanupCSS(element) {
110
+ removeInjectedResource(element);
111
+ }
112
+ /**
113
+ * Cleans up injected JavaScript element
114
+ */
115
+ export function cleanupJS(element) {
116
+ removeInjectedResource(element);
117
+ }
118
+ //# sourceMappingURL=resource-injector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-injector.js","sourceRoot":"","sources":["../../src/utils/resource-injector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;GAEG;AACH,SAAS,KAAK,CAAC,OAAe;IAC5B,OAAO,CACL,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAC5F,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAAc;IACxC,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;A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C,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAE9F,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,OAA2B;IACpD,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAA2B;IACnD,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/**\n * Utility functions for injecting custom CSS and JavaScript resources into the document\n */\n\nexport interface InjectedResource {\n element: HTMLElement;\n id: string;\n}\n\n/**\n * Checks if a string is a URL (http, https, or protocol-relative)\n */\nfunction isUrl(content: string): boolean {\n return (\n content.startsWith('http://') || content.startsWith('https://') || content.startsWith('//')\n );\n}\n\n/**\n * Generates a unique ID for injected resources\n */\nfunction generateResourceId(prefix: string): string {\n return `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n}\n\n/**\n * Creates a CSS link element for loading CSS from a URL\n */\nfunction createCssLinkElement(url: string, id: string): HTMLLinkElement {\n const linkElement = document.createElement('link');\n linkElement.rel = 'stylesheet';\n linkElement.href = url;\n linkElement.id = id;\n linkElement.setAttribute('data-rebill-injected', 'true');\n return linkElement;\n}\n\n/**\n * Creates a style element for injecting raw CSS\n */\nfunction createStyleElement(css: string, id: string): HTMLStyleElement {\n const styleElement = document.createElement('style');\n styleElement.id = id;\n styleElement.setAttribute('data-rebill-injected', 'true');\n styleElement.textContent = css;\n return styleElement;\n}\n\n/**\n * Creates a script element for loading JavaScript from a URL\n */\nfunction createScriptLinkElement(url: string, id: string): HTMLScriptElement {\n const scriptElement = document.createElement('script');\n scriptElement.src = url;\n scriptElement.id = id;\n scriptElement.setAttribute('data-rebill-injected', 'true');\n scriptElement.async = true;\n return scriptElement;\n}\n\n/**\n * Creates a script element for injecting raw JavaScript\n */\nfunction createScriptElement(js: string, id: string): HTMLScriptElement {\n const scriptElement = document.createElement('script');\n scriptElement.id = id;\n scriptElement.setAttribute('data-rebill-injected', 'true');\n scriptElement.textContent = js;\n return scriptElement;\n}\n\n/**\n * Removes an injected resource element from the DOM\n */\nfunction removeInjectedResource(element: HTMLElement | null): void {\n if (!element) {\n return;\n }\n\n try {\n element.remove();\n } catch (error) {\n console.warn('Error removing injected resource:', error);\n }\n}\n\n/**\n * Injects custom CSS into the document\n * @param css - CSS content (raw CSS string or URL)\n * @param existingElement - Optional existing injected element to clean up first\n * @returns The injected element or null if no CSS was provided\n */\nexport function injectCSS(\n css: string | undefined,\n existingElement: HTMLElement | null = null,\n): HTMLStyleElement | HTMLLinkElement | null {\n if (!css) {\n return null;\n }\n\n // Clean up existing element if provided\n removeInjectedResource(existingElement);\n\n const cssId = generateResourceId('rebill-checkout-css');\n const element = isUrl(css) ? createCssLinkElement(css, cssId) : createStyleElement(css, cssId);\n\n document.head.appendChild(element);\n return element;\n}\n\n/**\n * Injects custom JavaScript into the document\n * @param js - JavaScript content (raw JS string or URL)\n * @param existingElement - Optional existing injected element to clean up first\n * @returns The injected element or null if no JS was provided\n */\nexport function injectJS(\n js: string | undefined,\n existingElement: HTMLElement | null = null,\n): HTMLScriptElement | null {\n if (!js) {\n return null;\n }\n\n // Clean up existing element if provided\n removeInjectedResource(existingElement);\n\n const jsId = generateResourceId('rebill-checkout-js');\n const element = isUrl(js) ? createScriptLinkElement(js, jsId) : createScriptElement(js, jsId);\n\n document.head.appendChild(element);\n return element;\n}\n\n/**\n * Cleans up injected CSS element\n */\nexport function cleanupCSS(element: HTMLElement | null): void {\n removeInjectedResource(element);\n}\n\n/**\n * Cleans up injected JavaScript element\n */\nexport function cleanupJS(element: HTMLElement | null): void {\n removeInjectedResource(element);\n}\n"]}