@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
package/dist/cjs/index.d.cts
CHANGED
|
@@ -81,10 +81,10 @@ declare class Language {
|
|
|
81
81
|
*/
|
|
82
82
|
declare class ValidationRuleResult {
|
|
83
83
|
private readonly shouldValidate;
|
|
84
|
-
isValid: boolean;
|
|
84
|
+
isValid: boolean | null;
|
|
85
85
|
errorMessage: string | ErrorMessageObject | undefined;
|
|
86
86
|
errorI18n: string;
|
|
87
|
-
constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context: FieldContext, i18n: Language);
|
|
87
|
+
constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context: FieldContext | undefined, i18n: Language);
|
|
88
88
|
/**
|
|
89
89
|
* Whether the validation is considered an error.
|
|
90
90
|
* A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.
|
|
@@ -101,7 +101,7 @@ type ErrorMessageObject = {
|
|
|
101
101
|
values: Record<string, string | null>;
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
-
type ValidateFunction = (value: string, context: any) => boolean;
|
|
104
|
+
type ValidateFunction = (value: string, context: any) => boolean | null;
|
|
105
105
|
interface ValidatorRule {
|
|
106
106
|
validate: ValidateFunction;
|
|
107
107
|
errorMessage?: string | ErrorMessageObject;
|
|
@@ -138,11 +138,11 @@ interface AddressProps {
|
|
|
138
138
|
countryCode?: string;
|
|
139
139
|
data?: AddressData | null;
|
|
140
140
|
label?: string;
|
|
141
|
-
onChange
|
|
141
|
+
onChange?: (newState: any) => void;
|
|
142
142
|
onAddressLookup?: OnAddressLookupType;
|
|
143
143
|
onAddressSelected?: OnAddressSelectedType;
|
|
144
144
|
addressSearchDebounceMs?: number;
|
|
145
|
-
requiredFields?: string[];
|
|
145
|
+
requiredFields?: readonly string[];
|
|
146
146
|
specifications?: AddressSpecifications;
|
|
147
147
|
validationRules?: ValidatorRules;
|
|
148
148
|
visibility?: string;
|
|
@@ -256,7 +256,7 @@ declare class AdyenCheckoutError extends Error {
|
|
|
256
256
|
|
|
257
257
|
type InstallmentPlan = 'revolving' | 'bonus' | 'regular';
|
|
258
258
|
interface InstallmentOption {
|
|
259
|
-
values
|
|
259
|
+
values?: number[];
|
|
260
260
|
plans?: InstallmentPlan[];
|
|
261
261
|
preselectedValue?: number;
|
|
262
262
|
}
|
|
@@ -1446,7 +1446,7 @@ interface AmazonPayConfiguration extends UIElementProps {
|
|
|
1446
1446
|
isExpress?: boolean;
|
|
1447
1447
|
}
|
|
1448
1448
|
type AmazonPayComponentRef = ComponentMethodsRef & {
|
|
1449
|
-
getSubmitFunction?: () => () => void;
|
|
1449
|
+
getSubmitFunction?: () => (() => void) | null;
|
|
1450
1450
|
};
|
|
1451
1451
|
interface AmazonPayComponentProps extends AmazonPayConfiguration {
|
|
1452
1452
|
showSignOutButton?: boolean;
|
|
@@ -1467,7 +1467,7 @@ interface AmazonPayButtonProps {
|
|
|
1467
1467
|
design?: string;
|
|
1468
1468
|
environment?: string;
|
|
1469
1469
|
locale?: string;
|
|
1470
|
-
onClick
|
|
1470
|
+
onClick?: (resolve: (value?: unknown) => void, reject: () => void) => Promise<void>;
|
|
1471
1471
|
onError?: (error: AdyenCheckoutError, component: UIElement) => void;
|
|
1472
1472
|
placement?: Placement;
|
|
1473
1473
|
productType?: ProductType;
|
|
@@ -1476,11 +1476,11 @@ interface AmazonPayButtonProps {
|
|
|
1476
1476
|
initCheckout(): void;
|
|
1477
1477
|
}>;
|
|
1478
1478
|
returnUrl?: string;
|
|
1479
|
-
showPayButton
|
|
1479
|
+
showPayButton?: boolean;
|
|
1480
1480
|
}
|
|
1481
1481
|
interface SignOutButtonProps {
|
|
1482
1482
|
amazonRef: AmazonWindowObject;
|
|
1483
|
-
onSignOut
|
|
1483
|
+
onSignOut?: (resolve: (value?: unknown) => void, reject: () => void) => Promise<void>;
|
|
1484
1484
|
}
|
|
1485
1485
|
interface ChangePaymentDetailsButtonProps {
|
|
1486
1486
|
amazonCheckoutSessionId: string;
|
|
@@ -1492,31 +1492,31 @@ interface ChangeActionOptions {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
interface OrderButtonProps {
|
|
1494
1494
|
amazonCheckoutSessionId: string;
|
|
1495
|
-
clientKey
|
|
1495
|
+
clientKey?: string;
|
|
1496
1496
|
chargePermissionType?: ChargePermissionType;
|
|
1497
|
-
onError
|
|
1498
|
-
recurringMetadata
|
|
1497
|
+
onError?: (error: AdyenCheckoutError, component: UIElement) => void;
|
|
1498
|
+
recurringMetadata?: RecurringMetadata;
|
|
1499
1499
|
ref: RefObject<{
|
|
1500
1500
|
createOrder(): void;
|
|
1501
1501
|
}>;
|
|
1502
|
-
region
|
|
1503
|
-
returnUrl
|
|
1504
|
-
publicKeyId
|
|
1502
|
+
region?: Region;
|
|
1503
|
+
returnUrl?: string;
|
|
1504
|
+
publicKeyId?: string;
|
|
1505
1505
|
}
|
|
1506
1506
|
interface AmazonPayElementData {
|
|
1507
1507
|
paymentMethod: {
|
|
1508
1508
|
type: string;
|
|
1509
1509
|
checkoutSessionId?: string;
|
|
1510
1510
|
};
|
|
1511
|
-
browserInfo: BrowserInfo;
|
|
1511
|
+
browserInfo: BrowserInfo | undefined;
|
|
1512
1512
|
}
|
|
1513
1513
|
interface AmazonPayButtonSettings {
|
|
1514
1514
|
buttonColor?: ButtonColor;
|
|
1515
|
-
design?: string;
|
|
1515
|
+
design?: string | null;
|
|
1516
1516
|
/**
|
|
1517
1517
|
* Amazon Pay merchant account identifier
|
|
1518
1518
|
*/
|
|
1519
|
-
merchantId
|
|
1519
|
+
merchantId?: string;
|
|
1520
1520
|
/**
|
|
1521
1521
|
* Sets button to Sandbox environment
|
|
1522
1522
|
*/
|
|
@@ -1524,11 +1524,11 @@ interface AmazonPayButtonSettings {
|
|
|
1524
1524
|
/**
|
|
1525
1525
|
* Product type selected for checkout
|
|
1526
1526
|
*/
|
|
1527
|
-
productType
|
|
1527
|
+
productType?: ProductType;
|
|
1528
1528
|
/**
|
|
1529
1529
|
* Placement of the Amazon Pay button on your website
|
|
1530
1530
|
*/
|
|
1531
|
-
placement
|
|
1531
|
+
placement?: Placement;
|
|
1532
1532
|
/**
|
|
1533
1533
|
* Language used to render the button and text on Amazon Pay hosted pages. Please note that supported language(s) is dependent on the region that your Amazon Pay account was registered for
|
|
1534
1534
|
*/
|
|
@@ -1591,19 +1591,19 @@ interface CheckoutDetailsRequest {
|
|
|
1591
1591
|
region?: Region;
|
|
1592
1592
|
}
|
|
1593
1593
|
interface UpdateAmazonCheckoutSessionRequest {
|
|
1594
|
-
amount
|
|
1594
|
+
amount?: PaymentAmount;
|
|
1595
1595
|
chargePermissionType?: ChargePermissionType;
|
|
1596
1596
|
checkoutCancelUrl?: string;
|
|
1597
|
-
checkoutResultReturnUrl
|
|
1597
|
+
checkoutResultReturnUrl?: string;
|
|
1598
1598
|
checkoutSessionId: string;
|
|
1599
|
-
publicKeyId
|
|
1599
|
+
publicKeyId?: string;
|
|
1600
1600
|
recurringMetadata?: RecurringMetadata;
|
|
1601
|
-
region
|
|
1601
|
+
region?: Region;
|
|
1602
1602
|
}
|
|
1603
1603
|
interface CheckoutSessionConfig {
|
|
1604
1604
|
payloadJSON: string;
|
|
1605
|
-
signature: string;
|
|
1606
|
-
publicKeyId
|
|
1605
|
+
signature: string | null;
|
|
1606
|
+
publicKeyId?: string;
|
|
1607
1607
|
}
|
|
1608
1608
|
interface DeliverySpecifications {
|
|
1609
1609
|
specialRestrictions?: string[];
|
|
@@ -2187,7 +2187,7 @@ type ClickToPayPaymentData = {
|
|
|
2187
2187
|
type: string;
|
|
2188
2188
|
};
|
|
2189
2189
|
origin: string;
|
|
2190
|
-
browserInfo: BrowserInfo;
|
|
2190
|
+
browserInfo: BrowserInfo | undefined;
|
|
2191
2191
|
};
|
|
2192
2192
|
|
|
2193
2193
|
declare enum ErrorEventCode {
|
|
@@ -2303,7 +2303,7 @@ interface ChallengeData {
|
|
|
2303
2303
|
acsURL: string;
|
|
2304
2304
|
cReqData: CReqData;
|
|
2305
2305
|
iframeSizeArr: string[];
|
|
2306
|
-
postMessageDomain: string;
|
|
2306
|
+
postMessageDomain: string | null;
|
|
2307
2307
|
}
|
|
2308
2308
|
interface ResultObject {
|
|
2309
2309
|
threeDSCompInd?: ResultValue;
|
|
@@ -2336,7 +2336,7 @@ interface FingerPrintData {
|
|
|
2336
2336
|
threeDSServerTransID: string;
|
|
2337
2337
|
threeDSMethodURL: string;
|
|
2338
2338
|
threeDSMethodNotificationURL: string;
|
|
2339
|
-
postMessageDomain: string;
|
|
2339
|
+
postMessageDomain: string | null;
|
|
2340
2340
|
}
|
|
2341
2341
|
type ThreeDS2FingerprintResponse = {
|
|
2342
2342
|
type: 'action' | 'completed';
|
|
@@ -3104,7 +3104,7 @@ declare class CashAppPay extends UIElement<CashAppPayConfiguration> {
|
|
|
3104
3104
|
get isValid(): boolean;
|
|
3105
3105
|
private readonly handleOnChangeStoreDetails;
|
|
3106
3106
|
private readonly handleAuthorize;
|
|
3107
|
-
protected componentToRender(): h.JSX.Element;
|
|
3107
|
+
protected componentToRender(): h.JSX.Element | null;
|
|
3108
3108
|
}
|
|
3109
3109
|
|
|
3110
3110
|
declare class ClickToPayElement extends UIElement<ClickToPayConfiguration> {
|
|
@@ -3671,7 +3671,7 @@ declare class GooglePay extends UIElement<GooglePayConfiguration> {
|
|
|
3671
3671
|
* Use this method to prefetch a PaymentDataRequest configuration to improve loadPaymentData execution time on later user interaction. No value is returned.
|
|
3672
3672
|
*/
|
|
3673
3673
|
prefetch: () => void;
|
|
3674
|
-
get browserInfo(): BrowserInfo;
|
|
3674
|
+
get browserInfo(): BrowserInfo | undefined;
|
|
3675
3675
|
get icon(): string;
|
|
3676
3676
|
protected componentToRender(): h.JSX.Element;
|
|
3677
3677
|
}
|
|
@@ -4095,10 +4095,12 @@ declare class CustomCard extends UIElement<CustomCardConfiguration> {
|
|
|
4095
4095
|
protected componentToRender(): h.JSX.Element;
|
|
4096
4096
|
}
|
|
4097
4097
|
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4098
|
+
type IbanData = Partial<IbanInputData>;
|
|
4099
|
+
/** Unlike `IbanData` (the external, optional prop shape), the component's own state always normalizes these to strings in the constructor. */
|
|
4100
|
+
interface IbanInputData {
|
|
4101
|
+
ownerName: string;
|
|
4102
|
+
ibanNumber: string;
|
|
4103
|
+
countryCode: string;
|
|
4102
4104
|
}
|
|
4103
4105
|
|
|
4104
4106
|
interface SepaElementData {
|
|
@@ -7158,6 +7160,10 @@ interface CoreConfiguration {
|
|
|
7158
7160
|
risk?: RiskModuleOptions;
|
|
7159
7161
|
donation?: DonationOptions;
|
|
7160
7162
|
order?: Order;
|
|
7163
|
+
/**
|
|
7164
|
+
* Suppress warnings about configuration issues. ATM this just relates to warnings about multiple instances of checkout on the same page.
|
|
7165
|
+
*/
|
|
7166
|
+
suppressConfigWarnings?: boolean;
|
|
7161
7167
|
/**
|
|
7162
7168
|
* Add @adyen/web metadata to the window object.
|
|
7163
7169
|
* It helps to identify version number and bundle type in the merchant environment
|
|
@@ -7327,7 +7333,7 @@ declare abstract class BaseElement<P extends BaseElementProps, S extends BaseEle
|
|
|
7327
7333
|
props: P;
|
|
7328
7334
|
state: S;
|
|
7329
7335
|
_component: ComponentChild | undefined;
|
|
7330
|
-
protected _node: HTMLElement;
|
|
7336
|
+
protected _node: HTMLElement | null;
|
|
7331
7337
|
protected static readonly defaultProps: {};
|
|
7332
7338
|
constructor(checkout: ICore, props?: P);
|
|
7333
7339
|
protected buildElementProps(componentProps?: P): void;
|
|
@@ -7341,8 +7347,13 @@ declare abstract class BaseElement<P extends BaseElementProps, S extends BaseEle
|
|
|
7341
7347
|
* Returns the component data necessary for the /payments request
|
|
7342
7348
|
*/
|
|
7343
7349
|
protected formatData(): PaymentData;
|
|
7344
|
-
protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent):
|
|
7345
|
-
protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>):
|
|
7350
|
+
protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent): void;
|
|
7351
|
+
protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>): void;
|
|
7352
|
+
/**
|
|
7353
|
+
* The node the element is currently mounted into.
|
|
7354
|
+
* Throws the same error as `mount()` when the element has not been mounted yet.
|
|
7355
|
+
*/
|
|
7356
|
+
protected get mountedNode(): HTMLElement;
|
|
7346
7357
|
protected setState(newState: S): void;
|
|
7347
7358
|
/**
|
|
7348
7359
|
* Returns the component payment data ready to submit to the Checkout API
|
|
@@ -7389,6 +7400,7 @@ declare abstract class UIElement<P extends UIElementProps = UIElementProps> exte
|
|
|
7389
7400
|
*/
|
|
7390
7401
|
protected componentRef: ComponentMethodsRef | undefined;
|
|
7391
7402
|
protected resources: Resources;
|
|
7403
|
+
protected i18n: Language;
|
|
7392
7404
|
/**
|
|
7393
7405
|
* elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx or Dropin.tsx
|
|
7394
7406
|
*/
|
|
@@ -7415,7 +7427,7 @@ declare abstract class UIElement<P extends UIElementProps = UIElementProps> exte
|
|
|
7415
7427
|
protected reportIntegrationFlavor(): void;
|
|
7416
7428
|
get analytics(): IAnalytics;
|
|
7417
7429
|
get srPanel(): SRPanel;
|
|
7418
|
-
protected getPaymentMethodConfigFromResponse(componentProps
|
|
7430
|
+
protected getPaymentMethodConfigFromResponse(componentProps?: P): RawPaymentMethod;
|
|
7419
7431
|
protected buildElementProps(componentProps?: P): void;
|
|
7420
7432
|
protected getStoredPaymentMethodDetails(storedPaymentMethodId: string): StoredPaymentMethod;
|
|
7421
7433
|
/**
|
|
@@ -7452,7 +7464,7 @@ declare abstract class UIElement<P extends UIElementProps = UIElementProps> exte
|
|
|
7452
7464
|
protected submitAnalytics(event: AbstractAnalyticsEvent): void;
|
|
7453
7465
|
submit(): void;
|
|
7454
7466
|
executePaymentsCall(): void;
|
|
7455
|
-
protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse
|
|
7467
|
+
protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> | undefined;
|
|
7456
7468
|
private submitUsingAdvancedFlow;
|
|
7457
7469
|
private submitUsingSessionsFlow;
|
|
7458
7470
|
protected onComplete(state: AdditionalDetailsData): void;
|
|
@@ -7462,7 +7474,9 @@ declare abstract class UIElement<P extends UIElementProps = UIElementProps> exte
|
|
|
7462
7474
|
private submitAdditionalDetailsUsingSessionsFlow;
|
|
7463
7475
|
handleAction(action: PaymentAction, props?: {}): UIElement | null;
|
|
7464
7476
|
protected onActionHandled(actionHandledObj: ActionHandledReturnObject): void;
|
|
7465
|
-
protected handleOrder: (response: PaymentResponseData
|
|
7477
|
+
protected handleOrder: (response: PaymentResponseData & {
|
|
7478
|
+
order: Order;
|
|
7479
|
+
}) => void;
|
|
7466
7480
|
protected setupSessionsDonation(): void;
|
|
7467
7481
|
/**
|
|
7468
7482
|
* Handles when the payment fails. The payment fails when:
|
|
@@ -7516,7 +7530,7 @@ declare abstract class UIElement<P extends UIElementProps = UIElementProps> exte
|
|
|
7516
7530
|
/**
|
|
7517
7531
|
* Used to display the second line of a payment method item
|
|
7518
7532
|
*/
|
|
7519
|
-
get additionalInfo(): string;
|
|
7533
|
+
get additionalInfo(): string | null;
|
|
7520
7534
|
/**
|
|
7521
7535
|
* Return the type of an element
|
|
7522
7536
|
*/
|
|
@@ -8366,7 +8380,7 @@ declare class ThreeDS2Challenge extends UIElement<ThreeDS2ChallengeConfiguration
|
|
|
8366
8380
|
* (as defined in the 3DS2InMDFlow and passed in as a config prop).
|
|
8367
8381
|
*/
|
|
8368
8382
|
onComplete(state: ChallengeResolveData): void;
|
|
8369
|
-
protected componentToRender(): h.JSX.Element;
|
|
8383
|
+
protected componentToRender(): h.JSX.Element | null;
|
|
8370
8384
|
}
|
|
8371
8385
|
|
|
8372
8386
|
declare class ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {
|
|
@@ -8382,7 +8396,7 @@ declare class ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerpr
|
|
|
8382
8396
|
* Can be called directly from PrepareFingerprint (MDFlow) or after the call to /submitThreeDS2Fingerprint endpoint (native flow)
|
|
8383
8397
|
*/
|
|
8384
8398
|
onComplete(state: FingerprintResolveData): void;
|
|
8385
|
-
protected componentToRender(): h.JSX.Element;
|
|
8399
|
+
protected componentToRender(): h.JSX.Element | null;
|
|
8386
8400
|
}
|
|
8387
8401
|
|
|
8388
8402
|
declare class OnlineBankingFI extends IssuerListContainer {
|
|
@@ -8790,7 +8804,8 @@ declare class FastlaneSDK {
|
|
|
8790
8804
|
/**
|
|
8791
8805
|
* Creates the configuration for the Fastlane component
|
|
8792
8806
|
*
|
|
8793
|
-
* @param
|
|
8807
|
+
* @param card - card from the authenticated shopper's Fastlane profile
|
|
8808
|
+
* @param email - email of the authenticated shopper
|
|
8794
8809
|
* @private
|
|
8795
8810
|
*/
|
|
8796
8811
|
private createFastlaneComponentConfiguration;
|
|
@@ -8825,6 +8840,7 @@ declare class Core implements ICore {
|
|
|
8825
8840
|
static readonly metadata: {
|
|
8826
8841
|
version: string;
|
|
8827
8842
|
bundleType: string;
|
|
8843
|
+
numberOfInitialisedCheckouts: number;
|
|
8828
8844
|
};
|
|
8829
8845
|
static readonly registry: {
|
|
8830
8846
|
componentsMap: Record<string, NewableComponent>;
|
|
@@ -8834,6 +8850,7 @@ declare class Core implements ICore {
|
|
|
8834
8850
|
createComponentsMap(components: NewableComponent[]): {};
|
|
8835
8851
|
};
|
|
8836
8852
|
static setBundleType(type: string): void;
|
|
8853
|
+
static increaseInitialisationCount(): void;
|
|
8837
8854
|
static register(...items: NewableComponent[]): void;
|
|
8838
8855
|
/**
|
|
8839
8856
|
* Used internally by the PaymentMethod components to auto-register themselves
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import t from"../../utils/browserInfo.js";import n from"./components/AmazonPayComponent.js";import s from"./defaultProps.js";import{getCheckoutDetails as r}from"./services.js";import{TxVariants as i}from"../tx-variants.js";import{sanitizeResponse as p,verifyPaymentDidNotFail as a}from"../internal/UIElement/utils.js";import{AnalyticsInfoEvent as c,InfoEventType as l}from"../../core/Analytics/events/AnalyticsInfoEvent.js";function u(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}class h extends o{formatProps(e){return{...e,checkoutMode:e.isDropin?"ProcessOrder":e.checkoutMode,environment:e.environment?.toUpperCase(),locale:e.locale?.replace("-","_"),productType:e.isDropin&&!e.addressDetails?"PayOnly":e.productType}}formatData(){const{amazonCheckoutSessionId:e}=this.props;return{paymentMethod:{type:h.type,...e&&{checkoutSessionId:e}},browserInfo:this.browserInfo}}beforeRender(e){const o=new c({type:l.rendered,component:this.type,configData:{...e,showPayButton:this.props.showPayButton},...e?.isExpress&&{isExpress:e.isExpress},...e?.expressPage&&{expressPage:e.expressPage}});this.analytics.sendAnalytics(o)}getShopperDetails(){const{amazonCheckoutSessionId:e,configuration:o={},loadingContext:t,clientKey:n}=this.props;if(!e)return console.error("Could not shopper details. Missing checkoutSessionId.");const s={checkoutSessionId:e,getDeliveryAddress:!0,publicKeyId:o?.publicKeyId||"",region:o.region};return r(t??"",n??"",s)}handleDeclineFlow(){const{amazonCheckoutSessionId:e,configuration:o={},loadingContext:t,clientKey:n}=this.props;if(!e)return console.error("Could handle the decline flow. Missing checkoutSessionId.");const s={checkoutSessionId:e,getDeclineFlowUrl:!0,publicKeyId:o.publicKeyId??"",region:o.region};r(t??"",n??"",s).then((e={})=>{if(!e?.declineFlowUrl)throw e;window.location.assign(e.declineFlowUrl)}).catch(e=>{this.props.onError&&this.props.onError(e,this)})}get isValid(){return!0}get browserInfo(){return t()}submit(){const e=this.componentRef?.getSubmitFunction?.()||null;if(e)return e();this.makePaymentsCall()
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import t from"../../utils/browserInfo.js";import n from"./components/AmazonPayComponent.js";import s from"./defaultProps.js";import{getCheckoutDetails as r}from"./services.js";import{TxVariants as i}from"../tx-variants.js";import{sanitizeResponse as p,verifyPaymentDidNotFail as a}from"../internal/UIElement/utils.js";import{AnalyticsInfoEvent as c,InfoEventType as l}from"../../core/Analytics/events/AnalyticsInfoEvent.js";function u(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}class h extends o{formatProps(e){return{...e,checkoutMode:e.isDropin?"ProcessOrder":e.checkoutMode,environment:e.environment?.toUpperCase(),locale:e.locale?.replace("-","_"),productType:e.isDropin&&!e.addressDetails?"PayOnly":e.productType}}formatData(){const{amazonCheckoutSessionId:e}=this.props;return{paymentMethod:{type:h.type,...e&&{checkoutSessionId:e}},browserInfo:this.browserInfo}}beforeRender(e){const o=new c({type:l.rendered,component:this.type,configData:{...e,showPayButton:this.props.showPayButton},...e?.isExpress&&{isExpress:e.isExpress},...e?.expressPage&&{expressPage:e.expressPage}});this.analytics.sendAnalytics(o)}getShopperDetails(){const{amazonCheckoutSessionId:e,configuration:o={},loadingContext:t,clientKey:n}=this.props;if(!e)return console.error("Could not shopper details. Missing checkoutSessionId.");const s={checkoutSessionId:e,getDeliveryAddress:!0,publicKeyId:o?.publicKeyId||"",region:o.region};return r(t??"",n??"",s)}handleDeclineFlow(){const{amazonCheckoutSessionId:e,configuration:o={},loadingContext:t,clientKey:n}=this.props;if(!e)return console.error("Could handle the decline flow. Missing checkoutSessionId.");const s={checkoutSessionId:e,getDeclineFlowUrl:!0,publicKeyId:o.publicKeyId??"",region:o.region};r(t??"",n??"",s).then((e={})=>{if(!e?.declineFlowUrl)throw e;window.location.assign(e.declineFlowUrl)}).catch(e=>{this.props.onError&&this.props.onError(e,this)})}get isValid(){return!0}get browserInfo(){return t()}submit(){const e=this.componentRef?.getSubmitFunction?.()||null;if(e)return e();this.makePaymentsCall()?.then(p).then(a).then(this.handleResponse).catch(this.handleFailedResult)}componentToRender(){return e(n,{setComponentRef:this.setComponentRef,showPayButton:this.props.showPayButton,onClick:this.props.onClick,onError:this.props.onError,onSignOut:this.props.onSignOut,...this.props})}}u(h,"type",i.amazonpay),u(h,"defaultProps",s);export{h as AmazonPayElement,h as default};
|
|
2
2
|
//# sourceMappingURL=AmazonPay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonPay.js","sources":["../../../../src/components/AmazonPay/AmazonPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AmazonPayComponent from './components/AmazonPayComponent';\nimport { AmazonPayElementData, AmazonPayConfiguration, CheckoutDetailsRequest, AmazonPayComponentRef } from './types';\nimport defaultProps from './defaultProps';\nimport { getCheckoutDetails } from './services';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nimport './AmazonPay.scss';\n\nexport class AmazonPayElement extends UIElement<AmazonPayConfiguration> {\n public static readonly type = TxVariants.amazonpay;\n\n protected static readonly defaultProps = defaultProps;\n\n declare protected componentRef: AmazonPayComponentRef | undefined;\n\n formatProps(props: AmazonPayConfiguration): AmazonPayConfiguration {\n return {\n ...props,\n checkoutMode: props.isDropin ? 'ProcessOrder' : props.checkoutMode,\n environment: props.environment?.toUpperCase(),\n locale: props.locale?.replace('-', '_'),\n productType: props.isDropin && !props.addressDetails ? 'PayOnly' : props.productType\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): AmazonPayElementData {\n const { amazonCheckoutSessionId: checkoutSessionId } = this.props;\n return {\n paymentMethod: {\n type: AmazonPayElement.type,\n ...(checkoutSessionId && { checkoutSessionId })\n },\n browserInfo: this.browserInfo\n };\n }\n\n protected override beforeRender(configSetByMerchant?: AmazonPayConfiguration) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.isExpress && { isExpress: configSetByMerchant.isExpress }),\n ...(configSetByMerchant?.expressPage && { expressPage: configSetByMerchant.expressPage })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n getShopperDetails() {\n const { amazonCheckoutSessionId, configuration = {}, loadingContext, clientKey } = this.props;\n if (!amazonCheckoutSessionId) return console.error('Could not shopper details. Missing checkoutSessionId.');\n\n const request: CheckoutDetailsRequest = {\n checkoutSessionId: amazonCheckoutSessionId,\n getDeliveryAddress: true,\n publicKeyId: configuration?.publicKeyId || '',\n region: configuration.region\n };\n\n return getCheckoutDetails(loadingContext ?? '', clientKey ?? '', request);\n }\n\n public handleDeclineFlow() {\n const { amazonCheckoutSessionId, configuration = {}, loadingContext, clientKey } = this.props;\n if (!amazonCheckoutSessionId) return console.error('Could handle the decline flow. Missing checkoutSessionId.');\n\n const request: CheckoutDetailsRequest = {\n checkoutSessionId: amazonCheckoutSessionId,\n getDeclineFlowUrl: true,\n publicKeyId: configuration.publicKeyId ?? '',\n region: configuration.region\n };\n\n getCheckoutDetails(loadingContext ?? '', clientKey ?? '', request)\n .then((response = {}) => {\n if (!response?.declineFlowUrl) throw response;\n window.location.assign(response.declineFlowUrl);\n })\n .catch(error => {\n if (this.props.onError) this.props.onError(error, this);\n });\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n public submit(): void {\n const amazonComponentSubmitFunction = this.componentRef?.getSubmitFunction?.() || null;\n if (amazonComponentSubmitFunction) {\n return amazonComponentSubmitFunction();\n }\n this.makePaymentsCall()
|
|
1
|
+
{"version":3,"file":"AmazonPay.js","sources":["../../../../src/components/AmazonPay/AmazonPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AmazonPayComponent from './components/AmazonPayComponent';\nimport { AmazonPayElementData, AmazonPayConfiguration, CheckoutDetailsRequest, AmazonPayComponentRef } from './types';\nimport defaultProps from './defaultProps';\nimport { getCheckoutDetails } from './services';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nimport './AmazonPay.scss';\n\nexport class AmazonPayElement extends UIElement<AmazonPayConfiguration> {\n public static readonly type = TxVariants.amazonpay;\n\n protected static readonly defaultProps = defaultProps;\n\n declare protected componentRef: AmazonPayComponentRef | undefined;\n\n formatProps(props: AmazonPayConfiguration): AmazonPayConfiguration {\n return {\n ...props,\n checkoutMode: props.isDropin ? 'ProcessOrder' : props.checkoutMode,\n environment: props.environment?.toUpperCase(),\n locale: props.locale?.replace('-', '_'),\n productType: props.isDropin && !props.addressDetails ? 'PayOnly' : props.productType\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): AmazonPayElementData {\n const { amazonCheckoutSessionId: checkoutSessionId } = this.props;\n return {\n paymentMethod: {\n type: AmazonPayElement.type,\n ...(checkoutSessionId && { checkoutSessionId })\n },\n browserInfo: this.browserInfo\n };\n }\n\n protected override beforeRender(configSetByMerchant?: AmazonPayConfiguration) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.isExpress && { isExpress: configSetByMerchant.isExpress }),\n ...(configSetByMerchant?.expressPage && { expressPage: configSetByMerchant.expressPage })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n getShopperDetails() {\n const { amazonCheckoutSessionId, configuration = {}, loadingContext, clientKey } = this.props;\n if (!amazonCheckoutSessionId) return console.error('Could not shopper details. Missing checkoutSessionId.');\n\n const request: CheckoutDetailsRequest = {\n checkoutSessionId: amazonCheckoutSessionId,\n getDeliveryAddress: true,\n publicKeyId: configuration?.publicKeyId || '',\n region: configuration.region\n };\n\n return getCheckoutDetails(loadingContext ?? '', clientKey ?? '', request);\n }\n\n public handleDeclineFlow() {\n const { amazonCheckoutSessionId, configuration = {}, loadingContext, clientKey } = this.props;\n if (!amazonCheckoutSessionId) return console.error('Could handle the decline flow. Missing checkoutSessionId.');\n\n const request: CheckoutDetailsRequest = {\n checkoutSessionId: amazonCheckoutSessionId,\n getDeclineFlowUrl: true,\n publicKeyId: configuration.publicKeyId ?? '',\n region: configuration.region\n };\n\n getCheckoutDetails(loadingContext ?? '', clientKey ?? '', request)\n .then((response = {}) => {\n if (!response?.declineFlowUrl) throw response;\n window.location.assign(response.declineFlowUrl);\n })\n .catch(error => {\n if (this.props.onError) this.props.onError(error, this);\n });\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n public submit(): void {\n const amazonComponentSubmitFunction = this.componentRef?.getSubmitFunction?.() || null;\n if (amazonComponentSubmitFunction) {\n return amazonComponentSubmitFunction();\n }\n this.makePaymentsCall()?.then(sanitizeResponse).then(verifyPaymentDidNotFail).then(this.handleResponse).catch(this.handleFailedResult);\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <AmazonPayComponent\n setComponentRef={this.setComponentRef}\n showPayButton={this.props.showPayButton}\n onClick={this.props.onClick}\n onError={this.props.onError}\n onSignOut={this.props.onSignOut}\n {...this.props}\n />\n );\n }\n}\n\nexport default AmazonPayElement;\n"],"names":["AmazonPayElement","UIElement","formatProps","props","checkoutMode","isDropin","environment","toUpperCase","locale","replace","productType","addressDetails","formatData","amazonCheckoutSessionId","checkoutSessionId","this","paymentMethod","type","browserInfo","beforeRender","configSetByMerchant","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","isExpress","expressPage","analytics","sendAnalytics","getShopperDetails","configuration","loadingContext","clientKey","console","error","request","getDeliveryAddress","publicKeyId","region","getCheckoutDetails","handleDeclineFlow","getDeclineFlowUrl","then","response","declineFlowUrl","window","location","assign","catch","onError","isValid","collectBrowserInfo","submit","amazonComponentSubmitFunction","componentRef","getSubmitFunction","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","handleFailedResult","componentToRender","h","AmazonPayComponent","setComponentRef","onClick","onSignOut","_define_property","TxVariants","amazonpay","defaultProps"],"mappings":"oqBAaO,MAAMA,UAAyBC,EAOlCC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,aAAcD,EAAME,SAAW,eAAiBF,EAAMC,aACtDE,YAAaH,EAAMG,aAAaC,cAChCC,OAAQL,EAAMK,QAAQC,QAAQ,IAAK,KACnCC,YAAaP,EAAME,WAAaF,EAAMQ,eAAiB,UAAYR,EAAMO,YAEjF,CAKAE,UAAAA,GACI,MAAQC,wBAAyBC,GAAsBC,KAAKZ,MAC5D,MAAO,CACHa,cAAe,CACXC,KAAMjB,EAAiBiB,QACnBH,GAAqB,CAAEA,sBAE/BI,YAAaH,KAAKG,YAE1B,CAEmBC,YAAAA,CAAaC,GAC5B,MAAMC,EAAQ,IAAIC,EAAmB,CACjCL,KAAMM,EAAcC,SACpBC,UAAWV,KAAKE,KAChBS,WAAY,IAAKN,EAAqBO,cAAeZ,KAAKZ,MAAMwB,kBAC5DP,GAAqBQ,WAAa,CAAEA,UAAWR,EAAoBQ,cACnER,GAAqBS,aAAe,CAAEA,YAAaT,EAAoBS,eAG/Ed,KAAKe,UAAUC,cAAcV,EACjC,CAEAW,iBAAAA,GACI,MAAMnB,wBAAEA,EAAuBoB,cAAEA,EAAgB,CAAA,EAAEC,eAAEA,EAAcC,UAAEA,GAAcpB,KAAKZ,MACxF,IAAKU,EAAyB,OAAOuB,QAAQC,MAAM,yDAEnD,MAAMC,EAAkC,CACpCxB,kBAAmBD,EACnB0B,oBAAoB,EACpBC,YAAaP,GAAeO,aAAe,GAC3CC,OAAQR,EAAcQ,QAG1B,OAAOC,EAAmBR,GAAkB,GAAIC,GAAa,GAAIG,EACrE,CAEOK,iBAAAA,GACH,MAAM9B,wBAAEA,EAAuBoB,cAAEA,EAAgB,CAAA,EAAEC,eAAEA,EAAcC,UAAEA,GAAcpB,KAAKZ,MACxF,IAAKU,EAAyB,OAAOuB,QAAQC,MAAM,6DAEnD,MAAMC,EAAkC,CACpCxB,kBAAmBD,EACnB+B,mBAAmB,EACnBJ,YAAaP,EAAcO,aAAe,GAC1CC,OAAQR,EAAcQ,QAG1BC,EAAmBR,GAAkB,GAAIC,GAAa,GAAIG,GACrDO,KAAK,CAACC,EAAW,MACd,IAAKA,GAAUC,eAAgB,MAAMD,EACrCE,OAAOC,SAASC,OAAOJ,EAASC,kBAEnCI,MAAMd,IACCtB,KAAKZ,MAAMiD,SAASrC,KAAKZ,MAAMiD,QAAQf,EAAOtB,OAE9D,CAEA,WAAIsC,GACA,OAAO,CACX,CAEA,eAAInC,GACA,OAAOoC,GACX,CAEOC,MAAAA,GACH,MAAMC,EAAgCzC,KAAK0C,cAAcC,uBAAyB,KAClF,GAAIF,EACA,OAAOA,IAEXzC,KAAK4C,oBAAoBd,KAAKe,GAAkBf,KAAKgB,GAAyBhB,KAAK9B,KAAK+C,gBAAgBX,MAAMpC,KAAKgD,mBACvH,CAEmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,gBAAiBpD,KAAKoD,gBACtBxC,cAAeZ,KAAKZ,MAAMwB,cAC1ByC,QAASrD,KAAKZ,MAAMiE,QACpBhB,QAASrC,KAAKZ,MAAMiD,QACpBiB,UAAWtD,KAAKZ,MAAMkE,aAClBtD,KAAKZ,OAGrB,EAxGAmE,EADStE,EACciB,OAAOsD,EAAWC,WAEzCF,EAHStE,EAGiByE,eAAeA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as o}from"../../../external/preact/dist/preact.js";import{useState as t,useEffect as e}from"../../../external/preact/hooks/dist/hooks.js";import{getAmazonSignature as n}from"../services.js";import{getPayloadJSON as r,getAmazonPaySettings as a}from"../utils.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{useAmount as s}from"../../../core/Context/AmountProvider.js";function c(c){const{amount:u}=s(),{loadingContext:m}=i(),{amazonRef:l,configuration:f={}}=c,[h,p]=t(null),d=r(c,u),y=a(c,u),C=()=>new Promise((o,t)=>{c.onClick(o,t)}).then(this.initCheckout).catch(o=>{c.onError&&c.onError(o,this.componentRef)});return this.initCheckout=()=>{const o={payloadJSON:JSON.stringify(d),publicKeyId:f.publicKeyId,signature:h};l.Pay.initCheckout({...y,createCheckoutSessionConfig:o})},e(()=>{const{clientKey:o}=c;n(m,o,d).then(o=>{if(!o?.signature)return console.error("Could not get AmazonPay signature");p(o.signature),c.showPayButton&&l.Pay.renderButton("#amazonPayButton",y).onClick(()=>{C()})}).catch(o=>{console.error(o),c.onError&&c.onError(o,this.componentRef)})},[]),c.showPayButton?o("div",{className:"adyen-checkout__amazonpay__button",id:"amazonPayButton","data-testid":"amazon-pay-button"}):null}export{c as default};
|
|
1
|
+
import{createElement as o}from"../../../external/preact/dist/preact.js";import{useState as t,useEffect as e}from"../../../external/preact/hooks/dist/hooks.js";import{getAmazonSignature as n}from"../services.js";import{getPayloadJSON as r,getAmazonPaySettings as a}from"../utils.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{useAmount as s}from"../../../core/Context/AmountProvider.js";function c(c){const{amount:u}=s(),{loadingContext:m}=i(),{amazonRef:l,configuration:f={}}=c,[h,p]=t(null),d=r(c,u),y=a(c,u),C=()=>{(c.onClick?new Promise((o,t)=>{c.onClick?.(o,t)}):Promise.resolve()).then(this.initCheckout).catch(o=>{c.onError&&c.onError(o,this.componentRef)})};return this.initCheckout=()=>{const o={payloadJSON:JSON.stringify(d),publicKeyId:f.publicKeyId,signature:h};l.Pay.initCheckout({...y,createCheckoutSessionConfig:o})},e(()=>{const{clientKey:o}=c;n(m,o??"",d).then(o=>{if(!o?.signature)return console.error("Could not get AmazonPay signature");p(o.signature),c.showPayButton&&l.Pay.renderButton("#amazonPayButton",y).onClick(()=>{C()})}).catch(o=>{console.error(o),c.onError&&c.onError(o,this.componentRef)})},[]),c.showPayButton?o("div",{className:"adyen-checkout__amazonpay__button",id:"amazonPayButton","data-testid":"amazon-pay-button"}):null}export{c as default};
|
|
2
2
|
//# sourceMappingURL=AmazonPayButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonPayButton.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport { getAmazonSignature } from '../services';\nimport { getAmazonPaySettings, getPayloadJSON } from '../utils';\nimport { AmazonPayButtonProps, CheckoutSessionConfig, PayloadJSON } from '../types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\nexport default function AmazonPayButton(props: Readonly<AmazonPayButtonProps>) {\n const { amount } = useAmount();\n const { loadingContext } = useCoreContext();\n const { amazonRef, configuration = {} } = props;\n const [signature, setSignature] = useState<string>(null);\n const payloadJSON: PayloadJSON = getPayloadJSON(props, amount);\n const settings = getAmazonPaySettings(props, amount);\n\n const handleOnClick = () => {\n
|
|
1
|
+
{"version":3,"file":"AmazonPayButton.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport { getAmazonSignature } from '../services';\nimport { getAmazonPaySettings, getPayloadJSON } from '../utils';\nimport { AmazonPayButtonProps, CheckoutSessionConfig, PayloadJSON } from '../types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\nexport default function AmazonPayButton(props: Readonly<AmazonPayButtonProps>) {\n const { amount } = useAmount();\n const { loadingContext } = useCoreContext();\n const { amazonRef, configuration = {} } = props;\n const [signature, setSignature] = useState<string | null>(null);\n const payloadJSON: PayloadJSON = getPayloadJSON(props, amount);\n const settings = getAmazonPaySettings(props, amount);\n\n const handleOnClick = () => {\n const clickPromise = props.onClick ? new Promise((resolve, reject) => void props.onClick?.(resolve, reject)) : Promise.resolve();\n\n clickPromise.then(this.initCheckout).catch(error => {\n if (props.onError) props.onError(error, this.componentRef);\n });\n };\n\n const renderAmazonPayButton = (): void => {\n const amazonPayButton = amazonRef.Pay.renderButton('#amazonPayButton', settings);\n amazonPayButton.onClick(() => void handleOnClick());\n };\n\n this.initCheckout = () => {\n const checkoutSessionConfig: CheckoutSessionConfig = {\n payloadJSON: JSON.stringify(payloadJSON),\n publicKeyId: configuration.publicKeyId,\n signature\n };\n\n amazonRef.Pay.initCheckout({\n ...settings,\n createCheckoutSessionConfig: checkoutSessionConfig\n });\n };\n\n useEffect(() => {\n const { clientKey } = props;\n\n getAmazonSignature(loadingContext, clientKey ?? '', payloadJSON)\n .then(response => {\n if (!response?.signature) return console.error('Could not get AmazonPay signature');\n setSignature(response.signature);\n if (props.showPayButton) renderAmazonPayButton();\n })\n .catch(error => {\n console.error(error);\n if (props.onError) props.onError(error, this.componentRef);\n });\n }, []);\n\n if (!props.showPayButton) return null;\n return <div className=\"adyen-checkout__amazonpay__button\" id=\"amazonPayButton\" data-testid=\"amazon-pay-button\" />;\n}\n"],"names":["AmazonPayButton","props","amount","useAmount","loadingContext","useCoreContext","amazonRef","configuration","signature","setSignature","useState","payloadJSON","getPayloadJSON","settings","getAmazonPaySettings","handleOnClick","onClick","Promise","resolve","reject","then","this","initCheckout","catch","error","onError","componentRef","checkoutSessionConfig","JSON","stringify","publicKeyId","Pay","createCheckoutSessionConfig","useEffect","clientKey","getAmazonSignature","response","console","showPayButton","renderButton","h","div","className","id","data-testid"],"mappings":"qaAQe,SAASA,EAAgBC,GACpC,MAAMC,OAAEA,GAAWC,KACbC,eAAEA,GAAmBC,KACrBC,UAAEA,EAASC,cAAEA,EAAgB,CAAA,GAAON,GACnCO,EAAWC,GAAgBC,EAAwB,MACpDC,EAA2BC,EAAeX,EAAOC,GACjDW,EAAWC,EAAqBb,EAAOC,GAEvCa,EAAgB,MACGd,EAAMe,QAAU,IAAIC,QAAQ,CAACC,EAASC,KAAgBlB,EAAMe,UAAUE,EAASC,KAAWF,QAAQC,WAE1GE,KAAKC,KAAKC,cAAcC,MAAMC,IACnCvB,EAAMwB,SAASxB,EAAMwB,QAAQD,EAAOH,KAAKK,iBAqCrD,OA5BAL,KAAKC,aAAe,KAChB,MAAMK,EAA+C,CACjDhB,YAAaiB,KAAKC,UAAUlB,GAC5BmB,YAAavB,EAAcuB,YAC3BtB,aAGJF,EAAUyB,IAAIT,aAAa,IACpBT,EACHmB,4BAA6BL,KAIrCM,EAAU,KACN,MAAMC,UAAEA,GAAcjC,EAEtBkC,EAAmB/B,EAAgB8B,GAAa,GAAIvB,GAC/CS,KAAKgB,IACF,IAAKA,GAAU5B,UAAW,OAAO6B,QAAQb,MAAM,qCAC/Cf,EAAa2B,EAAS5B,WAClBP,EAAMqC,eAxBMhC,EAAUyB,IAAIQ,aAAa,mBAAoB1B,GACvDG,QAAQ,KAAWD,QAyB9BQ,MAAMC,IACHa,QAAQb,MAAMA,GACVvB,EAAMwB,SAASxB,EAAMwB,QAAQD,EAAOH,KAAKK,iBAEtD,IAEEzB,EAAMqC,cACJE,EAACC,MAAAA,CAAIC,UAAU,oCAAoCC,GAAG,kBAAkBC,cAAY,sBAD1D,IAErC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as n,useRef as o,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../internal/Spinner/Spinner.js";import{getAmazonPayUrl as a}from"../utils.js";import i from"./AmazonPayButton.js";import c from"./ChangePaymentDetailsButton.js";import s from"./OrderButton.js";import u from"./SignOutButton.js";import m from"../../../utils/Script.js";import l from"../../../core/Analytics/useAnalytics.js";function
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as n,useRef as o,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../internal/Spinner/Spinner.js";import{getAmazonPayUrl as a}from"../utils.js";import i from"./AmazonPayButton.js";import c from"./ChangePaymentDetailsButton.js";import s from"./OrderButton.js";import u from"./SignOutButton.js";import m from"../../../utils/Script.js";import l from"../../../core/Analytics/useAnalytics.js";function p(p){const[d,y]=n("pending"),f=o(null),g=o(null),{analytics:h}=l(),z=()=>{y("ready")},k=o({getSubmitFunction:()=>f.current?.initCheckout?()=>f.current?.initCheckout():g.current?.createOrder?()=>g.current?.createOrder():null});t(()=>{p.setComponentRef(k.current)},[p.setComponentRef]),t(()=>{const e=a(p.configuration?.region),n=new m({src:e,component:"amazonpay",analytics:h});return window.amazon?z():n.load().then(z),()=>{n.remove()}},[h]);const S=window.amazon;return"pending"!==d&&S?p.showSignOutButton?e("div",{className:"adyen-checkout__amazonpay"},e(u,{amazonRef:S,onSignOut:p.onSignOut})):p.amazonCheckoutSessionId?e("div",{className:"adyen-checkout__amazonpay"},p.showOrderButton&&e(s,{amazonCheckoutSessionId:p.amazonCheckoutSessionId,chargePermissionType:p.chargePermissionType,recurringMetadata:p.recurringMetadata,clientKey:p.clientKey,onError:p.onError,publicKeyId:p.configuration?.publicKeyId,region:p.configuration?.region,returnUrl:p.returnUrl,ref:g}),p.showChangePaymentDetailsButton&&e(c,{amazonCheckoutSessionId:p.amazonCheckoutSessionId,amazonRef:S})):e("div",{className:"adyen-checkout__amazonpay"},e(i,{showPayButton:p.showPayButton,amazonRef:S,ref:f,buttonColor:p.buttonColor,cancelUrl:p.cancelUrl,chargePermissionType:p.chargePermissionType,onClick:p.onClick,onError:p.onError,clientKey:p.clientKey,configuration:p.configuration,currency:p.currency,deliverySpecifications:p.deliverySpecifications,design:p.design,environment:p.environment,locale:p.locale,placement:p.placement,productType:p.productType,recurringMetadata:p.recurringMetadata,returnUrl:p.returnUrl})):e("div",{className:"adyen-checkout__amazonpay"},e("div",{className:"adyen-checkout__amazonpay__status adyen-checkout__amazonpay__status--pending"},e(r,null)))}export{p as default};
|
|
2
2
|
//# sourceMappingURL=AmazonPayComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonPayComponent.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef } from 'preact/hooks';\nimport Spinner from '../../internal/Spinner';\nimport { getAmazonPayUrl } from '../utils';\nimport { AmazonPayComponentProps } from '../types';\nimport AmazonPayButton from './AmazonPayButton';\nimport ChangePaymentDetailsButton from './ChangePaymentDetailsButton';\nimport OrderButton from './OrderButton';\nimport SignOutButton from './SignOutButton';\nimport Script from '../../../utils/Script';\nimport useAnalytics from '../../../core/Analytics/useAnalytics';\n\nexport default function AmazonPayComponent(props: Readonly<AmazonPayComponentProps>) {\n const [status, setStatus] = useState('pending');\n const amazonPayButtonRef = useRef(null);\n const orderButtonRef = useRef(null);\n const { analytics } = useAnalytics();\n\n const handleLoad = () => {\n setStatus('ready');\n };\n\n const amazonPayRef = useRef({\n getSubmitFunction: () => {\n if (amazonPayButtonRef.current?.initCheckout) return () => amazonPayButtonRef.current
|
|
1
|
+
{"version":3,"file":"AmazonPayComponent.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef } from 'preact/hooks';\nimport Spinner from '../../internal/Spinner';\nimport { getAmazonPayUrl } from '../utils';\nimport { AmazonPayComponentProps } from '../types';\nimport AmazonPayButton from './AmazonPayButton';\nimport ChangePaymentDetailsButton from './ChangePaymentDetailsButton';\nimport OrderButton from './OrderButton';\nimport SignOutButton from './SignOutButton';\nimport Script from '../../../utils/Script';\nimport useAnalytics from '../../../core/Analytics/useAnalytics';\n\nexport default function AmazonPayComponent(props: Readonly<AmazonPayComponentProps>) {\n const [status, setStatus] = useState('pending');\n const amazonPayButtonRef = useRef<{ initCheckout(): void }>(null);\n const orderButtonRef = useRef<{ createOrder(): void }>(null);\n const { analytics } = useAnalytics();\n\n const handleLoad = () => {\n setStatus('ready');\n };\n\n const amazonPayRef = useRef({\n getSubmitFunction: () => {\n if (amazonPayButtonRef.current?.initCheckout) return () => amazonPayButtonRef.current?.initCheckout();\n if (orderButtonRef.current?.createOrder) return () => orderButtonRef.current?.createOrder();\n return null;\n }\n });\n\n useEffect(() => {\n props.setComponentRef(amazonPayRef.current);\n }, [props.setComponentRef]);\n\n useEffect(() => {\n const src = getAmazonPayUrl(props.configuration?.region);\n const script = new Script({\n src,\n component: 'amazonpay',\n analytics\n });\n\n if (window.amazon) {\n handleLoad();\n } else {\n void script.load().then(handleLoad);\n }\n\n return () => {\n script.remove();\n };\n }, [analytics]);\n\n const amazonRef = window.amazon;\n\n if (status === 'pending' || !amazonRef) {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <div className=\"adyen-checkout__amazonpay__status adyen-checkout__amazonpay__status--pending\">\n <Spinner />\n </div>\n </div>\n );\n }\n\n if (props.showSignOutButton) {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <SignOutButton amazonRef={amazonRef} onSignOut={props.onSignOut} />\n </div>\n );\n }\n\n if (props.amazonCheckoutSessionId) {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n {props.showOrderButton && (\n <OrderButton\n amazonCheckoutSessionId={props.amazonCheckoutSessionId}\n chargePermissionType={props.chargePermissionType}\n recurringMetadata={props.recurringMetadata}\n clientKey={props.clientKey}\n onError={props.onError}\n publicKeyId={props.configuration?.publicKeyId}\n region={props.configuration?.region}\n returnUrl={props.returnUrl}\n ref={orderButtonRef}\n />\n )}\n\n {props.showChangePaymentDetailsButton && (\n <ChangePaymentDetailsButton amazonCheckoutSessionId={props.amazonCheckoutSessionId} amazonRef={amazonRef} />\n )}\n </div>\n );\n }\n\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <AmazonPayButton\n showPayButton={props.showPayButton}\n amazonRef={amazonRef}\n ref={amazonPayButtonRef}\n buttonColor={props.buttonColor}\n cancelUrl={props.cancelUrl}\n chargePermissionType={props.chargePermissionType}\n onClick={props.onClick}\n onError={props.onError}\n clientKey={props.clientKey}\n configuration={props.configuration}\n currency={props.currency}\n deliverySpecifications={props.deliverySpecifications}\n design={props.design}\n environment={props.environment}\n locale={props.locale}\n placement={props.placement}\n productType={props.productType}\n recurringMetadata={props.recurringMetadata}\n returnUrl={props.returnUrl}\n />\n </div>\n );\n}\n"],"names":["AmazonPayComponent","props","status","setStatus","useState","amazonPayButtonRef","useRef","orderButtonRef","analytics","useAnalytics","handleLoad","amazonPayRef","getSubmitFunction","current","initCheckout","createOrder","useEffect","setComponentRef","src","getAmazonPayUrl","configuration","region","script","Script","component","window","amazon","load","then","remove","amazonRef","showSignOutButton","h","div","className","SignOutButton","onSignOut","amazonCheckoutSessionId","showOrderButton","OrderButton","chargePermissionType","recurringMetadata","clientKey","onError","publicKeyId","returnUrl","ref","showChangePaymentDetailsButton","ChangePaymentDetailsButton","AmazonPayButton","showPayButton","buttonColor","cancelUrl","onClick","currency","deliverySpecifications","design","environment","locale","placement","productType","Spinner"],"mappings":"8fAYe,SAASA,EAAmBC,GACvC,MAAOC,EAAQC,GAAaC,EAAS,WAC/BC,EAAqBC,EAAiC,MACtDC,EAAiBD,EAAgC,OACjDE,UAAEA,GAAcC,IAEhBC,EAAa,KACfP,EAAU,UAGRQ,EAAeL,EAAO,CACxBM,kBAAmB,IACXP,EAAmBQ,SAASC,aAAqB,IAAMT,EAAmBQ,SAASC,eACnFP,EAAeM,SAASE,YAAoB,IAAMR,EAAeM,SAASE,cACvE,OAIfC,EAAU,KACNf,EAAMgB,gBAAgBN,EAAaE,UACpC,CAACZ,EAAMgB,kBAEVD,EAAU,KACN,MAAME,EAAMC,EAAgBlB,EAAMmB,eAAeC,QAC3CC,EAAS,IAAIC,EAAO,CACtBL,MACAM,UAAW,YACXhB,cASJ,OANIiB,OAAOC,OACPhB,IAEKY,EAAOK,OAAOC,KAAKlB,GAGrB,KACHY,EAAOO,WAEZ,CAACrB,IAEJ,MAAMsB,EAAYL,OAAOC,OAEzB,MAAe,YAAXxB,GAAyB4B,EAUzB7B,EAAM8B,kBAEFC,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACG,EAAAA,CAAcL,UAAWA,EAAWM,UAAWnC,EAAMmC,aAK9DnC,EAAMoC,wBAEFL,EAACC,MAAAA,CAAIC,UAAU,6BACVjC,EAAMqC,iBACHN,EAACO,EAAAA,CACGF,wBAAyBpC,EAAMoC,wBAC/BG,qBAAsBvC,EAAMuC,qBAC5BC,kBAAmBxC,EAAMwC,kBACzBC,UAAWzC,EAAMyC,UACjBC,QAAS1C,EAAM0C,QACfC,YAAa3C,EAAMmB,eAAewB,YAClCvB,OAAQpB,EAAMmB,eAAeC,OAC7BwB,UAAW5C,EAAM4C,UACjBC,IAAKvC,IAIZN,EAAM8C,gCACHf,EAACgB,EAAAA,CAA2BX,wBAAyBpC,EAAMoC,wBAAyBP,UAAWA,KAO3GE,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACiB,EAAAA,CACGC,cAAejD,EAAMiD,cACrBpB,UAAWA,EACXgB,IAAKzC,EACL8C,YAAalD,EAAMkD,YACnBC,UAAWnD,EAAMmD,UACjBZ,qBAAsBvC,EAAMuC,qBAC5Ba,QAASpD,EAAMoD,QACfV,QAAS1C,EAAM0C,QACfD,UAAWzC,EAAMyC,UACjBtB,cAAenB,EAAMmB,cACrBkC,SAAUrD,EAAMqD,SAChBC,uBAAwBtD,EAAMsD,uBAC9BC,OAAQvD,EAAMuD,OACdC,YAAaxD,EAAMwD,YACnBC,OAAQzD,EAAMyD,OACdC,UAAW1D,EAAM0D,UACjBC,YAAa3D,EAAM2D,YACnBnB,kBAAmBxC,EAAMwC,kBACzBI,UAAW5C,EAAM4C,aA7DrBb,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACC,MAAAA,CAAIC,UAAU,gFACXF,EAAC6B,EAAAA,OA+DrB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import t from"../../internal/Button/Button.js";import{updateAmazonCheckoutSession as o}from"../services.js";import{useAmount as n}from"../../../core/Context/AmountProvider.js";function i(i){const{i18n:a,loadingContext:c}=r(),{amount:s}=n();return this.createOrder=()=>{const{amazonCheckoutSessionId:e,clientKey:r,chargePermissionType:t,publicKeyId:n,region:a,recurringMetadata:u,returnUrl:
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import t from"../../internal/Button/Button.js";import{updateAmazonCheckoutSession as o}from"../services.js";import{useAmount as n}from"../../../core/Context/AmountProvider.js";function i(i){const{i18n:a,loadingContext:c}=r(),{amount:s}=n();return this.createOrder=()=>{const{amazonCheckoutSessionId:e,clientKey:r,chargePermissionType:t,publicKeyId:n,region:a,recurringMetadata:u,returnUrl:l}=i;o(c,r??"",{amount:s,chargePermissionType:t,checkoutResultReturnUrl:l,checkoutSessionId:e,publicKeyId:n,recurringMetadata:u,region:a}).then(e=>{if(!e?.action?.type)return console.error(e.errorMessage||"Could not get the AmazonPay URL");"redirect"===e.action.type&&e.action.url&&window.location.assign(e.action.url)}).catch(e=>{i.onError&&i.onError(e,this.componentRef)})},e(t,{classNameModifiers:["standalone","pay"],label:a.get("confirmPurchase"),onClick:this.createOrder})}export{i as default};
|
|
2
2
|
//# sourceMappingURL=OrderButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderButton.js","sources":["../../../../../src/components/AmazonPay/components/OrderButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Button from '../../internal/Button';\nimport { updateAmazonCheckoutSession } from '../services';\nimport { OrderButtonProps, UpdateAmazonCheckoutSessionRequest } from '../types';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\nexport default function OrderButton(props: Readonly<OrderButtonProps>) {\n const { i18n, loadingContext } = useCoreContext();\n const { amount } = useAmount();\n\n this.createOrder = () => {\n const { amazonCheckoutSessionId, clientKey, chargePermissionType, publicKeyId, region, recurringMetadata, returnUrl } = props;\n\n const request: UpdateAmazonCheckoutSessionRequest = {\n amount,\n chargePermissionType,\n checkoutResultReturnUrl: returnUrl,\n checkoutSessionId: amazonCheckoutSessionId,\n publicKeyId,\n recurringMetadata,\n region\n };\n\n updateAmazonCheckoutSession(loadingContext, clientKey, request)\n .then(response => {\n if (!response?.action?.type) return console.error(response.errorMessage || 'Could not get the AmazonPay URL');\n if (response.action.type === 'redirect') window.location.assign(response.action.url);\n })\n .catch(error => {\n if (props.onError) props.onError(error, this.componentRef);\n });\n };\n\n return <Button classNameModifiers={['standalone', 'pay']} label={i18n.get('confirmPurchase')} onClick={this.createOrder} />;\n}\n"],"names":["OrderButton","props","i18n","loadingContext","useCoreContext","amount","useAmount","this","createOrder","amazonCheckoutSessionId","clientKey","chargePermissionType","publicKeyId","region","recurringMetadata","returnUrl","updateAmazonCheckoutSession","checkoutResultReturnUrl","checkoutSessionId","then","response","action","type","console","error","errorMessage","window","location","assign","
|
|
1
|
+
{"version":3,"file":"OrderButton.js","sources":["../../../../../src/components/AmazonPay/components/OrderButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Button from '../../internal/Button';\nimport { updateAmazonCheckoutSession } from '../services';\nimport { OrderButtonProps, UpdateAmazonCheckoutSessionRequest } from '../types';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\nexport default function OrderButton(props: Readonly<OrderButtonProps>) {\n const { i18n, loadingContext } = useCoreContext();\n const { amount } = useAmount();\n\n this.createOrder = () => {\n const { amazonCheckoutSessionId, clientKey, chargePermissionType, publicKeyId, region, recurringMetadata, returnUrl } = props;\n\n const request: UpdateAmazonCheckoutSessionRequest = {\n amount,\n chargePermissionType,\n checkoutResultReturnUrl: returnUrl,\n checkoutSessionId: amazonCheckoutSessionId,\n publicKeyId,\n recurringMetadata,\n region\n };\n\n updateAmazonCheckoutSession(loadingContext, clientKey ?? '', request)\n .then(response => {\n if (!response?.action?.type) return console.error(response.errorMessage || 'Could not get the AmazonPay URL');\n if (response.action.type === 'redirect' && response.action.url) window.location.assign(response.action.url);\n })\n .catch(error => {\n if (props.onError) props.onError(error, this.componentRef);\n });\n };\n\n return <Button classNameModifiers={['standalone', 'pay']} label={i18n.get('confirmPurchase')} onClick={this.createOrder} />;\n}\n"],"names":["OrderButton","props","i18n","loadingContext","useCoreContext","amount","useAmount","this","createOrder","amazonCheckoutSessionId","clientKey","chargePermissionType","publicKeyId","region","recurringMetadata","returnUrl","updateAmazonCheckoutSession","checkoutResultReturnUrl","checkoutSessionId","then","response","action","type","console","error","errorMessage","url","window","location","assign","catch","onError","componentRef","h","Button","classNameModifiers","label","get","onClick"],"mappings":"+TAOe,SAASA,EAAYC,GAChC,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,KAC3BC,OAAEA,GAAWC,IAyBnB,OAvBAC,KAAKC,YAAc,KACf,MAAMC,wBAAEA,EAAuBC,UAAEA,EAASC,qBAAEA,EAAoBC,YAAEA,EAAWC,OAAEA,EAAMC,kBAAEA,EAAiBC,UAAEA,GAAcd,EAYxHe,EAA4Bb,EAAgBO,GAAa,GAVL,CAChDL,SACAM,uBACAM,wBAAyBF,EACzBG,kBAAmBT,EACnBG,cACAE,oBACAD,WAICM,KAAKC,IACF,IAAKA,GAAUC,QAAQC,KAAM,OAAOC,QAAQC,MAAMJ,EAASK,cAAgB,mCAC9C,aAAzBL,EAASC,OAAOC,MAAuBF,EAASC,OAAOK,KAAKC,OAAOC,SAASC,OAAOT,EAASC,OAAOK,OAE1GI,MAAMN,IACCvB,EAAM8B,SAAS9B,EAAM8B,QAAQP,EAAOjB,KAAKyB,iBAIlDC,EAACC,EAAAA,CAAOC,mBAAoB,CAAC,aAAc,OAAQC,MAAOlC,EAAKmC,IAAI,mBAAoBC,QAAS/B,KAAKC,aAChH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";function e(e){const{i18n:n}=o();return t("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--ghost adyen-checkout__amazonpay__button--signOut",onClick:()=>{new Promise((t,o)=>{e.onSignOut(t,o)}).then(()=>{e.amazonRef.Pay.signout()}).catch(console.error)}},n.get("amazonpay.signout"))}export{e as default};
|
|
1
|
+
import{createElement as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";function e(e){const{i18n:n}=o();return t("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--ghost adyen-checkout__amazonpay__button--signOut",onClick:()=>{(e.onSignOut?new Promise((t,o)=>{e.onSignOut?.(t,o)}):Promise.resolve()).then(()=>{e.amazonRef.Pay.signout()}).catch(console.error)}},n.get("amazonpay.signout"))}export{e as default};
|
|
2
2
|
//# sourceMappingURL=SignOutButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignOutButton.js","sources":["../../../../../src/components/AmazonPay/components/SignOutButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { SignOutButtonProps } from '../types';\n\nexport default function SignOutButton(props: Readonly<SignOutButtonProps>) {\n const { i18n } = useCoreContext();\n\n const handleClick = () => {\n new Promise((resolve, reject) => void props.onSignOut(resolve, reject))\n .then(() => {\n props.amazonRef.Pay.signout();\n })\n .catch(console.error);\n };\n\n return (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--ghost adyen-checkout__amazonpay__button--signOut\"\n onClick={handleClick}\n >\n {i18n.get('amazonpay.signout')}\n </button>\n );\n}\n"],"names":["SignOutButton","props","i18n","useCoreContext","h","button","type","className","onClick","Promise","resolve","reject","
|
|
1
|
+
{"version":3,"file":"SignOutButton.js","sources":["../../../../../src/components/AmazonPay/components/SignOutButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { SignOutButtonProps } from '../types';\n\nexport default function SignOutButton(props: Readonly<SignOutButtonProps>) {\n const { i18n } = useCoreContext();\n\n const handleClick = () => {\n const signOutPromise = props.onSignOut ? new Promise((resolve, reject) => void props.onSignOut?.(resolve, reject)) : Promise.resolve();\n\n signOutPromise\n .then(() => {\n props.amazonRef.Pay.signout();\n })\n .catch(console.error);\n };\n\n return (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--ghost adyen-checkout__amazonpay__button--signOut\"\n onClick={handleClick}\n >\n {i18n.get('amazonpay.signout')}\n </button>\n );\n}\n"],"names":["SignOutButton","props","i18n","useCoreContext","h","button","type","className","onClick","onSignOut","Promise","resolve","reject","then","amazonRef","Pay","signout","catch","console","error","get"],"mappings":"+IAIe,SAASA,EAAcC,GAClC,MAAMC,KAAEA,GAASC,IAYjB,OACIC,EAACC,SAAAA,CACGC,KAAK,SACLC,UAAU,kGACVC,QAdY,MACOP,EAAMQ,UAAY,IAAIC,QAAQ,CAACC,EAASC,KAAgBX,EAAMQ,YAAYE,EAASC,KAAWF,QAAQC,WAGxHE,KAAK,KACFZ,EAAMa,UAAUC,IAAIC,YAEvBC,MAAMC,QAAQC,SASdjB,EAAKkB,IAAI,qBAGtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AMAZONPAY_URL_US as e,AMAZONPAY_URL_EU as
|
|
1
|
+
import{AMAZONPAY_URL_US as e,AMAZONPAY_URL_EU as r,LEDGER_CURRENCIES_PER_REGION as n,FALLBACK_LOCALE_US as t,FALLBACK_LOCALE_EU as o,SUPPORTED_LOCALES_US as c,SUPPORTED_LOCALES_EU as u}from"./config.js";import{getDecimalAmount as i}from"../../utils/amount-util.js";import a from"../../core/Errors/AdyenCheckoutError.js";function s(n){return"US"===n?e:r}function l(e,r){const t=e.configuration?.region;return{...e.buttonColor&&{buttonColor:e.buttonColor},...e.design&&{design:g(e.design)},checkoutLanguage:f(e.locale,t),ledgerCurrency:t&&n[t]||e.currency||r?.currency,merchantId:e.configuration?.merchantId,productType:e.productType,placement:e.placement,sandbox:"TEST"===e.environment}}function d(e){return"US"===e?t:o}function m(e){return"US"===e?c:u}function f(e,r){return m(r).includes(e)?e:d(r)}function g(e){return"noTagline"===e?"C0001":null}function h(e){return{amount:String(i(e.value,e.currency)),currencyCode:e.currency}}function y(e,r){const{addressDetails:n,cancelUrl:t,checkoutMode:o,deliverySpecifications:c,returnUrl:u,merchantMetadata:i,chargePermissionType:s,recurringMetadata:l}=e,d=e.configuration?.storeId,m="ProcessOrder"===o;let f=null;if(m){if(!r)throw new a("IMPLEMENTATION_ERROR","AmazonPay: 'amount' is required when checkoutMode is 'ProcessOrder'");f=h(r)}return{storeId:d,chargePermissionType:s,webCheckoutDetails:{...m?{checkoutResultReturnUrl:u}:{checkoutReviewReturnUrl:u},...t&&{checkoutCancelUrl:t},...m&&{checkoutMode:o}},...f&&{paymentDetails:{chargeAmount:f,paymentIntent:"Confirm",presentmentCurrency:f.currencyCode,totalOrderAmount:f}},...l&&{recurringMetadata:l},...i&&{merchantMetadata:i},...c&&{deliverySpecifications:c},...n&&{addressDetails:n}}}export{l as getAmazonPaySettings,s as getAmazonPayUrl,h as getChargeAmount,f as getCheckoutLocale,g as getDesignCode,d as getFallbackLocale,y as getPayloadJSON,m as getSupportedLocales};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/AmazonPay/utils.ts"],"sourcesContent":["import {\n AMAZONPAY_URL_EU,\n AMAZONPAY_URL_US,\n FALLBACK_LOCALE_EU,\n FALLBACK_LOCALE_US,\n LEDGER_CURRENCIES_PER_REGION,\n SUPPORTED_LOCALES_EU,\n SUPPORTED_LOCALES_US\n} from './config';\nimport { AmazonPayButtonProps, AmazonPayButtonSettings, ChargeAmount, Currency, PayloadJSON, Region, SupportedLocale } from './types';\nimport { PaymentAmount } from '../../types/global-types';\nimport { getDecimalAmount } from '../../utils/amount-util';\n\n/**\n * Returns the AmazonPay script URL for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns the AmazonPay script URL\n */\nexport function getAmazonPayUrl(region
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/AmazonPay/utils.ts"],"sourcesContent":["import {\n AMAZONPAY_URL_EU,\n AMAZONPAY_URL_US,\n FALLBACK_LOCALE_EU,\n FALLBACK_LOCALE_US,\n LEDGER_CURRENCIES_PER_REGION,\n SUPPORTED_LOCALES_EU,\n SUPPORTED_LOCALES_US\n} from './config';\nimport { AmazonPayButtonProps, AmazonPayButtonSettings, ChargeAmount, Currency, PayloadJSON, Region, SupportedLocale } from './types';\nimport { PaymentAmount } from '../../types/global-types';\nimport { getDecimalAmount } from '../../utils/amount-util';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\n\n/**\n * Returns the AmazonPay script URL for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns the AmazonPay script URL\n */\nexport function getAmazonPayUrl(region?: Region): string {\n return region === 'US' ? AMAZONPAY_URL_US : AMAZONPAY_URL_EU;\n}\n\n/**\n * Returns the AmazonPay button settings object\n * @param props -\n * @returns the AmazonPay button settings\n */\nexport function getAmazonPaySettings(props: AmazonPayButtonProps, amount?: PaymentAmount): AmazonPayButtonSettings {\n const region = props.configuration?.region;\n return {\n ...(props.buttonColor && { buttonColor: props.buttonColor }),\n ...(props.design && { design: getDesignCode(props.design) }),\n checkoutLanguage: getCheckoutLocale(props.locale, region),\n ledgerCurrency: (region && LEDGER_CURRENCIES_PER_REGION[region]) || props.currency || (amount?.currency as Currency),\n merchantId: props.configuration?.merchantId,\n productType: props.productType,\n placement: props.placement,\n sandbox: props.environment === 'TEST'\n };\n}\n\n/**\n * Returns the fallback locale for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns A fallback locale\n */\nexport function getFallbackLocale(region?: Region): SupportedLocale {\n return region === 'US' ? FALLBACK_LOCALE_US : FALLBACK_LOCALE_EU;\n}\n\n/**\n * Returns an array of supported locales for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns An array of supported locales\n */\nexport function getSupportedLocales(region?: Region): SupportedLocale[] {\n const supportedLocales = region === 'US' ? SUPPORTED_LOCALES_US : SUPPORTED_LOCALES_EU;\n return supportedLocales as unknown as SupportedLocale[];\n}\n\n/**\n * Gets a locale and matches it with one of the supported locales for the given region.\n * If there's no match, it will return the region's fallback option.\n * @param locale - Locale to be processed\n * @param region - Two-letter country code in ISO 3166 format\n * @returns A supported locale\n */\nexport function getCheckoutLocale(locale?: string, region?: Region): SupportedLocale {\n const supportedLocales = getSupportedLocales(region);\n const isSupportedLocale = supportedLocales.includes(locale as SupportedLocale);\n const checkoutLocale = isSupportedLocale ? locale : getFallbackLocale(region);\n\n return checkoutLocale as SupportedLocale;\n}\n\n/**\n * Gets the design code from the given alias.\n * @param design - The alias of one of the possible designs.\n * @returns A design code\n */\nexport function getDesignCode(design: string): string | null {\n if (design === 'noTagline') return 'C0001';\n return null;\n}\n\n/**\n * Returns the amount in the format Amazon expects.\n * @param amount - The amount object in the Adyen format\n * @returns the charge amount object in the Amazon format\n */\nexport function getChargeAmount(amount: PaymentAmount): ChargeAmount {\n return {\n amount: String(getDecimalAmount(amount.value, amount.currency)),\n currencyCode: amount.currency as Currency\n };\n}\n\n/**\n * Returns a PayloadJSON object.\n * @param props -\n * @returns PayloadJSON\n */\nexport function getPayloadJSON(props, amount?: PaymentAmount): PayloadJSON {\n const { addressDetails, cancelUrl, checkoutMode, deliverySpecifications, returnUrl, merchantMetadata, chargePermissionType, recurringMetadata } =\n props;\n\n const storeId = props.configuration?.storeId;\n const isPayNow = checkoutMode === 'ProcessOrder';\n let finalAmount: ChargeAmount | null = null;\n\n if (isPayNow) {\n if (!amount) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', \"AmazonPay: 'amount' is required when checkoutMode is 'ProcessOrder'\");\n }\n finalAmount = getChargeAmount(amount);\n }\n\n return {\n storeId,\n chargePermissionType,\n webCheckoutDetails: {\n ...(isPayNow ? { checkoutResultReturnUrl: returnUrl } : { checkoutReviewReturnUrl: returnUrl }),\n ...(cancelUrl && { checkoutCancelUrl: cancelUrl }),\n ...(isPayNow && { checkoutMode })\n },\n ...(finalAmount && {\n paymentDetails: {\n chargeAmount: finalAmount,\n paymentIntent: 'Confirm',\n presentmentCurrency: finalAmount.currencyCode,\n totalOrderAmount: finalAmount\n }\n }),\n ...(recurringMetadata && { recurringMetadata }),\n ...(merchantMetadata && { merchantMetadata }),\n ...(deliverySpecifications && { deliverySpecifications }),\n ...(addressDetails && { addressDetails })\n };\n}\n"],"names":["getAmazonPayUrl","region","AMAZONPAY_URL_US","AMAZONPAY_URL_EU","getAmazonPaySettings","props","amount","configuration","buttonColor","design","getDesignCode","checkoutLanguage","getCheckoutLocale","locale","ledgerCurrency","LEDGER_CURRENCIES_PER_REGION","currency","merchantId","productType","placement","sandbox","environment","getFallbackLocale","FALLBACK_LOCALE_US","FALLBACK_LOCALE_EU","getSupportedLocales","SUPPORTED_LOCALES_US","SUPPORTED_LOCALES_EU","includes","getChargeAmount","String","getDecimalAmount","value","currencyCode","getPayloadJSON","addressDetails","cancelUrl","checkoutMode","deliverySpecifications","returnUrl","merchantMetadata","chargePermissionType","recurringMetadata","storeId","isPayNow","finalAmount","AdyenCheckoutError","webCheckoutDetails","checkoutResultReturnUrl","checkoutReviewReturnUrl","checkoutCancelUrl","paymentDetails","chargeAmount","paymentIntent","presentmentCurrency","totalOrderAmount"],"mappings":"gUAmBO,SAASA,EAAgBC,GAC5B,MAAkB,OAAXA,EAAkBC,EAAmBC,CAChD,CAOO,SAASC,EAAqBC,EAA6BC,GAC9D,MAAML,EAASI,EAAME,eAAeN,OACpC,MAAO,IACCI,EAAMG,aAAe,CAAEA,YAAaH,EAAMG,gBAC1CH,EAAMI,QAAU,CAAEA,OAAQC,EAAcL,EAAMI,SAClDE,iBAAkBC,EAAkBP,EAAMQ,OAAQZ,GAClDa,eAAiBb,GAAUc,EAA6Bd,IAAYI,EAAMW,UAAaV,GAAQU,SAC/FC,WAAYZ,EAAME,eAAeU,WACjCC,YAAab,EAAMa,YACnBC,UAAWd,EAAMc,UACjBC,QAA+B,SAAtBf,EAAMgB,YAEvB,CAOO,SAASC,EAAkBrB,GAC9B,MAAkB,OAAXA,EAAkBsB,EAAqBC,CAClD,CAOO,SAASC,EAAoBxB,GAEhC,MADoC,OAAXA,EAAkByB,EAAuBC,CAEtE,CASO,SAASf,EAAkBC,EAAiBZ,GAK/C,OAJyBwB,EAAoBxB,GACF2B,SAASf,GACTA,EAASS,EAAkBrB,EAG1E,CAOO,SAASS,EAAcD,GAC1B,MAAe,cAAXA,EAA+B,QAC5B,IACX,CAOO,SAASoB,EAAgBvB,GAC5B,MAAO,CACHA,OAAQwB,OAAOC,EAAiBzB,EAAO0B,MAAO1B,EAAOU,WACrDiB,aAAc3B,EAAOU,SAE7B,CAOO,SAASkB,EAAe7B,EAAOC,GAClC,MAAM6B,eAAEA,EAAcC,UAAEA,EAASC,aAAEA,EAAYC,uBAAEA,EAAsBC,UAAEA,EAASC,iBAAEA,EAAgBC,qBAAEA,EAAoBC,kBAAEA,GACxHrC,EAEEsC,EAAUtC,EAAME,eAAeoC,QAC/BC,EAA4B,iBAAjBP,EACjB,IAAIQ,EAAmC,KAEvC,GAAID,EAAU,CACV,IAAKtC,EACD,MAAM,IAAIwC,EAAmB,uBAAwB,uEAEzDD,EAAchB,EAAgBvB,EAClC,CAEA,MAAO,CACHqC,UACAF,uBACAM,mBAAoB,IACZH,EAAW,CAAEI,wBAAyBT,GAAc,CAAEU,wBAAyBV,MAC/EH,GAAa,CAAEc,kBAAmBd,MAClCQ,GAAY,CAAEP,oBAElBQ,GAAe,CACfM,eAAgB,CACZC,aAAcP,EACdQ,cAAe,UACfC,oBAAqBT,EAAYZ,aACjCsB,iBAAkBV,OAGtBH,GAAqB,CAAEA,wBACvBF,GAAoB,CAAEA,uBACtBF,GAA0B,CAAEA,6BAC5BH,GAAkB,CAAEA,kBAEhC"}
|