@adyen/adyen-web 6.46.0 → 6.47.0-alpha.41c41fe
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.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +63 -46
- package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
- package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
- package/dist/es/components/AmazonPay/components/SignOutButton.js +1 -1
- package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
- package/dist/es/components/AmazonPay/utils.js +1 -1
- package/dist/es/components/AmazonPay/utils.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
- package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
- package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
- package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
- package/dist/es/components/CashAppPay/services/types.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js +1 -1
- package/dist/es/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es/components/PayPal/Paypal.js +1 -1
- package/dist/es/components/PayPal/Paypal.js.map +1 -1
- package/dist/es/components/PayPal/utils/get-paypal-locale.js.map +1 -1
- package/dist/es/components/PayPal/utils/get-paypal-settings.js +1 -1
- package/dist/es/components/PayPal/utils/get-paypal-settings.js.map +1 -1
- package/dist/es/components/PayPalFastlane/Fastlane.js +1 -1
- package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
- package/dist/es/components/PayPalFastlane/FastlaneSDK.js +1 -1
- package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
- package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/utils.js +1 -1
- package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/internal/Address/Address.js +1 -1
- package/dist/es/components/internal/Address/Address.js.map +1 -1
- package/dist/es/components/internal/Address/Specifications.js +1 -1
- package/dist/es/components/internal/Address/Specifications.js.map +1 -1
- package/dist/es/components/internal/Address/components/AddressSearch.js +1 -1
- package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
- package/dist/es/components/internal/Address/components/FieldContainer.js +1 -1
- package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
- package/dist/es/components/internal/Address/constants.js.map +1 -1
- package/dist/es/components/internal/Address/utils.js.map +1 -1
- package/dist/es/components/internal/Address/validate.formats.js +1 -1
- package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/validate.js +1 -1
- package/dist/es/components/internal/CompanyDetails/validate.js.map +1 -1
- package/dist/es/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.js.map +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputDate/InputDate.js +1 -1
- package/dist/es/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputDate/utils.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
- package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es/components/internal/IbanInput/specifications.js.map +1 -1
- package/dist/es/components/internal/IbanInput/utils.js +1 -1
- package/dist/es/components/internal/IbanInput/utils.js.map +1 -1
- package/dist/es/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/validate.js +1 -1
- package/dist/es/components/internal/PersonalDetails/validate.js.map +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputFields.js +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/components/internal/UIElement/utils.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/config.js.map +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/core/utils.js +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
- package/dist/es/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es/index.d.ts +63 -46
- package/dist/es/utils/Script.js.map +1 -1
- package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
- package/dist/es/utils/Validator/Validator.js +1 -1
- package/dist/es/utils/Validator/Validator.js.map +1 -1
- package/dist/es/utils/Validator/defaultRules.js +1 -1
- package/dist/es/utils/Validator/defaultRules.js.map +1 -1
- package/dist/es/utils/browserInfo.js.map +1 -1
- package/dist/es/utils/createSdkData.js.map +1 -1
- package/dist/es/utils/get-issuer-image.js +1 -1
- package/dist/es/utils/get-issuer-image.js.map +1 -1
- package/dist/es/utils/get-process-message-handler.js.map +1 -1
- package/dist/es/utils/getConsentUrl.js +1 -1
- package/dist/es/utils/getConsentUrl.js.map +1 -1
- package/dist/es/utils/getErrorMessage.js.map +1 -1
- package/dist/es/utils/getOrigin.js.map +1 -1
- package/dist/es/utils/isValidURL.js +1 -1
- package/dist/es/utils/isValidURL.js.map +1 -1
- package/dist/es/utils/promiseTimeout.js.map +1 -1
- package/dist/es/utils/useAutoFocus.js.map +1 -1
- package/dist/es/utils/validator-utils.js +1 -1
- package/dist/es/utils/validator-utils.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
- package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
- package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
- package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
- package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
- package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js.map +1 -1
- package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +1 -1
- package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/Fastlane.js +1 -1
- package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
- package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js +1 -1
- package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Specifications.js +1 -1
- package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/components/AddressSearch.js +1 -1
- package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/components/FieldContainer.js +1 -1
- package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
- package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/validate.js +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/specifications.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/utils.js +1 -1
- package/dist/es-legacy/components/internal/IbanInput/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/validate.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/config.js.map +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/core/utils.js +1 -1
- package/dist/es-legacy/core/utils.js.map +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es-legacy/utils/Script.js.map +1 -1
- package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
- package/dist/es-legacy/utils/Validator/Validator.js +1 -1
- package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
- package/dist/es-legacy/utils/Validator/defaultRules.js +1 -1
- package/dist/es-legacy/utils/Validator/defaultRules.js.map +1 -1
- package/dist/es-legacy/utils/browserInfo.js.map +1 -1
- package/dist/es-legacy/utils/createSdkData.js.map +1 -1
- package/dist/es-legacy/utils/get-issuer-image.js +1 -1
- package/dist/es-legacy/utils/get-issuer-image.js.map +1 -1
- package/dist/es-legacy/utils/get-process-message-handler.js.map +1 -1
- package/dist/es-legacy/utils/getConsentUrl.js +1 -1
- package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
- package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
- package/dist/es-legacy/utils/getOrigin.js.map +1 -1
- package/dist/es-legacy/utils/isValidURL.js +1 -1
- package/dist/es-legacy/utils/isValidURL.js.map +1 -1
- package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
- package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
- package/dist/es-legacy/utils/validator-utils.js +1 -1
- package/dist/es-legacy/utils/validator-utils.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentStatusTimer.js","sources":["../../../../src/hooks/usePaymentStatusTimer/usePaymentStatusTimer.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'preact/hooks';\nimport checkPaymentStatus from '../../core/Services/payment-status';\nimport { processPaymentStatusResponse } from '../../core/ProcessResponse/PaymentStatus';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { CountdownTime } from '../../components/internal/Countdown/types';\nimport { PaymentStatusTimerActions, PaymentStatusTimerState, UsePaymentStatusTimerProps } from './types';\nimport {\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from './constants';\nimport { AdditionalDetailsData, ProcessedPaymentStatusResponse } from '../../types';\n\nexport function usePaymentStatusTimer(props: Readonly<UsePaymentStatusTimerProps>): {\n state: PaymentStatusTimerState;\n actions: PaymentStatusTimerActions;\n} {\n const [completed, setCompleted] = useState(false);\n const [expired, setExpired] = useState(false);\n const [loading, setLoading] = useState(true);\n const [delay, setDelay] = useState(props.delay ?? DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS);\n const [percentage, setPercentage] = useState(100);\n const [timePassed, setTimePassed] = useState(0);\n const [onPollingStartedActionHandled, setOnPollingStartedActionHandled] = useState(false);\n const timeoutRef = useRef<NodeJS.Timeout | number | null>(null);\n\n const onTick = (time: CountdownTime): void => {\n setPercentage(time.percentage);\n };\n\n const onTimeUp = (): void => {\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n const onComplete = (status: ProcessedPaymentStatusResponse): void => {\n setCompleted(true);\n setLoading(false);\n\n if (status.props
|
|
1
|
+
{"version":3,"file":"usePaymentStatusTimer.js","sources":["../../../../src/hooks/usePaymentStatusTimer/usePaymentStatusTimer.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'preact/hooks';\nimport checkPaymentStatus from '../../core/Services/payment-status';\nimport { processPaymentStatusResponse } from '../../core/ProcessResponse/PaymentStatus';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { CountdownTime } from '../../components/internal/Countdown/types';\nimport { NetworkErrorPaymentStatus, PaymentStatusTimerActions, PaymentStatusTimerState, UsePaymentStatusTimerProps } from './types';\nimport {\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from './constants';\nimport { AdditionalDetailsData, ProcessedPaymentStatusResponse } from '../../types';\n\nexport function usePaymentStatusTimer(props: Readonly<UsePaymentStatusTimerProps>): {\n state: PaymentStatusTimerState;\n actions: PaymentStatusTimerActions;\n} {\n const [completed, setCompleted] = useState(false);\n const [expired, setExpired] = useState(false);\n const [loading, setLoading] = useState(true);\n const [delay, setDelay] = useState(props.delay ?? DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS);\n const [percentage, setPercentage] = useState(100);\n const [timePassed, setTimePassed] = useState(0);\n const [onPollingStartedActionHandled, setOnPollingStartedActionHandled] = useState(false);\n const timeoutRef = useRef<NodeJS.Timeout | number | null>(null);\n\n const onTick = (time: CountdownTime): void => {\n setPercentage(time.percentage);\n };\n\n const onTimeUp = (): void => {\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'Payment Expired'));\n };\n\n const onComplete = (status: ProcessedPaymentStatusResponse): void => {\n setCompleted(true);\n setLoading(false);\n\n if (status.props?.payload) {\n const additionalDetailsData: AdditionalDetailsData = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n props.onComplete(additionalDetailsData);\n } else {\n setExpired(true);\n props.onError(new AdyenCheckoutError('ERROR', 'successful result, but no payload in response'));\n }\n };\n\n const onError = (status: ProcessedPaymentStatusResponse): void => {\n setExpired(true);\n setLoading(false);\n\n if (status.props?.payload) {\n const additionalDetailsData: AdditionalDetailsData = {\n data: {\n details: { payload: status.props.payload },\n paymentData: props.paymentData\n }\n };\n props.onComplete(additionalDetailsData);\n } else {\n const error = new AdyenCheckoutError('ERROR', 'error result with no payload in response');\n props.onError(error);\n }\n };\n\n const checkStatus = async (): Promise<void> => {\n const { paymentData, clientKey, throttleInterval, pollStatus } = props;\n\n const pollStatusFunction = pollStatus ?? (() => checkPaymentStatus(paymentData, clientKey, props.loadingContext, throttleInterval));\n\n if (!onPollingStartedActionHandled) {\n props.onActionHandled?.({ componentType: props.type, actionDescription: 'polling-started' });\n setOnPollingStartedActionHandled(true);\n }\n\n return pollStatusFunction()\n .then(processPaymentStatusResponse)\n .catch((error: unknown): NetworkErrorPaymentStatus => ({\n type: 'network-error',\n props: error\n }))\n .then((status: ProcessedPaymentStatusResponse | NetworkErrorPaymentStatus) => {\n switch (status.type) {\n case 'success':\n onComplete(status);\n break;\n case 'error':\n onError(status);\n break;\n default:\n setLoading(false);\n }\n });\n };\n\n useEffect(() => {\n void checkStatus();\n }, []);\n\n useEffect(() => {\n if (expired || completed || loading) {\n return;\n }\n\n const statusInterval = async (): Promise<void> => {\n const start = performance.now();\n await checkStatus();\n const end = performance.now();\n const responseTime = Math.round(end - start);\n\n const actualTimePassed = timePassed + responseTime + delay;\n setTimePassed(actualTimePassed);\n\n if (\n actualTimePassed >= (props.throttleTime ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS) &&\n delay !== (props.throttleInterval ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS)\n ) {\n setDelay(props.throttleInterval ?? DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS);\n }\n };\n\n const timeoutId = setTimeout(() => {\n void statusInterval();\n }, delay);\n timeoutRef.current = timeoutId;\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [expired, completed, loading, delay, props.throttleTime, props.throttleInterval, timePassed]);\n\n const state: PaymentStatusTimerState = {\n completed,\n expired,\n loading,\n percentage,\n timePassed\n };\n\n const actions: PaymentStatusTimerActions = {\n onTick,\n onTimeUp\n };\n\n return { state, actions };\n}\n"],"names":["usePaymentStatusTimer","props","completed","setCompleted","useState","expired","setExpired","loading","setLoading","delay","setDelay","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","percentage","setPercentage","timePassed","setTimePassed","onPollingStartedActionHandled","setOnPollingStartedActionHandled","timeoutRef","useRef","checkStatus","async","paymentData","clientKey","throttleInterval","pollStatus","pollStatusFunction","checkPaymentStatus","loadingContext","onActionHandled","componentType","type","actionDescription","then","processPaymentStatusResponse","catch","error","status","payload","additionalDetailsData","data","details","onComplete","onError","AdyenCheckoutError","useEffect","timeoutId","setTimeout","start","performance","now","end","responseTime","Math","round","actualTimePassed","throttleTime","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS","statusInterval","current","clearTimeout","state","actions","onTick","time","onTimeUp"],"mappings":"seAaO,SAASA,EAAsBC,GAOCA,IAAAA,EAHnC,MAAOC,EAAWC,GAAgBC,GAAS,IACpCC,EAASC,GAAcF,GAAS,IAChCG,EAASC,GAAcJ,GAAS,IAChCK,EAAOC,GAAYN,EAAoB,QAAXH,EAAAA,EAAMQ,aAANR,IAAAA,EAAAA,EAAeU,IAC3CC,EAAYC,GAAiBT,EAAS,MACtCU,EAAYC,GAAiBX,EAAS,IACtCY,EAA+BC,GAAoCb,GAAS,GAC7Ec,EAAaC,EAAuC,MA+CpDC,EAAcC,UAChB,MAAMC,YAAEA,EAAWC,UAAEA,EAASC,iBAAEA,EAAgBC,WAAEA,GAAexB,EAE3DyB,EAAqBD,QAAAA,EAAe,IAAME,EAAmBL,EAAaC,EAAWtB,EAAM2B,eAAgBJ,GAG7GvB,IAAAA,EADCe,IACoB,QAArBf,EAAAA,EAAM4B,uBAAN5B,IAAAA,GAAAA,OAAAA,EAAwB,CAAE6B,cAAe7B,EAAM8B,KAAMC,kBAAmB,oBACxEf,GAAiC,IAGrC,OAAOS,IACFO,KAAKC,GACLC,MAAOC,KACJL,KAAM,gBACN9B,MAAOmC,KAEVH,KAAMI,IACH,OAAQA,EAAON,MACX,IAAK,UAtDF,CAACM,IAIZA,IAAAA,EAAJ,GAHAlC,GAAa,GACbK,GAAW,WAEP6B,EAAAA,EAAOpC,iBAAPoC,OAAAA,EAAAA,EAAcC,QAAS,CACvB,MAAMC,EAA+C,CACjDC,KAAM,CACFC,QAAS,CAAEH,QAASD,EAAOpC,MAAMqC,SACjChB,YAAarB,EAAMqB,cAG3BrB,EAAMyC,WAAWH,EACrB,MACIjC,GAAW,GACXL,EAAM0C,QAAQ,IAAIC,EAAmB,QAAS,mDAyClCF,CAAWL,GACX,MACJ,IAAK,QAvCL,CAACA,IAITA,IAAAA,EAAJ,GAHA/B,GAAW,GACXE,GAAW,WAEP6B,EAAAA,EAAOpC,iBAAPoC,OAAAA,EAAAA,EAAcC,QAAS,CACvB,MAAMC,EAA+C,CACjDC,KAAM,CACFC,QAAS,CAAEH,QAASD,EAAOpC,MAAMqC,SACjChB,YAAarB,EAAMqB,cAG3BrB,EAAMyC,WAAWH,EACrB,KAAO,CACH,MAAMH,EAAQ,IAAIQ,EAAmB,QAAS,4CAC9C3C,EAAM0C,QAAQP,EAClB,GAyBgBO,CAAQN,GACR,MACJ,QACI7B,GAAW,OAK/BqC,EAAU,KACDzB,KACN,IAEHyB,EAAU,KACN,GAAIxC,GAAWH,GAAaK,EACxB,OAGJ,MAiBMuC,EAAYC,WAAW,KAjBN1B,eAUMpB,EACVA,EAVf,MAAM+C,EAAQC,YAAYC,YACpB9B,IACN,MAAM+B,EAAMF,YAAYC,MAClBE,EAAeC,KAAKC,MAAMH,EAAMH,GAEhCO,EAAmBzC,EAAasC,EAAe3C,EAOxCR,IAAAA,EANbc,EAAcwC,GAGVA,YAAqBtD,EAAAA,EAAMuD,wBAANvD,EAAAA,EAAsBwD,IAC3ChD,KAAiC,QAAtBR,EAAAA,EAAMuB,wBAANvB,IAAAA,EAAAA,EAA0ByD,IAErChD,EAA+B,QAAtBT,EAAAA,EAAMuB,4BAANvB,EAAAA,EAA0ByD,IAKlCC,IACNlD,GAGH,OAFAS,EAAW0C,QAAUd,EAEd,KACHe,aAAaf,KAElB,CAACzC,EAASH,EAAWK,EAASE,EAAOR,EAAMuD,aAAcvD,EAAMuB,iBAAkBV,IAepF,MAAO,CAAEgD,MAb8B,CACnC5D,YACAG,UACAE,UACAK,aACAE,cAQYiD,QAL2B,CACvCC,OAxHYC,IACZpD,EAAcoD,EAAKrD,aAwHnBsD,SArHa,KACb5D,GAAW,GACXL,EAAM0C,QAAQ,IAAIC,EAAmB,QAAS,sBAuHtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: (reason?: unknown) => void | null = null;\n private resolveLoadScript: (() => void) | null = null;\n private rejectLoadScript: ((reason?: unknown) => void) | null = null;\n\n private readonly handleOnLoad = () => {\n this.script?.setAttribute('data-script-loaded', 'true');\n this.cleanupListeners();\n this.resolveLoadScript?.();\n };\n\n private readonly handleOnError = (errorEvent: ErrorEvent) => {\n this.cleanupListeners();\n const error = new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n );\n this.rejectLoadScript?.(error);\n };\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.cleanupListeners();\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private cleanupListeners() {\n if (!this.script) return;\n this.script.removeEventListener('load', this.handleOnLoad);\n this.script.removeEventListener('error', this.handleOnError);\n }\n\n private attachListeners() {\n if (!this.script) return;\n this.cleanupListeners();\n this.script.addEventListener('load', this.handleOnLoad);\n this.script.addEventListener('error', this.handleOnError);\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n this.resolveLoadScript = resolve;\n this.rejectLoadScript = reject;\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n this.resolveLoadScript();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.attachListeners();\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.attachListeners();\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","_this_script_parentNode","_this_script","this","cleanupListeners","script","parentNode","removeChild","removeEventListener","handleOnLoad","handleOnError","attachListeners","addEventListener","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","resolveLoadScript","rejectLoadScript","src","getAttribute","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","AdyenCheckoutError","trackEvent","eventType","_this_analytics","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","_this_resolveLoadScript","setAttribute","call","errorEvent","_this_rejectLoadScript","error","message","cause","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","_this_rejectLoadPromise","url","URL","origin","pathname","getBaseURL"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement> | undefined;\n private readonly dataAttributes: Record<string, string | undefined> | undefined;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement | null;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: ((reason?: unknown) => void) | null = null;\n private resolveLoadScript: (() => void) | null = null;\n private rejectLoadScript: ((reason?: unknown) => void) | null = null;\n\n private readonly handleOnLoad = () => {\n this.script?.setAttribute('data-script-loaded', 'true');\n this.cleanupListeners();\n this.resolveLoadScript?.();\n };\n\n private readonly handleOnError = (errorEvent: ErrorEvent) => {\n this.cleanupListeners();\n const error = new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n );\n this.rejectLoadScript?.(error);\n };\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.cleanupListeners();\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private cleanupListeners() {\n if (!this.script) return;\n this.script.removeEventListener('load', this.handleOnLoad);\n this.script.removeEventListener('error', this.handleOnError);\n }\n\n private attachListeners() {\n if (!this.script) return;\n this.cleanupListeners();\n this.script.addEventListener('load', this.handleOnLoad);\n this.script.addEventListener('error', this.handleOnError);\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n this.resolveLoadScript = resolve;\n this.rejectLoadScript = reject;\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n this.resolveLoadScript();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.attachListeners();\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.attachListeners();\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","_this_script_parentNode","_this_script","this","cleanupListeners","script","parentNode","removeChild","removeEventListener","handleOnLoad","handleOnError","attachListeners","addEventListener","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","resolveLoadScript","rejectLoadScript","src","getAttribute","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","AdyenCheckoutError","trackEvent","eventType","_this_analytics","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","_this_resolveLoadScript","setAttribute","call","errorEvent","_this_rejectLoadScript","error","message","cause","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","_this_rejectLoadPromise","url","URL","origin","pathname","getBaseURL"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject, ValidatorRule, ValidatorMode, FieldContext } from './types';\nimport Language from '../../language';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean;\n public errorMessage: string | ErrorMessageObject | undefined;\n public errorI18n: string;\n\n constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context: FieldContext, i18n: Language) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n\n if (typeof rule.errorMessage === 'string') {\n this.errorI18n = i18n.get(rule.errorMessage);\n } else if (rule.errorMessage) {\n this.errorI18n = i18n.get(rule.errorMessage.translationKey, rule.errorMessage.translationObject);\n }\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","hasError","isValidatingForm","this","isValid","shouldValidate","constructor","rule","value","mode","context","i18n","_define_property","errorMessage","errorI18n","modes","includes","validate","get","translationKey","translationObject"],"mappings":"wHAMO,MAAMA,EAwBTC,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBC,KAAKC,SAAWD,KAAKE,eAAiC,MAAhBF,KAAKC,UAAoBD,KAAKC,SAAWD,KAAKE,cACnH,CApBA,WAAAC,CAAYC,EAAqBC,EAAeC,EAAqBC,
|
|
1
|
+
{"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject, ValidatorRule, ValidatorMode, FieldContext } from './types';\nimport Language from '../../language';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean | null;\n public errorMessage: string | ErrorMessageObject | undefined;\n public errorI18n: string;\n\n constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context: FieldContext | undefined, i18n: Language) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n\n if (typeof rule.errorMessage === 'string') {\n this.errorI18n = i18n.get(rule.errorMessage);\n } else if (rule.errorMessage) {\n this.errorI18n = i18n.get(rule.errorMessage.translationKey, rule.errorMessage.translationObject);\n }\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","hasError","isValidatingForm","this","isValid","shouldValidate","constructor","rule","value","mode","context","i18n","_define_property","errorMessage","errorI18n","modes","includes","validate","get","translationKey","translationObject"],"mappings":"wHAMO,MAAMA,EAwBTC,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBC,KAAKC,SAAWD,KAAKE,eAAiC,MAAhBF,KAAKC,UAAoBD,KAAKC,SAAWD,KAAKE,cACnH,CApBA,WAAAC,CAAYC,EAAqBC,EAAeC,EAAqBC,EAAmCC,GALxGC,EAAAT,KAAiBE,yBACjBO,EAAAT,KAAOC,kBACPQ,EAAAT,KAAOU,uBACPD,EAAAT,KAAOW,oBAGHX,KAAKE,eAAiBE,EAAKQ,MAAMC,SAASP,GAC1CN,KAAKC,QAAUG,EAAKU,SAAST,EAAOE,GACpCP,KAAKU,aAAeN,EAAKM,aAEQ,iBAAtBN,EAAKM,aACZV,KAAKW,UAAYH,EAAKO,IAAIX,EAAKM,cACxBN,EAAKM,eACZV,KAAKW,UAAYH,EAAKO,IAAIX,EAAKM,aAAaM,eAAgBZ,EAAKM,aAAaO,mBAEtF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ValidationRuleResult as t}from"./ValidationRuleResult.js";function r(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}class e{get isValid(){return this.validationResults.
|
|
1
|
+
import{ValidationRuleResult as t}from"./ValidationRuleResult.js";function r(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}class e{get isValid(){return this.validationResults.every(t=>!!t.isValid)}hasError(t=!1){return Boolean(this.getError(t))}getError(t=!1){var r;return null!==(r=this.validationResults.find(r=>r.hasError(t)))&&void 0!==r?r:null}getAllErrors(){return this.validationResults.filter(t=>t.hasError())}constructor(t){r(this,"validationResults",void 0),this.validationResults=t}}class s{setRules(t){this.rules=function(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),i.forEach(function(e){r(t,e,s[e])})}return t}({},this.rules,t)}getRulesFor(t){var r;let e=null!==(r=this.rules[t])&&void 0!==r?r:this.rules.default;return Array.isArray(e)||(e=[e]),e}validate({key:r,value:s,mode:i="blur"},l){const n=this.getRulesFor(r).map(r=>new t(r,s,i,l,this.i18n));return new e(n)}constructor(t,e){r(this,"rules",{default:{validate:()=>!0,modes:["blur","input"]}}),r(this,"i18n",void 0),this.setRules(t),this.i18n=e}}export{e as ValidationResult,s as default};
|
|
2
2
|
//# sourceMappingURL=Validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\nimport type Language from '../../language';\n\nexport class ValidationResult {\n private readonly validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.
|
|
1
|
+
{"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\nimport type Language from '../../language';\n\nexport class ValidationResult {\n private readonly validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.every(result => !!result.isValid);\n }\n\n /** Checks if any validation rule returned an error */\n hasError(isValidatingForm = false): boolean {\n return Boolean(this.getError(isValidatingForm));\n }\n\n /** Returns the first validation result that returned an error */\n getError(isValidatingForm = false): ValidationRuleResult | null {\n return this.validationResults.find(result => result.hasError(isValidatingForm)) ?? null;\n }\n\n /** Returns all validation results that returned an error */\n getAllErrors() {\n return this.validationResults.filter(result => result.hasError());\n }\n}\n\nclass Validator {\n public rules: ValidatorRules = {\n default: {\n validate: () => true,\n modes: ['blur', 'input']\n }\n };\n\n private readonly i18n: Language;\n\n constructor(rules: ValidatorRules, i18n: Language) {\n this.setRules(rules);\n this.i18n = i18n;\n }\n\n setRules(newRules: ValidatorRules) {\n this.rules = {\n ...this.rules,\n ...newRules\n };\n }\n\n /**\n * Get all validation rules for a field\n */\n private getRulesFor(field: string): ValidatorRule[] {\n let fieldRules: ValidatorRule | ValidatorRule[] = this.rules[field] ?? this.rules['default'];\n\n if (!Array.isArray(fieldRules)) {\n fieldRules = [fieldRules];\n }\n\n return fieldRules;\n }\n\n /**\n * Validates a field\n */\n validate({ key, value, mode = 'blur' }: FieldData, context?: FieldContext) {\n const fieldRules = this.getRulesFor(key);\n // create an ValidationRuleResult, we run the actual validation inside of it\n // validate is called in the constructor of ValidationRuleResult\n // line rule.validate(value, context);\n //\n const validationRulesResult = fieldRules.map(rule => new ValidationRuleResult(rule, value, mode, context, this.i18n));\n\n return new ValidationResult(validationRulesResult);\n }\n}\n\nexport default Validator;\n"],"names":["ValidationResult","isValid","this","validationResults","every","result","hasError","isValidatingForm","Boolean","getError","_this_validationResults_find","find","getAllErrors","filter","constructor","results","_define_property","Validator","setRules","newRules","rules","_object_spread","getRulesFor","field","_this_rules_field","fieldRules","Array","isArray","validate","key","value","mode","context","validationRulesResult","map","rule","ValidationRuleResult","i18n","default","modes"],"mappings":"yLAIO,MAAMA,EAQT,WAAIC,GACA,OAAOC,KAAKC,kBAAkBC,MAAMC,KAAYA,EAAOJ,QAC3D,CAGAK,QAAAA,CAASC,GAAmB,GACxB,OAAOC,QAAQN,KAAKO,SAASF,GACjC,CAGAE,QAAAA,CAASF,GAAmB,GACjB,IAAAG,EAAP,OAA6DH,QAAtDG,EAAAR,KAAKC,kBAAkBQ,KAAKN,GAAUA,EAAOC,SAASC,eAAtDG,EAAAA,EAA4E,IACvF,CAGAE,YAAAA,GACI,OAAOV,KAAKC,kBAAkBU,OAAOR,GAAUA,EAAOC,WAC1D,CAtBA,WAAAQ,CAAYC,GAFZC,EAAAd,KAAiBC,4BAGbD,KAAKC,kBAAoBY,CAC7B,EAuBJ,MAAME,EAeFC,QAAAA,CAASC,GACLjB,KAAKkB,wUAAQC,IACNnB,KAAKkB,MACLD,EAEX,CAKQG,WAAAA,CAAYC,GACkC,IAAAC,EAAlD,IAAIC,EAA+D,QAAjBD,EAAAtB,KAAKkB,MAAMG,UAAX,IAAAC,EAAAA,EAAqBtB,KAAKkB,MAAM,QAMlF,OAJKM,MAAMC,QAAQF,KACfA,EAAa,CAACA,IAGXA,CACX,CAKAG,QAAAA,EAASC,IAAEA,EAAGC,MAAEA,EAAKC,KAAEA,EAAO,QAAqBC,GAC/C,MAKMC,EALa/B,KAAKoB,YAAYO,GAKKK,IAAIC,GAAQ,IAAIC,EAAqBD,EAAML,EAAOC,EAAMC,EAAS9B,KAAKmC,OAE/G,OAAO,IAAIrC,EAAiBiC,EAChC,CArCA,WAAAnB,CAAYM,EAAuBiB,GATnCrB,EAAAd,KAAOkB,QAAwB,CAC3BkB,QAAS,CACLV,SAAU,KAAM,EAChBW,MAAO,CAAC,OAAQ,YAIxBvB,EAAAd,KAAiBmC,eAGbnC,KAAKgB,SAASE,GACdlB,KAAKmC,KAAOA,CAChB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isEmpty as e}from"../validator-utils.js";import{ERROR_FIELD_REQUIRED as r,ERROR_FIELD_INVALID as t}from"../../core/Errors/constants.js";import{email as s,telephoneNumber as o}from"../regex.js";import{unformatDate as a}from"../../components/internal/FormFields/InputDate/utils.js";const l={validate:s=>((s,a)=>e(s)?(a.errorMessage=r,null):(a.errorMessage=t,o.test(s)))(s,l),modes:["blur"]},n={validate:o=>((o,a)=>e(o)?(a.errorMessage=r,null):(a.errorMessage=t,o.length>=6&&o.length<=320&&s.test(o)))(o,n),modes:["blur"]},i={validate:e=>((e,t)=>{if(!e)return t.errorMessage=r,!1;t.errorMessage="dateOfBirth.invalid";const s=a(e)
|
|
1
|
+
import{isEmpty as e}from"../validator-utils.js";import{ERROR_FIELD_REQUIRED as r,ERROR_FIELD_INVALID as t}from"../../core/Errors/constants.js";import{email as s,telephoneNumber as o}from"../regex.js";import{unformatDate as a}from"../../components/internal/FormFields/InputDate/utils.js";const l={validate:s=>((s,a)=>e(s)?(a.errorMessage=r,null):(a.errorMessage=t,o.test(s)))(s,l),modes:["blur"]},n={validate:o=>((o,a)=>e(o)?(a.errorMessage=r,null):(a.errorMessage=t,o.length>=6&&o.length<=320&&s.test(o)))(o,n),modes:["blur"]},i={validate:e=>((e,t)=>{if(!e)return t.errorMessage=r,!1;t.errorMessage="dateOfBirth.invalid";const s=a(e);if(!s)return!1;const o=Date.now()-Date.parse(s);return new Date(o).getFullYear()-1970>=18})(e,i),modes:["blur"]},u={phoneNumberRule:l,emailRule:n,dateOfBirthRule:i};export{u as validationRules};
|
|
2
2
|
//# sourceMappingURL=defaultRules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultRules.js","sources":["../../../../src/utils/Validator/defaultRules.ts"],"sourcesContent":["import { ValidatorRule } from './types';\nimport { isEmpty } from '../validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../core/Errors/constants';\nimport { email, telephoneNumber } from '../regex';\nimport { unformatDate } from '../../components/internal/FormFields/InputDate/utils';\n\nconst isPhoneValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return telephoneNumber.test(value);\n};\n\nconst isEmailValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return value.length >= 6 && value.length <= 320 && email.test(value);\n};\n\nconst isDateOfBirthValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (!value) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return false;\n }\n validationRule.errorMessage = 'dateOfBirth.invalid';\n const rawValue = unformatDate(value);\n const ageDiff = Date.now() - Date.parse(rawValue);\n const age = new Date(ageDiff).getFullYear() - 1970;\n return age >= 18;\n};\n\nconst phoneNumberRule: ValidatorRule = {\n validate: value => isPhoneValid(value, phoneNumberRule),\n modes: ['blur']\n};\n\nconst emailRule: ValidatorRule = {\n validate: value => isEmailValid(value, emailRule),\n modes: ['blur']\n};\n\nconst dateOfBirthRule: ValidatorRule = {\n validate: value => isDateOfBirthValid(value, dateOfBirthRule),\n modes: ['blur']\n};\n\nexport const validationRules = { phoneNumberRule, emailRule, dateOfBirthRule };\n"],"names":["phoneNumberRule","validate","value","validationRule","isEmpty","errorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","telephoneNumber","test","isPhoneValid","modes","emailRule","length","email","isEmailValid","dateOfBirthRule","rawValue","unformatDate","ageDiff","Date","now","parse","getFullYear","isDateOfBirthValid","validationRules"],"mappings":"+RAMA,
|
|
1
|
+
{"version":3,"file":"defaultRules.js","sources":["../../../../src/utils/Validator/defaultRules.ts"],"sourcesContent":["import { ValidatorRule } from './types';\nimport { isEmpty } from '../validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../core/Errors/constants';\nimport { email, telephoneNumber } from '../regex';\nimport { unformatDate } from '../../components/internal/FormFields/InputDate/utils';\n\nconst isPhoneValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return telephoneNumber.test(value);\n};\n\nconst isEmailValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return value.length >= 6 && value.length <= 320 && email.test(value);\n};\n\nconst isDateOfBirthValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (!value) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return false;\n }\n validationRule.errorMessage = 'dateOfBirth.invalid';\n const rawValue = unformatDate(value);\n if (!rawValue) return false;\n const ageDiff = Date.now() - Date.parse(rawValue);\n const age = new Date(ageDiff).getFullYear() - 1970;\n return age >= 18;\n};\n\nconst phoneNumberRule: ValidatorRule = {\n validate: value => isPhoneValid(value, phoneNumberRule),\n modes: ['blur']\n};\n\nconst emailRule: ValidatorRule = {\n validate: value => isEmailValid(value, emailRule),\n modes: ['blur']\n};\n\nconst dateOfBirthRule: ValidatorRule = {\n validate: value => isDateOfBirthValid(value, dateOfBirthRule),\n modes: ['blur']\n};\n\nexport const validationRules = { phoneNumberRule, emailRule, dateOfBirthRule };\n"],"names":["phoneNumberRule","validate","value","validationRule","isEmpty","errorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","telephoneNumber","test","isPhoneValid","modes","emailRule","length","email","isEmailValid","dateOfBirthRule","rawValue","unformatDate","ageDiff","Date","now","parse","getFullYear","isDateOfBirthValid","validationRules"],"mappings":"+RAMA,MA+BMA,EAAiC,CACnCC,SAAUC,GAhCO,EAACA,EAAeC,IAC7BC,EAAQF,IACRC,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBC,EAAgBC,KAAKP,IA0BTQ,CAAaR,EAAOF,GACvCW,MAAO,CAAC,SAGNC,EAA2B,CAC7BX,SAAUC,GA5BO,EAACA,EAAeC,IAC7BC,EAAQF,IACRC,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBL,EAAMW,QAAU,GAAKX,EAAMW,QAAU,KAAOC,EAAML,KAAKP,IAsB3Ca,CAAab,EAAOU,GACvCD,MAAO,CAAC,SAGNK,EAAiC,CACnCf,SAAUC,GAxBa,EAACA,EAAeC,KACvC,IAAKD,EAED,OADAC,EAAeE,aAAeC,GACvB,EAEXH,EAAeE,aAAe,sBAC9B,MAAMY,EAAWC,EAAahB,GAC9B,IAAKe,EAAU,OAAO,EACtB,MAAME,EAAUC,KAAKC,MAAQD,KAAKE,MAAML,GAExC,OADY,IAAIG,KAAKD,GAASI,cAAgB,MAChC,IAcKC,CAAmBtB,EAAOc,GAC7CL,MAAO,CAAC,SAGCc,EAAkB,CAAEzB,kBAAiBY,YAAWI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserInfo.js","sources":["../../../src/utils/browserInfo.ts"],"sourcesContent":["import type { BrowserInfo } from '../types/global-types';\n\n/**\n * Collects available frontend browser info and store it in the properties dictated by the EMVCo spec\n * (3DS_Spec_protocolAndCoreFny_v2-1_Oct2017.pdf)\n *\n * @example\n * ```js\n * const browserInfo = collectBrowserInfo();\n * ```\n *\n * @returns An object containing the retrieved browser properties\n */\nexport default function collectBrowserInfo(): BrowserInfo {\n if (typeof window === 'undefined') {\n return;\n }\n const colorDepth = window.screen.colorDepth;\n const screenHeight = window.screen.height;\n const screenWidth = window.screen.width;\n const userAgent = window.navigator.userAgent;\n\n const language = window.navigator.language || 'en';\n const timeZoneOffset = new Date().getTimezoneOffset();\n\n return {\n acceptHeader: '*/*',\n javaEnabled: false,\n colorDepth,\n language,\n screenHeight,\n screenWidth,\n userAgent,\n timeZoneOffset\n };\n}\n"],"names":["collectBrowserInfo","window","colorDepth","screen","screenHeight","height","screenWidth","width","userAgent","navigator","acceptHeader","javaEnabled","language","timeZoneOffset","Date","getTimezoneOffset"],"mappings":"AAae,SAASA,IACpB,GAAsB,oBAAXC,OACP,OAEJ,MAAMC,EAAaD,OAAOE,OAAOD,WAC3BE,EAAeH,OAAOE,OAAOE,OAC7BC,EAAcL,OAAOE,OAAOI,MAC5BC,EAAYP,OAAOQ,UAAUD,UAKnC,MAAO,CACHE,aAAc,MACdC,aAAa,EACbT,aACAU,SAPaX,OAAOQ,UAAUG,UAAY,KAQ1CR,eACAE,cACAE,YACAK,gBAVmB,IAAIC,MAAOC,oBAYtC"}
|
|
1
|
+
{"version":3,"file":"browserInfo.js","sources":["../../../src/utils/browserInfo.ts"],"sourcesContent":["import type { BrowserInfo } from '../types/global-types';\n\n/**\n * Collects available frontend browser info and store it in the properties dictated by the EMVCo spec\n * (3DS_Spec_protocolAndCoreFny_v2-1_Oct2017.pdf)\n *\n * @example\n * ```js\n * const browserInfo = collectBrowserInfo();\n * ```\n *\n * @returns An object containing the retrieved browser properties\n */\nexport default function collectBrowserInfo(): BrowserInfo | undefined {\n if (typeof window === 'undefined') {\n return;\n }\n const colorDepth = window.screen.colorDepth;\n const screenHeight = window.screen.height;\n const screenWidth = window.screen.width;\n const userAgent = window.navigator.userAgent;\n\n const language = window.navigator.language || 'en';\n const timeZoneOffset = new Date().getTimezoneOffset();\n\n return {\n acceptHeader: '*/*',\n javaEnabled: false,\n colorDepth,\n language,\n screenHeight,\n screenWidth,\n userAgent,\n timeZoneOffset\n };\n}\n"],"names":["collectBrowserInfo","window","colorDepth","screen","screenHeight","height","screenWidth","width","userAgent","navigator","acceptHeader","javaEnabled","language","timeZoneOffset","Date","getTimezoneOffset"],"mappings":"AAae,SAASA,IACpB,GAAsB,oBAAXC,OACP,OAEJ,MAAMC,EAAaD,OAAOE,OAAOD,WAC3BE,EAAeH,OAAOE,OAAOE,OAC7BC,EAAcL,OAAOE,OAAOI,MAC5BC,EAAYP,OAAOQ,UAAUD,UAKnC,MAAO,CACHE,aAAc,MACdC,aAAa,EACbT,aACAU,SAPaX,OAAOQ,UAAUG,UAAY,KAQ1CR,eACAE,cACAE,YACAK,gBAVmB,IAAIC,MAAOC,oBAYtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSdkData.js","sources":["../../../src/utils/createSdkData.ts"],"sourcesContent":["import base64 from './base64';\nimport { LIBRARY_VERSION, CHANNEL, PLATFORM, PAYMENT_METHOD_BEHAVIOR } from '../core/config';\nexport interface SdkDataObject {\n schemaVersion: number;\n createdAt: number;\n channel: CHANNEL;\n platform: string;\n sdkVersion: string;\n paymentMethodBehavior: PAYMENT_METHOD_BEHAVIOR;\n analytics: {\n checkoutAttemptId: string;\n };\n riskData
|
|
1
|
+
{"version":3,"file":"createSdkData.js","sources":["../../../src/utils/createSdkData.ts"],"sourcesContent":["import base64 from './base64';\nimport { LIBRARY_VERSION, CHANNEL, PLATFORM, PAYMENT_METHOD_BEHAVIOR } from '../core/config';\nexport interface SdkDataObject {\n schemaVersion: number;\n createdAt: number;\n channel: CHANNEL;\n platform: string;\n sdkVersion: string;\n paymentMethodBehavior: PAYMENT_METHOD_BEHAVIOR;\n analytics: {\n checkoutAttemptId: string;\n };\n riskData?: {\n clientData: string;\n };\n}\n\n/**\n * Creates the sdkData object with analytics and risk information\n * @param checkoutAttemptId - The checkout attempt ID from analytics\n * @param clientData - The client data from risk module\n * @returns Base64 encoded JSON string of the SDK data object\n */\nexport function createSdkData(checkoutAttemptId: string, clientData: string | null, paymentMethodBehavior: PAYMENT_METHOD_BEHAVIOR): string {\n const sdkDataObject: SdkDataObject = {\n schemaVersion: 1,\n createdAt: Date.now(),\n channel: CHANNEL.WEB,\n platform: PLATFORM,\n sdkVersion: LIBRARY_VERSION,\n paymentMethodBehavior,\n analytics: {\n checkoutAttemptId\n },\n ...(clientData && { riskData: { clientData } })\n };\n\n return base64.encode(JSON.stringify(sdkDataObject));\n}\n"],"names":["createSdkData","checkoutAttemptId","clientData","paymentMethodBehavior","sdkDataObject","_object_spread","schemaVersion","createdAt","Date","now","channel","CHANNEL","WEB","platform","PLATFORM","sdkVersion","LIBRARY_VERSION","analytics","riskData","base64","encode","JSON","stringify"],"mappings":"kOAuBO,SAASA,EAAcC,EAA2BC,EAA2BC,GAChF,MAAMC,oUAA+BC,CAAA,CACjCC,cAAe,EACfC,UAAWC,KAAKC,MAChBC,QAASC,EAAQC,IACjBC,SAAUC,EACVC,WAAYC,EACZb,wBACAc,UAAW,CACPhB,sBAEAC,GAAc,CAAEgB,SAAU,CAAEhB,gBAGpC,OAAOiB,EAAOC,OAAOC,KAAKC,UAAUlB,GACxC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const t=(t,r,n)=>o=>{if(!o)return
|
|
1
|
+
function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const t=(t,r,n)=>o=>{if(!o)return;const c=function(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){e(t,r,n[r])})}return t}({parentFolder:`${r}/`,type:o},t);return n(c)(o)};export{t as default};
|
|
2
2
|
//# sourceMappingURL=get-issuer-image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-issuer-image.js","sources":["../../../src/utils/get-issuer-image.ts"],"sourcesContent":["import { ImageOptions } from '../core/Context/Resources';\nimport { UseImageHookType } from '../core/Context/useImage';\n\nconst getIssuerImageUrl =\n (options:
|
|
1
|
+
{"version":3,"file":"get-issuer-image.js","sources":["../../../src/utils/get-issuer-image.ts"],"sourcesContent":["import type { ImageOptions } from '../core/Context/Resources';\nimport type { UseImageHookType } from '../core/Context/useImage';\n\n/**\n * USAGE:\n * Use getIssuerImageUrl() when rendering a list of issuer logos under logos/{txVariant}/{issuer}.svg\n * For anything else, like when you just need a single, named, asset - use Resources.getImage()\n */\n\nconst getIssuerImageUrl =\n (options: ImageOptions, type: string, getImage: UseImageHookType) =>\n (issuer: string | undefined): string | undefined => {\n if (!issuer) return undefined;\n\n const imageOptions: ImageOptions = {\n parentFolder: `${type}/`,\n type: issuer,\n ...options\n };\n\n return getImage(imageOptions)(issuer);\n };\n\nexport default getIssuerImageUrl;\n"],"names":["getIssuerImageUrl","options","type","getImage","issuer","imageOptions","_object_spread","parentFolder"],"mappings":"8HASMA,EACF,CAACC,EAAuBC,EAAcC,IACrCC,IACG,IAAKA,EAAQ,OAEb,MAAMC,oUAA6BC,CAAA,CAC/BC,aAAc,GAAGL,KACjBA,KAAME,GACHH,GAGP,OAAOE,EAASE,EAATF,CAAuBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-process-message-handler.js","sources":["../../../src/utils/get-process-message-handler.ts"],"sourcesContent":["/**\n * Centralised window.postMessage processing function used in 3DS2 components and *also* by the RiskModule's device fingerprinting process\n * NOTE: this latter use case means that while the deviceFingerprinting is still completing this component is also listening to\n * securedFields related postMessaging\n *\n * @param domain - expected domain for the postMesssage to have originated from\n * @param resolve - the resolve function from the Promise that called this function\n * @param reject - the reject function from the Promise that called this function\n * @param parseErrorObj - an error object to log in the case of unparseable data (albeit from a valid origin)\n * @param expectedType - string to check that the message event's data has the expected type\n */\nimport { hasOwnProperty } from './hasOwnProperty';\nimport { PostMsgParseErrorObject } from '../components/ThreeDS2/types';\n\nconst getProcessMessageHandler =\n (\n domain: string,\n resolve: (value: unknown) => void,\n reject: (reason?: unknown) => void,\n expectedType: string\n ): ((event: Pick<MessageEvent, 'origin' | 'data'>) => string | boolean) =>\n (event: Pick<MessageEvent, 'origin' | 'data'>): string | boolean => {\n const parseErrorObj: PostMsgParseErrorObject = {};\n const origin = event.origin;\n\n if (origin !== domain) {\n // FAIL SILENTLY: if it's not from the expected domain then it's not our traffic\n return 'Message was not sent from the expected domain';\n }\n\n /**\n * At this point we know the message is from the expected domain\n * - so is presumably \"our\" traffic and not random messages from the merchant's site, the build process, or from the browser (or extensions)\n * // TODO - Do more here in terms of logging to help debug issues with 3DS2\n */\n\n if (typeof event.data !== 'string') {\n // If it's from our domain but not a string - log this somewhere?\n return 'Event data from expected domain but not in expected form';\n }\n\n if (!event.data.length) {\n // If it's from our domain, is a string, but is empty - log this somewhere?\n return 'Event data from expected domain, in expected form, but empty';\n }\n\n // Try to parse the data\n try {\n const feedbackObj = JSON.parse(event.data) as Record<string, unknown>;\n if (feedbackObj && typeof feedbackObj === 'object' && hasOwnProperty(feedbackObj, 'type')) {\n if (feedbackObj.type === expectedType) {\n // Happy flow\n resolve(feedbackObj);\n return true;\n } else {\n // feedbackObj.type != expectedType - log this somewhere?\n return 'Event data has \"type\" but the object is not in the expected form';\n }\n } else {\n // FAIL SILENTLY: event.data had no 'type' property\n // example: applies when RiskModule device fingerprinting is ongoing and this handler is picking up securedFields traffic\n // - But, *if* we know we're in 3DS2 scenario - log this somewhere?\n return 'Event data had no type';\n }\n } catch (e) {\n parseErrorObj.type = `${expectedType}-JSON-parse-error`;\n parseErrorObj.comment = 'failed to JSON parse event.data';\n parseErrorObj.extraInfo = `event.data = ${event.data}`;\n parseErrorObj.eventDataRaw = event.data;\n\n // TODO - decide whether to console.log/debug/error &/or call the merchant defined onError callback\n console.debug('get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=', parseErrorObj);\n\n return false;\n }\n };\n\nexport default getProcessMessageHandler;\n"],"names":["getProcessMessageHandler","domain","resolve","reject","expectedType","event","parseErrorObj","origin","data","length","feedbackObj","JSON","parse","hasOwnProperty","type","e","comment","extraInfo","eventDataRaw","console","debug"],"mappings":"qDAcA,MAAMA,EACF,CACIC,EACAC,EACAC,EACAC,IAEHC,IACG,MAAMC,EAAyC,CAAA,EAG/C,GAFeD,EAAME,SAENN,EAEX,MAAO,gDASX,GAA0B,iBAAfI,EAAMG,KAEb,MAAO,2DAGX,IAAKH,EAAMG,KAAKC,OAEZ,MAAO,+DAIX,IACI,MAAMC,EAAcC,KAAKC,MAAMP,EAAMG,MACrC,OAAIE,GAAsC,iBAAhBA,GAA4BG,EAAeH,EAAa,QAC1EA,EAAYI,OAASV,GAErBF,EAAQQ,IACD,GAGA,mEAMJ,wBAEf,CAAE,MAAOK,GASL,OARAT,EAAcQ,KAAO,GAAGV,qBACxBE,EAAcU,QAAU,kCACxBV,EAAcW,UAAY,gBAAgBZ,EAAMG,OAChDF,EAAcY,aAAeb,EAAMG,KAGnCW,QAAQC,MAAM,yEAA0Ed,IAEjF,CACX"}
|
|
1
|
+
{"version":3,"file":"get-process-message-handler.js","sources":["../../../src/utils/get-process-message-handler.ts"],"sourcesContent":["/**\n * Centralised window.postMessage processing function used in 3DS2 components and *also* by the RiskModule's device fingerprinting process\n * NOTE: this latter use case means that while the deviceFingerprinting is still completing this component is also listening to\n * securedFields related postMessaging\n *\n * @param domain - expected domain for the postMesssage to have originated from\n * @param resolve - the resolve function from the Promise that called this function\n * @param reject - the reject function from the Promise that called this function\n * @param parseErrorObj - an error object to log in the case of unparseable data (albeit from a valid origin)\n * @param expectedType - string to check that the message event's data has the expected type\n */\nimport { hasOwnProperty } from './hasOwnProperty';\nimport { PostMsgParseErrorObject } from '../components/ThreeDS2/types';\n\nconst getProcessMessageHandler =\n (\n domain: string | null,\n resolve: (value: unknown) => void,\n reject: (reason?: unknown) => void,\n expectedType: string\n ): ((event: Pick<MessageEvent, 'origin' | 'data'>) => string | boolean) =>\n (event: Pick<MessageEvent, 'origin' | 'data'>): string | boolean => {\n const parseErrorObj: PostMsgParseErrorObject = {};\n const origin = event.origin;\n\n if (origin !== domain) {\n // FAIL SILENTLY: if it's not from the expected domain then it's not our traffic\n return 'Message was not sent from the expected domain';\n }\n\n /**\n * At this point we know the message is from the expected domain\n * - so is presumably \"our\" traffic and not random messages from the merchant's site, the build process, or from the browser (or extensions)\n * // TODO - Do more here in terms of logging to help debug issues with 3DS2\n */\n\n if (typeof event.data !== 'string') {\n // If it's from our domain but not a string - log this somewhere?\n return 'Event data from expected domain but not in expected form';\n }\n\n if (!event.data.length) {\n // If it's from our domain, is a string, but is empty - log this somewhere?\n return 'Event data from expected domain, in expected form, but empty';\n }\n\n // Try to parse the data\n try {\n const feedbackObj = JSON.parse(event.data) as Record<string, unknown>;\n if (feedbackObj && typeof feedbackObj === 'object' && hasOwnProperty(feedbackObj, 'type')) {\n if (feedbackObj.type === expectedType) {\n // Happy flow\n resolve(feedbackObj);\n return true;\n } else {\n // feedbackObj.type != expectedType - log this somewhere?\n return 'Event data has \"type\" but the object is not in the expected form';\n }\n } else {\n // FAIL SILENTLY: event.data had no 'type' property\n // example: applies when RiskModule device fingerprinting is ongoing and this handler is picking up securedFields traffic\n // - But, *if* we know we're in 3DS2 scenario - log this somewhere?\n return 'Event data had no type';\n }\n } catch (e) {\n parseErrorObj.type = `${expectedType}-JSON-parse-error`;\n parseErrorObj.comment = 'failed to JSON parse event.data';\n parseErrorObj.extraInfo = `event.data = ${event.data}`;\n parseErrorObj.eventDataRaw = event.data;\n\n // TODO - decide whether to console.log/debug/error &/or call the merchant defined onError callback\n console.debug('get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=', parseErrorObj);\n\n return false;\n }\n };\n\nexport default getProcessMessageHandler;\n"],"names":["getProcessMessageHandler","domain","resolve","reject","expectedType","event","parseErrorObj","origin","data","length","feedbackObj","JSON","parse","hasOwnProperty","type","e","comment","extraInfo","eventDataRaw","console","debug"],"mappings":"qDAcA,MAAMA,EACF,CACIC,EACAC,EACAC,EACAC,IAEHC,IACG,MAAMC,EAAyC,CAAA,EAG/C,GAFeD,EAAME,SAENN,EAEX,MAAO,gDASX,GAA0B,iBAAfI,EAAMG,KAEb,MAAO,2DAGX,IAAKH,EAAMG,KAAKC,OAEZ,MAAO,+DAIX,IACI,MAAMC,EAAcC,KAAKC,MAAMP,EAAMG,MACrC,OAAIE,GAAsC,iBAAhBA,GAA4BG,EAAeH,EAAa,QAC1EA,EAAYI,OAASV,GAErBF,EAAQQ,IACD,GAGA,mEAMJ,wBAEf,CAAE,MAAOK,GASL,OARAT,EAAcQ,KAAO,GAAGV,qBACxBE,EAAcU,QAAU,kCACxBV,EAAcW,UAAY,gBAAgBZ,EAAMG,OAChDF,EAAcY,aAAeb,EAAMG,KAGnCW,QAAQC,MAAM,yEAA0Ed,IAEjF,CACX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function o(o,n,e){
|
|
1
|
+
function o(o,n,e){const r=o?e[o.toLowerCase()]:void 0,t=n?null==r?void 0:r[n.toLowerCase().slice(0,2)]:void 0;return t||(console.warn(`Cannot find a consent url for the provided countryCode: ${o} and locale: ${n}`),null==r?void 0:r.en)}export{o as getConsentUrl};
|
|
2
2
|
//# sourceMappingURL=getConsentUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConsentUrl.js","sources":["../../../src/utils/getConsentUrl.ts"],"sourcesContent":["type UrlMap = {\n [countryCode: string]: {\n [language: string]: string;\n };\n};\n\nfunction getConsentUrl(countryCode: string, locale: string, urlMap: UrlMap): string {\n const
|
|
1
|
+
{"version":3,"file":"getConsentUrl.js","sources":["../../../src/utils/getConsentUrl.ts"],"sourcesContent":["type UrlMap = {\n [countryCode: string]: {\n [language: string]: string;\n };\n};\n\nconst FALLBACK_CONSENT_LANGUAGE = 'en';\n\nfunction getConsentUrl(countryCode: string | undefined, locale: string | undefined, urlMap: UrlMap): string | undefined {\n const countryUrls = countryCode ? urlMap[countryCode.toLowerCase()] : undefined;\n const consentUrl = locale ? countryUrls?.[locale.toLowerCase().slice(0, 2)] : undefined;\n if (consentUrl) {\n return consentUrl;\n }\n\n console.warn(`Cannot find a consent url for the provided countryCode: ${countryCode} and locale: ${locale}`);\n return countryUrls?.[FALLBACK_CONSENT_LANGUAGE];\n}\n\nexport { getConsentUrl };\n"],"names":["getConsentUrl","countryCode","locale","urlMap","countryUrls","toLowerCase","undefined","consentUrl","slice","console","warn","FALLBACK_CONSENT_LANGUAGE"],"mappings":"AAQA,SAASA,EAAcC,EAAiCC,EAA4BC,GAChF,MAAMC,EAAcH,EAAcE,EAAOF,EAAYI,oBAAiBC,EAChEC,EAAaL,EAASE,aAAAA,EAAAA,EAAcF,EAAOG,cAAcG,MAAM,EAAG,SAAMF,EAC9E,OAAIC,IAIJE,QAAQC,KAAK,2DAA2DT,iBAA2BC,KAC5FE,aAAAA,EAAAA,EAAcO,GACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErrorMessage.js","sources":["../../../src/utils/getErrorMessage.ts"],"sourcesContent":["import { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../core/Errors/constants';\nimport Language from '../language';\nimport { ValidationRuleResult } from './Validator/ValidationRuleResult';\n\nexport const getErrorMessage = (i18n: Language
|
|
1
|
+
{"version":3,"file":"getErrorMessage.js","sources":["../../../src/utils/getErrorMessage.ts"],"sourcesContent":["import { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../core/Errors/constants';\nimport Language from '../language';\nimport { ValidationRuleResult } from './Validator/ValidationRuleResult';\n\nexport const getErrorMessage = (\n i18n: Language,\n error?: ValidationRuleResult | null,\n label?: string,\n lowerCaseLabel: boolean = true\n): string | boolean => {\n if (error?.errorMessage && typeof error.errorMessage === 'string') {\n const errorKey = error.errorMessage;\n const shouldBuildErrorMessage = [ERROR_FIELD_REQUIRED, ERROR_FIELD_INVALID].includes(errorKey);\n // Build the error msg: Enter the [label name] or Enter a valid [label name]\n const options = { values: { label: lowerCaseLabel ? label?.toLowerCase() : label } };\n return shouldBuildErrorMessage ? i18n.get(errorKey, options) : i18n.get(errorKey);\n }\n\n return !!error;\n};\n"],"names":["getErrorMessage","i18n","error","label","lowerCaseLabel","errorMessage","errorKey","shouldBuildErrorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","includes","options","values","toLowerCase","get"],"mappings":"kGAIaA,EAAkB,CAC3BC,EACAC,EACAC,EACAC,GAA0B,KAE1B,IAAIF,aAAAA,EAAAA,EAAOG,eAA8C,iBAAvBH,EAAMG,aAA2B,CAC/D,MAAMC,EAAWJ,EAAMG,aACjBE,EAA0B,CAACC,EAAsBC,GAAqBC,SAASJ,GAE/EK,EAAU,CAAEC,OAAQ,CAAET,MAAOC,EAAiBD,aAAAA,EAAAA,EAAOU,cAAgBV,IAC3E,OAAOI,EAA0BN,EAAKa,IAAIR,EAAUK,GAAWV,EAAKa,IAAIR,EAC5E,CAEA,QAASJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrigin.js","sources":["../../../src/utils/getOrigin.ts"],"sourcesContent":["/**\n * Used to retrieve the origin from a url\n *\n * @remarks\n * Uses a regex to get origin (can't handle localhost origins)\n *\n * @param url - URL\n * @returns The origin of the url\n */\nexport const getOrigin = (url: string): string => {\n const originRegex = /^(?:([A-Za-z]+):)?(\\/{0,3})([0-9.\\-A-Za-z]+)(?::(\\d+))?(?:\\/([^?#]*))?(?:\\?([^#]*))?(?:#(.*))?$/;\n const matches = originRegex.exec(url);\n\n if (!matches) return null;\n\n const [, protocol, separator, host, port] = matches;\n\n if (!protocol || !separator || !host) return null;\n\n return `${protocol}:${separator}${host}${port ? `:${port}` : ''}`;\n};\n\nexport default getOrigin;\n"],"names":["getOrigin","url","matches","exec","protocol","separator","host","port"],"mappings":"AASO,MAAMA,EAAaC,IACtB,MACMC,EADc,kGACQC,KAAKF,GAEjC,IAAKC,EAAS,OAAO,KAErB,MAAM,CAAGE,EAAUC,EAAWC,EAAMC,GAAQL,EAE5C,OAAKE,GAAaC,GAAcC,EAEzB,GAAGF,KAAYC,IAAYC,IAAOC,EAAO,IAAIA,IAAS,KAFhB"}
|
|
1
|
+
{"version":3,"file":"getOrigin.js","sources":["../../../src/utils/getOrigin.ts"],"sourcesContent":["/**\n * Used to retrieve the origin from a url\n *\n * @remarks\n * Uses a regex to get origin (can't handle localhost origins)\n *\n * @param url - URL\n * @returns The origin of the url\n */\nexport const getOrigin = (url: string): string | null => {\n const originRegex = /^(?:([A-Za-z]+):)?(\\/{0,3})([0-9.\\-A-Za-z]+)(?::(\\d+))?(?:\\/([^?#]*))?(?:\\?([^#]*))?(?:#(.*))?$/;\n const matches = originRegex.exec(url);\n\n if (!matches) return null;\n\n const [, protocol, separator, host, port] = matches;\n\n if (!protocol || !separator || !host) return null;\n\n return `${protocol}:${separator}${host}${port ? `:${port}` : ''}`;\n};\n\nexport default getOrigin;\n"],"names":["getOrigin","url","matches","exec","protocol","separator","host","port"],"mappings":"AASO,MAAMA,EAAaC,IACtB,MACMC,EADc,kGACQC,KAAKF,GAEjC,IAAKC,EAAS,OAAO,KAErB,MAAM,CAAGE,EAAUC,EAAWC,EAAMC,GAAQL,EAE5C,OAAKE,GAAaC,GAAcC,EAEzB,GAAGF,KAAYC,IAAYC,IAAOC,EAAO,IAAIA,IAAS,KAFhB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=(t,
|
|
1
|
+
const t=(t,r=!1)=>{if(!t)return!1;let o;try{o=new URL(t)}catch(t){return!1}return r&&"http:"===o.protocol||"https:"===o.protocol};export{t as isValidHttpUrl};
|
|
2
2
|
//# sourceMappingURL=isValidURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValidURL.js","sources":["../../../src/utils/isValidURL.ts"],"sourcesContent":["export const isValidHttpUrl = (httpUrl: string, allowHttp = false) => {\n let url: URL;\n try {\n url = new URL(httpUrl);\n } catch (_) {\n return false;\n }\n return allowHttp ? url.protocol === 'http:' || url.protocol === 'https:' : url.protocol === 'https:';\n};\n"],"names":["isValidHttpUrl","httpUrl","allowHttp","url","URL","_","protocol"],"mappings":"AAAO,MAAMA,EAAiB,CAACC,
|
|
1
|
+
{"version":3,"file":"isValidURL.js","sources":["../../../src/utils/isValidURL.ts"],"sourcesContent":["export const isValidHttpUrl = (httpUrl: string | null | undefined, allowHttp = false) => {\n if (!httpUrl) return false;\n\n let url: URL;\n try {\n url = new URL(httpUrl);\n } catch (_) {\n return false;\n }\n return allowHttp ? url.protocol === 'http:' || url.protocol === 'https:' : url.protocol === 'https:';\n};\n"],"names":["isValidHttpUrl","httpUrl","allowHttp","url","URL","_","protocol"],"mappings":"AAAO,MAAMA,EAAiB,CAACC,EAAoCC,GAAY,KAC3E,IAAKD,EAAS,OAAO,EAErB,IAAIE,EACJ,IACIA,EAAM,IAAIC,IAAIH,EAClB,CAAE,MAAOI,GACL,OAAO,CACX,CACA,OAAOH,GAA6B,UAAjBC,EAAIG,UAAqE,WAAjBH,EAAIG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = <T>(ms: number, promise: Promise<T>, timeOutObject: object): { promise: Promise<T>; cancel: () => void } => {\n let timer: NodeJS.Timeout
|
|
1
|
+
{"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = <T>(ms: number, promise: Promise<T>, timeOutObject: object): { promise: Promise<T>; cancel: () => void } => {\n let timer: NodeJS.Timeout;\n\n const promiseTimer: Promise<T> = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n"],"names":["promiseTimeout","ms","promise","timeOutObject","timer","Promise","resolve","reject","setTimeout","then","res","clearTimeout","catch","err","cancel"],"mappings":"AAOA,MAAMA,EAAiB,CAAIC,EAAYC,EAAqBC,KACxD,IAAIC,EAuBJ,MAAO,CACHF,QAtB6B,IAAIG,QAAQ,CAACC,EAASC,KAEnDH,EAAQI,WAAW,KACfD,EAAOJ,IACRF,GAEHC,EACKO,KAAMC,IACHC,aAAaP,GACbE,EAAQI,KAEXE,MAAOC,IACJF,aAAaP,GACbG,EAAOM,OAUfC,OANgB,KAChBH,aAAaP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoFocus.js","sources":["../../../src/utils/useAutoFocus.ts"],"sourcesContent":["import { useRef, useEffect } from 'preact/hooks';\n\nconst useAutoFocus = () => {\n const ref = useRef(null);\n\n useEffect(() => {\n ref.current?.focus();\n }, []);\n\n return ref;\n};\n\nexport default useAutoFocus;\n"],"names":["useAutoFocus","ref","useRef","useEffect","current","focus"],"mappings":"+EAEA,MAAMA,EAAe,KACjB,MAAMC,EAAMC,
|
|
1
|
+
{"version":3,"file":"useAutoFocus.js","sources":["../../../src/utils/useAutoFocus.ts"],"sourcesContent":["import { useRef, useEffect } from 'preact/hooks';\n\nconst useAutoFocus = <T extends HTMLElement = HTMLElement>() => {\n const ref = useRef<T | null>(null);\n\n useEffect(() => {\n ref.current?.focus();\n }, []);\n\n return ref;\n};\n\nexport default useAutoFocus;\n"],"names":["useAutoFocus","ref","useRef","useEffect","current","focus"],"mappings":"+EAEA,MAAMA,EAAe,KACjB,MAAMC,EAAMC,EAAiB,MAM7B,OAJAC,EAAU,KACNF,IAAAA,EAAW,QAAXA,EAAAA,EAAIG,mBAAJH,GAAAA,EAAaI,SACd,IAEIJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=(e,n,t,r)=>{var u,l,o,g;if(null===(l=e[t])||void 0===l||null===(u=l[n])||void 0===u?void 0:u.formatterFn)return
|
|
1
|
+
const e=(e,n,t,r)=>{var u,l,o,g;if(t&&(null===(l=e[t])||void 0===l||null===(u=l[n])||void 0===u?void 0:u.formatterFn))return;const i=t?null===(g=e[t])||void 0===g||null===(o=g[n])||void 0===o?void 0:o.maxlength:void 0;return i||30},n=e=>!(null!=e&&!/^[\s]*$/.test(e)),t="(?:[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\p{Cc}\\p{Cf}]|[0-9#*]\\uFE0F?\\u20E3)",[r,u]=(()=>{try{return[new RegExp(t,"u"),new RegExp(t,"gu")]}catch(e){const n="[\\u0000-\\u001F\\u007F-\\u009F]";return[new RegExp(n),new RegExp(n,"g")]}})(),l=(e,n="g")=>new RegExp(`[${e}]`,n),o=e=>!e.length||!r.test(e),g=e=>e.replace(u,""),i=e=>e.trim().replace(/\s+/g," ");export{l as getFormattingRegEx,e as getMaxLengthByFieldAndCountry,n as isEmpty,g as stripInvalidChars,i as trimValWithOneSpace,o as validateForSpecialChars};
|
|
2
2
|
//# sourceMappingURL=validator-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string,\n ignoreIfFormatterExists: boolean\n): number |
|
|
1
|
+
{"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string | undefined,\n ignoreIfFormatterExists: boolean\n): number | undefined => {\n // In ignoreIfFormatterExists is true we expect the formatter function to also act to limit length\n if (ignoreIfFormatterExists && country && formattingRules[country]?.[field]?.formatterFn) {\n return undefined;\n }\n const maxLength = country ? formattingRules[country]?.[field]?.maxlength : undefined;\n return maxLength ? maxLength : MAX_LENGTH;\n};\n\n// Not null or undefined or only spaces\nexport const isEmpty = (input: string) => !!(input == null || /^[\\s]*$/.test(input));\n\nexport const isString = (input: unknown) => typeof input === 'string' || input instanceof String;\nexport const hasText = (input: string) => isString(input) && !isEmpty(input);\n\n// Block emojis and control/format characters, allow everything else\nconst INVALID_CHARS_REGEX_SOURCE = '(?:[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\p{Cc}\\\\p{Cf}]|[0-9#*]\\\\uFE0F?\\\\u20E3)';\nconst [INVALID_CHARS_TEST, INVALID_CHARS_STRIP] = ((): [RegExp, RegExp] => {\n try {\n // This is inside a try/catch just in case the browser doesn't support Unicode property escapes\n return [new RegExp(INVALID_CHARS_REGEX_SOURCE, 'u'), new RegExp(INVALID_CHARS_REGEX_SOURCE, 'gu')];\n } catch {\n // Fallback for browsers without Unicode property escapes - just block control chars\n const fallbackRegex = '[\\\\u0000-\\\\u001F\\\\u007F-\\\\u009F]';\n return [new RegExp(fallbackRegex), new RegExp(fallbackRegex, 'g')];\n }\n})();\n\n// Generates a regEx ideal for use in a String.replace call for use in a formatter\n// e.g. getFormattingRegEx('^\\\\d', 'g') will generate: /[^\\d]/g which is a regEx to match anything that is not a digit\nexport const getFormattingRegEx = (specChars: string, flags = 'g') => new RegExp(`[${specChars}]`, flags);\n\nexport const exactLength = (input: string, length: number) => {\n if (isEmpty(input)) {\n return true;\n }\n return input.length === length;\n};\n\nexport const validateForSpecialChars = (text: string): boolean => {\n if (!text.length) return true;\n // Returns true if no invalid characters found\n return !INVALID_CHARS_TEST.test(text);\n};\n\nexport const stripInvalidChars = (text: string): string => text.replace(INVALID_CHARS_STRIP, '');\n\n// Trim both ends and never allow more than 1 space in between\nexport const trimValWithOneSpace = (val: string) => val.trim().replace(/\\s+/g, ' ');\n"],"names":["getMaxLengthByFieldAndCountry","formattingRules","field","country","ignoreIfFormatterExists","formatterFn","maxLength","maxlength","undefined","isEmpty","input","test","INVALID_CHARS_REGEX_SOURCE","INVALID_CHARS_TEST","INVALID_CHARS_STRIP","RegExp","unused","fallbackRegex","getFormattingRegEx","specChars","flags","validateForSpecialChars","text","length","stripInvalidChars","replace","trimValWithOneSpace","val","trim"],"mappings":"AAEA,MAEaA,EAAgC,CACzCC,EACAC,EACAC,EACAC,KAG0CH,IAAAA,EAAAA,EAGdA,EAAAA,EAH5B,GAA+BE,IAAmC,QAAxBF,EAAAA,EAAgBE,UAAhBF,IAAAA,GAAiC,QAAjCA,EAAAA,EAA2BC,UAA3BD,IAAAA,OAAAA,EAAAA,EAAmCI,aACzE,OAEJ,MAAMC,EAAYH,EAAkC,QAAxBF,EAAAA,EAAgBE,cAAhBF,GAAiC,QAAjCA,EAAAA,EAA2BC,UAA3BD,IAAAA,OAAAA,EAAAA,EAAmCM,eAAYC,EAC3E,OAAOF,GAbQ,IAiBNG,EAAWC,KAA8B,MAATA,IAAiB,UAAUC,KAAKD,IAMvEE,EAA6B,gGAC5BC,EAAoBC,GAAuB,MAC9C,IAEI,MAAO,CAAC,IAAIC,OAAOH,EAA4B,KAAM,IAAIG,OAAOH,EAA4B,MAChG,CAAE,MAAAI,GAEE,MAAMC,EAAgB,mCACtB,MAAO,CAAC,IAAIF,OAAOE,GAAgB,IAAIF,OAAOE,EAAe,KACjE,CACJ,EATkD,GAarCC,EAAqB,CAACC,EAAmBC,EAAQ,MAAQ,IAAIL,OAAO,IAAII,KAAcC,GAStFC,EAA2BC,IAC/BA,EAAKC,SAEFV,EAAmBF,KAAKW,GAGvBE,EAAqBF,GAAyBA,EAAKG,QAAQX,EAAqB,IAGhFY,EAAuBC,GAAgBA,EAAIC,OAAOH,QAAQ,OAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adyen/adyen-web",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.47.0-alpha.41c41fe",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://docs.adyen.com/checkout",
|
|
6
6
|
"type": "module",
|
|
@@ -91,7 +91,8 @@
|
|
|
91
91
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
92
92
|
"@rollup/plugin-replace": "6.0.3",
|
|
93
93
|
"@rollup/plugin-terser": "1.0.0",
|
|
94
|
-
"@size-limit/
|
|
94
|
+
"@size-limit/file": "13.0.3",
|
|
95
|
+
"@size-limit/webpack": "13.0.3",
|
|
95
96
|
"@storybook/addon-a11y": "10.5.10",
|
|
96
97
|
"@storybook/addon-docs": "10.5.10",
|
|
97
98
|
"@storybook/preact-vite": "10.5.10",
|