@adyen/adyen-web 6.32.1 → 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.
@@ -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","_object_spread_props","_object_spread","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","ApplePaySession","sdkLoader","isSdkLoaded","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":"43DAwBA,MAAMA,UAAwBC,EA0CPC,WAAAA,CAAYC,OAQTA,EAEQA,EARAA,EAMcA,EACMA,EAP9C,MAAMC,GAAgC,QAAZD,EAAAA,EAAME,cAANF,IAAAA,OAAAA,EAAAA,EAAcG,QAASC,EAAUJ,EAAME,QAAUF,EAAMC,kBAEjF,OAAOI,EAAAC,EAAA,CAAA,EACAN,GAAAA,CACHO,cAAeP,EAAMO,cACrBN,oBACAO,aAAgC,QAAlBR,EAAAA,EAAMQ,oBAANR,IAAAA,EAAAA,EAAgC,QAAVA,EAAAA,EAAMS,gBAANT,OAAAA,EAAAA,EAAYU,OAChDC,gBAAiBX,EAAMW,kBAAsC,QAAnBX,EAAAA,EAAMO,qBAANP,IAAAA,SAAAA,EAAqBY,cAC/DC,6BAAsBb,EAAAA,EAAMa,gCAANb,EAAAA,EAA+Bc,IAAmB,SAAW,SAE3F,CAKA,UAAAC,GACI,MAAMC,cAAEA,EAAaC,eAAEA,EAAcC,gBAAEA,GAAoBC,KAAKC,OAC1DC,UAAEA,GAAcF,KAAKnB,MAE3B,OAAOM,EAAA,CACHgB,cAAehB,EAAA,CACXiB,KAAM1B,E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H,OAAOW,KAAKpI,MAC/BA,KAAK6D,iBAAmB7D,KAAK6D,iBAAiBuE,KAAKpI,MACnDA,KAAK+E,oCAAsC/E,KAAK+E,oCAAoCqD,KAAKpI,MACzFA,KAAK0E,oBAAsB1E,KAAK0E,oBAAoB0D,KAAKpI,MACzDA,KAAKqC,4BAA8BrC,KAAKqC,4BAA4B+F,KAAKpI,MACzEA,KAAKyC,4BAA8BzC,KAAKyC,4BAA4B2F,KAAKpI,MAEzEA,KAAKwB,UAAY,IAAI6G,EAAkB,CAAErH,UAAWhB,KAAKgB,YAEpDhB,KAAKwB,UACL8G,OACA3D,KAAK3E,KAAKqC,6BACVsC,KAAK3E,KAAKyC,6BACV4C,MAAM3D,IACH1B,KAAK2D,YAAYjC,IAE7B,EApCAmG,EADEnJ,EACqB0B,OAAOmI,EAAWC,UAEzCX,EAHEnJ,EAGwB+J,eAAeA"}
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/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","_object_spread_props","_object_spread","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","ApplePaySession","sdkLoader","isSdkLoaded","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":"43DAwBA,MAAMA,UAAwBC,EA0CPC,WAAAA,CAAYC,OAQTA,EAEQA,EARAA,EAMcA,EACMA,EAP9C,MAAMC,GAAgC,QAAZD,EAAAA,EAAME,cAANF,IAAAA,OAAAA,EAAAA,EAAcG,QAASC,EAAUJ,EAAME,QAAUF,EAAMC,kBAEjF,OAAOI,EAAAC,EAAA,CAAA,EACAN,GAAAA,CACHO,cAAe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AsG,EAAA9H,KAAQsC,6BAAgCsD,GAgFxCkC,EAAA9H,KAAgB0H,SAAS,KACrB,GAAI1H,KAAKnB,MAAMkJ,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,KAAKnB,MAEhF,IAAkB,IAAdqB,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,KAAKwB,UAAY,IAAI8G,EAAkB,CAAEtH,UAAWhB,KAAKgB,YAEpDhB,KAAKwB,UACL+G,OACA3D,KAAK5E,KAAKqC,6BACVuC,KAAK5E,KAAKyC,6BACV6C,MAAM5D,IACH1B,KAAK4D,YAAYlC,IAE7B,EApCAoG,EADEpJ,EACqB0B,OAAOoI,EAAWC,UAEzCX,EAHEpJ,EAGwBgK,eAAeA"}
@@ -1,2 +1,2 @@
1
- function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class t{begin(){return this.session.begin()}onvalidatemerchant(e,t){return new Promise((n,o)=>{t(n,o,e.validationURL)}).then(e=>{this.session.completeMerchantValidation(e)}).catch(e=>{console.error(e),this.session.abort(),this.options.onError(e)})}onpaymentauthorized(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completePayment(e)}).catch(e=>{this.session.completePayment(e)})}onpaymentmethodselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completePaymentMethodSelection(e)}).catch(e=>{this.session.completePaymentMethodSelection(e)})}onshippingcontactselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completeShippingContactSelection(e)}).catch(e=>{this.session.completeShippingContactSelection(e)})}onshippingmethodselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completeShippingMethodSelection(e)}).catch(e=>{this.session.completeShippingMethodSelection(e)})}oncancel(e,t){t(e)}constructor(t,n){e(this,"session",void 0),e(this,"options",void 0),this.options=n,this.session=new ApplePaySession(n.version,t),this.session.onvalidatemerchant=e=>{this.onvalidatemerchant(e,n.onValidateMerchant)},this.session.onpaymentauthorized=e=>{this.onpaymentauthorized(e,n.onPaymentAuthorized)},this.session.oncancel=e=>{this.oncancel(e,n.onCancel)},"function"==typeof n.onPaymentMethodSelected&&(this.session.onpaymentmethodselected=e=>{this.onpaymentmethodselected(e,n.onPaymentMethodSelected)}),"function"==typeof n.onShippingContactSelected&&(this.session.onshippingcontactselected=e=>{this.onshippingcontactselected(e,n.onShippingContactSelected)}),"function"==typeof n.onShippingMethodSelected&&(this.session.onshippingmethodselected=e=>{this.onshippingmethodselected(e,n.onShippingMethodSelected)})}}export{t as default};
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,KAAKC,QAAQoB,gBAAgBD,IAEzC,CAUAE,uBAAAA,CACInB,EACAoB,GAEA,OAAO,IAAIlB,QAAQ,CAACC,EAASC,IAAWgB,EAAwBjB,EAASC,EAAQJ,IAC5EM,KAAMe,IACHxB,KAAKC,QAAQwB,+BAA+B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 {"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,MAAM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EM,KAAM2B,IACHpC,KAAKC,QAAQoC,yBAAyBD,KAEzCxB,MAAOwB,IACJpC,KAAKC,QAAQoC,yBAAyBD,IAElD,CASAE,QAAAA,CAASnC,EAAyBoC,GAC9BA,EAASpC,EACb,CA3KA,WAAAqC,CAAYC,EAAmDzB,GAH/D0B,EAAA1C,KAAQC,kBACRyC,EAAA1C,KAAiBgB,kBAGbhB,KAAKgB,QAAUA,EAEfhB,KAAKC,QAAU,IAAI0C,gBAAgB3B,EAAQ4B,QAASH,GACpDzC,KAAKC,QAAQC,mBAAqBC,IACzBH,KAAKE,mBAAmBC,EAAOa,EAAQZ,qBAEhDJ,KAAKC,QAAQiB,oBAAsBf,IAC1BH,KAAKkB,oBAAoBf,EAAOa,EAAQG,sBAGjDnB,KAAKC,QAAQqC,SAAWnC,IACpBH,KAAKsC,SAASnC,EAAOa,EAAQuB,WAGc,mBAApCvB,EAAQO,0BACfvB,KAAKC,QAAQqB,wBAA0BnB,IAC9BH,KAAKsB,wBAAwBnB,EAAOa,EAAQO,2BAIR,mBAAtCP,EAAQW,4BACf3B,KAAKC,QAAQyB,0BAA4BvB,IAChCH,KAAK0B,0BAA0BvB,EAAOa,EAAQW,6BAIX,mBAArCX,EAAQe,2BACf/B,KAAKC,QAAQ6B,yBAA2B3B,IAC/BH,KAAK8B,yBAAyB3B,EAAOa,EAAQe,4BAIf,mBAAhCf,EAAQmB,sBACfnC,KAAKC,QAAQiC,oBAAsB/B,IAC1BH,KAAKkC,oBAAoB/B,EAAOa,EAAQmB,sBAGzD"}
@@ -1,2 +1,2 @@
1
- import{getDecimalAmount as e}from"../../../utils/amount-util.js";function t(e,t){if(null==e)return{};var n,r,o,i={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}const n=n=>{const{countryCode:r,companyName:o,amount:i}=n,p=t(n,["countryCode","companyName","amount"]),a=(t=>String(e(t.value,t.currency)))(i);return r||console.warn("Apple Pay - Make sure to set the countryCode in the AdyenCheckout configuration or in the Checkout Session creation"),{countryCode:r,currencyCode:i.currency,total:{label:p.totalPriceLabel,amount:a,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}};export{n as preparePaymentRequest};
1
+ import{getDecimalAmount as e}from"../../../utils/amount-util.js";function t(e,t){if(null==e)return{};var n,o,r,i={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);return i}if(i=function(e,t){if(null==e)return{};var n,o,r={},i=Object.getOwnPropertyNames(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);return i}const n=n=>{const{countryCode:o,companyName:r,amount:i}=n,p=t(n,["countryCode","companyName","amount"]),a=(t=>String(e(t.value,t.currency)))(i);return o||console.warn("Apple Pay - Make sure to set the countryCode in the AdyenCheckout configuration or in the Checkout Session creation"),{countryCode:o,currencyCode:i.currency,total:{label:p.totalPriceLabel,amount:a,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{n 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":"krBAIA,MAEaA,EACTC,IAKA,MAAMC,YAAEA,EAAWC,YAAEA,EAAWC,OAAEA,GAAqBH,EAAVI,EAAAA,EAAUJ,EAAAA,wCACjDK,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":"krBAIA,MAEaA,EACTC,IAKA,MAAMC,YAAEA,EAAWC,YAAEA,EAAWC,OAAEA,GAAqBH,EAAVI,EAAAA,EAAUJ,EAAAA,wCACjDK,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
- const e={test:"https://checkoutshopper-test.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.adyen.com/checkoutshopper/"},c={test:"https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/"},t={test:"https://checkoutanalytics-test.adyen.com/checkoutanalytics/",live:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/","live-us":"https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/","live-au":"https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/","live-apse":"https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/","live-in":"https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/",fallback:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/"};export{t as ANALYTICS_ENVIRONMENTS,e as API_ENVIRONMENTS,c as CDN_ENVIRONMENTS};
1
+ const e={test:"https://checkoutshopper-test.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.adyen.com/checkoutshopper/","live-nea":"https://checkoutshopper-live-nea.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.adyen.com/checkoutshopper/"},c={test:"https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/",live:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/","live-us":"https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/","live-au":"https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/","live-apse":"https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/","live-in":"https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/","live-nea":"https://checkoutshopper-live-nea.cdn.adyen.com/checkoutshopper/",fallback:"https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/"},t={test:"https://checkoutanalytics-test.adyen.com/checkoutanalytics/",live:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/","live-us":"https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/","live-au":"https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/","live-apse":"https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/","live-in":"https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/","live-nea":"https://checkoutanalytics-live-nea.adyen.com/checkoutanalytics/",fallback:"https://checkoutanalytics-live.adyen.com/checkoutanalytics/"};export{t as ANALYTICS_ENVIRONMENTS,e as API_ENVIRONMENTS,c as CDN_ENVIRONMENTS};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/core/Environment/constants.ts"],"sourcesContent":["const API_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.adyen.com/checkoutshopper/'\n};\n\nconst CDN_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/'\n};\n\nconst ANALYTICS_ENVIRONMENTS = {\n test: 'https://checkoutanalytics-test.adyen.com/checkoutanalytics/',\n live: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/',\n 'live-us': 'https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/',\n 'live-au': 'https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/',\n 'live-apse': 'https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/',\n 'live-in': 'https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/',\n fallback: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/'\n};\n\nexport { API_ENVIRONMENTS, CDN_ENVIRONMENTS, ANALYTICS_ENVIRONMENTS };\n"],"names":["API_ENVIRONMENTS","test","live","fallback","CDN_ENVIRONMENTS","ANALYTICS_ENVIRONMENTS"],"mappings":"AAAA,MAAMA,EAAmB,CACrBC,KAAM,0DACNC,KAAM,0DACN,UAAW,6DACX,UAAW,6DACX,YAAa,+DACb,UAAW,6DACXC,SAAU,2DAGRC,EAAmB,CACrBH,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACXC,SAAU,+DAGRE,EAAyB,CAC3BJ,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACXC,SAAU"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/core/Environment/constants.ts"],"sourcesContent":["const API_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/',\n 'live-nea': 'https://checkoutshopper-live-nea.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.adyen.com/checkoutshopper/'\n};\n\nconst CDN_ENVIRONMENTS = {\n test: 'https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.cdn.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.cdn.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.cdn.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.cdn.adyen.com/checkoutshopper/',\n 'live-nea': 'https://checkoutshopper-live-nea.cdn.adyen.com/checkoutshopper/',\n fallback: 'https://checkoutshopper-live.cdn.adyen.com/checkoutshopper/'\n};\n\nconst ANALYTICS_ENVIRONMENTS = {\n test: 'https://checkoutanalytics-test.adyen.com/checkoutanalytics/',\n live: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/',\n 'live-us': 'https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/',\n 'live-au': 'https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/',\n 'live-apse': 'https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/',\n 'live-in': 'https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/',\n 'live-nea': 'https://checkoutanalytics-live-nea.adyen.com/checkoutanalytics/',\n fallback: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/'\n};\n\nexport { API_ENVIRONMENTS, CDN_ENVIRONMENTS, ANALYTICS_ENVIRONMENTS };\n"],"names":["API_ENVIRONMENTS","test","live","fallback","CDN_ENVIRONMENTS","ANALYTICS_ENVIRONMENTS"],"mappings":"AAAA,MAAMA,EAAmB,CACrBC,KAAM,0DACNC,KAAM,0DACN,UAAW,6DACX,UAAW,6DACX,YAAa,+DACb,UAAW,6DACX,WAAY,8DACZC,SAAU,2DAGRC,EAAmB,CACrBH,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACX,WAAY,kEACZC,SAAU,+DAGRE,EAAyB,CAC3BJ,KAAM,8DACNC,KAAM,8DACN,UAAW,iEACX,UAAW,iEACX,YAAa,mEACb,UAAW,iEACX,WAAY,kEACZC,SAAU"}
@@ -1,2 +1,2 @@
1
- const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.32.1",o="eslegacy",t=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],r=6e4;export{r as DEFAULT_HTTP_TIMEOUT,e as FALLBACK_CONTEXT,t as GENERIC_OPTIONS,o as LIBRARY_BUNDLE_TYPE,n as LIBRARY_VERSION};
1
+ const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",n="6.33.0",o="eslegacy",t=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],r=6e4;export{r as DEFAULT_HTTP_TIMEOUT,e as FALLBACK_CONTEXT,t as GENERIC_OPTIONS,o as LIBRARY_BUNDLE_TYPE,n as LIBRARY_VERSION};
2
2
  //# sourceMappingURL=config.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/adyen-web",
3
- "version": "6.32.1",
3
+ "version": "6.33.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://docs.adyen.com/checkout",
6
6
  "type": "module",