rebill-web-components-sdk 1.10.11 → 1.10.12
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/index-C-VTnc0I.js.map +1 -1
- package/dist/cjs/{payment-error-mapper-DMma7xTr.js → payment-error-mapper-BBaiDgUx.js} +4 -2
- package/dist/cjs/payment-error-mapper-BBaiDgUx.js.map +1 -0
- package/dist/cjs/rebill-checkout.cjs.entry.js +1 -1
- package/dist/cjs/rebill-renewal.cjs.entry.js +1 -1
- package/dist/collection/models/enums/payment-status.enum.js +1 -0
- package/dist/collection/models/enums/payment-status.enum.js.map +1 -1
- package/dist/collection/utils/payment-error-mapper.js +1 -0
- package/dist/collection/utils/payment-error-mapper.js.map +1 -1
- package/dist/components/p-8BpuJ_V5.js.map +1 -1
- package/dist/components/{p-tTo6r99B.js → p-Dkw3idq6.js} +4 -2
- package/dist/components/p-Dkw3idq6.js.map +1 -0
- package/dist/components/rebill-checkout.js +1 -1
- package/dist/components/rebill-renewal.js +1 -1
- package/dist/esm/index-BTZ7D7jU.js.map +1 -1
- package/dist/esm/{payment-error-mapper-CtMCCzwd.js → payment-error-mapper-lsQ45Ggo.js} +4 -2
- package/dist/esm/payment-error-mapper-lsQ45Ggo.js.map +1 -0
- package/dist/esm/rebill-checkout.entry.js +1 -1
- package/dist/esm/rebill-renewal.entry.js +1 -1
- package/dist/rebill-web-components-sdk/{p-648d0204.entry.js → p-4b4e2e73.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/p-BTZ7D7jU.js.map +1 -1
- package/dist/rebill-web-components-sdk/p-BXKxstSq.js +2 -0
- package/dist/rebill-web-components-sdk/p-BXKxstSq.js.map +1 -0
- package/dist/rebill-web-components-sdk/{p-b3a695df.entry.js → p-ecd698bc.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/rebill-web-components-sdk.esm.js +1 -1
- package/dist/types/models/enums/payment-status.enum.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/payment-error-mapper-DMma7xTr.js.map +0 -1
- package/dist/components/p-tTo6r99B.js.map +0 -1
- package/dist/esm/payment-error-mapper-CtMCCzwd.js.map +0 -1
- package/dist/rebill-web-components-sdk/p-GqGHZ54B.js +0 -2
- package/dist/rebill-web-components-sdk/p-GqGHZ54B.js.map +0 -1
- /package/dist/rebill-web-components-sdk/{p-648d0204.entry.js.map → p-4b4e2e73.entry.js.map} +0 -0
- /package/dist/rebill-web-components-sdk/{p-b3a695df.entry.js.map → p-ecd698bc.entry.js.map} +0 -0
|
@@ -49,6 +49,7 @@ var PaymentMessageE;
|
|
|
49
49
|
PaymentMessageE["APM_ERROR_BANK_TRANSFER"] = "apm_error_bank_transfer";
|
|
50
50
|
PaymentMessageE["PROVIDER_ERROR"] = "provider_error";
|
|
51
51
|
PaymentMessageE["BANK_REJECTED"] = "bank_rejected";
|
|
52
|
+
PaymentMessageE["DO_NOT_HONOR"] = "do_not_honor";
|
|
52
53
|
PaymentMessageE["CALL_BANK_FOR_AUTHORIZE"] = "call_bank_for_authorize";
|
|
53
54
|
PaymentMessageE["REQUIRED_3DS"] = "required_3ds";
|
|
54
55
|
PaymentMessageE["BLACKLISTED"] = "blacklisted";
|
|
@@ -166,6 +167,7 @@ class PaymentErrorMapper {
|
|
|
166
167
|
[PaymentMessageE.APM_ERROR_BANK_TRANSFER]: I18nService.translate('paymentErrors.APMErrorBankTransfer'),
|
|
167
168
|
[PaymentMessageE.PROVIDER_ERROR]: I18nService.translate('paymentErrors.providerError'),
|
|
168
169
|
[PaymentMessageE.BANK_REJECTED]: I18nService.translate('paymentErrors.bankRejected'),
|
|
170
|
+
[PaymentMessageE.DO_NOT_HONOR]: I18nService.translate('paymentErrors.bankRejected'),
|
|
169
171
|
[PaymentMessageE.FRAUD_HIGH_RISK]: I18nService.translate('paymentErrors.fraudHighRisk'),
|
|
170
172
|
[PaymentMessageE.CALL_BANK_FOR_AUTHORIZE]: I18nService.translate('paymentErrors.callBankForAuthorize'),
|
|
171
173
|
[PaymentMessageE.REQUIRED_3DS]: I18nService.translate('paymentErrors.required3ds'),
|
|
@@ -200,6 +202,6 @@ class PaymentErrorMapper {
|
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
export { CheckoutStatusE as C, PaymentMessageE as P, PaymentErrorMapper as a, generateIdempotencyKey as g };
|
|
203
|
-
//# sourceMappingURL=payment-error-mapper-
|
|
205
|
+
//# sourceMappingURL=payment-error-mapper-lsQ45Ggo.js.map
|
|
204
206
|
|
|
205
|
-
//# sourceMappingURL=payment-error-mapper-
|
|
207
|
+
//# sourceMappingURL=payment-error-mapper-lsQ45Ggo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-error-mapper-lsQ45Ggo.js","sources":["src/api/entities/checkout/types.ts","src/models/enums/payment-status.enum.ts","src/utils/generate-idempotency-key.ts","src/utils/payment-error-mapper.ts"],"sourcesContent":["import { PaymentMethodNameE } from '../../../models/enums/payment-method-name.enum';\nimport { STATUS_REQ_CHECKOUT_APM } from '../../../models/enums/status-req-checkout-apm.enum';\n\n// Checkout request status\nexport enum CheckoutStatusE {\n PENDING = 'PENDING',\n APPROVED = 'APPROVED',\n REJECTED = 'REJECTED',\n ERROR = 'ERROR',\n}\n\n// APM Transaction interface (based on documentation)\nexport interface APMTransaction {\n name?: { text: string; language: string }[];\n description?: { text: string; language: string }[];\n isPriceFixed?: boolean;\n tiers?: any[];\n plan?: any;\n quantity: number;\n amount?: number;\n currency?: string;\n productId?: string;\n planId?: string;\n couponCode?: string;\n}\n\n// APM Customer interface (based on documentation)\nexport interface APMCustomer {\n firstName: string;\n lastName: string;\n email: string;\n phone: {\n countryCode: string;\n number: string;\n };\n shippingAddress?: APMAddress;\n}\n\n// APM Address interface (based on documentation)\nexport interface APMAddress {\n country: string;\n state: string;\n city: string;\n zipCode: string;\n lineOne: string;\n lineTwo?: string;\n}\n\n// APM Redirect URLs interface (based on documentation)\nexport interface APMRedirect {\n approved: string;\n rejected: string;\n}\n\n// Metadata interface\nexport interface Metadata {\n [key: string]: unknown;\n}\n\n// Create APM checkout request interface (based on documentation)\nexport interface CreateAPMCheckoutRequest {\n transaction: APMTransaction;\n method: PaymentMethodNameE;\n customer?: APMCustomer; // Optional for authenticated users\n billingDetails?: {\n address: {\n lineOne: string;\n lineTwo?: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n };\n identification: {\n type: string;\n value: string;\n };\n };\n redirect: APMRedirect;\n paymentMetadata?: Metadata;\n subscriptionMetadata?: Metadata;\n customAttributes?: {\n bank?: string;\n };\n targetCurrency?: string;\n}\n\n// Legacy interfaces for backward compatibility\nexport interface Transaction {\n amount: number;\n currency: string;\n description: string;\n}\n\nexport interface Customer {\n email: string;\n name: string;\n phone: string;\n documentType?: string;\n documentNumber?: string;\n shippingAddress: Address;\n}\n\nexport interface Address {\n lineOne: string;\n lineTwo?: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n}\n\nexport interface Redirect {\n successUrl: string;\n failureUrl: string;\n cancelUrl: string;\n}\n\nexport interface CreateCardCheckoutRequest {\n transaction: {\n quantity: number;\n currency?: string;\n amount?: number;\n couponCode?: string;\n };\n installments?: number;\n cardTokenId?: string | null; // Optional, if card is saved\n cardId?: string | null; // Optional, if card is saved\n customer?: {\n firstName: string;\n lastName: string;\n email: string;\n phone: {\n countryCode: string;\n number: string;\n };\n };\n billingDetails?: {\n address: {\n lineOne: string;\n lineTwo?: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n };\n identification: {\n type: string;\n value: string;\n };\n };\n paymentMetadata?: {\n bankCode?: string;\n };\n customAttributes?: {\n deviceId?: string;\n };\n saveCard?: boolean;\n}\nexport interface CreateCardCheckoutResponse {\n traceId: string;\n date: string;\n result?: {\n paymentId: string;\n status: CheckoutStatusE;\n subscriptionId: string;\n cardId: string;\n cardLastFour: string;\n customerId: string;\n statusDetail?: string;\n type?: string;\n };\n error: {\n traceId: string;\n date: string;\n error: {\n message: string;\n type: string;\n };\n statusCode: number;\n };\n}\nexport interface Card {\n cardHolderName: string;\n cardExpirationMonth: string;\n cardExpirationYear: string;\n securityCode: string;\n number: string;\n identification: {\n type: string;\n value: string;\n };\n saveCard: boolean;\n}\n// Instruction interface for payment reference\nexport interface PaymentInstruction {\n text: string;\n language: string;\n}\n\n// Bank transfer data interface\nexport interface BankTransferData {\n bbvAccountNumber?: string;\n account: string; // CLABE\n bankName: string;\n reference: string;\n}\n\n// Checkout data interface (provider-specific)\nexport interface CheckoutData {\n // For QR codes\n qrCode?: string;\n\n // For barcodes\n barcode?: string;\n\n // For bank transfer payments (new - multiple data sets)\n bankTransferData?: BankTransferData[];\n\n // For reference payments\n referenceId?: string;\n instructions?: PaymentInstruction[];\n\n // For redirect payments\n url?: string;\n message?: string;\n // For vouchers\n voucherUrl?: string;\n\n // Additional provider-specific data\n [key: string]: any;\n}\n\n// Checkout result interface\nexport interface CheckoutResult {\n checkoutRequestId: string;\n status: CheckoutStatusE;\n data: CheckoutData;\n}\n\n// Error interface\nexport interface CheckoutError {\n message: string;\n type: string;\n}\n\n// Bank interface for PSE payments\nexport interface Bank {\n code: string;\n name: string;\n}\n\n// Required fields request interface\nexport interface RequiredFieldsRequest {\n currency: string;\n method: string;\n bin?: number;\n}\n\n// Required fields response interface\nexport type RequiredFieldsResponse = {\n name: string;\n values?: {\n code: string;\n name: string;\n }[];\n}[];\n\n// Create APM checkout response interface\nexport interface CreateAPMCheckoutResponse {\n traceId: string;\n date: string;\n result?: CheckoutResult;\n error?: CheckoutError;\n}\n\nexport interface PaymentMethod {\n name: string;\n type: string;\n}\n\nexport interface TrackingData {\n locale: string;\n utmTerm: string;\n referrer: string;\n ipAddress: string;\n}\nexport interface Source {\n source: string;\n version: string;\n}\n\nexport interface APMSession {\n country: string;\n createdAt: string;\n deviceId: string;\n email: string | null;\n expiresAt: string;\n id: string;\n isCreatedDuringCheckout: boolean;\n metadata: Record<string, unknown>;\n organizationId: string;\n paymentLinkId: string;\n paymentMethods: PaymentMethod[];\n planId: string;\n priceId: string;\n productId: string | null;\n providerKey: string;\n source: Source;\n status: string;\n trackingData: TrackingData;\n updatedAt: string;\n}\n\nexport interface CheckoutRequestPayment {\n id: string;\n createdAt: string;\n updatedAt: string;\n organizationId: string;\n amount: number;\n currency: string;\n customer: {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n phoneNumbers: {\n number: string;\n countryCode: string;\n }[];\n };\n status: string;\n metadata: Record<string, unknown>;\n paymentMethodType: string;\n paymentMethodMetadata: Record<string, unknown>;\n card: {\n id: string;\n name: string;\n expiration: {\n month: string;\n year: string;\n };\n lastFour: string;\n brand: string;\n };\n quantity: number;\n paymentProviderReference: string | null;\n paymentProviderDescription: string | null;\n installments: number | null;\n priceFixedIn: string | null;\n conversionRate: number | null;\n couponId: string | null;\n description: [\n {\n text: string;\n language: string;\n },\n ];\n processingMode: string;\n processingFee: number | null;\n country: string;\n timezone: string;\n}\n\nexport interface CheckoutRequestPaymentAPM {\n checkoutRequestId: string;\n status: STATUS_REQ_CHECKOUT_APM;\n type: string;\n data: {\n message: string;\n url: string;\n };\n session: APMSession;\n payment: CheckoutRequestPayment | null;\n}\n","export enum PaymentMessageE {\n PENDING = 'pending',\n APPROVED = 'approved',\n REJECTED = 'rejected',\n DECLINED = 'declined',\n ERROR = 'error',\n REFUNDED = 'refunded',\n CANCELLED = 'cancelled',\n PARTIALLY_REFUNDED = 'partially_refunded',\n EXPIRED = 'expired',\n GENERIC_REJECT = 'generic_reject',\n INVALID_CARD = 'invalid_card',\n INVALID_CARD_NUMBER = 'invalid_card_number',\n INVALID_CARD_HOLDER_NAME = 'invalid_card_holder_name',\n INVALID_CARD_EXPIRATION_DATE = 'invalid_card_expiration_date',\n INVALID_CARD_CVC = 'invalid_card_cvc',\n INSUFFICIENT_FUNDS = 'insufficient_funds',\n\n BLACKLISTED_CARD = 'blacklisted_card',\n INVALID_CUSTOMER_EMAIL = 'invalid_customer_email',\n INVALID_CUSTOMER_PHONE = 'invalid_customer_phone',\n INVALID_CUSTOMER_BILLING_ADDRESS = 'invalid_customer_billing_address',\n REQUIRED_CUSTOMER_EMAIL = 'required_customer_email',\n REQUIRED_CUSTOMER_PHONE = 'required_customer_phone',\n REQUIRED_CUSTOMER_BILLING_ADDRESS = 'required_customer_billing_address',\n INVALID_CHECKOUT_REQUEST = 'invalid_checkout_request',\n UNAVAILABLE_PAYMENT_METHOD = 'unavailable_payment_method',\n INVALID_AMOUNT = 'invalid_amount',\n INVALID_CURRENCY = 'invalid_currency',\n INVALID_COUNTRY = 'invalid_country',\n MAX_ATTEMPTS = 'max_attempts',\n PAYMENT_EXPIRED = 'payment_expired',\n FRAUD_HIGH_RISK = 'fraud_high_risk',\n INTERNAL_ERROR = 'internal_error',\n INVALID_SESSION = 'invalid_session',\n APM_MESSAGE_ERROR = 'apm_message_error',\n APM_ERROR_GENERIC = 'apm_error_generic',\n APM_ERROR_BANK_TRANSFER = 'apm_error_bank_transfer',\n PROVIDER_ERROR = 'provider_error',\n BANK_REJECTED = 'bank_rejected',\n DO_NOT_HONOR = 'do_not_honor',\n CALL_BANK_FOR_AUTHORIZE = 'call_bank_for_authorize',\n REQUIRED_3DS = 'required_3ds',\n BLACKLISTED = 'blacklisted',\n HARD_DECLINE = 'hard-decline',\n SOFT_DECLINE = 'soft-decline',\n HUMAN_DECLINE = 'human-decline',\n INTERNAL = 'internal',\n INVALID_CARD_TOKENIZE_COUNTRY = 'invalid_card_tokenize_country',\n INVALID_CUSTOMER_ADDRESS = 'invalid_customer_address',\n INVALID_CUSTOMER_CITY = 'invalid_customer_city',\n INVALID_CUSTOMER_STATE = 'invalid_customer_state',\n INVALID_CUSTOMER_ZIP = 'invalid_customer_zip',\n INVALID_CUSTOMER_COUNTRY = 'invalid_customer_country',\n INVALID_CUSTOMER_DOCUMENT = 'invalid_customer_document',\n INVALID_CUSTOMER_DOCUMENT_NUMBER = 'invalid_customer_document_number',\n INVALID_CUSTOMER_DOCUMENT_TYPE = 'invalid_customer_document_type',\n INVALID_CHECKOUT_PAYMENT_METHOD = 'invalid_checkout_payment_method',\n REQUIRED_CUSTOMER_ADDRESS = 'required_customer_address',\n REQUIRED_CUSTOMER_CITY = 'required_customer_city',\n REQUIRED_CUSTOMER_STATE = 'required_customer_state',\n REQUIRED_CUSTOMER_ZIP = 'required_customer_zip',\n REQUIRED_CUSTOMER_COUNTRY = 'required_customer_country',\n REQUIRED_CUSTOMER_DOCUMENT = 'required_customer_document',\n REQUIRED_CUSTOMER_DOCUMENT_NUMBER = 'required_customer_document_number',\n REQUIRED_CUSTOMER_DOCUMENT_TYPE = 'required_customer_document_type',\n EXPIRED_CARD = 'expired_card',\n SANDBOX_ERROR = 'sandbox_error',\n}\n","export const generateIdempotencyKey = () => {\n return `idmp_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;\n};\n","import { I18nService } from '../i18n/i18n.service';\nimport { PAYMENT_METHOD_ENUM } from '../models/enums/payment-methods.enum';\nimport { PaymentMessageE } from '../models/enums/payment-status.enum';\n\nexport interface AlertErrorKeys {\n alertTitle?: PaymentMessageE;\n message: PaymentMessageE;\n}\n\n//currency country\n\nexport class PaymentErrorMapper {\n static getErrorMessage(\n errorMessageKey: AlertErrorKeys['message'] | null,\n paymentMethod: PAYMENT_METHOD_ENUM,\n currencyCountry?: string,\n ): string {\n if (\n !errorMessageKey ||\n !Object.values(PaymentMessageE).includes(errorMessageKey as PaymentMessageE) ||\n errorMessageKey === PaymentMessageE.GENERIC_REJECT\n ) {\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return I18nService.translate('paymentErrors.genericErrorCard');\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n if (currencyCountry === 'BR') {\n return I18nService.translate('paymentErrors.genericErrorMessagePIX');\n }\n if (currencyCountry === 'AR') {\n return I18nService.translate('paymentErrors.genericErrorMessageQR');\n }\n if (currencyCountry === 'CO') {\n return I18nService.translate('paymentErrors.genericErrorMessagePSE');\n }\n return I18nService.translate('paymentErrors.genericErrorMessageBankTransfer');\n }\n return I18nService.translate('paymentErrors.genericErrorMessage');\n }\n return PaymentErrorMapper.getMessage(errorMessageKey);\n }\n\n static getErrorTitle(\n paymentMethod: PAYMENT_METHOD_ENUM,\n currencyCountry: string,\n errorTitleKey?: AlertErrorKeys['alertTitle'],\n ): string {\n if (errorTitleKey && !(errorTitleKey in PaymentMessageE)) {\n return PaymentErrorMapper.getMessage(errorTitleKey);\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return I18nService.translate('paymentErrors.genericErrorTitleCard');\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n if (currencyCountry === 'BR') {\n return I18nService.translate('paymentErrors.genericErrorTitlePIX');\n }\n if (currencyCountry === 'AR') {\n return I18nService.translate('paymentErrors.genericErrorTitleQR');\n }\n if (currencyCountry === 'CO') {\n return I18nService.translate('paymentErrors.genericErrorTitlePSE');\n }\n }\n return I18nService.translate('paymentErrors.genericErrorTitleBankTransfer');\n }\n\n private static getMessage(errorMessageKey: PaymentMessageE): string {\n const messageMap: Record<PaymentMessageE, string> = {\n [PaymentMessageE.PENDING]: I18nService.translate('paymentErrors.pending'),\n [PaymentMessageE.APPROVED]: I18nService.translate('paymentErrors.approved'),\n [PaymentMessageE.REJECTED]: I18nService.translate('paymentErrors.rejected'),\n [PaymentMessageE.DECLINED]: I18nService.translate('paymentErrors.declined'),\n [PaymentMessageE.ERROR]: I18nService.translate('paymentErrors.error'),\n [PaymentMessageE.REFUNDED]: I18nService.translate('paymentErrors.refunded'),\n [PaymentMessageE.CANCELLED]: I18nService.translate('paymentErrors.cancelled'),\n [PaymentMessageE.PARTIALLY_REFUNDED]: I18nService.translate(\n 'paymentErrors.partiallyRefunded',\n ),\n [PaymentMessageE.EXPIRED]: I18nService.translate('paymentErrors.expired'),\n [PaymentMessageE.GENERIC_REJECT]: I18nService.translate('paymentErrors.genericReject'),\n [PaymentMessageE.INVALID_CARD]: I18nService.translate('paymentErrors.invalidCard'),\n [PaymentMessageE.INVALID_CARD_NUMBER]: I18nService.translate(\n 'paymentErrors.invalidCardNumber',\n ),\n [PaymentMessageE.INVALID_CARD_HOLDER_NAME]: I18nService.translate(\n 'paymentErrors.invalidCardHolderName',\n ),\n [PaymentMessageE.INVALID_CARD_EXPIRATION_DATE]: I18nService.translate(\n 'paymentErrors.invalidCardExpirationDate',\n ),\n [PaymentMessageE.INVALID_CARD_CVC]: I18nService.translate('paymentErrors.invalidCardCvc'),\n [PaymentMessageE.INSUFFICIENT_FUNDS]: I18nService.translate(\n 'paymentErrors.insufficientFunds',\n ),\n [PaymentMessageE.BLACKLISTED_CARD]: I18nService.translate('paymentErrors.blacklistedCard'),\n [PaymentMessageE.INVALID_CUSTOMER_EMAIL]: I18nService.translate(\n 'paymentErrors.invalidCustomerEmail',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_PHONE]: I18nService.translate(\n 'paymentErrors.invalidCustomerPhone',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_BILLING_ADDRESS]: I18nService.translate(\n 'paymentErrors.invalidCustomerBillingAddress',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_EMAIL]: I18nService.translate(\n 'paymentErrors.requiredCustomerEmail',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_PHONE]: I18nService.translate(\n 'paymentErrors.requiredCustomerPhone',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_BILLING_ADDRESS]: I18nService.translate(\n 'paymentErrors.requiredCustomerBillingAddress',\n ),\n [PaymentMessageE.INVALID_CHECKOUT_REQUEST]: I18nService.translate(\n 'paymentErrors.invalidCheckoutRequest',\n ),\n [PaymentMessageE.UNAVAILABLE_PAYMENT_METHOD]: I18nService.translate(\n 'paymentErrors.unavailablePaymentMethod',\n ),\n [PaymentMessageE.INVALID_AMOUNT]: I18nService.translate('paymentErrors.invalidAmount'),\n [PaymentMessageE.INVALID_CURRENCY]: I18nService.translate('paymentErrors.invalidCurrency'),\n [PaymentMessageE.INVALID_COUNTRY]: I18nService.translate('paymentErrors.invalidCountry'),\n [PaymentMessageE.MAX_ATTEMPTS]: I18nService.translate('paymentErrors.maxAttempts'),\n [PaymentMessageE.PAYMENT_EXPIRED]: I18nService.translate('paymentErrors.paymentExpired'),\n\n [PaymentMessageE.INTERNAL_ERROR]: I18nService.translate('paymentErrors.internalError'),\n [PaymentMessageE.INVALID_SESSION]: I18nService.translate('paymentErrors.invalidSession'),\n [PaymentMessageE.APM_MESSAGE_ERROR]: I18nService.translate('paymentErrors.APMMessageError'),\n [PaymentMessageE.APM_ERROR_GENERIC]: I18nService.translate('paymentErrors.APMErrorGeneric'),\n [PaymentMessageE.APM_ERROR_BANK_TRANSFER]: I18nService.translate(\n 'paymentErrors.APMErrorBankTransfer',\n ),\n [PaymentMessageE.PROVIDER_ERROR]: I18nService.translate('paymentErrors.providerError'),\n [PaymentMessageE.BANK_REJECTED]: I18nService.translate('paymentErrors.bankRejected'),\n [PaymentMessageE.DO_NOT_HONOR]: I18nService.translate('paymentErrors.bankRejected'),\n\n [PaymentMessageE.FRAUD_HIGH_RISK]: I18nService.translate('paymentErrors.fraudHighRisk'),\n [PaymentMessageE.CALL_BANK_FOR_AUTHORIZE]: I18nService.translate(\n 'paymentErrors.callBankForAuthorize',\n ),\n [PaymentMessageE.REQUIRED_3DS]: I18nService.translate('paymentErrors.required3ds'),\n [PaymentMessageE.BLACKLISTED]: I18nService.translate('paymentErrors.blacklisted'),\n [PaymentMessageE.HARD_DECLINE]: I18nService.translate('paymentErrors.hardDecline'),\n [PaymentMessageE.SOFT_DECLINE]: I18nService.translate('paymentErrors.softDecline'),\n [PaymentMessageE.HUMAN_DECLINE]: I18nService.translate('paymentErrors.humanDecline'),\n [PaymentMessageE.INTERNAL]: I18nService.translate('paymentErrors.internal'),\n [PaymentMessageE.INVALID_CARD_TOKENIZE_COUNTRY]: I18nService.translate(\n 'paymentErrors.invalidCardTokenizeCountry',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_ADDRESS]: I18nService.translate(\n 'paymentErrors.invalidCustomerAddress',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_CITY]: I18nService.translate(\n 'paymentErrors.invalidCustomerCity',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_STATE]: I18nService.translate(\n 'paymentErrors.invalidCustomerState',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_ZIP]: I18nService.translate(\n 'paymentErrors.invalidCustomerZip',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_COUNTRY]: I18nService.translate(\n 'paymentErrors.invalidCustomerCountry',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocument',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT_NUMBER]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocumentNumber',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT_TYPE]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocumentType',\n ),\n [PaymentMessageE.INVALID_CHECKOUT_PAYMENT_METHOD]: I18nService.translate(\n 'paymentErrors.invalidCheckoutPaymentMethod',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_ADDRESS]: I18nService.translate(\n 'paymentErrors.requiredCustomerAddress',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_CITY]: I18nService.translate(\n 'paymentErrors.requiredCustomerCity',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_STATE]: I18nService.translate(\n 'paymentErrors.requiredCustomerState',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_ZIP]: I18nService.translate(\n 'paymentErrors.requiredCustomerZip',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_COUNTRY]: I18nService.translate(\n 'paymentErrors.requiredCustomerCountry',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocument',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT_NUMBER]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocumentNumber',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT_TYPE]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocumentType',\n ),\n [PaymentMessageE.EXPIRED_CARD]: I18nService.translate('paymentErrors.expiredCard'),\n [PaymentMessageE.SANDBOX_ERROR]: I18nService.translate('paymentErrors.sandboxError'),\n };\n\n return messageMap[errorMessageKey] || I18nService.translate('paymentErrors.genericError');\n }\n}\n"],"names":[],"mappings":";;AAGA;AACY,IAAA;AAAZ,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EALW,eAAe,KAAf,eAAe,GAK1B,EAAA,CAAA,CAAA;;ACTW,IAAA;AAAZ,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,eAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC;AACzC,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,gBAAA,CAAA,GAAA,gBAAiC;AACjC,IAAA,eAAA,CAAA,cAAA,CAAA,GAA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,SAAS,CAAC,4BAA4B,CAAC;SACrF;QAED,OAAO,UAAU,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,4BAA4B,CAAC;;AAE5F;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-BTZ7D7jU.js';
|
|
2
2
|
import { c as create$6 } from './index.esm-CRUbzQx9.js';
|
|
3
3
|
import { a as api } from './index-BOl37xiG.js';
|
|
4
|
-
import { g as generateIdempotencyKey, P as PaymentMessageE, C as CheckoutStatusE, a as PaymentErrorMapper } from './payment-error-mapper-
|
|
4
|
+
import { g as generateIdempotencyKey, P as PaymentMessageE, C as CheckoutStatusE, a as PaymentErrorMapper } from './payment-error-mapper-lsQ45Ggo.js';
|
|
5
5
|
import { s as state, a as SESSION_TYPE_ENUM, I as I18nService, S as SessionStore, i as initializeI18nWithSessionLanguage, P as PAYMENT_METHOD_ENUM, o as onChange, b as SESSION_ITEM_TYPE_ENUM } from './i18n.service-BT_P311Y.js';
|
|
6
6
|
import { S as STATUS_REQ_CHECKOUT_APM } from './status-req-checkout-apm.enum-vsLqF4hk.js';
|
|
7
7
|
import { B as BREAKPOINT_ENUM, g as getBreakpoint, i as isBreakpointBelow } from './breakpoint-Do_vNuMa.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-BTZ7D7jU.js';
|
|
2
2
|
import { c as create$6 } from './index.esm-CRUbzQx9.js';
|
|
3
3
|
import { a as api } from './index-BOl37xiG.js';
|
|
4
|
-
import { g as generateIdempotencyKey, C as CheckoutStatusE, P as PaymentMessageE, a as PaymentErrorMapper } from './payment-error-mapper-
|
|
4
|
+
import { g as generateIdempotencyKey, C as CheckoutStatusE, P as PaymentMessageE, a as PaymentErrorMapper } from './payment-error-mapper-lsQ45Ggo.js';
|
|
5
5
|
import { P as PAYMENT_METHOD_ENUM, I as I18nService } from './i18n.service-BT_P311Y.js';
|
|
6
6
|
import { S as STATUS_REQ_CHECKOUT_APM } from './status-req-checkout-apm.enum-vsLqF4hk.js';
|
|
7
7
|
import { r as renewalState, R as RenewalStore, o as onChange } from './renewal.store-BNHBs7yZ.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,c as i,h as e}from"./p-BTZ7D7jU.js";import{c as s}from"./p-MMCcKmy_.js";import{a as n}from"./p-CV0wqtJM.js";import{g as a,P as o,C as r,a as l}from"./p-GqGHZ54B.js";import{s as c,a as h,I as d,S as u,i as m,P as p,o as f,b as y}from"./p-DPLmRWqO.js";import{S as b}from"./p-vsLqF4hk.js";import{B as g,g as w,i as k}from"./p-Do_vNuMa.js";import{G as x}from"./p-CMSUR2TZ.js";import{P as v}from"./p-_K6gh3MX.js";import{m as C,i as I,g as P}from"./p-B076eOjt.js";import"./p-E-ZsRS8r.js";import"./p-CzeVW03r.js";const S={checkoutSummary:true,submitButton:true,billingAddress:true,customerInformation:true,discountCode:true,logo:true,footer:true,sandboxMode:true,processingPayment:true,successPage:true,errorMessage:true,useAddressSearch:true};var M;(function(t){t["BAMBOO"]="bamboo_payment";t["FISERV"]="fiserv";t["KUSHKI"]="kushki";t["PAYWAY"]="payway";t["DOCK"]="dock";t["KLAP"]="klap";t["MOVII"]="movii";t["STRIPE"]="stripe";t["DECIDIR"]="decidir"})(M||(M={}));const N=async(t,i,e)=>{const s=await n.checkout.getRequiredFields({currency:t,method:i},e);return{fields:C(s.data),original:s.data}};const R=async()=>{const t=c.data?.itemInformation?.paymentMethods;const i=t.map((async t=>{try{const i=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);const e=await N(c.data.pricing.currency,i,c.data.organization.id);return{paymentMethod:t,...e}}catch(i){console.error(`Error getting required fields for ${t}:`,i);return{paymentMethod:t,fields:[],original:[]}}}));const e=await Promise.all(i);const s={};e.forEach((t=>{s[t.paymentMethod]={fields:t.fields,original:t.original}}));return s};const j=(t,i)=>{const e=i[t];if(e){return e}else{return{fields:[],original:[]}}};const D=t=>typeof t==="string"?JSON.parse(t):t;const T=t=>D(t);const q=()=>"190.188.127.250";const z=async({publicKey:t,instantProduct:i,instantPlan:e})=>{const s=D(i?i:e);const o=await n.sessions.createSDKInstantSessionRequest(s,a(),q(),t);const r={...o.data,...o.data.plan&&{plan:{...o.data.plan,description:s.description||[]}},...o.data.product&&{product:{...o.data.product,description:s.description||[]}}};const l=r;return l};const A=async({publicKey:t,productId:i,planId:e})=>{const s=await n.sessions.createSDKItemSessionRequest({...i?{productId:i}:{},...e?{planId:e}:{},idempotencyKey:a(),deviceId:"123123123",clientIP:q(),publicKey:t});const o=s.data;return o};const E=async({publicKey:t,checkoutLandingSession:i,instantProduct:e,instantPlan:s,productId:n,planId:a})=>{if(i){const t=await T(i);return{session:t,type:h.CHECKOUT_LANDING}}if(e||s){const i=await z({publicKey:t,instantProduct:e,instantPlan:s});return{session:i,type:h.INSTANT}}if(n||a){const i=await A({publicKey:t,productId:n,planId:a});return{session:i,type:h.SDK_ITEM}}};const O="@media (max-width: 1024px){.rebill-checkout{width:100%;flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section-checkout .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}.rebill-checkout.full-width-layout .left-section{width:100%}.rebill-checkout.full-width-layout .left-section-container{max-width:none;width:100%}}@media (min-width: 1025px){.rebill-checkout{width:100%;min-height:600px;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section-checkout{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.rebill-checkout.full-width-layout .left-section{width:100%;justify-content:stretch}.rebill-checkout.full-width-layout .left-section-container{max-width:none;min-width:auto;width:100%;margin:2.5rem 2rem 1.5rem 2rem}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const B=class{constructor(e){t(this,e);this.error=i(this,"error");this.success=i(this,"success");this.successRedirect=i(this,"successRedirect");this.formChange=i(this,"formChange");this.paymentMethodSelected=i(this,"paymentMethodSelected")}productId;planId;publicKey;instantProduct;instantPlan;display;customerInformation;oneClickCheckout=true;css;language;async handleLanguageChange(t,i){if(t&&t!==i){try{await d.changeLanguage(t);u.changeLanguage(t);console.log(`[RebillCheckout] Language changed from ${i} to ${t}`)}catch(t){console.error("[RebillCheckout] Failed to change language:",t)}}}error;success;successRedirect;formChange;checkoutLandingSession;externalPayment;rejectedPaymentCard=false;rejectedPaymentAPM=false;countries=[];currentPaymentMethod;checkoutResponse=null;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;isAPMSubmitting=false;isAPMSuccess=false;storedCheckoutResults=new Map;alertErrorKeys=null;currentApmPaymentMethod=null;breakpoint=g.DESKTOP;showRefreshModal=false;cardError={showCardInvalid:false,type:null};initialData={};allRequiredFields={};currentRequiredFields=[];customerExists=false;showOtp=false;otpVerified=false;responseCheckoutCard=null;cardMode=null;formElement;emailDebounceTimeout=null;injectedStyleElement=null;get displayConfig(){if(!this.display){return S}if(typeof this.display==="string"){try{const t=JSON.parse(this.display);return{...S,...t}}catch(t){console.warn("Invalid display configuration string, using defaults:",t);return S}}return{...S,...this.display}}get parsedCustomerInformation(){if(!this.customerInformation){return null}if(typeof this.customerInformation==="string"){try{return JSON.parse(this.customerInformation)}catch(t){console.warn("Invalid customerInformation configuration string, ignoring:",t);return null}}return this.customerInformation}get filteredPaymentMethods(){const t=c.data?.itemInformation?.paymentMethods||[];const i=this.displayConfig.excludePaymentMethods;if(!i||i.length===0){return t}return t.filter((t=>!i.includes(t)))}getCombinedUserData(t={}){const i=c.data.userInformation;const e=this.parsedCustomerInformation;return{email:t?.email||e?.email||i.email,fullName:t?.fullName||e?.fullName||i.fullName,countryCodePhoneNumber:t?.countryCodePhoneNumber||e?.phoneNumber?.countryCode||e?.countryCode||i.countryCode,phoneNumber:t?.phoneNumber||e?.phoneNumber?.number||i.phoneNumber,documentType:t?.documentType||e?.documentType||i.documentType,documentNumber:t?.documentNumber||e?.documentNumber||i.documentNumber,"billing-country":t?.["billing-country"]||e?.address?.billingAddress?.country||i.address?.billingAddress?.country,"billing-state":t?.["billing-state"]||e?.address?.billingAddress?.state||i.address?.billingAddress?.state,"billing-address":t?.["billing-address"]||e?.address?.billingAddress?.address||i.address?.billingAddress?.address,"billing-city":t?.["billing-city"]||e?.address?.billingAddress?.city||i.address?.billingAddress?.city,"billing-zip":t?.["billing-zip"]||e?.address?.billingAddress?.zip||i.address?.billingAddress?.zip,"billing-addInformation":t?.["billing-addInformation"]||e?.address?.billingAddress?.addInformation||i.address?.billingAddress?.addInformation}}injectCustomCSS(){if(!this.css){return}this.cleanupInjectedCSS();const t=`rebill-checkout-css-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;if(this.css.startsWith("http://")||this.css.startsWith("https://")||this.css.startsWith("//")){const i=document.createElement("link");i.rel="stylesheet";i.href=this.css;i.id=t;i.setAttribute("data-rebill-injected","true");document.head.appendChild(i);this.injectedStyleElement=i}else{const i=document.createElement("style");i.id=t;i.setAttribute("data-rebill-injected","true");i.textContent=this.css;document.head.appendChild(i);this.injectedStyleElement=i}}cleanupInjectedCSS(){if(this.injectedStyleElement){try{this.injectedStyleElement.remove()}catch(t){console.warn("Error removing injected CSS:",t)}this.injectedStyleElement=null}}timeToRedirectAPM=5e3;resizeHandler=()=>{const t=w(window.innerWidth);if(t!==this.breakpoint){this.breakpoint=t}};disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler);if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout);this.emailDebounceTimeout=null}this.cleanupInjectedCSS()}async componentWillLoad(){try{this.resizeHandler();window.addEventListener("resize",this.resizeHandler);this.injectCustomCSS();if(this.language){await d.changeLanguage(this.language)}else{m()}const{session:t,type:i}=await E({publicKey:this.publicKey,checkoutLandingSession:this.checkoutLandingSession,instantProduct:this.instantProduct,instantPlan:this.instantPlan,productId:this.productId,planId:this.planId});u.initializeSession({session:t,type:i,payment:typeof this.externalPayment==="string"?JSON.parse(this.externalPayment):this.externalPayment});if(c.sessionRefreshed){this.showRefreshModal=true}x.loadGoogleMapsScript();const e=await n.data.getCountries();this.countries=e.data;if(this.parsedCustomerInformation){u.setUserInformation(this.parsedCustomerInformation)}this.initialData=this.getInitialData();this.allRequiredFields=await R();if(this.filteredPaymentMethods.length>0){if(c.data.paymentStatus===o.REJECTED||c.data.paymentStatus===o.APPROVED&&this.filteredPaymentMethods.includes(p.BANK_TRANSFER)){const t=this.filteredPaymentMethods.find((t=>t===p.BANK_TRANSFER));if(t){this.changePaymentMethod(t);u.setPaymentMethodSelected(t)}}else{this.changePaymentMethod(this.filteredPaymentMethods[0])}}if(this.oneClickCheckout){n.customers.exists({email:c.data?.prefilledData?.email},this.publicKey).then((t=>{this.customerExists=t.data.exists}))}this.cardMode=c.cardMode;f("cardMode",(()=>{this.cardMode=c.cardMode}))}catch(t){console.error("Error initializing checkout:",t)}}componentWillUpdate(){this.injectCustomCSS()}async changePaymentMethod(t){if(t!==this.currentPaymentMethod&&this.filteredPaymentMethods.includes(t)){if(this.checkoutResponse){this.checkoutResponse=null;u.clearCheckoutResponse()}this.currentPaymentMethod=t;u.setPaymentMethodSelected(t);if(t!==p.CARD){this.cardMode="input";u.setCardMode("input")}this.isSubmitting=false;this.currentApmPaymentMethod=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);if(t!==p.CASH&&t!==p.BANK_TRANSFER){this.checkoutResponse=null;u.clearCheckoutResponse()}else{this.checkoutResponse=null;u.clearCheckoutResponse()}this.paymentMethodSelected.emit(t);try{this.currentRequiredFields=j(t,this.allRequiredFields).fields;const i=await n.sessions.updateCurrentSessionPaymentMethod(c.data.sessionId,{paymentMethodName:v.mapToAPMPaymentMethod(t,c.data.pricing.country),paymentMethodType:t,currency:c.data.pricing.currency});u.setProviderKey(i.providerKey);if(i.providerKey===M.DECIDIR||c.data.providerKey===M.DECIDIR){const t=crypto.randomUUID();const i=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const e=i.result.script;const s=document.createElement("script");s.innerHTML=e;document.body.appendChild(s)}}catch(t){console.error("Failed to update payment method or get required fields:",t)}}}get currentPaymentError(){if(this.currentPaymentMethod===p.CARD){return this.rejectedPaymentCard}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){return this.rejectedPaymentAPM}return false}paymentMethodSelected;async handlePaymentMethodSelected(t){t.stopPropagation();const i=t.detail;this.changePaymentMethod(i);if(this.formElement){this.formElement.resetValidation()}}async handleSubmit(t){if(this.isSubmitting){return}this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false;if(this.currentPaymentMethod===p.CARD){this.handleSubmitCard(t)}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){this.handleSubmitAPM(t)}}handleFormChange(t){const i=t.detail;let e=true;let s={};if(this.formElement?.errors){s=this.formElement.errors;e=Object.keys(s).length===0}this.formChange.emit({data:i,isValid:e,errors:Object.keys(s).length>0?s:undefined})}async handleSubmitCard(t){const i=t.detail;const e=this.getCombinedUserData(i);if(!c.data.cardTokenId&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"card_error"};return}if(!c.data.cardInformation&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"tokenization_error"};return}this.cardError={showCardInvalid:false,type:null};const s={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},installments:Number(i.installments||c.data.cardInformation?.installments?.selectedInstallment?.installment),...c.data.cardTokenId&&{cardTokenId:c.data.cardTokenId,...c.data?.itemInformation?.type!==y.PLAN&&{saveCard:c.saveCard}},...c.data.cardId&&{cardId:c.data.cardId},...(!this.otpVerified||this.cardMode==="input")&&{customer:{firstName:e.fullName?.split(" ")[0],lastName:e.fullName?.split(" ").slice(1).join(" "),email:e.email,phone:{countryCode:e.countryCodePhoneNumber,number:e.phoneNumber}}},billingDetails:{address:{lineOne:e["billing-address"],city:e["billing-city"],state:e["billing-state"],country:e["billing-country"],zipCode:e["billing-zip"],lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}},customAttributes:{...c.deviceId&&{deviceId:c.deviceId}},...c.metadata&&{paymentMetadata:c.metadata}};const l=a();this.isSubmitting=true;this.isCardSubmitting=true;try{const t=await n.checkout.createCardCheckoutRequest(c.data.sessionId,l,s,c.data.accessToken||undefined);u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;if(t.data.result?.status.toUpperCase()===r.APPROVED){this.isCardSuccess=true;u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:t.data});c.data.cardInformation.lastFour=t.data.result?.cardLastFour}else{this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data.result?.statusDetail.toLowerCase()??t.data.error?.error?.message?.toLowerCase()}}}catch(t){this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()}}finally{this.isSubmitting=false;this.isCardSubmitting=false}}async handleSubmitAPM(t){if(this.currentPaymentMethod!==p.CASH&&this.currentPaymentMethod!==p.BANK_TRANSFER){return}this.isSubmitting=true;const i=t.detail;const e=this.getCombinedUserData(i);try{const t={address:{country:e["billing-country"]||"",state:e["billing-state"]||"",city:e["billing-city"]||"",zipCode:e["billing-zip"]||"",lineOne:e["billing-address"]||"",lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}};const s=this.currentApmPaymentMethod||v.mapToAPMPaymentMethod(this.currentPaymentMethod,c.data?.pricing?.country);const o={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},method:s,billingDetails:t,redirect:{approved:window.location.origin+"/payment/success",rejected:window.location.origin+"/payment/failure"},paymentMetadata:c.metadata,customAttributes:{bank:i.bankId||c.data?.bankId?.code}};{o.customer={firstName:e.fullName?.split(" ")[0]||"",lastName:e.fullName?.split(" ").slice(1).join(" ")||"",email:e.email,phone:{countryCode:e.countryCodePhoneNumber||"",number:e.phoneNumber||""}}}const r=a();const l=await n.checkout.createAPMCheckoutRequest(c.data.sessionId,r,o);this.isSubmitting=false;this.checkoutResponse=l.data;this.storedCheckoutResults.set(this.currentPaymentMethod,l.data);if(l.data?.date){c.data.paymentDate=l.data.date;c.createdAt=l.data.date}if(l.data?.traceId){c.data.paymentReference=l.data.traceId}}catch(t){this.isSubmitting=false;this.checkoutResponse=t.data;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()};this.rejectedPaymentAPM=true}}async submit(){if(this.formElement&&typeof this.formElement.submit==="function"){this.formElement.submit()}else{await this.handleSubmit({detail:{}})}}handlePaymentStatusChange=t=>{if(t.isCompleted){if(t.status===b.APPROVED){u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:this.checkoutResponse})}else if(t.status===b.REJECTED){u.setPaymentStatus(o.REJECTED);this.alertErrorKeys={alertTitle:o.APM_ERROR_GENERIC,message:o.APM_MESSAGE_ERROR}}}};async handleInputChange(t){if(t?.detail?.id==="email"&&this.oneClickCheckout){if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout)}if(!t.detail.value||t.detail.value.trim()===""){this.customerExists=false;u.clearCustomerIdAndToken();return}this.emailDebounceTimeout=setTimeout((async()=>{try{const t=await n.customers.exists({email:c.data.userInformation.email},this.publicKey);this.customerExists=t.data.exists}catch(t){this.customerExists=false}}),500)}}validationSchema={email:s().when([],{is:()=>!this.otpVerified,then:t=>t.email("validation.emailInvalid").matches(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"validation.emailInvalid").required("validation.emailRequired"),otherwise:t=>t.notRequired()}),fullName:s().when([],{is:()=>!this.otpVerified,then:t=>t.required("validation.fullNameRequired").matches(/^[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}\s+[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}$/,"validation.fullNameInvalid"),otherwise:t=>t.notRequired()}),phoneNumber:s().when([],{is:()=>I("phoneNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.phoneRequired"),otherwise:t=>t.notRequired()}),isValidPhoneNumber:s().when([],{is:()=>I("phoneNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.equals(["true"],"validation.phoneRequired"),otherwise:t=>t.notRequired()}),"billing-country":s().when([],{is:()=>I("billing-country",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.countryRequired"),otherwise:t=>t.notRequired()}),"billing-state":s().when([],{is:()=>I("billing-state",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.stateRequired"),otherwise:t=>t.notRequired()}),"billing-address":s().when([],{is:()=>I("billing-address",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.addressRequired"),otherwise:t=>t.notRequired()}),"billing-city":s().when([],{is:()=>I("billing-city",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.cityRequired"),otherwise:t=>t.notRequired()}),"billing-zip":s().when([],{is:()=>I("billing-zip",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.zipRequired"),otherwise:t=>t.notRequired()}),bankId:s().when([],{is:()=>I("bankId",this.currentRequiredFields),then:t=>t.required("validation.bankRequired"),otherwise:t=>t.notRequired()}),installments:s().when([],{is:()=>this.currentPaymentMethod===p.CARD&&c.data.cardInformation.installments.isAvailableInstallments&&c.data.cardInformation?.installments?.installments.length>0&&c.data.itemInformation.type!==y.PLAN,then:t=>t.required("validation.installmentsRequired"),otherwise:t=>t.notRequired()}),documentType:s().when([],{is:()=>I("documentType",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.documentTypeRequired"),otherwise:t=>t.notRequired()}),documentNumber:s().when([],{is:()=>I("documentNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>{const i=t.required("validation.documentNumberRequired").min(7,"validation.documentInvalid");if(c.data?.pricing?.country==="BR"){return i.test("numeric-only","validation.documentNumberNumericOnly",(t=>{if(!t)return true;return/^\d+$/.test(t)}))}return i},otherwise:t=>t.notRequired()})};getInitialData=()=>({email:c.data.userInformation.email||"",fullName:c.data.userInformation.fullName||"",phoneNumber:c.data.userInformation.phoneNumber?.number||"",countryCodePhoneNumber:c.data.userInformation.countryCode||"",documentType:"",documentNumber:"","billing-country":c.data.userInformation.address?.billingAddress?.country||"","billing-state":c.data.userInformation?.address?.billingAddress?.state||"","billing-address":c.data.userInformation?.address?.billingAddress?.address||"","billing-city":c.data.userInformation?.address?.billingAddress?.city||"","billing-zip":c.data.userInformation?.address?.billingAddress?.zip||"",bankId:c.data.bankId?.code||"",card:"",installments:c.data.cardInformation?.installments?.selectedInstallment?.installment?.toString()||""});hasPrefilledAddress=()=>{const t=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return t.some((t=>{const i=this.initialData[t];return i&&i.trim()!==""}))};get isQrCodeVisible(){return!!this.checkoutResponse?.result?.data?.qrCode}get isBankTransferVisible(){return!!this.checkoutResponse?.result?.data?.account&&!!this.checkoutResponse?.result?.data?.bankName&&!!this.checkoutResponse?.result?.data?.reference}get isBoletoVisible(){return this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&!!this.checkoutResponse?.result?.data?.barcode}isPaymentApproved=()=>{if(c.data.paymentStatus===o.APPROVED){return true}return false};handleRebillAccountClick(t){this.showOtp=t.detail}handleReturnForm(t){this.showOtp=t.detail;u.clearCustomerIdAndToken()}handleSignOut(){this.showOtp=false;this.otpVerified=false;if(!c?.data?.prefilledData?.email){this.customerExists=false}u.clearCustomerIdAndToken();u.clearUserInformation();this.cardError={showCardInvalid:false,type:null};this.alertErrorKeys=null;this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false}handleCodeVerified(){this.otpVerified=true;this.showOtp=false;this.rejectedPaymentCard=false;this.alertErrorKeys=null;this.cardError={showCardInvalid:false,type:null};if(this.formElement){this.formElement.resetValidation()}}isPaymentRejected(){return c.data.paymentStatus===o.REJECTED&&this.currentPaymentMethod===p.BANK_TRANSFER}render(){const t=this.countries.map((t=>({label:t.country,value:t.isoCountryCode})));const i=(t={})=>e("rebill-summary",{key:"4b1db10c60e123202a604f64dc89990eace6325b",totalAmount:c.data.pricing.total,currency:c.data.pricing.currency,itemTitle:c._session?.getTitle(),itemDescription:c._session?.getDescription(),itemAmount:c.data.pricing.subtotal,subtotal:c.data.pricing.subtotal,allowCoupon:c._session?.getAllowCoupon(this.displayConfig),currentBreakpoint:this.breakpoint,planFrequency:c._session?.getPlanFrequency(),planFrequencyCount:c._session?.getPlanFrequencyCount(),discountType:c.data.discount.discountType,discountedPercentage:c.data.discount.discountedPercentage,discountDuration:c.data.discount.discountDuration,discountAmount:c.data.discount.discountAmount,...t});return c.isInitialized&&e(e.Fragment,null,this.showRefreshModal&&e("rebill-modal-overlay",{key:"479d5fbdd896241eadf43771c112d683fdafd54b"}),this.displayConfig.processingPayment&&e("rebill-processing-payment",{key:"29f1f76748c8603b97537e62fd6c973b17fecff7",style:{display:this.isCardSubmitting?"block":"none"}}),this.displayConfig.successPage&&this.isPaymentApproved()&&c.isInitialized?e("success-page",{typePaymentMethod:c.data.paymentMethodSelected,paymentMethodName:v.mapToAPMPaymentMethod(c.data.paymentMethodSelected||c.data.payment?.paymentMethodType,c.data?.pricing?.country),country:c.data?.pricing?.country,bank:c.data.payment?.paymentMethodMetadata?.bank||c.data.payment?.paymentMethodMetadata?.bank,cardLastFour:this.responseCheckoutCard?.result?.cardLastFour||c.data.cardInformation?.lastFour,paymentDate:c.data.paymentDate||this.responseCheckoutCard?.date||c.data.payment?.createdAt||this.checkoutResponse?.result?.data?.createdAt,referenceNumber:c.data.paymentReference||c.data.payment?.traceId||this.responseCheckoutCard?.traceId,onSuccessRedirect:t=>{this.successRedirect.emit(t.detail)},trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,debitDay:c.data?.itemInformation?.debitDay,planAmount:c.data?.pricing?.planAmount}):e(e.Fragment,null,this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&k(this.breakpoint,g.DESKTOP)&&e("div",{class:"mode-sandbox-mobile-container",style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"}},e("rebill-mode-sandbox-mobile",null)),e("rebill-checkout-form",{ref:t=>this.formElement=t,style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:t=>this.handleSubmit(t),onChange:t=>this.handleFormChange(t),renderForm:({submit:s,formData:n,errors:a})=>{const o=!this.isCardSuccess&&this.checkoutResponse?.result&&(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER);return e("div",{class:`rebill-checkout ${!this.displayConfig.checkoutSummary?"full-width-layout":""}`},e("div",{class:"left-section"},e("div",{class:"left-section-container"},this.displayConfig.logo&&e("organization-logo",{organization:c.data.organization}),e("div",{class:"otp-container",style:{display:this.showOtp?"block":"none"}},e("otp-component",null)),e("div",{style:{display:this.showOtp?"none":"block"}},e("div",{class:"checkout-form-section"},this.displayConfig.checkoutSummary&&e("div",{class:"summary-mobile-tablet",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["totalAmount","discount","timelineFreeTrial","timelineDebitDay","itemDetails"]})),!this.otpVerified&&this.displayConfig.customerInformation&&e("user-information",{customerExists:this.customerExists,disabled:this.isSubmitting,errors:{email:a.email,fullName:a.fullName}}),this.otpVerified&&this.displayConfig.customerInformation&&e("user-information-static",{variant:"otp",userInfo:{customerName:c.data.userInformation.fullName?.split(" ")[0],customerEmail:c.data.userInformation.email}}),e("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e("payment-method-selector",{enabledPaymentMethods:this.filteredPaymentMethods,defaultSelected:this.currentPaymentMethod,disabled:this.isSubmitting,errorComponent:{showErrorComponent:this.displayConfig.errorMessage&&(this.currentPaymentError||this.isPaymentRejected()),alertTitle:l.getErrorTitle(this.currentPaymentMethod,c.data?.pricing?.country||"",this.alertErrorKeys?.alertTitle),message:l.getErrorMessage(this.alertErrorKeys?.message,this.currentPaymentMethod,c.data?.pricing?.country)},country:c.data?.pricing?.country,installmentsError:a.installments,showDocument:(!this.otpVerified||this.otpVerified&&this.cardMode==="input")&&!o&&!this.isQrCodeVisible&&(I("documentNumber",this.currentRequiredFields)||I("documentType",this.currentRequiredFields)),documentTypeError:a.documentType,documentNumberError:a.documentNumber,cardError:this.cardError,customCSS:this.css}),!o&&(()=>{const t=I("bankId",this.currentRequiredFields);return t})()&&e("div",{class:"animated-component fade-in"},e("rebill-bank-selector",{banks:P("bank",this.allRequiredFields[this.currentPaymentMethod].original)||[],defaultSelectedBankId:n.bankId||"",error:a?.bankId,disabled:this.isSubmitting}))),!o&&(!this.otpVerified||this.cardMode==="input")&&e(e.Fragment,null,this.displayConfig.billingAddress&&(I("billing-country",this.currentRequiredFields)||I("billing-state",this.currentRequiredFields)||I("billing-address",this.currentRequiredFields)||I("billing-city",this.currentRequiredFields)||I("billing-zip",this.currentRequiredFields))&&e("div",{class:"animated-component slide-in"},e("rebill-address",{disabled:this.isSubmitting,countryOptions:t,billingView:(()=>{if(this.displayConfig.useAddressSearch!==undefined&&this.displayConfig.useAddressSearch===false){return"form"}return this.hasPrefilledAddress()?"form":"search"})(),errors:{"billing-country":a["billing-country"],"billing-state":a["billing-state"],"billing-address":a["billing-address"],"billing-city":a["billing-city"],"billing-zip":a["billing-zip"]}})),this.displayConfig.customerInformation&&I("phoneNumber",this.currentRequiredFields)&&e("div",{class:"animated-component fade-in"},e("user-information-phone",{disabled:this.isSubmitting,error:a?.phoneNumber||a?.isValidPhoneNumber,countryCode:c.data.userInformation?.countryCode||c.data.country}))),o&&(()=>{const t=this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&this.checkoutResponse?.result?.data?.barcode;return e("apm-checkout",{paymentMethod:this.currentPaymentMethod,barcode:t?this.checkoutResponse?.result?.data?.barcode:undefined,referenceId:this.currentPaymentMethod===p.CASH&&!t?this.checkoutResponse?.result?.data?.referenceId:undefined,qrCodeData:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.qrCode:undefined,code:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.code:undefined,checkoutRequestId:this.checkoutResponse?.result?.checkoutRequestId,providerName:c.data.providerKey,expirationDate:(()=>{const t=new Date;t.setDate(t.getDate()+30);return t.toISOString()})(),onPaymentStatusChange:t=>this.handlePaymentStatusChange(t.detail),country:c.data?.pricing?.country,redirectUrl:this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,bearerToken:this.checkoutResponse?.result?.data?.bearerToken,bankTransferData:this.checkoutResponse?.result?.data?.account&&this.checkoutResponse?.result?.data?.bankName&&this.checkoutResponse?.result?.data?.reference?{account:this.checkoutResponse.result.data.account,bankName:this.checkoutResponse.result.data.bankName,reference:this.checkoutResponse.result.data.reference}:undefined})})(),this.displayConfig.checkoutSummary&&e("div",{class:"summary-price-details",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["priceDetails"]})),this.displayConfig.submitButton&&!(o&&(this.isQrCodeVisible||this.isBankTransferVisible||this.isBoletoVisible))&&e("div",{class:"payment-button-container"},e("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,onSubmit:()=>{s()},redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,isDisabled:c.data.fetchingInstallments,country:c.data?.pricing?.country}),e("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:d.translate("otp.secureMessage")}))),this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&!k(this.breakpoint,g.DESKTOP)&&e("rebill-mode-sandbox",null)),this.displayConfig.footer&&e("rebill-footer",{style:{marginTop:k(this.breakpoint,g.DESKTOP)?"24px":"auto"}}))),this.displayConfig.checkoutSummary&&e("div",{class:"right-section-checkout"},e("div",{class:"checkout-summary-section"},e("div",{class:"summary-desktop",style:{display:!k(this.breakpoint,g.DESKTOP)?"block":"none"}},i()))))}})))}static get watchers(){return{language:["handleLanguageChange"]}}};B.style=O;export{B as rebill_checkout};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,c as i,h as e}from"./p-BTZ7D7jU.js";import{c as s}from"./p-MMCcKmy_.js";import{a as n}from"./p-CV0wqtJM.js";import{g as a,P as o,C as r,a as l}from"./p-BXKxstSq.js";import{s as c,a as h,I as d,S as u,i as m,P as p,o as f,b as y}from"./p-DPLmRWqO.js";import{S as b}from"./p-vsLqF4hk.js";import{B as g,g as w,i as k}from"./p-Do_vNuMa.js";import{G as x}from"./p-CMSUR2TZ.js";import{P as v}from"./p-_K6gh3MX.js";import{m as C,i as I,g as P}from"./p-B076eOjt.js";import"./p-E-ZsRS8r.js";import"./p-CzeVW03r.js";const S={checkoutSummary:true,submitButton:true,billingAddress:true,customerInformation:true,discountCode:true,logo:true,footer:true,sandboxMode:true,processingPayment:true,successPage:true,errorMessage:true,useAddressSearch:true};var M;(function(t){t["BAMBOO"]="bamboo_payment";t["FISERV"]="fiserv";t["KUSHKI"]="kushki";t["PAYWAY"]="payway";t["DOCK"]="dock";t["KLAP"]="klap";t["MOVII"]="movii";t["STRIPE"]="stripe";t["DECIDIR"]="decidir"})(M||(M={}));const N=async(t,i,e)=>{const s=await n.checkout.getRequiredFields({currency:t,method:i},e);return{fields:C(s.data),original:s.data}};const R=async()=>{const t=c.data?.itemInformation?.paymentMethods;const i=t.map((async t=>{try{const i=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);const e=await N(c.data.pricing.currency,i,c.data.organization.id);return{paymentMethod:t,...e}}catch(i){console.error(`Error getting required fields for ${t}:`,i);return{paymentMethod:t,fields:[],original:[]}}}));const e=await Promise.all(i);const s={};e.forEach((t=>{s[t.paymentMethod]={fields:t.fields,original:t.original}}));return s};const j=(t,i)=>{const e=i[t];if(e){return e}else{return{fields:[],original:[]}}};const D=t=>typeof t==="string"?JSON.parse(t):t;const T=t=>D(t);const q=()=>"190.188.127.250";const z=async({publicKey:t,instantProduct:i,instantPlan:e})=>{const s=D(i?i:e);const o=await n.sessions.createSDKInstantSessionRequest(s,a(),q(),t);const r={...o.data,...o.data.plan&&{plan:{...o.data.plan,description:s.description||[]}},...o.data.product&&{product:{...o.data.product,description:s.description||[]}}};const l=r;return l};const A=async({publicKey:t,productId:i,planId:e})=>{const s=await n.sessions.createSDKItemSessionRequest({...i?{productId:i}:{},...e?{planId:e}:{},idempotencyKey:a(),deviceId:"123123123",clientIP:q(),publicKey:t});const o=s.data;return o};const E=async({publicKey:t,checkoutLandingSession:i,instantProduct:e,instantPlan:s,productId:n,planId:a})=>{if(i){const t=await T(i);return{session:t,type:h.CHECKOUT_LANDING}}if(e||s){const i=await z({publicKey:t,instantProduct:e,instantPlan:s});return{session:i,type:h.INSTANT}}if(n||a){const i=await A({publicKey:t,productId:n,planId:a});return{session:i,type:h.SDK_ITEM}}};const O="@media (max-width: 1024px){.rebill-checkout{width:100%;flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section-checkout .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}.rebill-checkout.full-width-layout .left-section{width:100%}.rebill-checkout.full-width-layout .left-section-container{max-width:none;width:100%}}@media (min-width: 1025px){.rebill-checkout{width:100%;min-height:600px;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section-checkout{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.rebill-checkout.full-width-layout .left-section{width:100%;justify-content:stretch}.rebill-checkout.full-width-layout .left-section-container{max-width:none;min-width:auto;width:100%;margin:2.5rem 2rem 1.5rem 2rem}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const K=class{constructor(e){t(this,e);this.error=i(this,"error");this.success=i(this,"success");this.successRedirect=i(this,"successRedirect");this.formChange=i(this,"formChange");this.paymentMethodSelected=i(this,"paymentMethodSelected")}productId;planId;publicKey;instantProduct;instantPlan;display;customerInformation;oneClickCheckout=true;css;language;async handleLanguageChange(t,i){if(t&&t!==i){try{await d.changeLanguage(t);u.changeLanguage(t);console.log(`[RebillCheckout] Language changed from ${i} to ${t}`)}catch(t){console.error("[RebillCheckout] Failed to change language:",t)}}}error;success;successRedirect;formChange;checkoutLandingSession;externalPayment;rejectedPaymentCard=false;rejectedPaymentAPM=false;countries=[];currentPaymentMethod;checkoutResponse=null;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;isAPMSubmitting=false;isAPMSuccess=false;storedCheckoutResults=new Map;alertErrorKeys=null;currentApmPaymentMethod=null;breakpoint=g.DESKTOP;showRefreshModal=false;cardError={showCardInvalid:false,type:null};initialData={};allRequiredFields={};currentRequiredFields=[];customerExists=false;showOtp=false;otpVerified=false;responseCheckoutCard=null;cardMode=null;formElement;emailDebounceTimeout=null;injectedStyleElement=null;get displayConfig(){if(!this.display){return S}if(typeof this.display==="string"){try{const t=JSON.parse(this.display);return{...S,...t}}catch(t){console.warn("Invalid display configuration string, using defaults:",t);return S}}return{...S,...this.display}}get parsedCustomerInformation(){if(!this.customerInformation){return null}if(typeof this.customerInformation==="string"){try{return JSON.parse(this.customerInformation)}catch(t){console.warn("Invalid customerInformation configuration string, ignoring:",t);return null}}return this.customerInformation}get filteredPaymentMethods(){const t=c.data?.itemInformation?.paymentMethods||[];const i=this.displayConfig.excludePaymentMethods;if(!i||i.length===0){return t}return t.filter((t=>!i.includes(t)))}getCombinedUserData(t={}){const i=c.data.userInformation;const e=this.parsedCustomerInformation;return{email:t?.email||e?.email||i.email,fullName:t?.fullName||e?.fullName||i.fullName,countryCodePhoneNumber:t?.countryCodePhoneNumber||e?.phoneNumber?.countryCode||e?.countryCode||i.countryCode,phoneNumber:t?.phoneNumber||e?.phoneNumber?.number||i.phoneNumber,documentType:t?.documentType||e?.documentType||i.documentType,documentNumber:t?.documentNumber||e?.documentNumber||i.documentNumber,"billing-country":t?.["billing-country"]||e?.address?.billingAddress?.country||i.address?.billingAddress?.country,"billing-state":t?.["billing-state"]||e?.address?.billingAddress?.state||i.address?.billingAddress?.state,"billing-address":t?.["billing-address"]||e?.address?.billingAddress?.address||i.address?.billingAddress?.address,"billing-city":t?.["billing-city"]||e?.address?.billingAddress?.city||i.address?.billingAddress?.city,"billing-zip":t?.["billing-zip"]||e?.address?.billingAddress?.zip||i.address?.billingAddress?.zip,"billing-addInformation":t?.["billing-addInformation"]||e?.address?.billingAddress?.addInformation||i.address?.billingAddress?.addInformation}}injectCustomCSS(){if(!this.css){return}this.cleanupInjectedCSS();const t=`rebill-checkout-css-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;if(this.css.startsWith("http://")||this.css.startsWith("https://")||this.css.startsWith("//")){const i=document.createElement("link");i.rel="stylesheet";i.href=this.css;i.id=t;i.setAttribute("data-rebill-injected","true");document.head.appendChild(i);this.injectedStyleElement=i}else{const i=document.createElement("style");i.id=t;i.setAttribute("data-rebill-injected","true");i.textContent=this.css;document.head.appendChild(i);this.injectedStyleElement=i}}cleanupInjectedCSS(){if(this.injectedStyleElement){try{this.injectedStyleElement.remove()}catch(t){console.warn("Error removing injected CSS:",t)}this.injectedStyleElement=null}}timeToRedirectAPM=5e3;resizeHandler=()=>{const t=w(window.innerWidth);if(t!==this.breakpoint){this.breakpoint=t}};disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler);if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout);this.emailDebounceTimeout=null}this.cleanupInjectedCSS()}async componentWillLoad(){try{this.resizeHandler();window.addEventListener("resize",this.resizeHandler);this.injectCustomCSS();if(this.language){await d.changeLanguage(this.language)}else{m()}const{session:t,type:i}=await E({publicKey:this.publicKey,checkoutLandingSession:this.checkoutLandingSession,instantProduct:this.instantProduct,instantPlan:this.instantPlan,productId:this.productId,planId:this.planId});u.initializeSession({session:t,type:i,payment:typeof this.externalPayment==="string"?JSON.parse(this.externalPayment):this.externalPayment});if(c.sessionRefreshed){this.showRefreshModal=true}x.loadGoogleMapsScript();const e=await n.data.getCountries();this.countries=e.data;if(this.parsedCustomerInformation){u.setUserInformation(this.parsedCustomerInformation)}this.initialData=this.getInitialData();this.allRequiredFields=await R();if(this.filteredPaymentMethods.length>0){if(c.data.paymentStatus===o.REJECTED||c.data.paymentStatus===o.APPROVED&&this.filteredPaymentMethods.includes(p.BANK_TRANSFER)){const t=this.filteredPaymentMethods.find((t=>t===p.BANK_TRANSFER));if(t){this.changePaymentMethod(t);u.setPaymentMethodSelected(t)}}else{this.changePaymentMethod(this.filteredPaymentMethods[0])}}if(this.oneClickCheckout){n.customers.exists({email:c.data?.prefilledData?.email},this.publicKey).then((t=>{this.customerExists=t.data.exists}))}this.cardMode=c.cardMode;f("cardMode",(()=>{this.cardMode=c.cardMode}))}catch(t){console.error("Error initializing checkout:",t)}}componentWillUpdate(){this.injectCustomCSS()}async changePaymentMethod(t){if(t!==this.currentPaymentMethod&&this.filteredPaymentMethods.includes(t)){if(this.checkoutResponse){this.checkoutResponse=null;u.clearCheckoutResponse()}this.currentPaymentMethod=t;u.setPaymentMethodSelected(t);if(t!==p.CARD){this.cardMode="input";u.setCardMode("input")}this.isSubmitting=false;this.currentApmPaymentMethod=v.mapToAPMPaymentMethod(t,c.data?.pricing?.country);if(t!==p.CASH&&t!==p.BANK_TRANSFER){this.checkoutResponse=null;u.clearCheckoutResponse()}else{this.checkoutResponse=null;u.clearCheckoutResponse()}this.paymentMethodSelected.emit(t);try{this.currentRequiredFields=j(t,this.allRequiredFields).fields;const i=await n.sessions.updateCurrentSessionPaymentMethod(c.data.sessionId,{paymentMethodName:v.mapToAPMPaymentMethod(t,c.data.pricing.country),paymentMethodType:t,currency:c.data.pricing.currency});u.setProviderKey(i.providerKey);if(i.providerKey===M.DECIDIR||c.data.providerKey===M.DECIDIR){const t=crypto.randomUUID();const i=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const e=i.result.script;const s=document.createElement("script");s.innerHTML=e;document.body.appendChild(s)}}catch(t){console.error("Failed to update payment method or get required fields:",t)}}}get currentPaymentError(){if(this.currentPaymentMethod===p.CARD){return this.rejectedPaymentCard}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){return this.rejectedPaymentAPM}return false}paymentMethodSelected;async handlePaymentMethodSelected(t){t.stopPropagation();const i=t.detail;this.changePaymentMethod(i);if(this.formElement){this.formElement.resetValidation()}}async handleSubmit(t){if(this.isSubmitting){return}this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false;if(this.currentPaymentMethod===p.CARD){this.handleSubmitCard(t)}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){this.handleSubmitAPM(t)}}handleFormChange(t){const i=t.detail;let e=true;let s={};if(this.formElement?.errors){s=this.formElement.errors;e=Object.keys(s).length===0}this.formChange.emit({data:i,isValid:e,errors:Object.keys(s).length>0?s:undefined})}async handleSubmitCard(t){const i=t.detail;const e=this.getCombinedUserData(i);if(!c.data.cardTokenId&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"card_error"};return}if(!c.data.cardInformation&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"tokenization_error"};return}this.cardError={showCardInvalid:false,type:null};const s={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},installments:Number(i.installments||c.data.cardInformation?.installments?.selectedInstallment?.installment),...c.data.cardTokenId&&{cardTokenId:c.data.cardTokenId,...c.data?.itemInformation?.type!==y.PLAN&&{saveCard:c.saveCard}},...c.data.cardId&&{cardId:c.data.cardId},...(!this.otpVerified||this.cardMode==="input")&&{customer:{firstName:e.fullName?.split(" ")[0],lastName:e.fullName?.split(" ").slice(1).join(" "),email:e.email,phone:{countryCode:e.countryCodePhoneNumber,number:e.phoneNumber}}},billingDetails:{address:{lineOne:e["billing-address"],city:e["billing-city"],state:e["billing-state"],country:e["billing-country"],zipCode:e["billing-zip"],lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}},customAttributes:{...c.deviceId&&{deviceId:c.deviceId}},...c.metadata&&{paymentMetadata:c.metadata}};const l=a();this.isSubmitting=true;this.isCardSubmitting=true;try{const t=await n.checkout.createCardCheckoutRequest(c.data.sessionId,l,s,c.data.accessToken||undefined);u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;if(t.data.result?.status.toUpperCase()===r.APPROVED){this.isCardSuccess=true;u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:t.data});c.data.cardInformation.lastFour=t.data.result?.cardLastFour}else{this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data.result?.statusDetail.toLowerCase()??t.data.error?.error?.message?.toLowerCase()}}}catch(t){this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()}}finally{this.isSubmitting=false;this.isCardSubmitting=false}}async handleSubmitAPM(t){if(this.currentPaymentMethod!==p.CASH&&this.currentPaymentMethod!==p.BANK_TRANSFER){return}this.isSubmitting=true;const i=t.detail;const e=this.getCombinedUserData(i);try{const t={address:{country:e["billing-country"]||"",state:e["billing-state"]||"",city:e["billing-city"]||"",zipCode:e["billing-zip"]||"",lineOne:e["billing-address"]||"",lineTwo:e["billing-addInformation"]},identification:{type:e.documentType,value:e.documentNumber}};const s=this.currentApmPaymentMethod||v.mapToAPMPaymentMethod(this.currentPaymentMethod,c.data?.pricing?.country);const o={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},method:s,billingDetails:t,redirect:{approved:window.location.origin+"/payment/success",rejected:window.location.origin+"/payment/failure"},paymentMetadata:c.metadata,customAttributes:{bank:i.bankId||c.data?.bankId?.code}};{o.customer={firstName:e.fullName?.split(" ")[0]||"",lastName:e.fullName?.split(" ").slice(1).join(" ")||"",email:e.email,phone:{countryCode:e.countryCodePhoneNumber||"",number:e.phoneNumber||""}}}const r=a();const l=await n.checkout.createAPMCheckoutRequest(c.data.sessionId,r,o);this.isSubmitting=false;this.checkoutResponse=l.data;this.storedCheckoutResults.set(this.currentPaymentMethod,l.data);if(l.data?.date){c.data.paymentDate=l.data.date;c.createdAt=l.data.date}if(l.data?.traceId){c.data.paymentReference=l.data.traceId}}catch(t){this.isSubmitting=false;this.checkoutResponse=t.data;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()};this.rejectedPaymentAPM=true}}async submit(){if(this.formElement&&typeof this.formElement.submit==="function"){this.formElement.submit()}else{await this.handleSubmit({detail:{}})}}handlePaymentStatusChange=t=>{if(t.isCompleted){if(t.status===b.APPROVED){u.setPaymentStatus(o.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:this.checkoutResponse})}else if(t.status===b.REJECTED){u.setPaymentStatus(o.REJECTED);this.alertErrorKeys={alertTitle:o.APM_ERROR_GENERIC,message:o.APM_MESSAGE_ERROR}}}};async handleInputChange(t){if(t?.detail?.id==="email"&&this.oneClickCheckout){if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout)}if(!t.detail.value||t.detail.value.trim()===""){this.customerExists=false;u.clearCustomerIdAndToken();return}this.emailDebounceTimeout=setTimeout((async()=>{try{const t=await n.customers.exists({email:c.data.userInformation.email},this.publicKey);this.customerExists=t.data.exists}catch(t){this.customerExists=false}}),500)}}validationSchema={email:s().when([],{is:()=>!this.otpVerified,then:t=>t.email("validation.emailInvalid").matches(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"validation.emailInvalid").required("validation.emailRequired"),otherwise:t=>t.notRequired()}),fullName:s().when([],{is:()=>!this.otpVerified,then:t=>t.required("validation.fullNameRequired").matches(/^[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}\s+[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}$/,"validation.fullNameInvalid"),otherwise:t=>t.notRequired()}),phoneNumber:s().when([],{is:()=>I("phoneNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.phoneRequired"),otherwise:t=>t.notRequired()}),isValidPhoneNumber:s().when([],{is:()=>I("phoneNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.equals(["true"],"validation.phoneRequired"),otherwise:t=>t.notRequired()}),"billing-country":s().when([],{is:()=>I("billing-country",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.countryRequired"),otherwise:t=>t.notRequired()}),"billing-state":s().when([],{is:()=>I("billing-state",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.stateRequired"),otherwise:t=>t.notRequired()}),"billing-address":s().when([],{is:()=>I("billing-address",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.addressRequired"),otherwise:t=>t.notRequired()}),"billing-city":s().when([],{is:()=>I("billing-city",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.cityRequired"),otherwise:t=>t.notRequired()}),"billing-zip":s().when([],{is:()=>I("billing-zip",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.zipRequired"),otherwise:t=>t.notRequired()}),bankId:s().when([],{is:()=>I("bankId",this.currentRequiredFields),then:t=>t.required("validation.bankRequired"),otherwise:t=>t.notRequired()}),installments:s().when([],{is:()=>this.currentPaymentMethod===p.CARD&&c.data.cardInformation.installments.isAvailableInstallments&&c.data.cardInformation?.installments?.installments.length>0&&c.data.itemInformation.type!==y.PLAN,then:t=>t.required("validation.installmentsRequired"),otherwise:t=>t.notRequired()}),documentType:s().when([],{is:()=>I("documentType",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>t.required("validation.documentTypeRequired"),otherwise:t=>t.notRequired()}),documentNumber:s().when([],{is:()=>I("documentNumber",this.currentRequiredFields)&&!this.otpVerified||this.otpVerified&&this.cardMode==="input",then:t=>{const i=t.required("validation.documentNumberRequired").min(7,"validation.documentInvalid");if(c.data?.pricing?.country==="BR"){return i.test("numeric-only","validation.documentNumberNumericOnly",(t=>{if(!t)return true;return/^\d+$/.test(t)}))}return i},otherwise:t=>t.notRequired()})};getInitialData=()=>({email:c.data.userInformation.email||"",fullName:c.data.userInformation.fullName||"",phoneNumber:c.data.userInformation.phoneNumber?.number||"",countryCodePhoneNumber:c.data.userInformation.countryCode||"",documentType:"",documentNumber:"","billing-country":c.data.userInformation.address?.billingAddress?.country||"","billing-state":c.data.userInformation?.address?.billingAddress?.state||"","billing-address":c.data.userInformation?.address?.billingAddress?.address||"","billing-city":c.data.userInformation?.address?.billingAddress?.city||"","billing-zip":c.data.userInformation?.address?.billingAddress?.zip||"",bankId:c.data.bankId?.code||"",card:"",installments:c.data.cardInformation?.installments?.selectedInstallment?.installment?.toString()||""});hasPrefilledAddress=()=>{const t=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return t.some((t=>{const i=this.initialData[t];return i&&i.trim()!==""}))};get isQrCodeVisible(){return!!this.checkoutResponse?.result?.data?.qrCode}get isBankTransferVisible(){return!!this.checkoutResponse?.result?.data?.account&&!!this.checkoutResponse?.result?.data?.bankName&&!!this.checkoutResponse?.result?.data?.reference}get isBoletoVisible(){return this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&!!this.checkoutResponse?.result?.data?.barcode}isPaymentApproved=()=>{if(c.data.paymentStatus===o.APPROVED){return true}return false};handleRebillAccountClick(t){this.showOtp=t.detail}handleReturnForm(t){this.showOtp=t.detail;u.clearCustomerIdAndToken()}handleSignOut(){this.showOtp=false;this.otpVerified=false;if(!c?.data?.prefilledData?.email){this.customerExists=false}u.clearCustomerIdAndToken();u.clearUserInformation();this.cardError={showCardInvalid:false,type:null};this.alertErrorKeys=null;this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false}handleCodeVerified(){this.otpVerified=true;this.showOtp=false;this.rejectedPaymentCard=false;this.alertErrorKeys=null;this.cardError={showCardInvalid:false,type:null};if(this.formElement){this.formElement.resetValidation()}}isPaymentRejected(){return c.data.paymentStatus===o.REJECTED&&this.currentPaymentMethod===p.BANK_TRANSFER}render(){const t=this.countries.map((t=>({label:t.country,value:t.isoCountryCode})));const i=(t={})=>e("rebill-summary",{key:"4b1db10c60e123202a604f64dc89990eace6325b",totalAmount:c.data.pricing.total,currency:c.data.pricing.currency,itemTitle:c._session?.getTitle(),itemDescription:c._session?.getDescription(),itemAmount:c.data.pricing.subtotal,subtotal:c.data.pricing.subtotal,allowCoupon:c._session?.getAllowCoupon(this.displayConfig),currentBreakpoint:this.breakpoint,planFrequency:c._session?.getPlanFrequency(),planFrequencyCount:c._session?.getPlanFrequencyCount(),discountType:c.data.discount.discountType,discountedPercentage:c.data.discount.discountedPercentage,discountDuration:c.data.discount.discountDuration,discountAmount:c.data.discount.discountAmount,...t});return c.isInitialized&&e(e.Fragment,null,this.showRefreshModal&&e("rebill-modal-overlay",{key:"479d5fbdd896241eadf43771c112d683fdafd54b"}),this.displayConfig.processingPayment&&e("rebill-processing-payment",{key:"29f1f76748c8603b97537e62fd6c973b17fecff7",style:{display:this.isCardSubmitting?"block":"none"}}),this.displayConfig.successPage&&this.isPaymentApproved()&&c.isInitialized?e("success-page",{typePaymentMethod:c.data.paymentMethodSelected,paymentMethodName:v.mapToAPMPaymentMethod(c.data.paymentMethodSelected||c.data.payment?.paymentMethodType,c.data?.pricing?.country),country:c.data?.pricing?.country,bank:c.data.payment?.paymentMethodMetadata?.bank||c.data.payment?.paymentMethodMetadata?.bank,cardLastFour:this.responseCheckoutCard?.result?.cardLastFour||c.data.cardInformation?.lastFour,paymentDate:c.data.paymentDate||this.responseCheckoutCard?.date||c.data.payment?.createdAt||this.checkoutResponse?.result?.data?.createdAt,referenceNumber:c.data.paymentReference||c.data.payment?.traceId||this.responseCheckoutCard?.traceId,onSuccessRedirect:t=>{this.successRedirect.emit(t.detail)},trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,debitDay:c.data?.itemInformation?.debitDay,planAmount:c.data?.pricing?.planAmount}):e(e.Fragment,null,this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&k(this.breakpoint,g.DESKTOP)&&e("div",{class:"mode-sandbox-mobile-container",style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"}},e("rebill-mode-sandbox-mobile",null)),e("rebill-checkout-form",{ref:t=>this.formElement=t,style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:t=>this.handleSubmit(t),onChange:t=>this.handleFormChange(t),renderForm:({submit:s,formData:n,errors:a})=>{const o=!this.isCardSuccess&&this.checkoutResponse?.result&&(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER);return e("div",{class:`rebill-checkout ${!this.displayConfig.checkoutSummary?"full-width-layout":""}`},e("div",{class:"left-section"},e("div",{class:"left-section-container"},this.displayConfig.logo&&e("organization-logo",{organization:c.data.organization}),e("div",{class:"otp-container",style:{display:this.showOtp?"block":"none"}},e("otp-component",null)),e("div",{style:{display:this.showOtp?"none":"block"}},e("div",{class:"checkout-form-section"},this.displayConfig.checkoutSummary&&e("div",{class:"summary-mobile-tablet",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["totalAmount","discount","timelineFreeTrial","timelineDebitDay","itemDetails"]})),!this.otpVerified&&this.displayConfig.customerInformation&&e("user-information",{customerExists:this.customerExists,disabled:this.isSubmitting,errors:{email:a.email,fullName:a.fullName}}),this.otpVerified&&this.displayConfig.customerInformation&&e("user-information-static",{variant:"otp",userInfo:{customerName:c.data.userInformation.fullName?.split(" ")[0],customerEmail:c.data.userInformation.email}}),e("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e("payment-method-selector",{enabledPaymentMethods:this.filteredPaymentMethods,defaultSelected:this.currentPaymentMethod,disabled:this.isSubmitting,errorComponent:{showErrorComponent:this.displayConfig.errorMessage&&(this.currentPaymentError||this.isPaymentRejected()),alertTitle:l.getErrorTitle(this.currentPaymentMethod,c.data?.pricing?.country||"",this.alertErrorKeys?.alertTitle),message:l.getErrorMessage(this.alertErrorKeys?.message,this.currentPaymentMethod,c.data?.pricing?.country)},country:c.data?.pricing?.country,installmentsError:a.installments,showDocument:(!this.otpVerified||this.otpVerified&&this.cardMode==="input")&&!o&&!this.isQrCodeVisible&&(I("documentNumber",this.currentRequiredFields)||I("documentType",this.currentRequiredFields)),documentTypeError:a.documentType,documentNumberError:a.documentNumber,cardError:this.cardError,customCSS:this.css}),!o&&(()=>{const t=I("bankId",this.currentRequiredFields);return t})()&&e("div",{class:"animated-component fade-in"},e("rebill-bank-selector",{banks:P("bank",this.allRequiredFields[this.currentPaymentMethod].original)||[],defaultSelectedBankId:n.bankId||"",error:a?.bankId,disabled:this.isSubmitting}))),!o&&(!this.otpVerified||this.cardMode==="input")&&e(e.Fragment,null,this.displayConfig.billingAddress&&(I("billing-country",this.currentRequiredFields)||I("billing-state",this.currentRequiredFields)||I("billing-address",this.currentRequiredFields)||I("billing-city",this.currentRequiredFields)||I("billing-zip",this.currentRequiredFields))&&e("div",{class:"animated-component slide-in"},e("rebill-address",{disabled:this.isSubmitting,countryOptions:t,billingView:(()=>{if(this.displayConfig.useAddressSearch!==undefined&&this.displayConfig.useAddressSearch===false){return"form"}return this.hasPrefilledAddress()?"form":"search"})(),errors:{"billing-country":a["billing-country"],"billing-state":a["billing-state"],"billing-address":a["billing-address"],"billing-city":a["billing-city"],"billing-zip":a["billing-zip"]}})),this.displayConfig.customerInformation&&I("phoneNumber",this.currentRequiredFields)&&e("div",{class:"animated-component fade-in"},e("user-information-phone",{disabled:this.isSubmitting,error:a?.phoneNumber||a?.isValidPhoneNumber,countryCode:c.data.userInformation?.countryCode||c.data.country}))),o&&(()=>{const t=this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&this.checkoutResponse?.result?.data?.barcode;return e("apm-checkout",{paymentMethod:this.currentPaymentMethod,barcode:t?this.checkoutResponse?.result?.data?.barcode:undefined,referenceId:this.currentPaymentMethod===p.CASH&&!t?this.checkoutResponse?.result?.data?.referenceId:undefined,qrCodeData:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.qrCode:undefined,code:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.code:undefined,checkoutRequestId:this.checkoutResponse?.result?.checkoutRequestId,providerName:c.data.providerKey,expirationDate:(()=>{const t=new Date;t.setDate(t.getDate()+30);return t.toISOString()})(),onPaymentStatusChange:t=>this.handlePaymentStatusChange(t.detail),country:c.data?.pricing?.country,redirectUrl:this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,bearerToken:this.checkoutResponse?.result?.data?.bearerToken,bankTransferData:this.checkoutResponse?.result?.data?.account&&this.checkoutResponse?.result?.data?.bankName&&this.checkoutResponse?.result?.data?.reference?{account:this.checkoutResponse.result.data.account,bankName:this.checkoutResponse.result.data.bankName,reference:this.checkoutResponse.result.data.reference}:undefined})})(),this.displayConfig.checkoutSummary&&e("div",{class:"summary-price-details",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},i({displayedComponents:["priceDetails"]})),this.displayConfig.submitButton&&!(o&&(this.isQrCodeVisible||this.isBankTransferVisible||this.isBoletoVisible))&&e("div",{class:"payment-button-container"},e("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,onSubmit:()=>{s()},redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,isDisabled:c.data.fetchingInstallments,country:c.data?.pricing?.country}),e("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:d.translate("otp.secureMessage")}))),this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===h.CHECKOUT_LANDING&&!k(this.breakpoint,g.DESKTOP)&&e("rebill-mode-sandbox",null)),this.displayConfig.footer&&e("rebill-footer",{style:{marginTop:k(this.breakpoint,g.DESKTOP)?"24px":"auto"}}))),this.displayConfig.checkoutSummary&&e("div",{class:"right-section-checkout"},e("div",{class:"checkout-summary-section"},e("div",{class:"summary-desktop",style:{display:!k(this.breakpoint,g.DESKTOP)?"block":"none"}},i()))))}})))}static get watchers(){return{language:["handleLanguageChange"]}}};K.style=O;export{K as rebill_checkout};
|
|
2
|
+
//# sourceMappingURL=p-4b4e2e73.entry.js.map
|