@adyen/adyen-web 6.32.0 → 6.33.0
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 +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +26 -8
- package/dist/es/components/ApplePay/ApplePay.js +1 -1
- package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es/components/ApplePay/services/ApplePayService.js +1 -1
- package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
- package/dist/es/components/ApplePay/utils/payment-request.js +1 -1
- package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js +1 -1
- package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es/components/internal/Brand/Brand.js +1 -1
- package/dist/es/components/internal/Brand/Brand.js.map +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es/components/internal/PayButton/utils.js +1 -1
- package/dist/es/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/core/Environment/constants.js +1 -1
- package/dist/es/core/Environment/constants.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/index.d.ts +26 -8
- package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePayService.js +1 -1
- package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
- package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js +1 -1
- package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
- package/dist/es-legacy/components/internal/Brand/Brand.js +1 -1
- package/dist/es-legacy/components/internal/Brand/Brand.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
- package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/core/Environment/constants.js +1 -1
- package/dist/es-legacy/core/Environment/constants.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/package.json +6 -6
package/dist/cjs/index.d.cts
CHANGED
|
@@ -329,7 +329,6 @@ interface PayButtonProps extends ButtonProps {
|
|
|
329
329
|
status?: string;
|
|
330
330
|
disabled?: boolean;
|
|
331
331
|
icon?: string;
|
|
332
|
-
onClick?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;
|
|
333
332
|
}
|
|
334
333
|
|
|
335
334
|
type AchForm = {
|
|
@@ -850,12 +849,12 @@ interface ApplePayConfiguration extends UIElementProps {
|
|
|
850
849
|
/**
|
|
851
850
|
* The Apple Pay version number your website supports.
|
|
852
851
|
* @default highest supported version by the shopper device
|
|
853
|
-
* @see {@link https://developer.apple.com/documentation/
|
|
852
|
+
* @see {@link https://developer.apple.com/documentation/applepayontheweb/apple-pay-on-the-web-version-history Apple Pay on the Web Version History}
|
|
854
853
|
*/
|
|
855
854
|
version?: number;
|
|
856
855
|
/**
|
|
857
856
|
* Part of the 'ApplePayLineItem' object, which sets the label of the payment request
|
|
858
|
-
* @see {@link https://developer.apple.com/documentation/
|
|
857
|
+
* @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaylineitem ApplePayLineItem docs}
|
|
859
858
|
*/
|
|
860
859
|
totalPriceLabel?: string;
|
|
861
860
|
/**
|
|
@@ -909,7 +908,7 @@ interface ApplePayConfiguration extends UIElementProps {
|
|
|
909
908
|
supportedNetworks?: string[];
|
|
910
909
|
/**
|
|
911
910
|
* ApplePayRecurringPaymentRequest - Represents a request to set up a recurring payment, typically a subscription.
|
|
912
|
-
* {@link https://developer.apple.com/documentation/
|
|
911
|
+
* {@link https://developer.apple.com/documentation/applepayontheweb/applepayrecurringpaymentrequest}
|
|
913
912
|
*/
|
|
914
913
|
recurringPaymentRequest?: ApplePayJS.ApplePayRecurringPaymentRequest;
|
|
915
914
|
/**
|
|
@@ -974,7 +973,7 @@ interface ApplePayConfiguration extends UIElementProps {
|
|
|
974
973
|
* Collect the order tracking details if available.
|
|
975
974
|
* This callback is invoked when a successfull payment is resolved
|
|
976
975
|
*
|
|
977
|
-
* {@link https://developer.apple.com/documentation/
|
|
976
|
+
* {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentorderdetails}
|
|
978
977
|
* @param resolve - Must be called with the orderDetails fields
|
|
979
978
|
* @param reject - Must be called if something failed during the order creation. Calling 'reject' won't cancel the payment flow
|
|
980
979
|
*/
|
|
@@ -1015,6 +1014,25 @@ interface ApplePayConfiguration extends UIElementProps {
|
|
|
1015
1014
|
* @param event - The event parameter contains the shippingMethod attribute.
|
|
1016
1015
|
*/
|
|
1017
1016
|
onShippingMethodSelected?: (resolve: (shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => void, reject: (shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => void, event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => void;
|
|
1017
|
+
/**
|
|
1018
|
+
* The initial coupon code for the payment request.
|
|
1019
|
+
* @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest/couponcode couponCode docs}
|
|
1020
|
+
*/
|
|
1021
|
+
couponCode?: ApplePayJS.ApplePayPaymentRequest['couponCode'];
|
|
1022
|
+
/**
|
|
1023
|
+
* A Boolean value that determines whether the payment sheet displays the coupon code field.
|
|
1024
|
+
* @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest/supportscouponcode supportsCouponCode docs}
|
|
1025
|
+
*/
|
|
1026
|
+
supportsCouponCode?: ApplePayJS.ApplePayPaymentRequest['supportsCouponCode'];
|
|
1027
|
+
/**
|
|
1028
|
+
* An event handler called by the system when the user enters or updates a coupon code.
|
|
1029
|
+
*
|
|
1030
|
+
* {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/oncouponcodechanged}
|
|
1031
|
+
* @param resolve - Completes the change of a coupon code with an update.
|
|
1032
|
+
* @param reject - Completes the change of a coupon code with no update.
|
|
1033
|
+
* @param event - The event parameter contains the couponCode attribute.
|
|
1034
|
+
*/
|
|
1035
|
+
onCouponCodeChanged?: (resolve: (update: ApplePayJS.ApplePayCouponCodeUpdate) => void, reject: (update: ApplePayJS.ApplePayCouponCodeUpdate) => void, event: ApplePayJS.ApplePayCouponCodeChangedEvent) => void;
|
|
1018
1036
|
buttonColor?: ApplePayButtonStyle;
|
|
1019
1037
|
buttonType?: ApplePayButtonType;
|
|
1020
1038
|
/**
|
|
@@ -3647,7 +3665,7 @@ declare class ApplePayElement extends UIElement<ApplePayConfiguration> {
|
|
|
3647
3665
|
* not mean there are no cards available, it means the status cannot be determined and as such defaulting
|
|
3648
3666
|
* and upstreaming should still be considered.
|
|
3649
3667
|
*
|
|
3650
|
-
* {@link https://developer.apple.com/documentation/
|
|
3668
|
+
* {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/4440085-applepaycapabilities}
|
|
3651
3669
|
* @param merchantIdentifier
|
|
3652
3670
|
*/
|
|
3653
3671
|
applePayCapabilities(merchantIdentifier?: string): Promise<ApplePayJS.PaymentCredentialStatusResponse>;
|
|
@@ -6140,7 +6158,7 @@ interface CoreConfiguration {
|
|
|
6140
6158
|
/**
|
|
6141
6159
|
* Use 'test'. When you're ready to accept live payments, change the value to one of our {@link https://docs.adyen.com/checkout/drop-in-web#testing-your-integration | live environments}.
|
|
6142
6160
|
*/
|
|
6143
|
-
environment?: 'test' | 'live' | 'live-us' | 'live-au' | 'live-apse' | 'live-in';
|
|
6161
|
+
environment?: 'test' | 'live' | 'live-us' | 'live-au' | 'live-apse' | 'live-in' | 'live-nea';
|
|
6144
6162
|
/**
|
|
6145
6163
|
* Show or hides a Pay Button for each payment method
|
|
6146
6164
|
* @default true
|
|
@@ -7847,7 +7865,7 @@ declare class Core implements ICore {
|
|
|
7847
7865
|
* @param options - Can be used to avoid remounting the elements
|
|
7848
7866
|
* @returns this - the Core instance
|
|
7849
7867
|
*/
|
|
7850
|
-
update(props?: Partial<CoreConfiguration
|
|
7868
|
+
update(props?: Partial<Omit<CoreConfiguration, 'session'>>, { shouldReinitializeCheckout }?: {
|
|
7851
7869
|
shouldReinitializeCheckout?: boolean;
|
|
7852
7870
|
}): Promise<this>;
|
|
7853
7871
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import s from"./components/ApplePayButton.js";import o from"./services/ApplePayService.js";import
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import s from"./components/ApplePayButton.js";import o from"./services/ApplePayService.js";import n from"../../utils/base64.js";import i from"./defaultProps.js";import{httpPost as r}from"../../core/Services/http.js";import{preparePaymentRequest as a}from"./utils/payment-request.js";import p from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as l}from"../tx-variants.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as c}from"../internal/UIElement/utils.js";import{resolveSupportedVersion as h}from"./utils/resolve-supported-version.js";import{formatApplePayContactToAdyenAddressFormat as y}from"./utils/format-applepay-contact-to-adyen-format.js";import{mapBrands as m}from"./utils/map-adyen-brands-to-applepay-brands.js";import u from"./services/ApplePaySdkLoader.js";import{detectInIframe as P}from"../../utils/detectInIframe.js";import{AnalyticsInfoEvent as A,InfoEventType as b,UiTarget as f}from"../../core/Analytics/events/AnalyticsInfoEvent.js";function g(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class S extends t{formatProps(e){const t=e.brands?.length?m(e.brands):e.supportedNetworks;return{...e,configuration:e.configuration,supportedNetworks:t,buttonLocale:e.buttonLocale??e.i18n?.locale,totalPriceLabel:e.totalPriceLabel||e.configuration?.merchantName,renderApplePayCodeAs:e.renderApplePayCodeAs??(P()?"window":"modal")}}formatData(){const{applePayToken:e,billingAddress:t,deliveryAddress:s}=this.state,{isExpress:o}=this.props;return{paymentMethod:{type:S.type,applePayToken:e,...o&&{subtype:"express"}},...t&&{billingAddress:t},...s&&{deliveryAddress:s}}}beforeRender(e){const t=new A({type:b.rendered,component:this.type,configData:{...e,showPayButton:this.props.showPayButton},...e?.isExpress&&{isExpress:e.isExpress},...e?.expressPage&&{expressPage:e.expressPage}});this.analytics.sendAnalytics(t)}get isValid(){return!0}async applePayCapabilities(e){const t=e||this.props.configuration.merchantId;try{return await this.sdkLoader.isSdkLoaded(),await(ApplePaySession?.applePayCapabilities(t))}catch(e){throw new p("ERROR","Apple Pay: Error when requesting applePayCapabilities()",{cause:e})}}async isAvailable(){if("https:"!==window.location.protocol)return Promise.reject(new p("IMPLEMENTATION_ERROR","Trying to start an Apple Pay session from an insecure document"));try{return await this.sdkLoader.isSdkLoaded(),ApplePaySession?.canMakePayments()?Promise.resolve():Promise.reject(new p("ERROR","Apple Pay is not available on this device"))}catch(e){return Promise.reject(new p("ERROR","Apple Pay SDK failed to load",{cause:e}))}}defineApplePayVersionNumber(){"https:"===window.location.protocol&&(this.applePayVersionNumber=this.props.version||h(14))}configureApplePayWebOptions(){if(window.ApplePayWebOptions){const{renderApplePayCodeAs:e,onApplePayCodeClose:t}=this.props;window.ApplePayWebOptions.set({renderApplePayCodeAs:e,...t&&{onApplePayCodeClose:t}})}}startSession(){const{onValidateMerchant:e,onPaymentMethodSelected:t,onShippingMethodSelected:s,onShippingContactSelected:n,onCouponCodeChanged:i}=this.props,r=a({companyName:this.props.configuration.merchantName,countryCode:this.core.options.countryCode,...this.props}),l=new o(r,{version:this.applePayVersionNumber,onError:e=>{this.handleError(new p("ERROR","ApplePay - Something went wrong on ApplePayService",{cause:e}))},onCancel:e=>{this.handleError(new p("CANCEL","ApplePay UI dismissed",{cause:e}))},onPaymentMethodSelected:t,onShippingMethodSelected:s,onShippingContactSelected:n,onCouponCodeChanged:i,onValidateMerchant:e||this.validateMerchant,onPaymentAuthorized:(e,t,s)=>{const o=y(s.payment.billingContact),n=y(s.payment.shippingContact,!0);this.setState({applePayToken:btoa(JSON.stringify(s.payment.token.paymentData)),authorizedEvent:s,...o&&{billingAddress:o},...n&&{deliveryAddress:n}}),this.handleAuthorization().then(this.makePaymentsCall).then(d).then(c).then(this.collectOrderTrackingDetailsIfNeeded).then(({paymentResponse:t,orderDetails:s})=>(e({status:ApplePaySession.STATUS_SUCCESS,...s&&{orderDetails:s}}),t)).then(e=>{this.handleResponse(e)}).catch(e=>{const s=e?.error?.applePayError;t({status:ApplePaySession.STATUS_FAILURE,errors:s?Array.isArray(s)?s:[s]:void 0});const o={...e,error:{applePayError:s}};this.handleFailedResult(o)})}});return new Promise((e,t)=>this.props.onClick(e,t)).then(()=>{l.begin()}).catch(()=>({}))}async handleAuthorization(){return new Promise((e,t)=>{this.props.onAuthorized||e();const{authorizedEvent:s,billingAddress:o,deliveryAddress:n}=this.state;this.props.onAuthorized({authorizedEvent:s,...o&&{billingAddress:o},...n&&{deliveryAddress:n}},{resolve:e,reject:t})}).catch(e=>{const t={error:{applePayError:e}};return Promise.reject(t)})}async collectOrderTrackingDetailsIfNeeded(e){return new Promise((e,t)=>{if(!this.props.onOrderTrackingRequest)return e();this.props.onOrderTrackingRequest(e,t)}).then(t=>({paymentResponse:e,...t&&{orderDetails:t}})).catch(()=>({paymentResponse:e}))}async validateMerchant(e,t){const{hostname:s}=window.location,{clientKey:o,configuration:i,loadingContext:a,initiative:p,domainName:l}=this.props,{merchantName:d,merchantId:c}=i,h={loadingContext:a,path:`v1/applePay/sessions?clientKey=${o}`},y={displayName:d,domainName:l||s,initiative:p,merchantIdentifier:c};try{const s=await r(h,y),o=n.decode(s.data);if(o.success){e(JSON.parse(o.data))}else t("Could not decode Apple Pay session")}catch(e){t("Could not get Apple Pay session")}}componentToRender(){return this.props.showPayButton?e(s,{buttonStyle:this.props.buttonColor,buttonType:this.props.buttonType,buttonLocale:this.props.buttonLocale,onClick:this.submit}):null}constructor(e,t){super(e,t),g(this,"sdkLoader",void 0),g(this,"applePayVersionNumber",void 0),g(this,"submit",()=>{if(this.props.isInstantPayment){const e=new A({component:this.type,type:b.selected,target:f.instantPaymentButton});this.submitAnalytics(e)}this.startSession()});const{isExpress:s,onShippingContactSelected:o,onShippingMethodSelected:n}=this.props;if(!1===s&&(o||n))throw new p("IMPLEMENTATION_ERROR",'ApplePay - You must set "isExpress" flag to "true" in order to use "onShippingContactSelected" and/or "onShippingMethodSelected" callbacks');this.startSession=this.startSession.bind(this),this.submit=this.submit.bind(this),this.validateMerchant=this.validateMerchant.bind(this),this.collectOrderTrackingDetailsIfNeeded=this.collectOrderTrackingDetailsIfNeeded.bind(this),this.handleAuthorization=this.handleAuthorization.bind(this),this.defineApplePayVersionNumber=this.defineApplePayVersionNumber.bind(this),this.configureApplePayWebOptions=this.configureApplePayWebOptions.bind(this),this.sdkLoader=new u({analytics:this.analytics}),this.sdkLoader.load().then(this.defineApplePayVersionNumber).then(this.configureApplePayWebOptions).catch(e=>{this.handleError(e)})}}g(S,"type",l.applepay),g(S,"defaultProps",i);export{S as default};
|
|
2
2
|
//# sourceMappingURL=ApplePay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplePay.js","sources":["../../../../src/components/ApplePay/ApplePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ApplePayButton from './components/ApplePayButton';\nimport ApplePayService from './services/ApplePayService';\nimport base64 from '../../utils/base64';\nimport defaultProps from './defaultProps';\nimport { httpPost } from '../../core/Services/http';\nimport { preparePaymentRequest } from './utils/payment-request';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { DecodeObject } from '../../types/global-types';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { resolveSupportedVersion } from './utils/resolve-supported-version';\nimport { formatApplePayContactToAdyenAddressFormat } from './utils/format-applepay-contact-to-adyen-format';\nimport { mapBrands } from './utils/map-adyen-brands-to-applepay-brands';\nimport ApplePaySdkLoader from './services/ApplePaySdkLoader';\nimport { detectInIframe } from '../../utils/detectInIframe';\nimport type { ApplePayConfiguration, ApplePayElementData, ApplePayPaymentOrderDetails, ApplePaySessionRequest } from './types';\nimport type { ICore } from '../../core/types';\nimport type { PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nconst LATEST_APPLE_PAY_VERSION = 14;\n\nclass ApplePayElement extends UIElement<ApplePayConfiguration> {\n public static readonly type = TxVariants.applepay;\n\n protected static readonly defaultProps = defaultProps;\n\n private sdkLoader: ApplePaySdkLoader;\n private applePayVersionNumber: number = undefined;\n\n constructor(checkout: ICore, props?: ApplePayConfiguration) {\n super(checkout, props);\n\n const { isExpress, onShippingContactSelected, onShippingMethodSelected } = this.props;\n\n if (isExpress === false && (onShippingContactSelected || onShippingMethodSelected)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'ApplePay - You must set \"isExpress\" flag to \"true\" in order to use \"onShippingContactSelected\" and/or \"onShippingMethodSelected\" callbacks'\n );\n }\n\n this.startSession = this.startSession.bind(this);\n this.submit = this.submit.bind(this);\n this.validateMerchant = this.validateMerchant.bind(this);\n this.collectOrderTrackingDetailsIfNeeded = this.collectOrderTrackingDetailsIfNeeded.bind(this);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.defineApplePayVersionNumber = this.defineApplePayVersionNumber.bind(this);\n this.configureApplePayWebOptions = this.configureApplePayWebOptions.bind(this);\n\n this.sdkLoader = new ApplePaySdkLoader({ analytics: this.analytics });\n\n void this.sdkLoader\n .load()\n .then(this.defineApplePayVersionNumber)\n .then(this.configureApplePayWebOptions)\n .catch(error => {\n this.handleError(error);\n });\n }\n\n /**\n * Formats the component props\n */\n protected override formatProps(props: ApplePayConfiguration): ApplePayConfiguration {\n // @ts-ignore TODO: Fix brands prop\n const supportedNetworks = props.brands?.length ? mapBrands(props.brands) : props.supportedNetworks;\n\n return {\n ...props,\n configuration: props.configuration,\n supportedNetworks,\n buttonLocale: props.buttonLocale ?? props.i18n?.locale,\n totalPriceLabel: props.totalPriceLabel || props.configuration?.merchantName,\n renderApplePayCodeAs: props.renderApplePayCodeAs ?? (detectInIframe() ? 'window' : 'modal')\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData(): ApplePayElementData {\n const { applePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: ApplePayElement.type,\n applePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n protected override beforeRender(configSetByMerchant?: ApplePayConfiguration) {\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 public override submit = (): void => {\n if (this.props.isInstantPayment) {\n const event = new AnalyticsInfoEvent({ component: this.type, type: InfoEventType.selected, target: UiTarget.instantPaymentButton });\n this.submitAnalytics(event);\n }\n void this.startSession();\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n /**\n * This API is only intended for upstreaming or defaulting to Apple Pay, all other scenarios should continue to\n * use canMakePayments(). For Safari browsers, this API will indicate whether there is a card available to make\n * payments. For third-party browsers a new status of paymentCredentialStatusUnknown will be returned. This does\n * not mean there are no cards available, it means the status cannot be determined and as such defaulting\n * and upstreaming should still be considered.\n *\n * {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities}\n * @param merchantIdentifier\n */\n public async applePayCapabilities(merchantIdentifier?: string): Promise<ApplePayJS.PaymentCredentialStatusResponse> {\n const identifier = merchantIdentifier || this.props.configuration.merchantId;\n\n try {\n await this.sdkLoader.isSdkLoaded();\n return await ApplePaySession?.applePayCapabilities(identifier);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Apple Pay: Error when requesting applePayCapabilities()', { cause: error });\n }\n }\n\n /**\n * Determines if Apple Pay component can be displayed or not\n */\n public override async isAvailable(): Promise<void> {\n if (window.location.protocol !== 'https:') {\n return Promise.reject(new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Trying to start an Apple Pay session from an insecure document'));\n }\n\n try {\n await this.sdkLoader.isSdkLoaded();\n\n if (ApplePaySession?.canMakePayments()) {\n return Promise.resolve();\n }\n\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay is not available on this device'));\n } catch (error) {\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay SDK failed to load', { cause: error }));\n }\n }\n\n /**\n * Sets the Apple Pay version available for the shopper.\n * This code needs to be executed once the Apple Pay SDK is fully loaded\n * @private\n */\n private defineApplePayVersionNumber() {\n if (window.location.protocol !== 'https:') return;\n this.applePayVersionNumber = this.props.version || resolveSupportedVersion(LATEST_APPLE_PAY_VERSION);\n }\n\n /**\n * Sets the configuration/callbacks that pertain to the Apple Pay code overlay/modal.\n * @private\n */\n private configureApplePayWebOptions() {\n if (window.ApplePayWebOptions) {\n const { renderApplePayCodeAs, onApplePayCodeClose } = this.props;\n\n window.ApplePayWebOptions.set({\n renderApplePayCodeAs,\n ...(onApplePayCodeClose && { onApplePayCodeClose })\n });\n }\n }\n\n private startSession() {\n const { onValidateMerchant, onPaymentMethodSelected, onShippingMethodSelected, onShippingContactSelected } = this.props;\n\n const paymentRequest = preparePaymentRequest({\n companyName: this.props.configuration.merchantName,\n countryCode: this.core.options.countryCode,\n ...this.props\n });\n\n const session = new ApplePayService(paymentRequest, {\n version: this.applePayVersionNumber,\n onError: (error: unknown) => {\n this.handleError(\n new AdyenCheckoutError('ERROR', 'ApplePay - Something went wrong on ApplePayService', {\n cause: error\n })\n );\n },\n onCancel: event => {\n this.handleError(new AdyenCheckoutError('CANCEL', 'ApplePay UI dismissed', { cause: event }));\n },\n onPaymentMethodSelected,\n onShippingMethodSelected,\n onShippingContactSelected,\n onValidateMerchant: onValidateMerchant || this.validateMerchant,\n onPaymentAuthorized: (resolve, reject, event) => {\n const billingAddress = formatApplePayContactToAdyenAddressFormat(event.payment.billingContact);\n const deliveryAddress = formatApplePayContactToAdyenAddressFormat(event.payment.shippingContact, true);\n\n this.setState({\n applePayToken: btoa(JSON.stringify(event.payment.token.paymentData)),\n authorizedEvent: event,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.collectOrderTrackingDetailsIfNeeded)\n .then(({ paymentResponse, orderDetails }) => {\n resolve({\n status: ApplePaySession.STATUS_SUCCESS,\n ...(orderDetails && { orderDetails })\n });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n const errors = paymentResponse?.error?.applePayError;\n\n reject({\n status: ApplePaySession.STATUS_FAILURE,\n errors: errors ? (Array.isArray(errors) ? errors : [errors]) : undefined\n });\n\n const responseWithError: RawPaymentResponse = {\n ...paymentResponse,\n error: {\n applePayError: errors\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\n }\n });\n\n return new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject))\n .then(() => {\n session.begin();\n })\n .catch(() => ({\n // Swallow exception triggered by onClick reject\n }));\n }\n\n /**\n * Call the 'onAuthorized' callback if available.\n * Must be resolved/reject for the payment flow to continue\n *\n * @private\n */\n private async handleAuthorization(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.props.onAuthorized) {\n resolve();\n }\n\n const { authorizedEvent, billingAddress, deliveryAddress } = this.state;\n\n this.props.onAuthorized(\n {\n authorizedEvent,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n );\n }).catch((error?: ApplePayJS.ApplePayError) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { applePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Verify if the 'onOrderTrackingRequest' is provided. If so, triggers the callback expecting an\n * Apple Pay order details back\n *\n * @private\n */\n private async collectOrderTrackingDetailsIfNeeded(\n paymentResponse: PaymentResponseData\n ): Promise<{ orderDetails?: ApplePayPaymentOrderDetails; paymentResponse: PaymentResponseData }> {\n return new Promise<ApplePayPaymentOrderDetails | void>((resolve, reject) => {\n if (!this.props.onOrderTrackingRequest) {\n return resolve();\n }\n\n this.props.onOrderTrackingRequest(resolve, reject);\n })\n .then(orderDetails => {\n return {\n paymentResponse,\n ...(orderDetails && { orderDetails })\n };\n })\n .catch(() => {\n return { paymentResponse };\n });\n }\n\n private async validateMerchant(resolve: (merchantSession: any) => void, reject: (error: string) => void) {\n const { hostname } = window.location;\n const { clientKey, configuration, loadingContext, initiative, domainName } = this.props;\n const { merchantName, merchantId } = configuration;\n const path = `v1/applePay/sessions?clientKey=${clientKey}`;\n const options = { loadingContext, path };\n const request: ApplePaySessionRequest = {\n displayName: merchantName,\n domainName: domainName || hostname,\n initiative,\n merchantIdentifier: merchantId\n };\n\n try {\n const response = await httpPost(options, request);\n const decodedData: DecodeObject = base64.decode(response.data);\n if (!decodedData.success) {\n reject('Could not decode Apple Pay session');\n } else {\n const session = JSON.parse(decodedData.data);\n resolve(session);\n }\n } catch (e) {\n reject('Could not get Apple Pay session');\n }\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (!this.props.showPayButton) {\n return null;\n }\n\n return (\n <ApplePayButton\n buttonStyle={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonLocale={this.props.buttonLocale}\n onClick={this.submit}\n />\n );\n }\n}\n\nexport default ApplePayElement;\n"],"names":["ApplePayElement","UIElement","formatProps","props","supportedNetworks","brands","length","mapBrands","configuration","buttonLocale","i18n","locale","totalPriceLabel","merchantName","renderApplePayCodeAs","detectInIframe","formatData","applePayToken","billingAddress","deliveryAddress","this","state","isExpress","paymentMethod","type","subtype","beforeRender","configSetByMerchant","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","isValid","applePayCapabilities","merchantIdentifier","identifier","merchantId","sdkLoader","isSdkLoaded","ApplePaySession","error","AdyenCheckoutError","cause","isAvailable","window","location","protocol","Promise","reject","canMakePayments","resolve","defineApplePayVersionNumber","applePayVersionNumber","version","resolveSupportedVersion","configureApplePayWebOptions","ApplePayWebOptions","onApplePayCodeClose","set","startSession","onValidateMerchant","onPaymentMethodSelected","onShippingMethodSelected","onShippingContactSelected","paymentRequest","preparePaymentRequest","companyName","countryCode","core","options","session","ApplePayService","onError","handleError","onCancel","validateMerchant","onPaymentAuthorized","formatApplePayContactToAdyenAddressFormat","payment","billingContact","shippingContact","setState","btoa","JSON","stringify","token","paymentData","authorizedEvent","handleAuthorization","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","collectOrderTrackingDetailsIfNeeded","paymentResponse","orderDetails","status","STATUS_SUCCESS","handleResponse","catch","errors","applePayError","STATUS_FAILURE","Array","isArray","undefined","responseWithError","handleFailedResult","onClick","begin","onAuthorized","data","onOrderTrackingRequest","hostname","clientKey","loadingContext","initiative","domainName","path","request","displayName","response","httpPost","decodedData","base64","decode","success","parse","e","componentToRender","h","ApplePayButton","buttonStyle","buttonColor","buttonType","submit","constructor","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","bind","ApplePaySdkLoader","load","TxVariants","applepay","defaultProps"],"mappings":"2sCAwBA,MAAMA,UAAwBC,EA0CPC,WAAAA,CAAYC,GAE3B,MAAMC,EAAoBD,EAAME,QAAQC,OAASC,EAAUJ,EAAME,QAAUF,EAAMC,kBAEjF,MAAO,IACAD,EACHK,cAAeL,EAAMK,cACrBJ,oBACAK,aAAcN,EAAMM,cAAgBN,EAAMO,MAAMC,OAChDC,gBAAiBT,EAAMS,iBAAmBT,EAAMK,eAAeK,aAC/DC,qBAAsBX,EAAMW,uBAAyBC,IAAmB,SAAW,SAE3F,CAKA,UAAAC,GACI,MAAMC,cAAEA,EAAaC,eAAEA,EAAcC,gBAAEA,GAAoBC,KAAKC,OAC1DC,UAAEA,GAAcF,KAAKjB,MAE3B,MAAO,CACHoB,cAAe,CACXC,KAAMxB,EAAgBwB,KACtBP,mBACIK,GAAa,CAAEG,QAAS,eAE5BP,GAAkB,CAAEA,qBACpBC,GAAmB,CAAEA,mBAEjC,CAEmBO,YAAAA,CAAaC,GAC5B,MAAMC,EAAQ,IAAIC,EAAmB,CACjCL,KAAMM,EAAcC,SACpBC,UAAWZ,KAAKI,KAChBS,WAAY,IAAKN,EAAqBO,cAAed,KAAKjB,MAAM+B,kBAC5DP,GAAqBL,WAAa,CAAEA,UAAWK,EAAoB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h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ApplePayButton from './components/ApplePayButton';\nimport ApplePayService from './services/ApplePayService';\nimport base64 from '../../utils/base64';\nimport defaultProps from './defaultProps';\nimport { httpPost } from '../../core/Services/http';\nimport { preparePaymentRequest } from './utils/payment-request';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { DecodeObject } from '../../types/global-types';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { resolveSupportedVersion } from './utils/resolve-supported-version';\nimport { formatApplePayContactToAdyenAddressFormat } from './utils/format-applepay-contact-to-adyen-format';\nimport { mapBrands } from './utils/map-adyen-brands-to-applepay-brands';\nimport ApplePaySdkLoader from './services/ApplePaySdkLoader';\nimport { detectInIframe } from '../../utils/detectInIframe';\nimport type { ApplePayConfiguration, ApplePayElementData, ApplePayPaymentOrderDetails, ApplePaySessionRequest } from './types';\nimport type { ICore } from '../../core/types';\nimport type { PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nconst LATEST_APPLE_PAY_VERSION = 14;\n\nclass ApplePayElement extends UIElement<ApplePayConfiguration> {\n public static readonly type = TxVariants.applepay;\n\n protected static readonly defaultProps = defaultProps;\n\n private sdkLoader: ApplePaySdkLoader;\n private applePayVersionNumber: number = undefined;\n\n constructor(checkout: ICore, props?: ApplePayConfiguration) {\n super(checkout, props);\n\n const { isExpress, onShippingContactSelected, onShippingMethodSelected } = this.props;\n\n if (isExpress === false && (onShippingContactSelected || onShippingMethodSelected)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'ApplePay - You must set \"isExpress\" flag to \"true\" in order to use \"onShippingContactSelected\" and/or \"onShippingMethodSelected\" callbacks'\n );\n }\n\n this.startSession = this.startSession.bind(this);\n this.submit = this.submit.bind(this);\n this.validateMerchant = this.validateMerchant.bind(this);\n this.collectOrderTrackingDetailsIfNeeded = this.collectOrderTrackingDetailsIfNeeded.bind(this);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.defineApplePayVersionNumber = this.defineApplePayVersionNumber.bind(this);\n this.configureApplePayWebOptions = this.configureApplePayWebOptions.bind(this);\n\n this.sdkLoader = new ApplePaySdkLoader({ analytics: this.analytics });\n\n void this.sdkLoader\n .load()\n .then(this.defineApplePayVersionNumber)\n .then(this.configureApplePayWebOptions)\n .catch(error => {\n this.handleError(error);\n });\n }\n\n /**\n * Formats the component props\n */\n protected override formatProps(props: ApplePayConfiguration): ApplePayConfiguration {\n // @ts-ignore TODO: Fix brands prop\n const supportedNetworks = props.brands?.length ? mapBrands(props.brands) : props.supportedNetworks;\n\n return {\n ...props,\n configuration: props.configuration,\n supportedNetworks,\n buttonLocale: props.buttonLocale ?? props.i18n?.locale,\n totalPriceLabel: props.totalPriceLabel || props.configuration?.merchantName,\n renderApplePayCodeAs: props.renderApplePayCodeAs ?? (detectInIframe() ? 'window' : 'modal')\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData(): ApplePayElementData {\n const { applePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: ApplePayElement.type,\n applePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n protected override beforeRender(configSetByMerchant?: ApplePayConfiguration) {\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 public override submit = (): void => {\n if (this.props.isInstantPayment) {\n const event = new AnalyticsInfoEvent({ component: this.type, type: InfoEventType.selected, target: UiTarget.instantPaymentButton });\n this.submitAnalytics(event);\n }\n void this.startSession();\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n /**\n * This API is only intended for upstreaming or defaulting to Apple Pay, all other scenarios should continue to\n * use canMakePayments(). For Safari browsers, this API will indicate whether there is a card available to make\n * payments. For third-party browsers a new status of paymentCredentialStatusUnknown will be returned. This does\n * not mean there are no cards available, it means the status cannot be determined and as such defaulting\n * and upstreaming should still be considered.\n *\n * {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/4440085-applepaycapabilities}\n * @param merchantIdentifier\n */\n public async applePayCapabilities(merchantIdentifier?: string): Promise<ApplePayJS.PaymentCredentialStatusResponse> {\n const identifier = merchantIdentifier || this.props.configuration.merchantId;\n\n try {\n await this.sdkLoader.isSdkLoaded();\n return await ApplePaySession?.applePayCapabilities(identifier);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Apple Pay: Error when requesting applePayCapabilities()', { cause: error });\n }\n }\n\n /**\n * Determines if Apple Pay component can be displayed or not\n */\n public override async isAvailable(): Promise<void> {\n if (window.location.protocol !== 'https:') {\n return Promise.reject(new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Trying to start an Apple Pay session from an insecure document'));\n }\n\n try {\n await this.sdkLoader.isSdkLoaded();\n\n if (ApplePaySession?.canMakePayments()) {\n return Promise.resolve();\n }\n\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay is not available on this device'));\n } catch (error) {\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay SDK failed to load', { cause: error }));\n }\n }\n\n /**\n * Sets the Apple Pay version available for the shopper.\n * This code needs to be executed once the Apple Pay SDK is fully loaded\n * @private\n */\n private defineApplePayVersionNumber() {\n if (window.location.protocol !== 'https:') return;\n this.applePayVersionNumber = this.props.version || resolveSupportedVersion(LATEST_APPLE_PAY_VERSION);\n }\n\n /**\n * Sets the configuration/callbacks that pertain to the Apple Pay code overlay/modal.\n * @private\n */\n private configureApplePayWebOptions() {\n if (window.ApplePayWebOptions) {\n const { renderApplePayCodeAs, onApplePayCodeClose } = this.props;\n\n window.ApplePayWebOptions.set({\n renderApplePayCodeAs,\n ...(onApplePayCodeClose && { onApplePayCodeClose })\n });\n }\n }\n\n private startSession() {\n const { onValidateMerchant, onPaymentMethodSelected, onShippingMethodSelected, onShippingContactSelected, onCouponCodeChanged } = this.props;\n\n const paymentRequest = preparePaymentRequest({\n companyName: this.props.configuration.merchantName,\n countryCode: this.core.options.countryCode,\n ...this.props\n });\n\n const session = new ApplePayService(paymentRequest, {\n version: this.applePayVersionNumber,\n onError: (error: unknown) => {\n this.handleError(\n new AdyenCheckoutError('ERROR', 'ApplePay - Something went wrong on ApplePayService', {\n cause: error\n })\n );\n },\n onCancel: event => {\n this.handleError(new AdyenCheckoutError('CANCEL', 'ApplePay UI dismissed', { cause: event }));\n },\n onPaymentMethodSelected,\n onShippingMethodSelected,\n onShippingContactSelected,\n onCouponCodeChanged,\n onValidateMerchant: onValidateMerchant || this.validateMerchant,\n onPaymentAuthorized: (resolve, reject, event) => {\n const billingAddress = formatApplePayContactToAdyenAddressFormat(event.payment.billingContact);\n const deliveryAddress = formatApplePayContactToAdyenAddressFormat(event.payment.shippingContact, true);\n\n this.setState({\n applePayToken: btoa(JSON.stringify(event.payment.token.paymentData)),\n authorizedEvent: event,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.collectOrderTrackingDetailsIfNeeded)\n .then(({ paymentResponse, orderDetails }) => {\n resolve({\n status: ApplePaySession.STATUS_SUCCESS,\n ...(orderDetails && { orderDetails })\n });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n const errors = paymentResponse?.error?.applePayError;\n\n reject({\n status: ApplePaySession.STATUS_FAILURE,\n errors: errors ? (Array.isArray(errors) ? errors : [errors]) : undefined\n });\n\n const responseWithError: RawPaymentResponse = {\n ...paymentResponse,\n error: {\n applePayError: errors\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\n }\n });\n\n return new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject))\n .then(() => {\n session.begin();\n })\n .catch(() => ({\n // Swallow exception triggered by onClick reject\n }));\n }\n\n /**\n * Call the 'onAuthorized' callback if available.\n * Must be resolved/reject for the payment flow to continue\n *\n * @private\n */\n private async handleAuthorization(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.props.onAuthorized) {\n resolve();\n }\n\n const { authorizedEvent, billingAddress, deliveryAddress } = this.state;\n\n this.props.onAuthorized(\n {\n authorizedEvent,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n );\n }).catch((error?: ApplePayJS.ApplePayError) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { applePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Verify if the 'onOrderTrackingRequest' is provided. If so, triggers the callback expecting an\n * Apple Pay order details back\n *\n * @private\n */\n private async collectOrderTrackingDetailsIfNeeded(\n paymentResponse: PaymentResponseData\n ): Promise<{ orderDetails?: ApplePayPaymentOrderDetails; paymentResponse: PaymentResponseData }> {\n return new Promise<ApplePayPaymentOrderDetails | void>((resolve, reject) => {\n if (!this.props.onOrderTrackingRequest) {\n return resolve();\n }\n\n this.props.onOrderTrackingRequest(resolve, reject);\n })\n .then(orderDetails => {\n return {\n paymentResponse,\n ...(orderDetails && { orderDetails })\n };\n })\n .catch(() => {\n return { paymentResponse };\n });\n }\n\n private async validateMerchant(resolve: (merchantSession: any) => void, reject: (error: string) => void) {\n const { hostname } = window.location;\n const { clientKey, configuration, loadingContext, initiative, domainName } = this.props;\n const { merchantName, merchantId } = configuration;\n const path = `v1/applePay/sessions?clientKey=${clientKey}`;\n const options = { loadingContext, path };\n const request: ApplePaySessionRequest = {\n displayName: merchantName,\n domainName: domainName || hostname,\n initiative,\n merchantIdentifier: merchantId\n };\n\n try {\n const response = await httpPost(options, request);\n const decodedData: DecodeObject = base64.decode(response.data);\n if (!decodedData.success) {\n reject('Could not decode Apple Pay session');\n } else {\n const session = JSON.parse(decodedData.data);\n resolve(session);\n }\n } catch (e) {\n reject('Could not get Apple Pay session');\n }\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (!this.props.showPayButton) {\n return null;\n }\n\n return (\n <ApplePayButton\n buttonStyle={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonLocale={this.props.buttonLocale}\n onClick={this.submit}\n />\n );\n }\n}\n\nexport default ApplePayElement;\n"],"names":["ApplePayElement","UIElement","formatProps","props","supportedNetworks","brands","length","mapBrands","configuration","buttonLocale","i18n","locale","totalPriceLabel","merchantName","renderApplePayCodeAs","detectInIframe","formatData","applePayToken","billingAddress","deliveryAddress","this","state","isExpress","paymentMethod","type","subtype","beforeRender","configSetByMerchant","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","isValid","applePayCapabilities","merchantIdentifier","identifier","merchantId","sdkLoader","isSdkLoaded","ApplePaySession","error","AdyenCheckoutError","cause","isAvailable","window","location","protocol","Promise","reject","canMakePayments","resolve","defineApplePayVersionNumber","applePayVersionNumber","version","resolveSupportedVersion","configureApplePayWebOptions","ApplePayWebOptions","onApplePayCodeClose","set","startSession","onValidateMerchant","onPaymentMethodSelected","onShippingMethodSelected","onShippingContactSelected","onCouponCodeChanged","paymentRequest","preparePaymentRequest","companyName","countryCode","core","options","session","ApplePayService","onError","handleError","onCancel","validateMerchant","onPaymentAuthorized","formatApplePayContactToAdyenAddressFormat","payment","billingContact","shippingContact","setState","btoa","JSON","stringify","token","paymentData","authorizedEvent","handleAuthorization","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","collectOrderTrackingDetailsIfNeeded","paymentResponse","orderDetails","status","STATUS_SUCCESS","handleResponse","catch","errors","applePayError","STATUS_FAILURE","Array","isArray","undefined","responseWithError","handleFailedResult","onClick","begin","onAuthorized","data","onOrderTrackingRequest","hostname","clientKey","loadingContext","initiative","domainName","path","request","displayName","response","httpPost","decodedData","base64","decode","success","parse","e","componentToRender","h","ApplePayButton","buttonStyle","buttonColor","buttonType","submit","constructor","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","bind","ApplePaySdkLoader","load","TxVariants","applepay","defaultProps"],"mappings":"2sCAwBA,MAAMA,UAAwBC,EA0CPC,WAAAA,CAAYC,GAE3B,MAAMC,EAAoBD,EAAME,QAAQC,OAASC,EAAUJ,EAAME,QAAUF,EAAMC,kBAEjF,MAAO,IACAD,EACHK,cAAeL,EAAMK,cACrBJ,oBACAK,aAAcN,EAAMM,cAAgBN,EAAMO,MAAMC,OAChDC,gBAAiBT,EAAMS,iBAAmBT,EAAMK,eAAeK,aAC/DC,qBAAsBX,EAAMW,uBAAyBC,IAAmB,SAAW,SAE3F,CAKA,UAAAC,GACI,MAAMC,cAAEA,EAAaC,eAAEA,EAAcC,gBAAEA,GAAoBC,KAAKC,OAC1DC,UAAEA,GAAcF,KAAKjB,MAE3B,MAAO,CACHoB,cAAe,CACXC,KAAMxB,EAAgBwB,KACtBP,mBACIK,GAAa,CAAEG,QAAS,eAE5BP,GAAkB,CAAEA,qBACpBC,GAAmB,CAAEA,mBAEjC,CAEmBO,YAAAA,CAAaC,GAC5B,MAAMC,EAAQ,IAAIC,EAAmB,CACjCL,KAAMM,EAAcC,SACpBC,UAAWZ,KAAKI,KAChBS,WAAY,IAAKN,EAAqBO,cAAed,KAAKjB,MAAM+B,kBAC5DP,GAAqBL,WAAa,CAAEA,UAAWK,EAAoBL,cACnEK,GAAqBQ,aAAe,CAAEA,YAAaR,EAAoBQ,eAG/Ef,KAAKgB,UAAUC,cAAcT,EACjC,CAUA,WAAWU,GACP,OAAO,CACX,CAYA,0BAAaC,C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,GACAuG,EAAA9H,KAAQsC,6BAAgCsD,GAgFxCkC,EAAA9H,KAAgB0H,SAAS,KACrB,GAAI1H,KAAKjB,MAAMgJ,iBAAkB,CAC7B,MAAMvH,EAAQ,IAAIC,EAAmB,CAAEG,UAAWZ,KAAKI,KAAMA,KAAMM,EAAcsH,SAAUC,OAAQC,EAASC,uBAC5GnI,KAAKoI,gBAAgB5H,EACzB,CACKR,KAAK6C,iBAhFV,MAAM3C,UAAEA,EAAS+C,0BAAEA,EAAyBD,yBAAEA,GAA6BhD,KAAKjB,MAEhF,IAAkB,IAAdmB,IAAwB+C,GAA6BD,GACrD,MAAM,IAAIrB,EACN,uBACA,8IAIR3B,KAAK6C,aAAe7C,KAAK6C,aAAawF,KAAKrI,MAC3CA,KAAK0H,OAAS1H,KAAK0H,OAAOW,KAAKrI,MAC/BA,KAAK8D,iBAAmB9D,KAAK8D,iBAAiBuE,KAAKrI,MACnDA,KAAKgF,oCAAsChF,KAAKgF,oCAAoCqD,KAAKrI,MACzFA,KAAK2E,oBAAsB3E,KAAK2E,oBAAoB0D,KAAKrI,MACzDA,KAAKqC,4BAA8BrC,KAAKqC,4BAA4BgG,KAAKrI,MACzEA,KAAKyC,4BAA8BzC,KAAKyC,4BAA4B4F,KAAKrI,MAEzEA,KAAKuB,UAAY,IAAI+G,EAAkB,CAAEtH,UAAWhB,KAAKgB,YAEpDhB,KAAKuB,UACLgH,OACA3D,KAAK5E,KAAKqC,6BACVuC,KAAK5E,KAAKyC,6BACV6C,MAAM5D,IACH1B,KAAK4D,YAAYlC,IAE7B,EApCAoG,EADElJ,EACqBwB,OAAOoI,EAAWC,UAEzCX,EAHElJ,EAGwB8J,eAAeA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t
|
|
1
|
+
function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class n{begin(){return this.session.begin()}onvalidatemerchant(e,n){return new Promise((t,o)=>{n(t,o,e.validationURL)}).then(e=>{this.session.completeMerchantValidation(e)}).catch(e=>{console.error(e),this.session.abort(),this.options.onError(e)})}onpaymentauthorized(e,n){return new Promise((t,o)=>n(t,o,e)).then(e=>{this.session.completePayment(e)}).catch(e=>{this.session.completePayment(e)})}onpaymentmethodselected(e,n){return new Promise((t,o)=>n(t,o,e)).then(e=>{this.session.completePaymentMethodSelection(e)}).catch(e=>{this.session.completePaymentMethodSelection(e)})}onshippingcontactselected(e,n){return new Promise((t,o)=>n(t,o,e)).then(e=>{this.session.completeShippingContactSelection(e)}).catch(e=>{this.session.completeShippingContactSelection(e)})}onshippingmethodselected(e,n){return new Promise((t,o)=>n(t,o,e)).then(e=>{this.session.completeShippingMethodSelection(e)}).catch(e=>{this.session.completeShippingMethodSelection(e)})}oncouponcodechanged(e,n){return new Promise((t,o)=>n(t,o,e)).then(e=>{this.session.completeCouponCodeChange(e)}).catch(e=>{this.session.completeCouponCodeChange(e)})}oncancel(e,n){n(e)}constructor(n,t){e(this,"session",void 0),e(this,"options",void 0),this.options=t,this.session=new ApplePaySession(t.version,n),this.session.onvalidatemerchant=e=>{this.onvalidatemerchant(e,t.onValidateMerchant)},this.session.onpaymentauthorized=e=>{this.onpaymentauthorized(e,t.onPaymentAuthorized)},this.session.oncancel=e=>{this.oncancel(e,t.onCancel)},"function"==typeof t.onPaymentMethodSelected&&(this.session.onpaymentmethodselected=e=>{this.onpaymentmethodselected(e,t.onPaymentMethodSelected)}),"function"==typeof t.onShippingContactSelected&&(this.session.onshippingcontactselected=e=>{this.onshippingcontactselected(e,t.onShippingContactSelected)}),"function"==typeof t.onShippingMethodSelected&&(this.session.onshippingmethodselected=e=>{this.onshippingmethodselected(e,t.onShippingMethodSelected)}),"function"==typeof t.onCouponCodeChanged&&(this.session.oncouponcodechanged=e=>{this.oncouponcodechanged(e,t.onCouponCodeChanged)})}}export{n as default};
|
|
2
2
|
//# sourceMappingURL=ApplePayService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplePayService.js","sources":["../../../../../src/components/ApplePay/services/ApplePayService.ts"],"sourcesContent":["import { ApplePayConfiguration, ApplePayPaymentAuthorizationResult } from '../types';\n\nexport interface ApplePayServiceOptions {\n version: number;\n onError: (error?: unknown) => void;\n onCancel?: (event: ApplePayJS.Event) => void;\n onValidateMerchant: ApplePayConfiguration['onValidateMerchant'];\n onPaymentMethodSelected?: ApplePayConfiguration['onPaymentMethodSelected'];\n onShippingMethodSelected?: ApplePayConfiguration['onShippingMethodSelected'];\n onShippingContactSelected?: ApplePayConfiguration['onShippingContactSelected'];\n onPaymentAuthorized: (\n resolve: (result: ApplePayPaymentAuthorizationResult) => void,\n reject: (result: ApplePayPaymentAuthorizationResult) => void,\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent\n ) => void;\n}\n\nclass ApplePayService {\n private session: ApplePaySession;\n private readonly options: ApplePayServiceOptions;\n\n constructor(paymentRequest: ApplePayJS.ApplePayPaymentRequest, options: ApplePayServiceOptions) {\n this.options = options;\n\n this.session = new ApplePaySession(options.version, paymentRequest);\n this.session.onvalidatemerchant = event => {\n void this.onvalidatemerchant(event, options.onValidateMerchant);\n };\n this.session.onpaymentauthorized = event => {\n void this.onpaymentauthorized(event, options.onPaymentAuthorized);\n };\n\n this.session.oncancel = event => {\n this.oncancel(event, options.onCancel);\n };\n\n if (typeof options.onPaymentMethodSelected === 'function') {\n this.session.onpaymentmethodselected = event => {\n void this.onpaymentmethodselected(event, options.onPaymentMethodSelected);\n };\n }\n\n if (typeof options.onShippingContactSelected === 'function') {\n this.session.onshippingcontactselected = event => {\n void this.onshippingcontactselected(event, options.onShippingContactSelected);\n };\n }\n\n if (typeof options.onShippingMethodSelected === 'function') {\n this.session.onshippingmethodselected = event => {\n void this.onshippingmethodselected(event, options.onShippingMethodSelected);\n };\n }\n }\n\n /**\n * Begins the merchant validation process.\n * When this method is called, the payment sheet is presented and the merchant validation process is initiated.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778001-begin}\n */\n begin() {\n return this.session.begin();\n }\n\n /**\n * An event handler that is called when the payment sheet is displayed.\n * Use this attribute to request and return a merchant session.\n * @param event - An ApplePayValidateMerchantEvent object (contains validationURL)\n * @param onValidateMerchant - A promise implemented by the merchant that will resolve with the merchantSession\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/providing_merchant_validation}\n */\n onvalidatemerchant(event: ApplePayJS.ApplePayValidateMerchantEvent, onValidateMerchant: ApplePayConfiguration['onValidateMerchant']) {\n return new Promise((resolve, reject) => {\n void onValidateMerchant(resolve, reject, event.validationURL);\n })\n .then(response => {\n this.session.completeMerchantValidation(response);\n })\n .catch(error => {\n console.error(error);\n this.session.abort();\n this.options.onError(error);\n });\n }\n\n /**\n * An event handler that is called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.\n * The onpaymentauthorized function must complete the payment and respond by calling completePayment before the 30 second timeout.\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentAuthorized - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778020-onpaymentauthorized}\n */\n onpaymentauthorized(\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent,\n onPaymentAuthorized: ApplePayServiceOptions['onPaymentAuthorized']\n ): Promise<void> {\n return new Promise((resolve, reject) => onPaymentAuthorized(resolve, reject, event))\n .then((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n })\n .catch((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentMethodSelected - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778013-onpaymentmethodselected}\n */\n onpaymentmethodselected(\n event: ApplePayJS.ApplePayPaymentMethodSelectedEvent,\n onPaymentMethodSelected: ApplePayServiceOptions['onPaymentMethodSelected']\n ) {\n return new Promise((resolve, reject) => onPaymentMethodSelected(resolve, reject, event))\n .then((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n })\n .catch((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingContact attribute.\n * @param onShippingContactSelected - A promise that will complete the selection of a shipping contact with an update.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingcontactselected(\n event: ApplePayJS.ApplePayShippingContactSelectedEvent,\n onShippingContactSelected: ApplePayConfiguration['onShippingContactSelected']\n ) {\n return new Promise((resolve, reject) => onShippingContactSelected(resolve, reject, event))\n .then((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n })\n .catch((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingMethod attribute.\n * @param onShippingMethodSelected - A promise that will complete the selection of a shipping method with an update.\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingmethodselected(\n event: ApplePayJS.ApplePayShippingMethodSelectedEvent,\n onShippingMethodSelected: ApplePayConfiguration['onShippingMethodSelected']\n ) {\n return new Promise((resolve, reject) => onShippingMethodSelected(resolve, reject, event))\n .then((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n })\n .catch((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n });\n }\n\n /**\n * An event handler that is automatically called when the payment UI is dismissed.\n * This function can be called even after an onpaymentauthorized event has been dispatched.\n * @param event -\n * @param onCancel -\n * @see {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778029-oncancel}\n */\n oncancel(event: ApplePayJS.Event, onCancel: (event: ApplePayJS.Event) => void): void {\n onCancel(event);\n }\n}\n\nexport default ApplePayService;\n"],"names":["ApplePayService","begin","this","session","onvalidatemerchant","event","onValidateMerchant","Promise","resolve","reject","validationURL","then","response","completeMerchantValidation","catch","error","console","abort","options","onError","onpaymentauthorized","onPaymentAuthorized","result","completePayment","onpaymentmethodselected","onPaymentMethodSelected","paymentMethodUpdate","completePaymentMethodSelection","onshippingcontactselected","onShippingContactSelected","shippingContactUpdate","completeShippingContactSelection","onshippingmethodselected","onShippingMethodSelected","shippingMethodUpdate","completeShippingMethodSelection","oncancel","onCancel","constructor","paymentRequest","_define_property","ApplePaySession","version"],"mappings":"wHAiBA,MAAMA,EA2CFC,KAAAA,GACI,OAAOC,KAAKC,QAAQF,OACxB,CASAG,kBAAAA,CAAmBC,EAAiDC,GAChE,OAAO,IAAIC,QAAQ,CAACC,EAASC,KACpBH,EAAmBE,EAASC,EAAQJ,EAAMK,iBAE9CC,KAAKC,IACFV,KAAKC,QAAQU,2BAA2BD,KAE3CE,MAAMC,IACHC,QAAQD,MAAMA,GACdb,KAAKC,QAAQc,QACbf,KAAKgB,QAAQC,QAAQJ,IAEjC,CAUAK,mBAAAA,CACIf,EACAgB,GAEA,OAAO,IAAId,QAAQ,CAACC,EAASC,IAAWY,EAAoBb,EAASC,EAAQJ,IACxEM,KAAMW,IACHpB,KAAKC,QAAQoB,gBAAgBD,KAEhCR,MAAOQ,IACJpB,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KC,QAAQyB,0BAA4BvB,IAChCH,KAAK0B,0BAA0BvB,EAAOa,EAAQW,6BAIX,mBAArCX,EAAQe,2BACf/B,KAAKC,QAAQ6B,yBAA2B3B,IAC/BH,KAAK8B,yBAAyB3B,EAAOa,EAAQe,2BAG9D"}
|
|
1
|
+
{"version":3,"file":"ApplePayService.js","sources":["../../../../../src/components/ApplePay/services/ApplePayService.ts"],"sourcesContent":["import { ApplePayConfiguration, ApplePayPaymentAuthorizationResult } from '../types';\n\nexport interface ApplePayServiceOptions {\n version: number;\n onError: (error?: unknown) => void;\n onCancel?: (event: ApplePayJS.Event) => void;\n onValidateMerchant: ApplePayConfiguration['onValidateMerchant'];\n onCouponCodeChanged?: ApplePayConfiguration['onCouponCodeChanged'];\n onPaymentMethodSelected?: ApplePayConfiguration['onPaymentMethodSelected'];\n onShippingMethodSelected?: ApplePayConfiguration['onShippingMethodSelected'];\n onShippingContactSelected?: ApplePayConfiguration['onShippingContactSelected'];\n onPaymentAuthorized: (\n resolve: (result: ApplePayPaymentAuthorizationResult) => void,\n reject: (result: ApplePayPaymentAuthorizationResult) => void,\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent\n ) => void;\n}\n\nclass ApplePayService {\n private session: ApplePaySession;\n private readonly options: ApplePayServiceOptions;\n\n constructor(paymentRequest: ApplePayJS.ApplePayPaymentRequest, options: ApplePayServiceOptions) {\n this.options = options;\n\n this.session = new ApplePaySession(options.version, paymentRequest);\n this.session.onvalidatemerchant = event => {\n void this.onvalidatemerchant(event, options.onValidateMerchant);\n };\n this.session.onpaymentauthorized = event => {\n void this.onpaymentauthorized(event, options.onPaymentAuthorized);\n };\n\n this.session.oncancel = event => {\n this.oncancel(event, options.onCancel);\n };\n\n if (typeof options.onPaymentMethodSelected === 'function') {\n this.session.onpaymentmethodselected = event => {\n void this.onpaymentmethodselected(event, options.onPaymentMethodSelected);\n };\n }\n\n if (typeof options.onShippingContactSelected === 'function') {\n this.session.onshippingcontactselected = event => {\n void this.onshippingcontactselected(event, options.onShippingContactSelected);\n };\n }\n\n if (typeof options.onShippingMethodSelected === 'function') {\n this.session.onshippingmethodselected = event => {\n void this.onshippingmethodselected(event, options.onShippingMethodSelected);\n };\n }\n\n if (typeof options.onCouponCodeChanged === 'function') {\n this.session.oncouponcodechanged = event => {\n void this.oncouponcodechanged(event, options.onCouponCodeChanged);\n };\n }\n }\n\n /**\n * Begins the merchant validation process.\n * When this method is called, the payment sheet is presented and the merchant validation process is initiated.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778001-begin}\n */\n begin() {\n return this.session.begin();\n }\n\n /**\n * An event handler that is called when the payment sheet is displayed.\n * Use this attribute to request and return a merchant session.\n * @param event - An ApplePayValidateMerchantEvent object (contains validationURL)\n * @param onValidateMerchant - A promise implemented by the merchant that will resolve with the merchantSession\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/apple_pay_js_api/providing_merchant_validation}\n */\n onvalidatemerchant(event: ApplePayJS.ApplePayValidateMerchantEvent, onValidateMerchant: ApplePayConfiguration['onValidateMerchant']) {\n return new Promise((resolve, reject) => {\n void onValidateMerchant(resolve, reject, event.validationURL);\n })\n .then(response => {\n this.session.completeMerchantValidation(response);\n })\n .catch(error => {\n console.error(error);\n this.session.abort();\n this.options.onError(error);\n });\n }\n\n /**\n * An event handler that is called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.\n * The onpaymentauthorized function must complete the payment and respond by calling completePayment before the 30 second timeout.\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentAuthorized - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778020-onpaymentauthorized}\n */\n onpaymentauthorized(\n event: ApplePayJS.ApplePayPaymentAuthorizedEvent,\n onPaymentAuthorized: ApplePayServiceOptions['onPaymentAuthorized']\n ): Promise<void> {\n return new Promise((resolve, reject) => onPaymentAuthorized(resolve, reject, event))\n .then((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n })\n .catch((result: ApplePayPaymentAuthorizationResult) => {\n this.session.completePayment(result);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n *\n * @param event - The event parameter contains the payment (ApplePayPayment) attribute.\n * @param onPaymentMethodSelected - A promise that will complete the payment when resolved. Use this promise to process the payment.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778013-onpaymentmethodselected}\n */\n onpaymentmethodselected(\n event: ApplePayJS.ApplePayPaymentMethodSelectedEvent,\n onPaymentMethodSelected: ApplePayServiceOptions['onPaymentMethodSelected']\n ) {\n return new Promise((resolve, reject) => onPaymentMethodSelected(resolve, reject, event))\n .then((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n })\n .catch((paymentMethodUpdate: ApplePayJS.ApplePayPaymentMethodUpdate) => {\n this.session.completePaymentMethodSelection(paymentMethodUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingContact attribute.\n * @param onShippingContactSelected - A promise that will complete the selection of a shipping contact with an update.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingcontactselected(\n event: ApplePayJS.ApplePayShippingContactSelectedEvent,\n onShippingContactSelected: ApplePayConfiguration['onShippingContactSelected']\n ) {\n return new Promise((resolve, reject) => onShippingContactSelected(resolve, reject, event))\n .then((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n })\n .catch((shippingContactUpdate: ApplePayJS.ApplePayShippingContactUpdate) => {\n this.session.completeShippingContactSelection(shippingContactUpdate);\n });\n }\n\n /**\n * An event handler that is called when a new payment method is selected.\n * The onpaymentmethodselected function must resolve before the 30 second timeout\n * @param event - The event parameter contains the shippingMethod attribute.\n * @param onShippingMethodSelected - A promise that will complete the selection of a shipping method with an update.\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778009-onshippingcontactselected}\n */\n onshippingmethodselected(\n event: ApplePayJS.ApplePayShippingMethodSelectedEvent,\n onShippingMethodSelected: ApplePayConfiguration['onShippingMethodSelected']\n ) {\n return new Promise((resolve, reject) => onShippingMethodSelected(resolve, reject, event))\n .then((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n })\n .catch((shippingMethodUpdate: ApplePayJS.ApplePayShippingMethodUpdate) => {\n this.session.completeShippingMethodSelection(shippingMethodUpdate);\n });\n }\n\n oncouponcodechanged(event: ApplePayJS.ApplePayCouponCodeChangedEvent, onCouponCodeChanged: ApplePayConfiguration['onCouponCodeChanged']) {\n return new Promise((resolve, reject) => onCouponCodeChanged(resolve, reject, event))\n .then((couponCodeUpdate: ApplePayJS.ApplePayCouponCodeUpdate) => {\n this.session.completeCouponCodeChange(couponCodeUpdate);\n })\n .catch((couponCodeUpdate: ApplePayJS.ApplePayCouponCodeUpdate) => {\n this.session.completeCouponCodeChange(couponCodeUpdate);\n });\n }\n\n /**\n * An event handler that is automatically called when the payment UI is dismissed.\n * This function can be called even after an onpaymentauthorized event has been dispatched.\n * @param event -\n * @param onCancel -\n * @see {@link https://developer.apple.com/documentation/applepayontheweb/applepaysession/1778029-oncancel}\n */\n oncancel(event: ApplePayJS.Event, onCancel: (event: ApplePayJS.Event) => void): void {\n onCancel(event);\n }\n}\n\nexport default ApplePayService;\n"],"names":["ApplePayService","begin","this","session","onvalidatemerchant","event","onValidateMerchant","Promise","resolve","reject","validationURL","then","response","completeMerchantValidation","catch","error","console","abort","options","onError","onpaymentauthorized","onPaymentAuthorized","result","completePayment","onpaymentmethodselected","onPaymentMethodSelected","paymentMethodUpdate","completePaymentMethodSelection","onshippingcontactselected","onShippingContactSelected","shippingContactUpdate","completeShippingContactSelection","onshippingmethodselected","onShippingMethodSelected","shippingMethodUpdate","completeShippingMethodSelection","oncouponcodechanged","onCouponCodeChanged","couponCodeUpdate","completeCouponCodeChange","oncancel","onCancel","constructor","paymentRequest","_define_property","ApplePaySession","version"],"mappings":"wHAkBA,MAAMA,EAiDFC,KAAAA,GACI,OAAOC,KAAKC,QAAQF,OACxB,CASAG,kBAAAA,CAAmBC,EAAiDC,GAChE,OAAO,IAAIC,QAAQ,CAACC,EAASC,KACpBH,EAAmBE,EAASC,EAAQJ,EAAMK,iBAE9CC,KAAKC,IACFV,KAAKC,QAAQU,2BAA2BD,KAE3CE,MAAMC,IACHC,QAAQD,MAAMA,GACdb,KAAKC,QAAQc,QACbf,KAAKgB,QAAQC,QAAQJ,IAEjC,CAUAK,mBAAAA,CACIf,EACAgB,GAEA,OAAO,IAAId,QAAQ,CAACC,EAASC,IAAWY,EAAoBb,EAASC,EAAQJ,IACxEM,KAAMW,IACHpB,KAAKC,QAAQoB,gBAAgBD,KAEhCR,MAAOQ,IACJpB,KAAKC,QAAQoB,gBAAgBD,IAEzC,CAUAE,uBAAAA,CACInB,EACAoB,GAEA,OAAO,IAAIlB,QAAQ,CAACC,EAASC,IAAWgB,EAAwBjB,EAASC,EAAQJ,IAC5EM,KAAMe,IACHxB,KAAKC,QAAQwB,+BAA+BD,KAE/CZ,MAAOY,IACJxB,KAAKC,QAAQwB,+BAA+BD,IAExD,CASAE,yBAAAA,CACIvB,EACAwB,GAEA,OAAO,IAAItB,QAAQ,CAACC,EAASC,IAAWoB,EAA0BrB,EAASC,EAAQJ,IAC9EM,KAAMmB,IACH5B,KAAKC,QAAQ4B,iCAAiCD,KAEjDhB,MAAOgB,IACJ5B,KAAKC,QAAQ4B,iCAAiCD,IAE1D,CASAE,wBAAAA,CACI3B,EACA4B,GAEA,OAAO,IAAI1B,QAAQ,CAACC,EAASC,IAAWwB,EAAyBzB,EAASC,EAAQJ,IAC7EM,KAAMuB,IACHhC,KAAKC,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,companyName:
|
|
1
|
+
import{getDecimalAmount as t}from"../../../utils/amount-util.js";const e=e=>{const{countryCode:i,companyName:o,amount:n,...p}=e,r=(e=>String(t(e.value,e.currency)))(n);return i||console.warn("Apple Pay - Make sure to set the countryCode in the AdyenCheckout configuration or in the Checkout Session creation"),{countryCode:i,currencyCode:n.currency,total:{label:p.totalPriceLabel,amount:r,type:p.totalPriceStatus},lineItems:p.lineItems,shippingContactEditingMode:p.shippingContactEditingMode,shippingMethods:p.shippingMethods,shippingType:p.shippingType,recurringPaymentRequest:p.recurringPaymentRequest,merchantCapabilities:p.merchantCapabilities,supportedCountries:p.supportedCountries,supportedNetworks:p.supportedNetworks,requiredShippingContactFields:p.requiredShippingContactFields,requiredBillingContactFields:p.requiredBillingContactFields,billingContact:p.billingContact,shippingContact:p.shippingContact,applicationData:p.applicationData,couponCode:p.couponCode,supportsCouponCode:p.supportsCouponCode}};export{e as preparePaymentRequest};
|
|
2
2
|
//# sourceMappingURL=payment-request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-request.js","sources":["../../../../../src/components/ApplePay/utils/payment-request.ts"],"sourcesContent":["import { getDecimalAmount } from '../../../utils/amount-util';\nimport { PaymentAmount } from '../../../types/global-types';\nimport { ApplePayConfiguration } from '../types';\n\nconst formatAmount = (amount: PaymentAmount) => String(getDecimalAmount(amount.value, amount.currency));\n\nexport const preparePaymentRequest = (\n paymentRequest: ApplePayConfiguration & {\n countryCode: string;\n companyName: string;\n }\n): ApplePayJS.ApplePayPaymentRequest => {\n const { countryCode, companyName, amount, ...props } = paymentRequest;\n const formattedAmount = formatAmount(amount);\n\n if (!countryCode) {\n console.warn('Apple Pay - Make sure to set the countryCode in the AdyenCheckout configuration or in the Checkout Session creation');\n }\n\n return {\n countryCode,\n currencyCode: amount.currency,\n\n total: {\n label: props.totalPriceLabel,\n amount: formattedAmount,\n type: props.totalPriceStatus\n },\n\n lineItems: props.lineItems,\n shippingContactEditingMode: props.shippingContactEditingMode,\n shippingMethods: props.shippingMethods,\n shippingType: props.shippingType,\n\n recurringPaymentRequest: props.recurringPaymentRequest,\n\n merchantCapabilities: props.merchantCapabilities,\n supportedCountries: props.supportedCountries,\n supportedNetworks: props.supportedNetworks,\n\n requiredShippingContactFields: props.requiredShippingContactFields,\n requiredBillingContactFields: props.requiredBillingContactFields,\n\n billingContact: props.billingContact,\n shippingContact: props.shippingContact,\n\n applicationData: props.applicationData\n };\n};\n\nexport default preparePaymentRequest;\n"],"names":["preparePaymentRequest","paymentRequest","countryCode","companyName","amount","props","formattedAmount","String","getDecimalAmount","value","currency","formatAmount","console","warn","currencyCode","total","label","totalPriceLabel","type","totalPriceStatus","lineItems","shippingContactEditingMode","shippingMethods","shippingType","recurringPaymentRequest","merchantCapabilities","supportedCountries","supportedNetworks","requiredShippingContactFields","requiredBillingContactFields","billingContact","shippingContact","applicationData"],"mappings":"iEAIA,MAEaA,EACTC,IAKA,MAAMC,YAAEA,EAAWC,YAAEA,EAAWC,OAAEA,KAAWC,GAAUJ,EACjDK,EATW,CAACF,GAA0BG,OAAOC,EAAiBJ,EAAOK,MAAOL,EAAOM,WASjEC,CAAaP,GAMrC,OAJKF,GACDU,QAAQC,KAAK,uHAGV,CACHX,cACAY,aAAcV,EAAOM,SAErBK,MAAO,CACHC,MAAOX,EAAMY,gBACbb,OAAQE,EACRY,KAAMb,EAAMc,kBAGhBC,UAAWf,EAAMe,UACjBC,2BAA4BhB,EAAMgB,2BAClCC,gBAAiBjB,EAAMiB,gBACvBC,aAAclB,EAAMkB,aAEpBC,wBAAyBnB,EAAMmB,wBAE/BC,qBAAsBpB,EAAMoB,qBAC5BC,mBAAoBrB,EAAMqB,mBAC1BC,kBAAmBtB,EAAMsB,kBAEzBC,8BAA+BvB,EAAMuB,8BACrCC,6BAA8BxB,EAAMwB,6BAEpCC,eAAgBzB,EAAMyB,eACtBC,gBAAiB1B,EAAM0B,gBAEvBC,gBAAiB3B,EAAM2B"}
|
|
1
|
+
{"version":3,"file":"payment-request.js","sources":["../../../../../src/components/ApplePay/utils/payment-request.ts"],"sourcesContent":["import { getDecimalAmount } from '../../../utils/amount-util';\nimport { PaymentAmount } from '../../../types/global-types';\nimport { ApplePayConfiguration } from '../types';\n\nconst formatAmount = (amount: PaymentAmount) => String(getDecimalAmount(amount.value, amount.currency));\n\nexport const preparePaymentRequest = (\n paymentRequest: ApplePayConfiguration & {\n countryCode: string;\n companyName: string;\n }\n): ApplePayJS.ApplePayPaymentRequest => {\n const { countryCode, companyName, amount, ...props } = paymentRequest;\n const formattedAmount = formatAmount(amount);\n\n if (!countryCode) {\n console.warn('Apple Pay - Make sure to set the countryCode in the AdyenCheckout configuration or in the Checkout Session creation');\n }\n\n return {\n countryCode,\n currencyCode: amount.currency,\n\n total: {\n label: props.totalPriceLabel,\n amount: formattedAmount,\n type: props.totalPriceStatus\n },\n\n lineItems: props.lineItems,\n shippingContactEditingMode: props.shippingContactEditingMode,\n shippingMethods: props.shippingMethods,\n shippingType: props.shippingType,\n\n recurringPaymentRequest: props.recurringPaymentRequest,\n\n merchantCapabilities: props.merchantCapabilities,\n supportedCountries: props.supportedCountries,\n supportedNetworks: props.supportedNetworks,\n\n requiredShippingContactFields: props.requiredShippingContactFields,\n requiredBillingContactFields: props.requiredBillingContactFields,\n\n billingContact: props.billingContact,\n shippingContact: props.shippingContact,\n\n applicationData: props.applicationData,\n\n couponCode: props.couponCode,\n supportsCouponCode: props.supportsCouponCode\n };\n};\n\nexport default preparePaymentRequest;\n"],"names":["preparePaymentRequest","paymentRequest","countryCode","companyName","amount","props","formattedAmount","String","getDecimalAmount","value","currency","formatAmount","console","warn","currencyCode","total","label","totalPriceLabel","type","totalPriceStatus","lineItems","shippingContactEditingMode","shippingMethods","shippingType","recurringPaymentRequest","merchantCapabilities","supportedCountries","supportedNetworks","requiredShippingContactFields","requiredBillingContactFields","billingContact","shippingContact","applicationData","couponCode","supportsCouponCode"],"mappings":"iEAIA,MAEaA,EACTC,IAKA,MAAMC,YAAEA,EAAWC,YAAEA,EAAWC,OAAEA,KAAWC,GAAUJ,EACjDK,EATW,CAACF,GAA0BG,OAAOC,EAAiBJ,EAAOK,MAAOL,EAAOM,WASjEC,CAAaP,GAMrC,OAJKF,GACDU,QAAQC,KAAK,uHAGV,CACHX,cACAY,aAAcV,EAAOM,SAErBK,MAAO,CACHC,MAAOX,EAAMY,gBACbb,OAAQE,EACRY,KAAMb,EAAMc,kBAGhBC,UAAWf,EAAMe,UACjBC,2BAA4BhB,EAAMgB,2BAClCC,gBAAiBjB,EAAMiB,gBACvBC,aAAclB,EAAMkB,aAEpBC,wBAAyBnB,EAAMmB,wBAE/BC,qBAAsBpB,EAAMoB,qBAC5BC,mBAAoBrB,EAAMqB,mBAC1BC,kBAAmBtB,EAAMsB,kBAEzBC,8BAA+BvB,EAAMuB,8BACrCC,6BAA8BxB,EAAMwB,6BAEpCC,eAAgBzB,EAAMyB,eACtBC,gBAAiB1B,EAAM0B,gBAEvBC,gBAAiB3B,EAAM2B,gBAEvBC,WAAY5B,EAAM4B,WAClBC,mBAAoB7B,EAAM6B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"./PaymentMethodIcon.js";import{useCoreContext as a}from"../../../../core/Context/CoreProvider.js";import
|
|
1
|
+
import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"./PaymentMethodIcon.js";import{useCoreContext as a}from"../../../../core/Context/CoreProvider.js";import n from"../../../../core/Context/useImage.js";const o=({order:o,orderStatus:r,onOrderCancel:d,brandLogoConfiguration:m})=>{const{i18n:c}=a(),u=n();return e("div",null,e("ul",{className:"adyen-checkout__order-payment-methods-list"},r?.paymentMethods?.map((a,n)=>e("li",{key:`${a.type}-${n}`,className:"adyen-checkout__order-payment-method"},e("div",{className:"adyen-checkout__order-payment-method__header"},e("div",{className:"adyen-checkout__payment-method__header__title"},e(t,{altDescription:a.name,type:a.type,src:m[a.type]||u()(a.type)}),a.label?`${a.label}`:`•••• ${a.lastFour}`),d&&e("button",{type:"button",className:"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link",onClick:()=>{d({order:o})}},c.get("storedPaymentMethod.disable.button"))),e("div",{className:"adyen-checkout__order-payment-method__details"},e("div",{className:"adyen-checkout__order-payment-method__deducted-amount"},e("span",{className:"adyen-checkout__order-payment-method__deducted-amount__label"},c.get("deductedBalance")),e("span",{className:"adyen-checkout__order-payment-method__deducted-amount__value"},c.amount(a.amount.value,a.amount.currency))))))),r.remainingAmount&&e("p",{className:"adyen-checkout__order-remaining-amount"},c.get("partialPayment.warning")," ",e("strong",null,c.amount(r.remainingAmount.value,r.remainingAmount.currency))))};export{o as OrderPaymentMethods,o as default};
|
|
2
2
|
//# sourceMappingURL=OrderPaymentMethods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/OrderPaymentMethods.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodIcon from './PaymentMethodIcon';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport './OrderPaymentMethods.scss';\nimport { Order, OrderStatus } from '../../../../types';\n\ntype OrderPaymentMethodsProps = {\n order: Order;\n orderStatus: OrderStatus;\n onOrderCancel: (order) => void;\n brandLogoConfiguration: any;\n};\n\nexport const OrderPaymentMethods = ({ order, orderStatus, onOrderCancel, brandLogoConfiguration }: Readonly<OrderPaymentMethodsProps>) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div>\n <ul className={'adyen-checkout__order-payment-methods-list'}>\n {orderStatus?.paymentMethods?.map((orderPaymentMethod, index) => (\n <li key={`${orderPaymentMethod.type}-${index}`} className=\"adyen-checkout__order-payment-method\">\n <div className=\"adyen-checkout__order-payment-method__header\">\n <div className=\"adyen-checkout__payment-method__header__title\">\n <PaymentMethodIcon\n altDescription={orderPaymentMethod.name}\n type={orderPaymentMethod.type}\n src={brandLogoConfiguration[orderPaymentMethod.type] || getImage()(orderPaymentMethod.type)}\n />\n {orderPaymentMethod.label ? `${orderPaymentMethod.label}` : `•••• ${orderPaymentMethod.lastFour}`}\n </div>\n\n {onOrderCancel && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={() => {\n onOrderCancel({ order });\n }}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n </div>\n <div className=\"adyen-checkout__order-payment-method__details\">\n <div className=\"adyen-checkout__order-payment-method__deducted-amount\">\n <
|
|
1
|
+
{"version":3,"file":"OrderPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/OrderPaymentMethods.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodIcon from './PaymentMethodIcon';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport './OrderPaymentMethods.scss';\nimport { Order, OrderStatus } from '../../../../types';\n\ntype OrderPaymentMethodsProps = {\n order: Order;\n orderStatus: OrderStatus;\n onOrderCancel: (order) => void;\n brandLogoConfiguration: any;\n};\n\nexport const OrderPaymentMethods = ({ order, orderStatus, onOrderCancel, brandLogoConfiguration }: Readonly<OrderPaymentMethodsProps>) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div>\n <ul className={'adyen-checkout__order-payment-methods-list'}>\n {orderStatus?.paymentMethods?.map((orderPaymentMethod, index) => (\n <li key={`${orderPaymentMethod.type}-${index}`} className=\"adyen-checkout__order-payment-method\">\n <div className=\"adyen-checkout__order-payment-method__header\">\n <div className=\"adyen-checkout__payment-method__header__title\">\n <PaymentMethodIcon\n altDescription={orderPaymentMethod.name}\n type={orderPaymentMethod.type}\n src={brandLogoConfiguration[orderPaymentMethod.type] || getImage()(orderPaymentMethod.type)}\n />\n {orderPaymentMethod.label ? `${orderPaymentMethod.label}` : `•••• ${orderPaymentMethod.lastFour}`}\n </div>\n\n {onOrderCancel && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={() => {\n onOrderCancel({ order });\n }}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n </div>\n <div className=\"adyen-checkout__order-payment-method__details\">\n <div className=\"adyen-checkout__order-payment-method__deducted-amount\">\n <span className=\"adyen-checkout__order-payment-method__deducted-amount__label\">{i18n.get('deductedBalance')}</span>\n <span className=\"adyen-checkout__order-payment-method__deducted-amount__value\">\n {i18n.amount(orderPaymentMethod.amount.value, orderPaymentMethod.amount.currency)}\n </span>\n </div>\n </div>\n </li>\n ))}\n </ul>\n\n {orderStatus.remainingAmount && (\n <p className=\"adyen-checkout__order-remaining-amount\">\n {i18n.get('partialPayment.warning')}{' '}\n <strong>{i18n.amount(orderStatus.remainingAmount.value, orderStatus.remainingAmount.currency)}</strong>\n </p>\n )}\n </div>\n );\n};\n\nexport default OrderPaymentMethods;\n"],"names":["OrderPaymentMethods","order","orderStatus","onOrderCancel","brandLogoConfiguration","i18n","useCoreContext","getImage","useImage","h","div","ul","className","paymentMethods","map","orderPaymentMethod","index","li","key","type","PaymentMethodIcon","altDescription","name","src","label","lastFour","button","onClick","get","span","amount","value","currency","remainingAmount","p","strong"],"mappings":"+OAcO,MAAMA,EAAsB,EAAGC,QAAOC,cAAaC,gBAAeC,6BACrE,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAEjB,OACIC,EAACC,WACGD,EAACE,KAAAA,CAAGC,UAAW,8CACVV,GAAaW,gBAAgBC,IAAI,CAACC,EAAoBC,IACnDP,EAACQ,KAAAA,CAAGC,IAAK,GAAGH,EAAmBI,QAAQH,IAASJ,UAAU,wCACtDH,EAACC,MAAAA,CAAIE,UAAU,gDACXH,EAACC,MAAAA,CAAIE,UAAU,iDACXH,EAACW,EAAAA,CACGC,eAAgBN,EAAmBO,KACnCH,KAAMJ,EAAmBI,KACzBI,IAAKnB,EAAuBW,EAAmBI,OAASZ,IAAWQ,EAAmBI,QAEzFJ,EAAmBS,MAAQ,GAAGT,EAAmBS,QAAU,QAAQT,EAAmBU,YAG1FtB,GACGM,EAACiB,SAAAA,CACGP,KAAK,SACLP,UAAU,qFACVe,QAAS,KACLxB,EAAc,CAAEF,YAGnBI,EAAKuB,IAAI,wCAItBnB,EAACC,MAAAA,CAAIE,UAAU,iDACXH,EAACC,MAAAA,CAAIE,UAAU,yDACXH,EAACoB,OAAAA,CAAKjB,UAAU,gEAAgEP,EAAKuB,IAAI,oBACzFnB,EAACoB,OAAAA,CAAKjB,UAAU,gEACXP,EAAKyB,OAAOf,EAAmBe,OAAOC,MAAOhB,EAAmBe,OAAOE,gBAQ/F9B,EAAY+B,iBACTxB,EAACyB,IAAAA,CAAEtB,UAAU,0CACRP,EAAKuB,IAAI,0BAA2B,IACrCnB,EAAC0B,cAAQ9B,EAAKyB,OAAO5B,EAAY+B,gBAAgBF,MAAO7B,EAAY+B,gBAAgBD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getUrlFromMap as n}from"../../../core/Environment/Environment.js";import{CDN_ENVIRONMENTS as e}from"../../../core/Environment/constants.js";import s from"../../../core/Errors/AdyenCheckoutError.js";import t from"../../../utils/Script.js";function r(n,e,s){return e in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}class i{isAvailable(){return null!=this.AdyenPasskey}async load(){if(this.isAvailable())return this.AdyenPasskey;try{const s=n(this.environment,e),r=new t({src:`${s}${i.PASSKEY_SDK_URL}`,component:"paybybank_pix",analytics:this.analytics});return await r.load(),this.AdyenPasskey=window.AdyenPasskey?.default,this.AdyenPasskey}catch(n){throw new s("SCRIPT_ERROR",`Unable to load script. Message: ${n instanceof Error?n.message:"Unknown error loading Passkey sdk"}`)}}constructor({analytics:n,environment:e}){r(this,"AdyenPasskey",void 0),r(this,"analytics",void 0),r(this,"environment",void 0),this.analytics=n,this.environment=e}}r(i,"PASSKEY_SDK_URL","js/adyenpasskey/1.
|
|
1
|
+
import{getUrlFromMap as n}from"../../../core/Environment/Environment.js";import{CDN_ENVIRONMENTS as e}from"../../../core/Environment/constants.js";import s from"../../../core/Errors/AdyenCheckoutError.js";import t from"../../../utils/Script.js";function r(n,e,s){return e in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}class i{isAvailable(){return null!=this.AdyenPasskey}async load(){if(this.isAvailable())return this.AdyenPasskey;try{const s=n(this.environment,e),r=new t({src:`${s}${i.PASSKEY_SDK_URL}`,component:"paybybank_pix",analytics:this.analytics});return await r.load(),this.AdyenPasskey=window.AdyenPasskey?.default,this.AdyenPasskey}catch(n){throw new s("SCRIPT_ERROR",`Unable to load script. Message: ${n instanceof Error?n.message:"Unknown error loading Passkey sdk"}`)}}constructor({analytics:n,environment:e}){r(this,"AdyenPasskey",void 0),r(this,"analytics",void 0),r(this,"environment",void 0),this.analytics=n,this.environment=e}}r(i,"PASSKEY_SDK_URL","js/adyenpasskey/1.2.0/adyen-passkey.js");export{i as PasskeySdkLoader};
|
|
2
2
|
//# sourceMappingURL=PasskeySdkLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeySdkLoader.js","sources":["../../../../../src/components/PayByBankPix/services/PasskeySdkLoader.ts"],"sourcesContent":["import { IAdyenPasskey } from './types';\nimport { getUrlFromMap } from '../../../core/Environment/Environment';\nimport type { CoreConfiguration } from '../../../core/types';\nimport { CDN_ENVIRONMENTS } from '../../../core/Environment/constants';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Script from '../../../utils/Script';\nimport { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface IPasskeySdkLoader {\n load(environment: CoreConfiguration['environment'], analytics: IAnalytics): Promise<IAdyenPasskey>;\n}\n\nclass PasskeySdkLoader implements IPasskeySdkLoader {\n
|
|
1
|
+
{"version":3,"file":"PasskeySdkLoader.js","sources":["../../../../../src/components/PayByBankPix/services/PasskeySdkLoader.ts"],"sourcesContent":["import { IAdyenPasskey } from './types';\nimport { getUrlFromMap } from '../../../core/Environment/Environment';\nimport type { CoreConfiguration } from '../../../core/types';\nimport { CDN_ENVIRONMENTS } from '../../../core/Environment/constants';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Script from '../../../utils/Script';\nimport { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface IPasskeySdkLoader {\n load(environment: CoreConfiguration['environment'], analytics: IAnalytics): Promise<IAdyenPasskey>;\n}\n\nclass PasskeySdkLoader implements IPasskeySdkLoader {\n public static readonly PASSKEY_SDK_URL = 'js/adyenpasskey/1.2.0/adyen-passkey.js';\n private AdyenPasskey: IAdyenPasskey;\n\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isAvailable(): boolean {\n return this.AdyenPasskey != null;\n }\n\n public async load(): Promise<IAdyenPasskey> {\n if (this.isAvailable()) {\n return this.AdyenPasskey;\n }\n\n try {\n const cdnUrl = getUrlFromMap(this.environment as CoreConfiguration['environment'], CDN_ENVIRONMENTS);\n const url = `${cdnUrl}${PasskeySdkLoader.PASSKEY_SDK_URL}`;\n\n const scriptElement = new Script({\n src: url,\n component: 'paybybank_pix',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n this.AdyenPasskey = window.AdyenPasskey?.default;\n return this.AdyenPasskey;\n } catch (e: unknown) {\n throw new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script. Message: ${e instanceof Error ? e.message : 'Unknown error loading Passkey sdk'}`\n );\n }\n }\n}\n\nexport { PasskeySdkLoader };\n"],"names":["PasskeySdkLoader","isAvailable","this","AdyenPasskey","load","cdnUrl","getUrlFromMap","environment","CDN_ENVIRONMENTS","scriptElement","Script","src","PASSKEY_SDK_URL","component","analytics","window","default","e","AdyenCheckoutError","Error","message","constructor","_define_property"],"mappings":"6WAYA,MAAMA,EAYMC,WAAAA,GACJ,OAA4B,MAArBC,KAAKC,YAChB,CAEA,UAAaC,GACT,GAAIF,KAAKD,cACL,OAAOC,KAAKC,aAGhB,IACI,MAAME,EAASC,EAAcJ,KAAKK,YAAiDC,GAG7EC,EAAgB,IAAIC,EAAO,CAC7BC,IAHQ,GAAGN,IAASL,EAAiBY,kBAIrCC,UAAW,gBACXC,UAAWZ,KAAKY,YAKpB,aAFML,EAAcL,OACpBF,KAAKC,aAAeY,OAAOZ,cAAca,QAClCd,KAAKC,YAChB,CAAE,MAAOc,GACL,MAAM,IAAIC,EACN,eACA,mCAAmCD,aAAaE,MAAQF,EAAEG,QAAU,sCAE5E,CACJ,CAjCA,WAAAC,EAAYP,UAAEA,EAASP,YAAEA,IALzBe,EAAApB,KAAQC,uBAERmB,EAAApB,KAAiBY,oBACjBQ,EAAApB,KAAiBK,sBAGbL,KAAKY,UAAYA,EACjBZ,KAAKK,YAAcA,CACvB,EATAe,EADEtB,EACqBY,kBAAkB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as r}from"../../../external/preact/dist/preact.js";import{useState as a}from"../../../external/preact/hooks/dist/hooks.js";import e from"../../../_virtual/index.js";import
|
|
1
|
+
import{createElement as r}from"../../../external/preact/dist/preact.js";import{useState as a}from"../../../external/preact/hooks/dist/hooks.js";import e from"../../../_virtual/index.js";import t from"../Img/Img.js";const s=({url:s,alt:o,wrapperClassName:m="",imgClassName:p="",showOnError:n})=>{const[c,l]=a(!1),d=e("adyen-checkout-brand-wrapper",m,n?{}:{"adyen-checkout-brand-wrapper--error":c});return r("span",{className:d,"data-testid":"brand-image-wrapper"},r(t,{className:p,src:s,alt:o,onError:()=>l(!0)}))};export{s as default};
|
|
2
2
|
//# sourceMappingURL=Brand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Brand.js","sources":["../../../../../src/components/internal/Brand/Brand.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport cx from 'classnames';\nimport Img from '../Img';\nimport './Brand.scss';\n\ninterface BrandProps {\n url: string;\n alt: string;\n wrapperClassName?: string;\n imgClassName?: string;\n showOnError?: boolean;\n}\n\nconst Brand = ({ url, alt, wrapperClassName = '', imgClassName = '', showOnError }: Readonly<BrandProps>) => {\n const [hasError, setHasError] = useState(false);\n const classesOnError = showOnError ? {} : { 'adyen-checkout-brand-wrapper--error': hasError };\n const classes = cx('adyen-checkout-brand-wrapper', wrapperClassName, classesOnError);\n\n return (\n <span className={classes}>\n <Img className={imgClassName} src={url} alt={alt} onError={() => setHasError(true)} />\n </span>\n );\n};\n\nexport default Brand;\n"],"names":["Brand","url","alt","wrapperClassName","imgClassName","showOnError","hasError","setHasError","useState","classes","cx","h","span","className","Img","src","onError"],"mappings":"uNAcA,MAAMA,EAAQ,EAAGC,MAAKC,MAAKC,mBAAmB,GAAIC,eAAe,GAAIC,kBACjE,MAAOC,EAAUC,GAAeC,GAAS,GAEnCC,EAAUC,EAAG,+BAAgCP,EAD5BE,EAAc,GAAK,CAAE,sCAAuCC,IAGnF,OACIK,EAACC,OAAAA,CAAKC,UAAWJ,
|
|
1
|
+
{"version":3,"file":"Brand.js","sources":["../../../../../src/components/internal/Brand/Brand.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport cx from 'classnames';\nimport Img from '../Img';\nimport './Brand.scss';\n\ninterface BrandProps {\n url: string;\n alt: string;\n wrapperClassName?: string;\n imgClassName?: string;\n showOnError?: boolean;\n}\n\nconst Brand = ({ url, alt, wrapperClassName = '', imgClassName = '', showOnError }: Readonly<BrandProps>) => {\n const [hasError, setHasError] = useState(false);\n const classesOnError = showOnError ? {} : { 'adyen-checkout-brand-wrapper--error': hasError };\n const classes = cx('adyen-checkout-brand-wrapper', wrapperClassName, classesOnError);\n\n return (\n <span className={classes} data-testid=\"brand-image-wrapper\">\n <Img className={imgClassName} src={url} alt={alt} onError={() => setHasError(true)} />\n </span>\n );\n};\n\nexport default Brand;\n"],"names":["Brand","url","alt","wrapperClassName","imgClassName","showOnError","hasError","setHasError","useState","classes","cx","h","span","className","data-testid","Img","src","onError"],"mappings":"uNAcA,MAAMA,EAAQ,EAAGC,MAAKC,MAAKC,mBAAmB,GAAIC,eAAe,GAAIC,kBACjE,MAAOC,EAAUC,GAAeC,GAAS,GAEnCC,EAAUC,EAAG,+BAAgCP,EAD5BE,EAAc,GAAK,CAAE,sCAAuCC,IAGnF,OACIK,EAACC,OAAAA,CAAKC,UAAWJ,EAASK,cAAY,uBAClCH,EAACI,EAAAA,CAAIF,UAAWT,EAAcY,IAAKf,EAAKC,IAAKA,EAAKe,QAAS,IAAMV,GAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as o}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{createButtonLabel as e,createSecondaryLabel as s}from"./utils.js";import a from"./components/SecondaryButtonLabel.js";import{useAmount as m,useSecondaryAmount as i}from"../../../core/Context/AmountProvider.js";import{isAmountValid as n}from"../../../utils/amount-util.js";const l=({customAmount:l,classNameModifiers:u=[],label:c,...d})=>{const{amount:p,isZeroAuth:f}=m(),{secondaryAmount:j}=i(),{i18n:b}=r(),x=e(b,c,p,f,l),A=s(b,j,n(p),f,c),y=d.disabled||"loading"===d.status;return o(t,{...d,disabled:y,classNameModifiers:[...u,"pay"],label:x},A&&o(a,{label:A}))};export{l as default};
|
|
1
|
+
import{createElement as o}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{createButtonLabel as e,createSecondaryLabel as s}from"./utils.js";import a from"./components/SecondaryButtonLabel.js";import{useAmount as m,useSecondaryAmount as i}from"../../../core/Context/AmountProvider.js";import{isAmountValid as n}from"../../../utils/amount-util.js";const l=({customAmount:l,classNameModifiers:u=[],label:c,...d})=>{const{amount:p,isZeroAuth:f}=m(),{secondaryAmount:j}=i(),{i18n:b}=r(),x=e(b,c,p,f,l,j),A=s(b,j,n(p),f,c),y=d.disabled||"loading"===d.status;return o(t,{...d,disabled:y,classNameModifiers:[...u,"pay"],label:x},A&&o(a,{label:A}))};export{l as default};
|
|
2
2
|
//# sourceMappingURL=PayButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { createButtonLabel, createSecondaryLabel } from './utils';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\nimport { useAmount, useSecondaryAmount } from '../../../core/Context/AmountProvider';\nimport type { PaymentAmount } from '../../../types';\nimport { isAmountValid } from '../../../utils/amount-util';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n /**\n * Custom amount that can be passed to the button.\n * This is useful when the amount is not available in the amount provider, such as Giftcard scenario where\n * we need to display the remaining amount\n */\n customAmount?: PaymentAmount;\n label?: string;\n status?: string;\n disabled?: boolean;\n icon?: string;\n
|
|
1
|
+
{"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { createButtonLabel, createSecondaryLabel } from './utils';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\nimport { useAmount, useSecondaryAmount } from '../../../core/Context/AmountProvider';\nimport type { PaymentAmount } from '../../../types';\nimport { isAmountValid } from '../../../utils/amount-util';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n /**\n * Custom amount that can be passed to the button.\n * This is useful when the amount is not available in the amount provider, such as Giftcard scenario where\n * we need to display the remaining amount\n */\n customAmount?: PaymentAmount;\n label?: string;\n status?: string;\n disabled?: boolean;\n icon?: string;\n}\n\nconst PayButton = ({ customAmount, classNameModifiers = [], label, ...props }: Readonly<PayButtonProps>) => {\n const { amount, isZeroAuth } = useAmount();\n const { secondaryAmount } = useSecondaryAmount();\n const { i18n } = useCoreContext();\n\n const buttonLabel = createButtonLabel(i18n, label, amount, isZeroAuth, customAmount, secondaryAmount);\n const secondaryAmountLabel = createSecondaryLabel(i18n, secondaryAmount, isAmountValid(amount), isZeroAuth, label);\n\n const isDisabled = props.disabled || props.status === 'loading';\n\n return (\n <Button {...props} disabled={isDisabled} classNameModifiers={[...classNameModifiers, 'pay']} label={buttonLabel}>\n {secondaryAmountLabel && <SecondaryButtonLabel label={secondaryAmountLabel} />}\n </Button>\n );\n};\n\nexport default PayButton;\n"],"names":["PayButton","customAmount","classNameModifiers","label","props","amount","isZeroAuth","useAmount","secondaryAmount","useSecondaryAmount","i18n","useCoreContext","buttonLabel","createButtonLabel","secondaryAmountLabel","createSecondaryLabel","isAmountValid","isDisabled","disabled","status","h","Button","SecondaryButtonLabel"],"mappings":"ycA2BA,MAAMA,EAAY,EAAGC,eAAcC,qBAAqB,GAAIC,WAAUC,MAClE,MAAMC,OAAEA,EAAMC,WAAEA,GAAeC,KACzBC,gBAAEA,GAAoBC,KACtBC,KAAEA,GAASC,IAEXC,EAAcC,EAAkBH,EAAMP,EAAOE,EAAQC,EAAYL,EAAcO,GAC/EM,EAAuBC,EAAqBL,EAAMF,EAAiBQ,EAAcX,GAASC,EAAYH,GAEtGc,EAAab,EAAMc,UAA6B,YAAjBd,EAAMe,OAE3C,OACIC,EAACC,EAAAA,IAAWjB,EAAOc,SAAUD,EAAYf,mBAAoB,IAAIA,EAAoB,OAAQC,MAAOS,GAC/FE,GAAwBM,EAACE,EAAAA,CAAqBnB,MAAOW"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const r="/ ",n=(r,n)=>n?.value&&n?.currency?r.amount(n.value,n.currency,{currencyDisplay:n.currencyDisplay||"symbol"}):"",
|
|
1
|
+
const r="/ ",n=(r,n)=>n?.value&&n?.currency?r.amount(n.value,n.currency,{currencyDisplay:n.currencyDisplay||"symbol"}):"",t=r=>{const n=r.get("payAmountFormat"),t=n.indexOf("%@");return t>=0&&n.substring(t+2).trim().length>0},e=(r,e,c)=>{const o=n(r,e);if(!o)return r.get("payButton");if(c&&t(r)){const n=u(r,c);return r.get("payAmountFormat").replace("%@",`${o}${n}`)}return r.get("payAmountFormat").replace("%@",o)},u=(r,n)=>{const t=n&&n?.value&&n?.currency?r.amount(n.value,n.currency,{currencyDisplay:n.currencyDisplay||"symbol"}):"";return`${t.length?"/ ":""}${t}`};function c(r,n,t,u,c,o){return n||(c?e(r,c):u?r.get("confirmPreauthorization"):e(r,t,o))}function o(r,n,e,c,o){return c||o||!e||!n||t(r)?null:u(r,n)}export{r as PAY_BTN_DIVIDER,n as amountLabel,c as createButtonLabel,o as createSecondaryLabel,e as payAmountLabel};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/PayButton/utils.ts"],"sourcesContent":["import Language from '../../../language';\nimport type { PaymentAmount } from '../../../types/global-types';\n\nexport const PAY_BTN_DIVIDER = '/ ';\n\nconst amountLabel = (i18n, amount: PaymentAmount) =>\n !!amount?.value && !!amount?.currency ? i18n.amount(amount.value, amount.currency, { currencyDisplay: amount.currencyDisplay || 'symbol' }) : '';\n\nconst payAmountLabel = (i18n: Language, amount: PaymentAmount) =>
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/PayButton/utils.ts"],"sourcesContent":["import Language from '../../../language';\nimport type { PaymentAmount } from '../../../types/global-types';\n\nexport const PAY_BTN_DIVIDER = '/ ';\n\nconst amountLabel = (i18n, amount: PaymentAmount) =>\n !!amount?.value && !!amount?.currency ? i18n.amount(amount.value, amount.currency, { currencyDisplay: amount.currencyDisplay || 'symbol' }) : '';\n\nconst isAmountFirstFormat = (i18n: Language): boolean => {\n const format = i18n.get('payAmountFormat');\n const tokenIndex = format.indexOf('%@');\n return tokenIndex >= 0 && format.substring(tokenIndex + 2).trim().length > 0;\n};\n\nconst payAmountLabel = (i18n: Language, amount: PaymentAmount, secondaryAmount?: PaymentAmount) => {\n const amountLabelValue = amountLabel(i18n, amount);\n if (!amountLabelValue) {\n return i18n.get('payButton');\n }\n\n if (secondaryAmount && isAmountFirstFormat(i18n)) {\n const secondaryAmountValue = formatSecondaryAmountLabel(i18n, secondaryAmount);\n return i18n.get('payAmountFormat').replace('%@', `${amountLabelValue}${secondaryAmountValue}`);\n }\n\n return i18n.get('payAmountFormat').replace('%@', amountLabelValue);\n};\n\nconst formatSecondaryAmountLabel = (i18n: Language, secondaryAmount: PaymentAmount) => {\n const convertedSecondaryAmount =\n secondaryAmount && !!secondaryAmount?.value && !!secondaryAmount?.currency\n ? i18n.amount(secondaryAmount.value, secondaryAmount.currency, { currencyDisplay: secondaryAmount.currencyDisplay || 'symbol' })\n : '';\n\n const divider = convertedSecondaryAmount.length ? PAY_BTN_DIVIDER : '';\n\n return `${divider}${convertedSecondaryAmount}`;\n};\n\nfunction createButtonLabel(\n i18n: Language,\n customLabel: string,\n amount: PaymentAmount,\n isZeroAuth: boolean,\n customAmount?: PaymentAmount,\n secondaryAmount?: PaymentAmount\n): string {\n if (customLabel) {\n return customLabel;\n }\n\n if (customAmount) {\n return payAmountLabel(i18n, customAmount);\n }\n\n return isZeroAuth ? i18n.get('confirmPreauthorization') : payAmountLabel(i18n, amount, secondaryAmount);\n}\n\n/**\n * Show the secondaryLabel if:\n * - it's not zero auth, and\n * - we don't have a predefined label (i.e. redirect, qrcode, await based comps...), and\n * - we do have an amount object (merchant might not be passing this in order to not show the amount on the button), and\n * - we have a secondaryAmount object with some properties, and\n * - the payAmountFormat is not amount-first (e.g. \"%@ betalen\"), since in that case the secondary\n * amount is already embedded in the button label via createButtonLabel\n */\nfunction createSecondaryLabel(\n i18n: Language,\n secondaryAmount: PaymentAmount,\n isAmountValid: boolean,\n isZeroAuth: boolean,\n customLabel: string\n): string | null {\n if (isZeroAuth || customLabel || !isAmountValid || !secondaryAmount) {\n return null;\n }\n\n if (isAmountFirstFormat(i18n)) {\n return null;\n }\n\n return formatSecondaryAmountLabel(i18n, secondaryAmount);\n}\n\nexport { payAmountLabel, amountLabel, createButtonLabel, createSecondaryLabel };\n"],"names":["PAY_BTN_DIVIDER","amountLabel","i18n","amount","value","currency","currencyDisplay","isAmountFirstFormat","format","get","tokenIndex","indexOf","substring","trim","length","payAmountLabel","secondaryAmount","amountLabelValue","secondaryAmountValue","formatSecondaryAmountLabel","replace","convertedSecondaryAmount","createButtonLabel","customLabel","isZeroAuth","customAmount","createSecondaryLabel","isAmountValid"],"mappings":"AAGO,MAAMA,EAAkB,KAEzBC,EAAc,CAACC,EAAMC,IACrBA,GAAQC,OAAWD,GAAQE,SAAWH,EAAKC,OAAOA,EAAOC,MAAOD,EAAOE,SAAU,CAAEC,gBAAiBH,EAAOG,iBAAmB,WAAc,GAE5IC,EAAuBL,IACzB,MAAMM,EAASN,EAAKO,IAAI,mBAClBC,EAAaF,EAAOG,QAAQ,MAClC,OAAOD,GAAc,GAAKF,EAAOI,UAAUF,EAAa,GAAGG,OAAOC,OAAS,GAGzEC,EAAiB,CAACb,EAAgBC,EAAuBa,KAC3D,MAAMC,EAAmBhB,EAAYC,EAAMC,GAC3C,IAAKc,EACD,OAAOf,EAAKO,IAAI,aAGpB,GAAIO,GAAmBT,EAAoBL,GAAO,CAC9C,MAAMgB,EAAuBC,EAA2BjB,EAAMc,GAC9D,OAAOd,EAAKO,IAAI,mBAAmBW,QAAQ,KAAM,GAAGH,IAAmBC,IAC3E,CAEA,OAAOhB,EAAKO,IA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