@adyen/adyen-web 6.10.0 → 6.11.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.
Files changed (49) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +1 -1
  4. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  5. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  6. package/dist/es/components/ApplePay/defaultProps.js +1 -1
  7. package/dist/es/components/ApplePay/defaultProps.js.map +1 -1
  8. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  9. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  10. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  11. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
  13. package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  14. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  18. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  19. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  20. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  21. package/dist/es/core/core.js +1 -1
  22. package/dist/es/index.d.ts +1 -1
  23. package/dist/es/utils/detectInIframe.js +2 -0
  24. package/dist/es/utils/detectInIframe.js.map +1 -0
  25. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  26. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  27. package/dist/es-legacy/components/ApplePay/defaultProps.js +1 -1
  28. package/dist/es-legacy/components/ApplePay/defaultProps.js.map +1 -1
  29. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  30. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  31. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  32. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  33. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
  34. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  35. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  36. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  37. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  38. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  39. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  40. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  41. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  42. package/dist/es-legacy/core/core.js +1 -1
  43. package/dist/es-legacy/utils/detectInIframe.js +2 -0
  44. package/dist/es-legacy/utils/detectInIframe.js.map +1 -0
  45. package/package.json +2 -1
  46. package/dist/es/utils/inIframe.js +0 -2
  47. package/dist/es/utils/inIframe.js.map +0 -1
  48. package/dist/es-legacy/utils/inIframe.js +0 -2
  49. package/dist/es-legacy/utils/inIframe.js.map +0 -1
@@ -1914,7 +1914,7 @@ declare class ApplePayElement extends UIElement<ApplePayConfiguration> {
1914
1914
  /**
1915
1915
  * Formats the component props
1916
1916
  */
1917
- protected formatProps(props: any): ApplePayConfiguration;
1917
+ protected formatProps(props: ApplePayConfiguration): ApplePayConfiguration;
1918
1918
  /**
1919
1919
  * Formats the component data output
1920
1920
  */
@@ -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 i from"./services/ApplePayService.js";import o from"../../utils/base64.js";import r from"./defaultProps.js";import{httpPost as n}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{ANALYTICS_SELECTED_STR as h,ANALYTICS_INSTANT_PAYMENT_BUTTON as u}from"../../core/Analytics/constants.js";import{resolveSupportedVersion as y}from"./utils/resolve-supported-version.js";import{formatApplePayContactToAdyenAddressFormat as m}from"./utils/format-applepay-contact-to-adyen-format.js";import{mapBrands as P}from"./utils/map-adyen-brands-to-applepay-brands.js";import A from"./services/ApplePaySdkLoader.js";function b(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class f extends t{formatProps(e){const t=e.brands?.length?P(e.brands):e.supportedNetworks;return{...e,configuration:e.configuration,supportedNetworks:t,buttonLocale:e.buttonLocale??e.i18n?.locale,totalPriceLabel:e.totalPriceLabel||e.configuration?.merchantName}}formatData(){const{applePayToken:e,billingAddress:t,deliveryAddress:s}=this.state,{isExpress:i}=this.props;return{paymentMethod:{type:f.type,applePayToken:e,...i&&{subtype:"express"}},...t&&{billingAddress:t},...s&&{deliveryAddress:s}}}submitAnalytics(e){super.submitAnalytics({...e},this.props)}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||y(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:o}=this.props,r=a({companyName:this.props.configuration.merchantName,countryCode:this.core.options.countryCode,...this.props}),n=new i(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:o,onValidateMerchant:e||this.validateMerchant,onPaymentAuthorized:(e,t,s)=>{const i=m(s.payment.billingContact),o=m(s.payment.shippingContact,!0);this.setState({applePayToken:btoa(JSON.stringify(s.payment.token.paymentData)),authorizedEvent:s,...i&&{billingAddress:i},...o&&{deliveryAddress:o}}),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 i={...e,error:{applePayError:s}};this.handleFailedResult(i)}))}});return new Promise(((e,t)=>this.props.onClick(e,t))).then((()=>{n.begin()})).catch((()=>({})))}async handleAuthorization(){return new Promise(((e,t)=>{this.props.onAuthorized||e();const{authorizedEvent:s,billingAddress:i,deliveryAddress:o}=this.state;this.props.onAuthorized({authorizedEvent:s,...i&&{billingAddress:i},...o&&{deliveryAddress:o}},{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:i,configuration:r,loadingContext:a,initiative:p}=this.props,{merchantName:l,merchantId:d}=r,c={loadingContext:a,path:`v1/applePay/sessions?clientKey=${i}`},h={displayName:l,domainName:s,initiative:p,merchantIdentifier:d};try{const s=await n(c,h),i=o.decode(s.data);if(i.success){e(JSON.parse(i.data))}else t("Could not decode Apple Pay session")}catch(e){t("Could not get Apple Pay session")}}render(){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),b(this,"sdkLoader",void 0),b(this,"applePayVersionNumber",void 0),b(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:h,target:u}),this.startSession()}));const{isExpress:s,onShippingContactSelected:i,onShippingMethodSelected:o}=this.props;if(!1===s&&(i||o))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 A,this.sdkLoader.load().then(this.defineApplePayVersionNumber).then(this.configureApplePayWebOptions).catch((e=>{this.handleError(e)}))}}b(f,"type",l.applepay),b(f,"defaultProps",r);export{f as default};
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 i from"./services/ApplePayService.js";import o from"../../utils/base64.js";import r from"./defaultProps.js";import{httpPost as n}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{ANALYTICS_SELECTED_STR as h,ANALYTICS_INSTANT_PAYMENT_BUTTON as m}from"../../core/Analytics/constants.js";import{resolveSupportedVersion as y}from"./utils/resolve-supported-version.js";import{formatApplePayContactToAdyenAddressFormat as u}from"./utils/format-applepay-contact-to-adyen-format.js";import{mapBrands as P}from"./utils/map-adyen-brands-to-applepay-brands.js";import A from"./services/ApplePaySdkLoader.js";import{detectInIframe as b}from"../../utils/detectInIframe.js";function f(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class g extends t{formatProps(e){const t=e.brands?.length?P(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??(b()?"window":"modal")}}formatData(){const{applePayToken:e,billingAddress:t,deliveryAddress:s}=this.state,{isExpress:i}=this.props;return{paymentMethod:{type:g.type,applePayToken:e,...i&&{subtype:"express"}},...t&&{billingAddress:t},...s&&{deliveryAddress:s}}}submitAnalytics(e){super.submitAnalytics({...e},this.props)}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||y(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:o}=this.props,r=a({companyName:this.props.configuration.merchantName,countryCode:this.core.options.countryCode,...this.props}),n=new i(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:o,onValidateMerchant:e||this.validateMerchant,onPaymentAuthorized:(e,t,s)=>{const i=u(s.payment.billingContact),o=u(s.payment.shippingContact,!0);this.setState({applePayToken:btoa(JSON.stringify(s.payment.token.paymentData)),authorizedEvent:s,...i&&{billingAddress:i},...o&&{deliveryAddress:o}}),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 i={...e,error:{applePayError:s}};this.handleFailedResult(i)}))}});return new Promise(((e,t)=>this.props.onClick(e,t))).then((()=>{n.begin()})).catch((()=>({})))}async handleAuthorization(){return new Promise(((e,t)=>{this.props.onAuthorized||e();const{authorizedEvent:s,billingAddress:i,deliveryAddress:o}=this.state;this.props.onAuthorized({authorizedEvent:s,...i&&{billingAddress:i},...o&&{deliveryAddress:o}},{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:i,configuration:r,loadingContext:a,initiative:p}=this.props,{merchantName:l,merchantId:d}=r,c={loadingContext:a,path:`v1/applePay/sessions?clientKey=${i}`},h={displayName:l,domainName:s,initiative:p,merchantIdentifier:d};try{const s=await n(c,h),i=o.decode(s.data);if(i.success){e(JSON.parse(i.data))}else t("Could not decode Apple Pay session")}catch(e){t("Could not get Apple Pay session")}}render(){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),f(this,"sdkLoader",void 0),f(this,"applePayVersionNumber",void 0),f(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:h,target:m}),this.startSession()}));const{isExpress:s,onShippingContactSelected:i,onShippingMethodSelected:o}=this.props;if(!1===s&&(i||o))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 A,this.sdkLoader.load().then(this.defineApplePayVersionNumber).then(this.configureApplePayWebOptions).catch((e=>{this.handleError(e)}))}}f(g,"type",l.applepay),f(g,"defaultProps",r);export{g 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 { ANALYTICS_INSTANT_PAYMENT_BUTTON, ANALYTICS_SELECTED_STR } from '../../core/Analytics/constants';\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';\n\nimport type { SendAnalyticsObject } from '../../core/Analytics/types';\nimport type { ApplePayConfiguration, ApplePayElementData, ApplePayPaymentOrderDetails, ApplePaySessionRequest } from './types';\nimport type { ICore } from '../../core/types';\nimport type { PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\n\nconst LATEST_APPLE_PAY_VERSION = 14;\n\nclass ApplePayElement extends UIElement<ApplePayConfiguration> {\n public static type = TxVariants.applepay;\n\n protected static 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();\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 {\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 };\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 submitAnalytics(analyticsObj: SendAnalyticsObject) {\n // Analytics will need to know about this.props.isExpress & this.props.expressPage\n super.submitAnalytics({ ...analyticsObj }, this.props);\n }\n\n public override submit = (): void => {\n // Analytics\n if (this.props.isInstantPayment) {\n this.submitAnalytics({ type: ANALYTICS_SELECTED_STR, target: ANALYTICS_INSTANT_PAYMENT_BUTTON });\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((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, reject) {\n const { hostname: domainName } = window.location;\n const { clientKey, configuration, loadingContext, initiative } = 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,\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 render() {\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","formatData","applePayToken","billingAddress","deliveryAddress","this","state","isExpress","paymentMethod","type","subtype","submitAnalytics","analyticsObj","super","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","renderApplePayCodeAs","onApplePayCodeClose","set","startSession","onValidateMerchant","onPaymentMethodSelected","onShippingMethodSelected","onShippingContactSelected","paymentRequest","preparePaymentRequest","companyName","countryCode","core","options","session","ApplePayService","onError","handleError","onCancel","event","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","domainName","clientKey","loadingContext","initiative","path","request","displayName","response","httpPost","decodedData","base64","decode","success","parse","e","render","showPayButton","h","ApplePayButton","buttonStyle","buttonColor","buttonType","submit","constructor","checkout","_define_property","isInstantPayment","ANALYTICS_SELECTED_STR","target","ANALYTICS_INSTANT_PAYMENT_BUTTON","bind","ApplePaySdkLoader","load","TxVariants","applepay","defaultProps"],"mappings":"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"}
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 { ANALYTICS_INSTANT_PAYMENT_BUTTON, ANALYTICS_SELECTED_STR } from '../../core/Analytics/constants';\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';\n\nimport type { SendAnalyticsObject } from '../../core/Analytics/types';\nimport type { ApplePayConfiguration, ApplePayElementData, ApplePayPaymentOrderDetails, ApplePaySessionRequest } from './types';\nimport type { ICore } from '../../core/types';\nimport type { PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\n\nconst LATEST_APPLE_PAY_VERSION = 14;\n\nclass ApplePayElement extends UIElement<ApplePayConfiguration> {\n public static type = TxVariants.applepay;\n\n protected static 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();\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 submitAnalytics(analyticsObj: SendAnalyticsObject) {\n // Analytics will need to know about this.props.isExpress & this.props.expressPage\n super.submitAnalytics({ ...analyticsObj }, this.props);\n }\n\n public override submit = (): void => {\n // Analytics\n if (this.props.isInstantPayment) {\n this.submitAnalytics({ type: ANALYTICS_SELECTED_STR, target: ANALYTICS_INSTANT_PAYMENT_BUTTON });\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((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, reject) {\n const { hostname: domainName } = window.location;\n const { clientKey, configuration, loadingContext, initiative } = 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,\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 render() {\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","submitAnalytics","analyticsObj","super","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","event","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","domainName","clientKey","loadingContext","initiative","path","request","displayName","response","httpPost","decodedData","base64","decode","success","parse","e","render","showPayButton","h","ApplePayButton","buttonStyle","buttonColor","buttonType","submit","constructor","checkout","_define_property","isInstantPayment","ANALYTICS_SELECTED_STR","target","ANALYTICS_INSTANT_PAYMENT_BUTTON","bind","ApplePaySdkLoader","load","TxVariants","applepay","defaultProps"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{inIframe as t}from"../../utils/inIframe.js";const e={isExpress:!1,amount:{currency:"USD",value:0},totalPriceStatus:"final",initiative:"web",merchantCapabilities:["supports3DS"],supportedNetworks:["amex","discover","masterCard","visa"],buttonType:"plain",buttonColor:"black",renderApplePayCodeAs:t()?"window":"modal",onClick:t=>t()};export{e as default};
1
+ const t={isExpress:!1,amount:{currency:"USD",value:0},totalPriceStatus:"final",initiative:"web",merchantCapabilities:["supports3DS"],supportedNetworks:["amex","discover","masterCard","visa"],buttonType:"plain",buttonColor:"black",onClick:t=>t()};export{t as default};
2
2
  //# sourceMappingURL=defaultProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/ApplePay/defaultProps.ts"],"sourcesContent":["import { ApplePayConfiguration } from './types';\nimport { inIframe } from '../../utils/inIframe';\n\nconst defaultProps: ApplePayConfiguration = {\n isExpress: false,\n amount: { currency: 'USD', value: 0 },\n totalPriceStatus: 'final',\n initiative: 'web',\n merchantCapabilities: ['supports3DS'],\n supportedNetworks: ['amex', 'discover', 'masterCard', 'visa'],\n buttonType: 'plain',\n buttonColor: 'black',\n renderApplePayCodeAs: inIframe() ? 'window' : 'modal',\n onClick: resolve => resolve()\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","amount","currency","value","totalPriceStatus","initiative","merchantCapabilities","supportedNetworks","buttonType","buttonColor","renderApplePayCodeAs","inIframe","onClick","resolve"],"mappings":"mDAGA,MAAMA,EAAsC,CACxCC,WAAW,EACXC,OAAQ,CAAEC,SAAU,MAAOC,MAAO,GAClCC,iBAAkB,QAClBC,WAAY,MACZC,qBAAsB,CAAC,eACvBC,kBAAmB,CAAC,OAAQ,WAAY,aAAc,QACtDC,WAAY,QACZC,YAAa,QACbC,qBAAsBC,IAAa,SAAW,QAC9CC,QAASC,GAAWA"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/ApplePay/defaultProps.ts"],"sourcesContent":["import { ApplePayConfiguration } from './types';\n\nconst defaultProps: ApplePayConfiguration = {\n isExpress: false,\n amount: { currency: 'USD', value: 0 },\n totalPriceStatus: 'final',\n initiative: 'web',\n merchantCapabilities: ['supports3DS'],\n supportedNetworks: ['amex', 'discover', 'masterCard', 'visa'],\n buttonType: 'plain',\n buttonColor: 'black',\n onClick: resolve => resolve()\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","amount","currency","value","totalPriceStatus","initiative","merchantCapabilities","supportedNetworks","buttonType","buttonColor","onClick","resolve"],"mappings":"AAEA,MAAMA,EAAsC,CACxCC,WAAW,EACXC,OAAQ,CAAEC,SAAU,MAAOC,MAAO,GAClCC,iBAAkB,QAClBC,WAAY,MACZC,qBAAsB,CAAC,eACvBC,kBAAmB,CAAC,OAAQ,WAAY,aAAc,QACtDC,WAAY,QACZC,YAAa,QACbC,QAASC,GAAWA"}
@@ -1,2 +1,2 @@
1
- import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as o,getFullBrandName as t}from"../utils.js";import a from"../../../../../core/Context/useImage.js";import{useState as e}from"../../../../../external/preact/hooks/dist/hooks.js";import n from"../../../../../_virtual/index.js";function c({brand:c,brandsConfiguration:i={}}){const s=a(),d="card"===c?"nocard":c,m=i[c]?.icon??o(d,s),[u,p]=e(!1),_=n({"adyen-checkout-card-input__icon":!0,"adyen-checkout__card__cardNumber__brandIcon":!0,"adyen-checkout-card-input__icon--hidden":!u});return r("img",{className:_,onLoad:()=>{p(!0)},onError:()=>{p(!1)},alt:t(c),src:m})}export{c as default};
1
+ import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as o,getFullBrandName as t}from"../utils.js";import a from"../../../../../core/Context/useImage.js";import{useState as e}from"../../../../../external/preact/hooks/dist/hooks.js";import n from"../../../../../_virtual/index.js";function c({brand:c,brandsConfiguration:i={},onClick:s}){const d=a(),m="card"===c?"nocard":c,u=i[c]?.icon??o(m,d),[p,_]=e(!1),l=n({"adyen-checkout-card-input__icon":!0,"adyen-checkout__card__cardNumber__brandIcon":!0,"adyen-checkout-card-input__icon--hidden":!p});return r("img",{className:l,onLoad:()=>{_(!0)},onError:()=>{_(!1)},alt:t(c),src:u,onClick:s})}export{c as default};
2
2
  //# sourceMappingURL=BrandIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useState } from 'preact/hooks';\nimport classNames from 'classnames';\n\nexport default function BrandIcon({ brand, brandsConfiguration = {} }: BrandIconProps) {\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageUrl = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n const [hasLoaded, setHasLoaded] = useState(false);\n\n const handleError = () => {\n setHasLoaded(false);\n };\n\n const handleLoad = () => {\n setHasLoaded(true);\n };\n\n const fieldClassnames = classNames({\n 'adyen-checkout-card-input__icon': true,\n 'adyen-checkout__card__cardNumber__brandIcon': true,\n 'adyen-checkout-card-input__icon--hidden': !hasLoaded\n });\n\n return <img className={fieldClassnames} onLoad={handleLoad} onError={handleError} alt={getFullBrandName(brand)} src={imageUrl} />;\n}\n"],"names":["BrandIcon","brand","brandsConfiguration","getImage","useImage","imageName","imageUrl","icon","getCardImageUrl","hasLoaded","setHasLoaded","useState","fieldClassnames","classNames","h","img","className","onLoad","onError","alt","getFullBrandName","src"],"mappings":"uUAOe,SAASA,GAAUC,MAAEA,EAAKC,oBAAEA,EAAsB,CAAE,IAC/D,MAAMC,EAAWC,IACXC,EAAsB,SAAVJ,EAAmB,SAAWA,EAC1CK,EAAWJ,EAAoBD,IAAQM,MAAQC,EAAgBH,EAAWF,IAEzEM,EAAWC,GAAgBC,GAAS,GAUrCC,EAAkBC,EAAW,CAC/B,mCAAmC,EACnC,+CAA+C,EAC/C,2CAA4CJ,IAGhD,OAAOK,EAACC,MAAAA,CAAIC,UAAWJ,EAAiBK,OAVrB,KACfP,GAAa,EAAA,EAS2CQ,QAdxC,KAChBR,GAAa,EAAA,EAaiES,IAAKC,EAAiBnB,GAAQoB,IAAKf,GACzH"}
1
+ {"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useState } from 'preact/hooks';\nimport classNames from 'classnames';\n\nexport default function BrandIcon({ brand, brandsConfiguration = {}, onClick }: BrandIconProps) {\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageUrl = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n const [hasLoaded, setHasLoaded] = useState(false);\n\n const handleError = () => {\n setHasLoaded(false);\n };\n\n const handleLoad = () => {\n setHasLoaded(true);\n };\n\n const fieldClassnames = classNames({\n 'adyen-checkout-card-input__icon': true,\n 'adyen-checkout__card__cardNumber__brandIcon': true,\n 'adyen-checkout-card-input__icon--hidden': !hasLoaded\n });\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions\n <img className={fieldClassnames} onLoad={handleLoad} onError={handleError} alt={getFullBrandName(brand)} src={imageUrl} onClick={onClick} />\n );\n}\n"],"names":["BrandIcon","brand","brandsConfiguration","onClick","getImage","useImage","imageName","imageUrl","icon","getCardImageUrl","hasLoaded","setHasLoaded","useState","fieldClassnames","classNames","h","img","className","onLoad","onError","alt","getFullBrandName","src"],"mappings":"uUAOe,SAASA,GAAUC,MAAEA,EAAKC,oBAAEA,EAAsB,CAAE,EAAAC,QAAEA,IACjE,MAAMC,EAAWC,IACXC,EAAsB,SAAVL,EAAmB,SAAWA,EAC1CM,EAAWL,EAAoBD,IAAQO,MAAQC,EAAgBH,EAAWF,IAEzEM,EAAWC,GAAgBC,GAAS,GAUrCC,EAAkBC,EAAW,CAC/B,mCAAmC,EACnC,+CAA+C,EAC/C,2CAA4CJ,IAGhD,OAEIK,EAACC,MAAAA,CAAIC,UAAWJ,EAAiBK,OAZlB,KACfP,GAAa,EAAA,EAWwCQ,QAhBrC,KAChBR,GAAa,EAAA,EAe8DS,IAAKC,EAAiBpB,GAAQqB,IAAKf,EAAUJ,QAASA,GAEzI"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_HIDDEN as a,CVC_POLICY_OPTIONAL as c,ENCRYPTED_SECURITY_CODE as l,CVC_POLICY_REQUIRED as n}from"../../../../internal/SecuredFields/lib/constants.js";import d from"./DataSfSpan.js";import{alternativeLabelContent as s}from"./FieldLabelAlternative.js";function u(u){const{label:_,onFocusField:m=()=>{},error:f="",className:p="",classNameModifiers:y=[],focused:C,filled:h,isValid:x,frontCVC:F=!1,cvcPolicy:v=n,showContextualElement:b,contextualText:k}=u,{i18n:j}=r(),V=t(p,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":v===a,"adyen-checkout__field__cvc--optional":v===c}),N=t({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":f,"adyen-checkout__input--focus":C,"adyen-checkout__input--valid":x}),T=v!==c?_:j.get("creditCard.securityCode.label.optional"),E=`${T} ${k}`;return e(i,{label:T,focused:C,filled:h,classNameModifiers:[...y,"securityCode"],onFocusField:()=>m(l),className:V,errorMessage:f,isValid:x,dir:"ltr",name:l,i18n:j,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:s,showContextualElement:b,contextualText:k},e(d,{encryptedFieldType:l,className:N}),e(o,{frontCVC:F,fieldLabel:E}))}export{u as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_HIDDEN as a,CVC_POLICY_OPTIONAL as c,ENCRYPTED_SECURITY_CODE as l,CVC_POLICY_REQUIRED as n}from"../../../../internal/SecuredFields/lib/constants.js";import d from"./DataSfSpan.js";import{alternativeLabelContent as s}from"./FieldLabelAlternative.js";function u(u){const{label:_,onFocusField:m=()=>{},error:f="",className:p="",classNameModifiers:y=[],focused:C,filled:h,isValid:x,frontCVC:F=!1,cvcPolicy:k=n,showContextualElement:v,contextualText:b}=u,{i18n:j}=r(),V=t(p,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":k===a,"adyen-checkout__field__cvc--optional":k===c}),N=t({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":f,"adyen-checkout__input--focus":C,"adyen-checkout__input--valid":x}),T=k!==c?_:j.get("creditCard.securityCode.label.optional"),E=`${T} ${b}`;return e(i,{label:T,focused:C,filled:h,classNameModifiers:[...y,"securityCode"],onFocusField:()=>m(l),className:V,errorMessage:f,isValid:x,dir:"ltr",name:l,i18n:j,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:s,showContextualElement:v,contextualText:b},e(d,{encryptedFieldType:l,className:N}),e(o,{frontCVC:F,fieldLabel:E,onClick:()=>{m(l)}}))}export{u as default};
2
2
  //# sourceMappingURL=CVC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\n\nexport default function CVC(props: CVCProps) {\n const {\n label,\n onFocusField = () => {},\n error = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const imageDescription = `${fieldLabel} ${contextualText}`;\n\n return (\n <Field\n label={fieldLabel}\n focused={focused}\n filled={filled}\n classNameModifiers={[...classNameModifiers, 'securityCode']}\n onFocusField={() => onFocusField(ENCRYPTED_SECURITY_CODE)}\n className={fieldClassnames}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_SECURITY_CODE}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <DataSfSpan encryptedFieldType={ENCRYPTED_SECURITY_CODE} className={cvcClassnames} />\n\n <CVCHint frontCVC={frontCVC} fieldLabel={imageDescription} />\n </Field>\n );\n}\n"],"names":["CVC","props","label","onFocusField","error","className","classNameModifiers","focused","filled","isValid","frontCVC","cvcPolicy","CVC_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","fieldClassnames","classNames","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","cvcClassnames","fieldLabel","get","imageDescription","h","Field","ENCRYPTED_SECURITY_CODE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","CVCHint"],"mappings":"gjBAee,SAASA,EAAIC,GACxB,MAAMC,MACFA,EAAKC,aACLA,EAAe,OAAQC,MACvBA,EAAQ,GAAEC,UACVA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,QACvBA,EAAOC,OACPA,EAAMC,QACNA,EAAOC,SACPA,GAAW,EAAKC,UAChBA,EAAYC,EAAmBC,sBAC/BA,EAAqBC,eACrBA,GACAb,GACEc,KAAEA,GAASC,IAEXC,EAAkBC,EAAWb,EAAW,CAC1C,8BAA8B,EAC9B,2CAA4CM,IAAcQ,EAC1D,uCAAwCR,IAAcS,IAGpDC,EAAgBH,EAAW,CAC7B,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCd,EAChC,+BAAgCG,EAChC,+BAAgCE,IAG9Ba,EAAaX,IAAcS,EAAsBlB,EAAQa,EAAKQ,IAAI,0CAElEC,EAAmB,GAAGF,KAAcR,IAE1C,OACIW,EAACC,EAAAA,CACGxB,MAAOoB,EACPf,QAASA,EACTC,OAAQA,EACRF,mBAAoB,IAAIA,EAAoB,gBAC5CH,aAAc,IAAMA,EAAawB,GACjCtB,UAAWY,EACXW,aAAcxB,EACdK,QAASA,EACToB,IAAK,MACLC,KAAMH,EACNZ,KAAMA,EACNgB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BrB,sBAAuBA,EACvBC,eAAgBA,GAEhBW,EAACU,EAAAA,CAAWC,mBAAoBT,EAAyBtB,UAAWgB,IAEpEI,EAACY,EAAAA,CAAQ3B,SAAUA,EAAUY,WAAYE,IAGrD"}
1
+ {"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\n\nexport default function CVC(props: CVCProps) {\n const {\n label,\n onFocusField = () => {},\n error = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_SECURITY_CODE);\n };\n\n const imageDescription = `${fieldLabel} ${contextualText}`;\n\n return (\n <Field\n label={fieldLabel}\n focused={focused}\n filled={filled}\n classNameModifiers={[...classNameModifiers, 'securityCode']}\n onFocusField={() => onFocusField(ENCRYPTED_SECURITY_CODE)}\n className={fieldClassnames}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_SECURITY_CODE}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <DataSfSpan encryptedFieldType={ENCRYPTED_SECURITY_CODE} className={cvcClassnames} />\n\n <CVCHint frontCVC={frontCVC} fieldLabel={imageDescription} onClick={handleIconClick} />\n </Field>\n );\n}\n"],"names":["CVC","props","label","onFocusField","error","className","classNameModifiers","focused","filled","isValid","frontCVC","cvcPolicy","CVC_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","fieldClassnames","classNames","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","cvcClassnames","fieldLabel","get","imageDescription","h","Field","ENCRYPTED_SECURITY_CODE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","CVCHint","onClick"],"mappings":"gjBAee,SAASA,EAAIC,GACxB,MAAMC,MACFA,EAAKC,aACLA,EAAe,OAAQC,MACvBA,EAAQ,GAAEC,UACVA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,QACvBA,EAAOC,OACPA,EAAMC,QACNA,EAAOC,SACPA,GAAW,EAAKC,UAChBA,EAAYC,EAAmBC,sBAC/BA,EAAqBC,eACrBA,GACAb,GACEc,KAAEA,GAASC,IAEXC,EAAkBC,EAAWb,EAAW,CAC1C,8BAA8B,EAC9B,2CAA4CM,IAAcQ,EAC1D,uCAAwCR,IAAcS,IAGpDC,EAAgBH,EAAW,CAC7B,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCd,EAChC,+BAAgCG,EAChC,+BAAgCE,IAG9Ba,EAAaX,IAAcS,EAAsBlB,EAAQa,EAAKQ,IAAI,0CAMlEC,EAAmB,GAAGF,KAAcR,IAE1C,OACIW,EAACC,EAAAA,CACGxB,MAAOoB,EACPf,QAASA,EACTC,OAAQA,EACRF,mBAAoB,IAAIA,EAAoB,gBAC5CH,aAAc,IAAMA,EAAawB,GACjCtB,UAAWY,EACXW,aAAcxB,EACdK,QAASA,EACToB,IAAK,MACLC,KAAMH,EACNZ,KAAMA,EACNgB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BrB,sBAAuBA,EACvBC,eAAgBA,GAEhBW,EAACU,EAAAA,CAAWC,mBAAoBT,EAAyBtB,UAAWgB,IAEpEI,EAACY,EAAAA,CAAQ3B,SAAUA,EAAUY,WAAYE,EAAkBc,QA3B3C,KACpBnC,EAAawB,EAAAA,IA6BrB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../../../external/preact/dist/preact.js";import c from"../../../../../_virtual/index.js";function e({frontCVC:e=!1,fieldLabel:_}){const i=c({"adyen-checkout__card__cvc__hint__wrapper":!0,"adyen-checkout__field__cvc--front-hint":!!e,"adyen-checkout__field__cvc--back-hint":!e});return t("span",{className:i},t("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!e,role:"img"},t("title",{id:"adyen-checkout__cvc__front-hint-img"},_),t("path",{d:"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z",fill:"#E6E9EB"}),t("rect",{x:"4",y:"12",width:"19",height:"2",fill:"#B9C4C9"}),t("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1",fill:"white"}),t("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"4.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})),t("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!!e,role:"img"},t("title",{id:"adyen-checkout__cvc__back-hint-img"},_),t("path",{d:"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z",fill:"#E6E9EB"}),t("path",{d:"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z",fill:"#E6E9EB"}),t("rect",{y:"4.00012",width:"27",height:"3.00001",fill:"#687282"}),t("path",{d:"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z",fill:"white"}),t("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"9.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})))}export{e as default};
1
+ import{createElement as t}from"../../../../../external/preact/dist/preact.js";import c from"../../../../../_virtual/index.js";function e({frontCVC:e=!1,fieldLabel:_,onClick:i}){const h=c({"adyen-checkout__card__cvc__hint__wrapper":!0,"adyen-checkout__field__cvc--front-hint":!!e,"adyen-checkout__field__cvc--back-hint":!e});return t("span",{className:h,onClick:i},t("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!e,role:"img"},t("title",{id:"adyen-checkout__cvc__front-hint-img"},_),t("path",{d:"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z",fill:"#E6E9EB"}),t("rect",{x:"4",y:"12",width:"19",height:"2",fill:"#B9C4C9"}),t("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1",fill:"white"}),t("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"4.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})),t("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!!e,role:"img"},t("title",{id:"adyen-checkout__cvc__back-hint-img"},_),t("path",{d:"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z",fill:"#E6E9EB"}),t("path",{d:"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z",fill:"#E6E9EB"}),t("rect",{y:"4.00012",width:"27",height:"3.00001",fill:"#687282"}),t("path",{d:"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z",fill:"white"}),t("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"9.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})))}export{e as default};
2
2
  //# sourceMappingURL=CVCHint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CVCHint.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVCHint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport { CVCHintProps } from './types';\n\nexport default function CVCHint({ frontCVC = false, fieldLabel }: CVCHintProps) {\n const hintClassnames = classNames({\n 'adyen-checkout__card__cvc__hint__wrapper': true,\n 'adyen-checkout__field__cvc--front-hint': !!frontCVC,\n 'adyen-checkout__field__cvc--back-hint': !frontCVC\n });\n\n return (\n <span className={hintClassnames}>\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front'}\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={!frontCVC}\n role={'img'}\n >\n <title id={'adyen-checkout__cvc__front-hint-img'}>{fieldLabel}</title>\n <path\n d=\"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z\"\n fill=\"#E6E9EB\"\n />\n <rect x=\"4\" y=\"12\" width=\"19\" height=\"2\" fill=\"#B9C4C9\" />\n <rect x=\"4\" y=\"4\" width=\"4\" height=\"4\" rx=\"1\" fill=\"white\" />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"4.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back'}\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={!!frontCVC}\n role={'img'}\n >\n <title id={'adyen-checkout__cvc__back-hint-img'}>{fieldLabel}</title>\n <path\n d=\"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z\"\n fill=\"#E6E9EB\"\n />\n <path\n d=\"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z\"\n fill=\"#E6E9EB\"\n />\n <rect y=\"4.00012\" width=\"27\" height=\"3.00001\" fill=\"#687282\" />\n <path\n d=\"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z\"\n fill=\"white\"\n />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"9.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n </span>\n );\n}\n"],"names":["CVCHint","frontCVC","fieldLabel","hintClassnames","classNames","h","span","className","svg","width","height","viewBox","fill","xmlns","aria-hidden","role","title","id","path","d","rect","x","y","rx","stroke"],"mappings":"8HAIe,SAASA,GAAQC,SAAEA,GAAW,EAAKC,WAAEA,IAChD,MAAMC,EAAiBC,EAAW,CAC9B,4CAA4C,EAC5C,2CAA4CH,EAC5C,yCAA0CA,IAG9C,OACII,EAACC,OAAAA,CAAKC,UAAWJ,GACbE,EAACG,MAAAA,CACGD,UAAW,yEACXE,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,eAAcb,EACdc,KAAM,OAENV,EAACW,QAAAA,CAAMC,GAAI,uCAAwCf,GACnDG,EAACa,OAAAA,CACGC,EAAE,0HACFP,KAAK,YAETP,EAACe,OAAAA,CAAKC,EAAE,IAAIC,EAAE,KAAKb,MAAM,KAAKC,OAAO,IAAIE,KAAK,YAC9CP,EAACe,OAAAA,CAAKC,EAAE,IAAIC,EAAE,IAAIb,MAAM,IAAIC,OAAO,IAAIa,GAAG,IAAIX,KAAK,UACnDP,EAACe,OAAAA,CAAKb,UAAW,4CAA6Cc,EAAE,OAAOC,EAAE,MAAMb,MAAM,IAAIC,OAAO,IAAIa,GAAG,MAAMC,OAAO,aAGxHnB,EAACG,MAAAA,CACGD,UAAW,wEACXE,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,gBAAeb,EACfc,KAAM,OAENV,EAACW,QAAAA,CAAMC,GAAI,sCAAuCf,GAClDG,EAACa,OAAAA,CACGC,EAAE,wMACFP,KAAK,YAETP,EAACa,OAAAA,CACGC,EAAE,wMACFP,KAAK,YAETP,EAACe,OAAAA,CAAKE,EAAE,UAAUb,MAAM,KAAKC,OAAO,UAAUE,KAAK,YACnDP,EAACa,OAAAA,CACGC,EAAE,6HACFP,KAAK,UAETP,EAACe,OAAAA,CAAKb,UAAW,4CAA6Cc,EAAE,OAAOC,EAAE,MAAMb,MAAM,IAAIC,OAAO,IAAIa,GAAG,MAAMC,OAAO,aAIpI"}
1
+ {"version":3,"file":"CVCHint.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVCHint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport { CVCHintProps } from './types';\n\nexport default function CVCHint({ frontCVC = false, fieldLabel, onClick }: CVCHintProps) {\n const hintClassnames = classNames({\n 'adyen-checkout__card__cvc__hint__wrapper': true,\n 'adyen-checkout__field__cvc--front-hint': !!frontCVC,\n 'adyen-checkout__field__cvc--back-hint': !frontCVC\n });\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <span className={hintClassnames} onClick={onClick}>\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front'}\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={!frontCVC}\n role={'img'}\n >\n <title id={'adyen-checkout__cvc__front-hint-img'}>{fieldLabel}</title>\n <path\n d=\"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z\"\n fill=\"#E6E9EB\"\n />\n <rect x=\"4\" y=\"12\" width=\"19\" height=\"2\" fill=\"#B9C4C9\" />\n <rect x=\"4\" y=\"4\" width=\"4\" height=\"4\" rx=\"1\" fill=\"white\" />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"4.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back'}\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={!!frontCVC}\n role={'img'}\n >\n <title id={'adyen-checkout__cvc__back-hint-img'}>{fieldLabel}</title>\n <path\n d=\"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z\"\n fill=\"#E6E9EB\"\n />\n <path\n d=\"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z\"\n fill=\"#E6E9EB\"\n />\n <rect y=\"4.00012\" width=\"27\" height=\"3.00001\" fill=\"#687282\" />\n <path\n d=\"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z\"\n fill=\"white\"\n />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"9.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n </span>\n );\n}\n"],"names":["CVCHint","frontCVC","fieldLabel","onClick","hintClassnames","classNames","h","span","className","svg","width","height","viewBox","fill","xmlns","aria-hidden","role","title","id","path","d","rect","x","y","rx","stroke"],"mappings":"8HAIe,SAASA,GAAQC,SAAEA,GAAW,EAAKC,WAAEA,EAAUC,QAAEA,IAC5D,MAAMC,EAAiBC,EAAW,CAC9B,4CAA4C,EAC5C,2CAA4CJ,EAC5C,yCAA0CA,IAG9C,OAEIK,EAACC,OAAAA,CAAKC,UAAWJ,EAAgBD,QAASA,GACtCG,EAACG,MAAAA,CACGD,UAAW,yEACXE,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,eAAcd,EACde,KAAM,OAENV,EAACW,QAAAA,CAAMC,GAAI,uCAAwChB,GACnDI,EAACa,OAAAA,CACGC,EAAE,0HACFP,KAAK,YAETP,EAACe,OAAAA,CAAKC,EAAE,IAAIC,EAAE,KAAKb,MAAM,KAAKC,OAAO,IAAIE,KAAK,YAC9CP,EAACe,OAAAA,CAAKC,EAAE,IAAIC,EAAE,IAAIb,MAAM,IAAIC,OAAO,IAAIa,GAAG,IAAIX,KAAK,UACnDP,EAACe,OAAAA,CAAKb,UAAW,4CAA6Cc,EAAE,OAAOC,EAAE,MAAMb,MAAM,IAAIC,OAAO,IAAIa,GAAG,MAAMC,OAAO,aAGxHnB,EAACG,MAAAA,CACGD,UAAW,wEACXE,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,gBAAed,EACfe,KAAM,OAENV,EAACW,QAAAA,CAAMC,GAAI,sCAAuChB,GAClDI,EAACa,OAAAA,CACGC,EAAE,wMACFP,KAAK,YAETP,EAACa,OAAAA,CACGC,EAAE,wMACFP,KAAK,YAETP,EAACe,OAAAA,CAAKE,EAAE,UAAUb,MAAM,KAAKC,OAAO,UAAUE,KAAK,YACnDP,EAACa,OAAAA,CACGC,EAAE,6HACFP,KAAK,UAETP,EAACe,OAAAA,CAAKb,UAAW,4CAA6Cc,EAAE,OAAOC,EAAE,MAAMb,MAAM,IAAIC,OAAO,IAAIa,GAAG,MAAMC,OAAO,aAIpI"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import n from"../../../../../_virtual/index.js";import a from"./BrandIcon.js";import r from"./DualBrandingIcon/DualBrandingIcon.js";import d from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as o}from"../../../../../core/Context/CoreProvider.js";import i from"./DataSfSpan.js";import{ENCRYPTED_CARD_NUMBER as t}from"../../../../internal/SecuredFields/lib/constants.js";import{alternativeLabelContent as c}from"./FieldLabelAlternative.js";function l(l){const{i18n:s}=o(),{error:u="",isValid:_=!1,onFocusField:m=()=>{},dualBrandingElements:f,dualBrandingChangeHandler:p,dualBrandingSelected:b}=l;return e(d,{label:l.label,focused:l.focused,filled:l.filled,classNameModifiers:["cardNumber"],onFocusField:()=>m(t),errorMessage:u,isValid:_,dir:"ltr",name:t,showValidIcon:!1,i18n:s,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:c},e(i,{encryptedFieldType:t,className:n({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":u,"adyen-checkout__input--focus":l.focused,"adyen-checkout__input--valid":_,"adyen-checkout__card__cardNumber__input--noBrand":!l.showBrandIcon})}),l.showBrandIcon&&!f&&e(a,{brandsConfiguration:l.brandsConfiguration,brand:l.brand}),f&&!u&&e("div",{className:n(["adyen-checkout__card__dual-branding__buttons",{"adyen-checkout__card__dual-branding__buttons--active":_}])},f.map((n=>e(r,{key:n.id,brand:n.id,brandsConfiguration:l.brandsConfiguration,onClick:p,dataValue:n.id,notSelected:""!==b&&b!==n.id})))))}export{l as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import n from"../../../../../_virtual/index.js";import a from"./BrandIcon.js";import r from"./DualBrandingIcon/DualBrandingIcon.js";import d from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as o}from"../../../../../core/Context/CoreProvider.js";import i from"./DataSfSpan.js";import{ENCRYPTED_CARD_NUMBER as t}from"../../../../internal/SecuredFields/lib/constants.js";import{alternativeLabelContent as c}from"./FieldLabelAlternative.js";function l(l){const{i18n:s}=o(),{error:u="",isValid:_=!1,onFocusField:m=()=>{},dualBrandingElements:f,dualBrandingChangeHandler:p,dualBrandingSelected:b}=l;return e(d,{label:l.label,focused:l.focused,filled:l.filled,classNameModifiers:["cardNumber"],onFocusField:()=>m(t),errorMessage:u,isValid:_,dir:"ltr",name:t,showValidIcon:!1,i18n:s,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:c},e(i,{encryptedFieldType:t,className:n({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":u,"adyen-checkout__input--focus":l.focused,"adyen-checkout__input--valid":_,"adyen-checkout__card__cardNumber__input--noBrand":!l.showBrandIcon})}),l.showBrandIcon&&!f&&e(a,{brandsConfiguration:l.brandsConfiguration,brand:l.brand,onClick:()=>{m(t)}}),f&&!u&&e("div",{className:n(["adyen-checkout__card__dual-branding__buttons",{"adyen-checkout__card__dual-branding__buttons--active":_}])},f.map((n=>e(r,{key:n.id,brand:n.id,brandsConfiguration:l.brandsConfiguration,onClick:p,dataValue:n.id,notSelected:""!==b&&b!==n.id})))))}export{l as default};
2
2
  //# sourceMappingURL=CardNumber.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardNumber.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardNumber.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport BrandIcon from './BrandIcon';\nimport DualBrandingIcon from './DualBrandingIcon/DualBrandingIcon';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardNumberProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport { ENCRYPTED_CARD_NUMBER } from '../../../../internal/SecuredFields/lib/constants';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\n\nexport default function CardNumber(props: CardNumberProps) {\n const { i18n } = useCoreContext();\n const { error = '', isValid = false, onFocusField = () => {}, dualBrandingElements, dualBrandingChangeHandler, dualBrandingSelected } = props;\n\n return (\n <Field\n label={props.label}\n focused={props.focused}\n filled={props.filled}\n classNameModifiers={['cardNumber']}\n onFocusField={() => onFocusField(ENCRYPTED_CARD_NUMBER)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_CARD_NUMBER}\n showValidIcon={false}\n i18n={i18n}\n contextVisibleToScreenReader={false} // securedFields have their own, internal, aria-describedby element\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_CARD_NUMBER}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': props.focused,\n 'adyen-checkout__input--valid': isValid,\n 'adyen-checkout__card__cardNumber__input--noBrand': !props.showBrandIcon\n })}\n ></DataSfSpan>\n\n {props.showBrandIcon && !dualBrandingElements && <BrandIcon brandsConfiguration={props.brandsConfiguration} brand={props.brand} />}\n\n {dualBrandingElements && !error && (\n <div\n className={classNames([\n 'adyen-checkout__card__dual-branding__buttons',\n { 'adyen-checkout__card__dual-branding__buttons--active': isValid }\n ])}\n >\n {dualBrandingElements.map(element => (\n <DualBrandingIcon\n key={element.id}\n brand={element.id}\n brandsConfiguration={props.brandsConfiguration}\n onClick={dualBrandingChangeHandler}\n dataValue={element.id}\n notSelected={dualBrandingSelected !== '' && dualBrandingSelected !== element.id}\n />\n ))}\n </div>\n )}\n </Field>\n );\n}\n"],"names":["CardNumber","props","i18n","useCoreContext","error","isValid","onFocusField","dualBrandingElements","dualBrandingChangeHandler","dualBrandingSelected","h","Field","label","focused","filled","classNameModifiers","ENCRYPTED_CARD_NUMBER","errorMessage","dir","name","showValidIcon","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","className","classNames","showBrandIcon","BrandIcon","brandsConfiguration","brand","div","map","element","DualBrandingIcon","key","id","onClick","dataValue","notSelected"],"mappings":"6hBAWe,SAASA,EAAWC,GAC/B,MAAMC,KAAEA,GAASC,KACXC,MAAEA,EAAQ,GAAEC,QAAEA,GAAU,EAAKC,aAAEA,EAAe,OAAQC,qBAAEA,EAAoBC,0BAAEA,EAAyBC,qBAAEA,GAAyBR,EAExI,OACIS,EAACC,EAAAA,CACGC,MAAOX,EAAMW,MACbC,QAASZ,EAAMY,QACfC,OAAQb,EAAMa,OACdC,mBAAoB,CAAC,cACrBT,aAAc,IAAMA,EAAaU,GACjCC,aAAcb,EACdC,QAASA,EACTa,IAAK,MACLC,KAAMH,EACNI,eAAe,EACflB,KAAMA,EACNmB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1Bd,EAACe,EAAAA,CACGC,mBAAoBV,EACpBW,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgCxB,EAChC,+BAAgCH,EAAMY,QACtC,+BAAgCR,EAChC,oDAAqDJ,EAAM4B,kBAIlE5B,EAAM4B,gBAAkBtB,GAAwBG,EAACoB,EAAAA,CAAUC,oBAAqB9B,EAAM8B,oBAAqBC,MAAO/B,EAAM+B,QAExHzB,IAAyBH,GACtBM,EAACuB,MAAAA,CACGN,UAAWC,EAAW,CAClB,+CACA,CAAE,uDAAwDvB,MAG7DE,EAAqB2B,KAAIC,GACtBzB,EAAC0B,EAAAA,CACGC,IAAKF,EAAQG,GACbN,MAAOG,EAAQG,GACfP,oBAAqB9B,EAAM8B,oBAC3BQ,QAAS/B,EACTgC,UAAWL,EAAQG,GACnBG,YAAsC,KAAzBhC,GAA+BA,IAAyB0B,EAAQG,QAOzG"}
1
+ {"version":3,"file":"CardNumber.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardNumber.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport BrandIcon from './BrandIcon';\nimport DualBrandingIcon from './DualBrandingIcon/DualBrandingIcon';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardNumberProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport { ENCRYPTED_CARD_NUMBER } from '../../../../internal/SecuredFields/lib/constants';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\n\nexport default function CardNumber(props: CardNumberProps) {\n const { i18n } = useCoreContext();\n const { error = '', isValid = false, onFocusField = () => {}, dualBrandingElements, dualBrandingChangeHandler, dualBrandingSelected } = props;\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_CARD_NUMBER);\n };\n\n return (\n <Field\n label={props.label}\n focused={props.focused}\n filled={props.filled}\n classNameModifiers={['cardNumber']}\n onFocusField={() => onFocusField(ENCRYPTED_CARD_NUMBER)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_CARD_NUMBER}\n showValidIcon={false}\n i18n={i18n}\n contextVisibleToScreenReader={false} // securedFields have their own, internal, aria-describedby element\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_CARD_NUMBER}\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': props.focused,\n 'adyen-checkout__input--valid': isValid,\n 'adyen-checkout__card__cardNumber__input--noBrand': !props.showBrandIcon\n })}\n ></DataSfSpan>\n\n {props.showBrandIcon && !dualBrandingElements && (\n <BrandIcon brandsConfiguration={props.brandsConfiguration} brand={props.brand} onClick={handleIconClick} />\n )}\n\n {dualBrandingElements && !error && (\n <div\n className={classNames([\n 'adyen-checkout__card__dual-branding__buttons',\n { 'adyen-checkout__card__dual-branding__buttons--active': isValid }\n ])}\n >\n {dualBrandingElements.map(element => (\n <DualBrandingIcon\n key={element.id}\n brand={element.id}\n brandsConfiguration={props.brandsConfiguration}\n onClick={dualBrandingChangeHandler}\n dataValue={element.id}\n notSelected={dualBrandingSelected !== '' && dualBrandingSelected !== element.id}\n />\n ))}\n </div>\n )}\n </Field>\n );\n}\n"],"names":["CardNumber","props","i18n","useCoreContext","error","isValid","onFocusField","dualBrandingElements","dualBrandingChangeHandler","dualBrandingSelected","h","Field","label","focused","filled","classNameModifiers","ENCRYPTED_CARD_NUMBER","errorMessage","dir","name","showValidIcon","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","className","classNames","showBrandIcon","BrandIcon","brandsConfiguration","brand","onClick","div","map","element","DualBrandingIcon","key","id","dataValue","notSelected"],"mappings":"6hBAWe,SAASA,EAAWC,GAC/B,MAAMC,KAAEA,GAASC,KACXC,MAAEA,EAAQ,GAAEC,QAAEA,GAAU,EAAKC,aAAEA,EAAe,OAAQC,qBAAEA,EAAoBC,0BAAEA,EAAyBC,qBAAEA,GAAyBR,EAMxI,OACIS,EAACC,EAAAA,CACGC,MAAOX,EAAMW,MACbC,QAASZ,EAAMY,QACfC,OAAQb,EAAMa,OACdC,mBAAoB,CAAC,cACrBT,aAAc,IAAMA,EAAaU,GACjCC,aAAcb,EACdC,QAASA,EACTa,IAAK,MACLC,KAAMH,EACNI,eAAe,EACflB,KAAMA,EACNmB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1Bd,EAACe,EAAAA,CACGC,mBAAoBV,EACpBW,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgCxB,EAChC,+BAAgCH,EAAMY,QACtC,+BAAgCR,EAChC,oDAAqDJ,EAAM4B,kBAIlE5B,EAAM4B,gBAAkBtB,GACrBG,EAACoB,EAAAA,CAAUC,oBAAqB9B,EAAM8B,oBAAqBC,MAAO/B,EAAM+B,MAAOC,QAnCnE,KACpB3B,EAAaU,EAAAA,IAqCRT,IAAyBH,GACtBM,EAACwB,MAAAA,CACGP,UAAWC,EAAW,CAClB,+CACA,CAAE,uDAAwDvB,MAG7DE,EAAqB4B,KAAIC,GACtB1B,EAAC2B,EAAAA,CACGC,IAAKF,EAAQG,GACbP,MAAOI,EAAQG,GACfR,oBAAqB9B,EAAM8B,oBAC3BE,QAASzB,EACTgC,UAAWJ,EAAQG,GACnBE,YAAsC,KAAzBhC,GAA+BA,IAAyB2B,EAAQG,QAOzG"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as i}from"../../../../../core/Context/CoreProvider.js";import o from"./DataSfSpan.js";import{DATE_POLICY_HIDDEN as n,DATE_POLICY_OPTIONAL as r,ENCRYPTED_EXPIRY_DATE as l,DATE_POLICY_REQUIRED as d}from"../../../../internal/SecuredFields/lib/constants.js";import c from"../../../../../core/Context/useImage.js";import{alternativeLabelContent as _}from"./FieldLabelAlternative.js";function s(s){const{label:p,focused:u,filled:m,onFocusField:f,className:x="",error:h="",isValid:y=!1,expiryDatePolicy:k=d,showContextualElement:F,contextualText:j}=s,{i18n:b}=i(),N=c(),g=t(x,{"adyen-checkout__field__exp-date":!0,"adyen-checkout__card__exp-date__input--hidden":k===n,"adyen-checkout__field__exp-date--optional":k===r}),v=k!==r?p:`${p} ${b.get("field.title.optional")}`,C=`${v} ${j}`;return e(a,{label:v,classNameModifiers:["expiryDate"],className:g,focused:u,filled:m,onFocusField:()=>f(l),errorMessage:h,isValid:y,dir:"ltr",name:"encryptedExpiryDate",i18n:b,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:_,showContextualElement:F,contextualText:j},e(o,{encryptedFieldType:l,className:t("adyen-checkout__input","adyen-checkout__input--small","adyen-checkout__card__exp-date__input",{"adyen-checkout__input--error":h,"adyen-checkout__input--focus":u,"adyen-checkout__input--valid":y})}),e("span",{className:t("adyen-checkout__field__exp-date_hint_wrapper",{"adyen-checkout__field__exp-date_hint_wrapper--hidden":h||y})},e("img",{src:N({imageFolder:"components/"})("expiry_date_hint"),className:"adyen-checkout__field__exp-date_hint",alt:C})))}export{s as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as i}from"../../../../../core/Context/CoreProvider.js";import o from"./DataSfSpan.js";import{DATE_POLICY_HIDDEN as n,DATE_POLICY_OPTIONAL as r,ENCRYPTED_EXPIRY_DATE as l,DATE_POLICY_REQUIRED as d}from"../../../../internal/SecuredFields/lib/constants.js";import c from"../../../../../core/Context/useImage.js";import{alternativeLabelContent as _}from"./FieldLabelAlternative.js";function s(s){const{label:p,focused:u,filled:m,onFocusField:f,className:x="",error:h="",isValid:y=!1,expiryDatePolicy:k=d,showContextualElement:F,contextualText:j}=s,{i18n:b}=i(),C=c(),N=t(x,{"adyen-checkout__field__exp-date":!0,"adyen-checkout__card__exp-date__input--hidden":k===n,"adyen-checkout__field__exp-date--optional":k===r}),g=k!==r?p:`${p} ${b.get("field.title.optional")}`,v=`${g} ${j}`;return e(a,{label:g,classNameModifiers:["expiryDate"],className:N,focused:u,filled:m,onFocusField:()=>f(l),errorMessage:h,isValid:y,dir:"ltr",name:"encryptedExpiryDate",i18n:b,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:_,showContextualElement:F,contextualText:j},e(o,{encryptedFieldType:l,className:t("adyen-checkout__input","adyen-checkout__input--small","adyen-checkout__card__exp-date__input",{"adyen-checkout__input--error":h,"adyen-checkout__input--focus":u,"adyen-checkout__input--valid":y})}),e("span",{className:t("adyen-checkout__field__exp-date_hint_wrapper",{"adyen-checkout__field__exp-date_hint_wrapper--hidden":h||y})},e("img",{src:C({imageFolder:"components/"})("expiry_date_hint"),className:"adyen-checkout__field__exp-date_hint",alt:v,onClick:()=>{f(l)}})))}export{s as default};
2
2
  //# sourceMappingURL=ExpirationDate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpirationDate.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/ExpirationDate.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { ExpirationDateProps } from './types';\nimport DataSfSpan from './DataSfSpan';\n\nimport {\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport useImage from '../../../../../core/Context/useImage';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\n\nexport default function ExpirationDate(props: ExpirationDateProps) {\n const {\n label,\n focused,\n filled,\n onFocusField,\n className = '',\n error = '',\n isValid = false,\n expiryDatePolicy = DATE_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__exp-date': true,\n 'adyen-checkout__card__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN,\n 'adyen-checkout__field__exp-date--optional': expiryDatePolicy === DATE_POLICY_OPTIONAL\n });\n\n const fieldLabel = expiryDatePolicy !== DATE_POLICY_OPTIONAL ? label : `${label} ${i18n.get('field.title.optional')}`;\n\n const imageDescription = `${fieldLabel} ${contextualText}`;\n\n return (\n <Field\n label={fieldLabel}\n classNameModifiers={['expiryDate']}\n className={fieldClassnames}\n focused={focused}\n filled={filled}\n onFocusField={() => onFocusField(ENCRYPTED_EXPIRY_DATE)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={'encryptedExpiryDate'}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_EXPIRY_DATE}\n className={classNames('adyen-checkout__input', 'adyen-checkout__input--small', 'adyen-checkout__card__exp-date__input', {\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n })}\n />\n <span\n className={classNames('adyen-checkout__field__exp-date_hint_wrapper', {\n 'adyen-checkout__field__exp-date_hint_wrapper--hidden': error || isValid\n })}\n >\n <img\n src={getImage({ imageFolder: 'components/' })('expiry_date_hint')}\n className=\"adyen-checkout__field__exp-date_hint\"\n alt={imageDescription}\n />\n </span>\n </Field>\n );\n}\n"],"names":["ExpirationDate","props","label","focused","filled","onFocusField","className","error","isValid","expiryDatePolicy","DATE_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","getImage","useImage","fieldClassnames","classNames","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","fieldLabel","get","imageDescription","h","Field","classNameModifiers","ENCRYPTED_EXPIRY_DATE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","span","img","src","imageFolder","alt"],"mappings":"4kBAgBe,SAASA,EAAeC,GACnC,MAAMC,MACFA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,aACNA,EAAYC,UACZA,EAAY,GAAEC,MACdA,EAAQ,GAAEC,QACVA,GAAU,EAAKC,iBACfA,EAAmBC,EAAoBC,sBACvCA,EAAqBC,eACrBA,GACAX,GACEY,KAAEA,GAASC,IACXC,EAAWC,IAEXC,EAAkBC,EAAWZ,EAAW,CAC1C,mCAAmC,EACnC,gDAAiDG,IAAqBU,EACtE,4CAA6CV,IAAqBW,IAGhEC,EAAaZ,IAAqBW,EAAuBlB,EAAQ,GAAGA,KAASW,EAAKS,IAAI,0BAEtFC,EAAmB,GAAGF,KAAcT,IAE1C,OACIY,EAACC,EAAAA,CACGvB,MAAOmB,EACPK,mBAAoB,CAAC,cACrBpB,UAAWW,EACXd,QAASA,EACTC,OAAQA,EACRC,aAAc,IAAMA,EAAasB,GACjCC,aAAcrB,EACdC,QAASA,EACTqB,IAAK,MACLC,KAAM,sBACNjB,KAAMA,EACNkB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BvB,sBAAuBA,EACvBC,eAAgBA,GAEhBY,EAACW,EAAAA,CACGC,mBAAoBT,EACpBrB,UAAWY,EAAW,wBAAyB,+BAAgC,wCAAyC,CACpH,+BAAgCX,EAChC,+BAAgCJ,EAChC,+BAAgCK,MAGxCgB,EAACa,OAAAA,CACG/B,UAAWY,EAAW,+CAAgD,CAClE,uDAAwDX,GAASC,KAGrEgB,EAACc,MAAAA,CACGC,IAAKxB,EAAS,CAAEyB,YAAa,eAAxBzB,CAAyC,oBAC9CT,UAAU,uCACVmC,IAAKlB,KAKzB"}
1
+ {"version":3,"file":"ExpirationDate.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/ExpirationDate.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { ExpirationDateProps } from './types';\nimport DataSfSpan from './DataSfSpan';\n\nimport {\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport useImage from '../../../../../core/Context/useImage';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\n\nexport default function ExpirationDate(props: ExpirationDateProps) {\n const {\n label,\n focused,\n filled,\n onFocusField,\n className = '',\n error = '',\n isValid = false,\n expiryDatePolicy = DATE_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__exp-date': true,\n 'adyen-checkout__card__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN,\n 'adyen-checkout__field__exp-date--optional': expiryDatePolicy === DATE_POLICY_OPTIONAL\n });\n\n const fieldLabel = expiryDatePolicy !== DATE_POLICY_OPTIONAL ? label : `${label} ${i18n.get('field.title.optional')}`;\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_EXPIRY_DATE);\n };\n\n const imageDescription = `${fieldLabel} ${contextualText}`;\n\n return (\n <Field\n label={fieldLabel}\n classNameModifiers={['expiryDate']}\n className={fieldClassnames}\n focused={focused}\n filled={filled}\n onFocusField={() => onFocusField(ENCRYPTED_EXPIRY_DATE)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={'encryptedExpiryDate'}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_EXPIRY_DATE}\n className={classNames('adyen-checkout__input', 'adyen-checkout__input--small', 'adyen-checkout__card__exp-date__input', {\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n })}\n />\n <span\n className={classNames('adyen-checkout__field__exp-date_hint_wrapper', {\n 'adyen-checkout__field__exp-date_hint_wrapper--hidden': error || isValid\n })}\n >\n {/*eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions*/}\n <img\n src={getImage({ imageFolder: 'components/' })('expiry_date_hint')}\n className=\"adyen-checkout__field__exp-date_hint\"\n alt={imageDescription}\n onClick={handleIconClick}\n />\n </span>\n </Field>\n );\n}\n"],"names":["ExpirationDate","props","label","focused","filled","onFocusField","className","error","isValid","expiryDatePolicy","DATE_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","getImage","useImage","fieldClassnames","classNames","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","fieldLabel","get","imageDescription","h","Field","classNameModifiers","ENCRYPTED_EXPIRY_DATE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","span","img","src","imageFolder","alt","onClick"],"mappings":"4kBAgBe,SAASA,EAAeC,GACnC,MAAMC,MACFA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,aACNA,EAAYC,UACZA,EAAY,GAAEC,MACdA,EAAQ,GAAEC,QACVA,GAAU,EAAKC,iBACfA,EAAmBC,EAAoBC,sBACvCA,EAAqBC,eACrBA,GACAX,GACEY,KAAEA,GAASC,IACXC,EAAWC,IAEXC,EAAkBC,EAAWZ,EAAW,CAC1C,mCAAmC,EACnC,gDAAiDG,IAAqBU,EACtE,4CAA6CV,IAAqBW,IAGhEC,EAAaZ,IAAqBW,EAAuBlB,EAAQ,GAAGA,KAASW,EAAKS,IAAI,0BAMtFC,EAAmB,GAAGF,KAAcT,IAE1C,OACIY,EAACC,EAAAA,CACGvB,MAAOmB,EACPK,mBAAoB,CAAC,cACrBpB,UAAWW,EACXd,QAASA,EACTC,OAAQA,EACRC,aAAc,IAAMA,EAAasB,GACjCC,aAAcrB,EACdC,QAASA,EACTqB,IAAK,MACLC,KAAM,sBACNjB,KAAMA,EACNkB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BvB,sBAAuBA,EACvBC,eAAgBA,GAEhBY,EAACW,EAAAA,CACGC,mBAAoBT,EACpBrB,UAAWY,EAAW,wBAAyB,+BAAgC,wCAAyC,CACpH,+BAAgCX,EAChC,+BAAgCJ,EAChC,+BAAgCK,MAGxCgB,EAACa,OAAAA,CACG/B,UAAWY,EAAW,+CAAgD,CAClE,uDAAwDX,GAASC,KAIrEgB,EAACc,MAAAA,CACGC,IAAKxB,EAAS,CAAEyB,YAAa,eAAxBzB,CAAyC,oBAC9CT,UAAU,uCACVmC,IAAKlB,EACLmB,QA3CQ,KACpBrC,EAAasB,EAAAA,KA+CrB"}
@@ -1,2 +1,2 @@
1
- const e="encrypted",r="encryptedCardNumber",c="encryptedExpiryDate",t="encryptedExpiryMonth",a="encryptedExpiryYear",d="encryptedSecurityCode",i="encryptedPassword",n="encryptedBankAccountNumber",o="encryptedBankLocationId",s="encryptedSecurityCode3digits",y="encryptedSecurityCode4digits",p="giftcard",u="5.5.0",m=["amex","mc","visa"],C=["ach",p],b=[r,c,t,a,d,i],x=[n,o],h=b.concat(x),D=["bcmc"],g="required",k="optional",B="hidden",l=g,v=k,A=B,E=g,M=k,N=B,S="data-cse",f="data-info",j="data-uid",I=["accel","pulse","star","nyce"],w={visa:"VISA",mc:"MasterCard",amex:"American Express",discover:"Discover",cup:"China Union Pay",jcb:"JCB",diners:"Diners Club",maestro:"Maestro",bcmc:"Bancontact card",bijcard:"de Bijenkorf Card"},L={[r]:"cardNumber",[c]:"expiryDate",[d]:"securityCode",[t]:"expiryMonth",[a]:"expiryYear",[i]:"password",[n]:"bankAccountNumber",[o]:"bankLocationId",[s]:"securityCodeThreeDigits",[y]:"securityCodeFourDigits"},P=6e3;export{h as ALL_SECURED_FIELDS,I as BRAND_ICON_UI_EXCLUSION_LIST,w as BRAND_READABLE_NAME_MAP,b as CREDIT_CARD_SF_FIELDS,A as CVC_POLICY_HIDDEN,v as CVC_POLICY_OPTIONAL,l as CVC_POLICY_REQUIRED,S as DATA_ENCRYPTED_FIELD_ATTR,f as DATA_INFO,j as DATA_UID,N as DATE_POLICY_HIDDEN,M as DATE_POLICY_OPTIONAL,E as DATE_POLICY_REQUIRED,D as DEDICATED_CARD_COMPONENTS,m as DEFAULT_CARD_GROUP_TYPES,e as ENCRYPTED,n as ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,o as ENCRYPTED_BANK_LOCATION_FIELD,r as ENCRYPTED_CARD_NUMBER,c as ENCRYPTED_EXPIRY_DATE,t as ENCRYPTED_EXPIRY_MONTH,a as ENCRYPTED_EXPIRY_YEAR,i as ENCRYPTED_PWD_FIELD,d as ENCRYPTED_SECURITY_CODE,s as ENCRYPTED_SECURITY_CODE_3_DIGITS,y as ENCRYPTED_SECURITY_CODE_4_DIGITS,p as GIFT_CARD,B as HIDDEN,C as NON_CREDIT_CARD_TYPE_SECURED_FIELDS,k as OPTIONAL,x as OTHER_SF_FIELDS,g as REQUIRED,P as SF_CONFIG_TIMEOUT,L as SF_FIELDS_MAP,u as SF_VERSION};
1
+ const e="encrypted",r="encryptedCardNumber",c="encryptedExpiryDate",t="encryptedExpiryMonth",a="encryptedExpiryYear",d="encryptedSecurityCode",i="encryptedPassword",n="encryptedBankAccountNumber",o="encryptedBankLocationId",s="encryptedSecurityCode3digits",y="encryptedSecurityCode4digits",p="giftcard",u="5.5.1",m=["amex","mc","visa"],C=["ach",p],b=[r,c,t,a,d,i],x=[n,o],h=b.concat(x),D=["bcmc"],g="required",k="optional",B="hidden",l=g,v=k,A=B,E=g,M=k,N=B,S="data-cse",f="data-info",j="data-uid",I=["accel","pulse","star","nyce"],w={visa:"VISA",mc:"MasterCard",amex:"American Express",discover:"Discover",cup:"China Union Pay",jcb:"JCB",diners:"Diners Club",maestro:"Maestro",bcmc:"Bancontact card",bijcard:"de Bijenkorf Card"},L={[r]:"cardNumber",[c]:"expiryDate",[d]:"securityCode",[t]:"expiryMonth",[a]:"expiryYear",[i]:"password",[n]:"bankAccountNumber",[o]:"bankLocationId",[s]:"securityCodeThreeDigits",[y]:"securityCodeFourDigits"},P=6e3;export{h as ALL_SECURED_FIELDS,I as BRAND_ICON_UI_EXCLUSION_LIST,w as BRAND_READABLE_NAME_MAP,b as CREDIT_CARD_SF_FIELDS,A as CVC_POLICY_HIDDEN,v as CVC_POLICY_OPTIONAL,l as CVC_POLICY_REQUIRED,S as DATA_ENCRYPTED_FIELD_ATTR,f as DATA_INFO,j as DATA_UID,N as DATE_POLICY_HIDDEN,M as DATE_POLICY_OPTIONAL,E as DATE_POLICY_REQUIRED,D as DEDICATED_CARD_COMPONENTS,m as DEFAULT_CARD_GROUP_TYPES,e as ENCRYPTED,n as ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,o as ENCRYPTED_BANK_LOCATION_FIELD,r as ENCRYPTED_CARD_NUMBER,c as ENCRYPTED_EXPIRY_DATE,t as ENCRYPTED_EXPIRY_MONTH,a as ENCRYPTED_EXPIRY_YEAR,i as ENCRYPTED_PWD_FIELD,d as ENCRYPTED_SECURITY_CODE,s as ENCRYPTED_SECURITY_CODE_3_DIGITS,y as ENCRYPTED_SECURITY_CODE_4_DIGITS,p as GIFT_CARD,B as HIDDEN,C as NON_CREDIT_CARD_TYPE_SECURED_FIELDS,k as OPTIONAL,x as OTHER_SF_FIELDS,g as REQUIRED,P as SF_CONFIG_TIMEOUT,L as SF_FIELDS_MAP,u as SF_VERSION};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../../src/components/internal/SecuredFields/lib/constants.ts"],"sourcesContent":["import { CVCPolicyType, DatePolicyType } from './types';\n\nexport const ENCRYPTED = 'encrypted';\n\nexport const ENCRYPTED_CARD_NUMBER = 'encryptedCardNumber';\nexport const ENCRYPTED_EXPIRY_DATE = 'encryptedExpiryDate';\nexport const ENCRYPTED_EXPIRY_MONTH = 'encryptedExpiryMonth';\nexport const ENCRYPTED_EXPIRY_YEAR = 'encryptedExpiryYear';\nexport const ENCRYPTED_SECURITY_CODE = 'encryptedSecurityCode';\nexport const ENCRYPTED_PWD_FIELD = 'encryptedPassword';\nexport const ENCRYPTED_PIN_FIELD = 'encryptedPin';\nexport const ENCRYPTED_BANK_ACCNT_NUMBER_FIELD = 'encryptedBankAccountNumber';\nexport const ENCRYPTED_BANK_LOCATION_FIELD = 'encryptedBankLocationId';\n\nexport const ENCRYPTED_SECURITY_CODE_3_DIGITS = 'encryptedSecurityCode3digits';\nexport const ENCRYPTED_SECURITY_CODE_4_DIGITS = 'encryptedSecurityCode4digits';\n\nexport const GIFT_CARD = 'giftcard';\n\nexport const SF_VERSION = '5.5.0';\n\nexport const DEFAULT_CARD_GROUP_TYPES = ['amex', 'mc', 'visa'];\n\nexport const NON_CREDIT_CARD_TYPE_SECURED_FIELDS = ['ach', GIFT_CARD]; // Maybe, sometime in the future will include 'sepa' & 'sepadirectdebit'\n\n// Credit card (CardInput) related securedFields (based on the data-cse attribute)\nexport const CREDIT_CARD_SF_FIELDS = [\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_PWD_FIELD\n // ENCRYPTED_PIN_FIELD,// probably redundant - it was an alt. name for KCP's encryptedPassword. But maybe has a role to play if we ever encrypt ibans.\n];\n\nexport const OTHER_SF_FIELDS = [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD, ENCRYPTED_BANK_LOCATION_FIELD]; // ACH fields\n\n/** A list of all the data-cse attributes that relate to securedFields (as found in card, giftcard or ach) */\nexport const ALL_SECURED_FIELDS = CREDIT_CARD_SF_FIELDS.concat(OTHER_SF_FIELDS);\n\n// Card components created as: checkout.create({BRAND}) e.g. checkout.create('bcmc')\n// - which are dedicated to a single, core, brand e.g. 'bcmc' BUT which can in effect handle multiple brands e.g. \"bcmc\", \"maestro\", \"visa\"\nexport const DEDICATED_CARD_COMPONENTS = ['bcmc'];\n\nexport const REQUIRED = 'required';\nexport const OPTIONAL = 'optional';\nexport const HIDDEN = 'hidden';\n\nexport const CVC_POLICY_REQUIRED: CVCPolicyType = REQUIRED;\nexport const CVC_POLICY_OPTIONAL: CVCPolicyType = OPTIONAL;\nexport const CVC_POLICY_HIDDEN: CVCPolicyType = HIDDEN;\n\nexport const DATE_POLICY_REQUIRED: DatePolicyType = REQUIRED;\nexport const DATE_POLICY_OPTIONAL: DatePolicyType = OPTIONAL;\nexport const DATE_POLICY_HIDDEN: DatePolicyType = HIDDEN;\n\nexport const DATA_ENCRYPTED_FIELD_ATTR = 'data-cse';\nexport const DATA_INFO = 'data-info';\nexport const DATA_UID = 'data-uid';\n\nexport const BRAND_ICON_UI_EXCLUSION_LIST = ['accel', 'pulse', 'star', 'nyce'];\n\nexport const BRAND_READABLE_NAME_MAP = {\n visa: 'VISA',\n mc: 'MasterCard',\n amex: 'American Express',\n discover: 'Discover',\n cup: 'China Union Pay',\n jcb: 'JCB',\n diners: 'Diners Club',\n maestro: 'Maestro',\n bcmc: 'Bancontact card',\n bijcard: 'de Bijenkorf Card'\n};\n\nexport const SF_FIELDS_MAP = {\n [ENCRYPTED_CARD_NUMBER]: 'cardNumber', // ph\n [ENCRYPTED_EXPIRY_DATE]: 'expiryDate', // ph\n [ENCRYPTED_SECURITY_CODE]: 'securityCode',\n [ENCRYPTED_EXPIRY_MONTH]: 'expiryMonth', // ph\n [ENCRYPTED_EXPIRY_YEAR]: 'expiryYear', // ph\n //\n [ENCRYPTED_PWD_FIELD]: 'password',\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]: 'bankAccountNumber',\n [ENCRYPTED_BANK_LOCATION_FIELD]: 'bankLocationId',\n //\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: 'securityCodeThreeDigits', // ph\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: 'securityCodeFourDigits' // ph\n};\n\n/** time within which we expect to receive a \"configured\" message from a securedField iframe, once it has registered as having loaded */\nexport const SF_CONFIG_TIMEOUT = 6000;\n"],"names":["ENCRYPTED","ENCRYPTED_CARD_NUMBER","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_SECURITY_CODE","ENCRYPTED_PWD_FIELD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ENCRYPTED_BANK_LOCATION_FIELD","ENCRYPTED_SECURITY_CODE_3_DIGITS","ENCRYPTED_SECURITY_CODE_4_DIGITS","GIFT_CARD","SF_VERSION","DEFAULT_CARD_GROUP_TYPES","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","CREDIT_CARD_SF_FIELDS","OTHER_SF_FIELDS","ALL_SECURED_FIELDS","concat","DEDICATED_CARD_COMPONENTS","REQUIRED","OPTIONAL","HIDDEN","CVC_POLICY_REQUIRED","CVC_POLICY_OPTIONAL","CVC_POLICY_HIDDEN","DATE_POLICY_REQUIRED","DATE_POLICY_OPTIONAL","DATE_POLICY_HIDDEN","DATA_ENCRYPTED_FIELD_ATTR","DATA_INFO","DATA_UID","BRAND_ICON_UI_EXCLUSION_LIST","BRAND_READABLE_NAME_MAP","visa","mc","amex","discover","cup","jcb","diners","maestro","bcmc","bijcard","SF_FIELDS_MAP","SF_CONFIG_TIMEOUT"],"mappings":"AAEO,MAAMA,EAAY,YAEZC,EAAwB,sBACxBC,EAAwB,sBACxBC,EAAyB,uBACzBC,EAAwB,sBACxBC,EAA0B,wBAC1BC,EAAsB,oBAEtBC,EAAoC,6BACpCC,EAAgC,0BAEhCC,EAAmC,+BACnCC,EAAmC,+BAEnCC,EAAY,WAEZC,EAAa,QAEbC,EAA2B,CAAC,OAAQ,KAAM,QAE1CC,EAAsC,CAAC,MAAOH,GAG9CI,EAAwB,CACjCd,EACAC,EACAC,EACAC,EACAC,EACAC,GAISU,EAAkB,CAACT,EAAmCC,GAGtDS,EAAqBF,EAAsBG,OAAOF,GAIlDG,EAA4B,CAAC,QAE7BC,EAAW,WACXC,EAAW,WACXC,EAAS,SAETC,EAAqCH,EACrCI,EAAqCH,EACrCI,EAAmCH,EAEnCI,EAAuCN,EACvCO,EAAuCN,EACvCO,EAAqCN,EAErCO,EAA4B,WAC5BC,EAAY,YACZC,EAAW,WAEXC,EAA+B,CAAC,QAAS,QAAS,OAAQ,QAE1DC,EAA0B,CACnCC,KAAM,OACNC,GAAI,aACJC,KAAM,mBACNC,SAAU,WACVC,IAAK,kBACLC,IAAK,MACLC,OAAQ,cACRC,QAAS,UACTC,KAAM,kBACNC,QAAS,qBAGAC,EAAgB,CACzB3C,CAACA,GAAwB,aACzBC,CAACA,GAAwB,aACzBG,CAACA,GAA0B,eAC3BF,CAACA,GAAyB,cAC1BC,CAACA,GAAwB,aAEzBE,CAACA,GAAsB,WACvBC,CAACA,GAAoC,oBACrCC,CAACA,GAAgC,iBAEjCC,CAACA,GAAmC,0BACpCC,CAACA,GAAmC,0BAI3BmC,EAAoB"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../../src/components/internal/SecuredFields/lib/constants.ts"],"sourcesContent":["import { CVCPolicyType, DatePolicyType } from './types';\n\nexport const ENCRYPTED = 'encrypted';\n\nexport const ENCRYPTED_CARD_NUMBER = 'encryptedCardNumber';\nexport const ENCRYPTED_EXPIRY_DATE = 'encryptedExpiryDate';\nexport const ENCRYPTED_EXPIRY_MONTH = 'encryptedExpiryMonth';\nexport const ENCRYPTED_EXPIRY_YEAR = 'encryptedExpiryYear';\nexport const ENCRYPTED_SECURITY_CODE = 'encryptedSecurityCode';\nexport const ENCRYPTED_PWD_FIELD = 'encryptedPassword';\nexport const ENCRYPTED_PIN_FIELD = 'encryptedPin';\nexport const ENCRYPTED_BANK_ACCNT_NUMBER_FIELD = 'encryptedBankAccountNumber';\nexport const ENCRYPTED_BANK_LOCATION_FIELD = 'encryptedBankLocationId';\n\nexport const ENCRYPTED_SECURITY_CODE_3_DIGITS = 'encryptedSecurityCode3digits';\nexport const ENCRYPTED_SECURITY_CODE_4_DIGITS = 'encryptedSecurityCode4digits';\n\nexport const GIFT_CARD = 'giftcard';\n\nexport const SF_VERSION = '5.5.1';\n\nexport const DEFAULT_CARD_GROUP_TYPES = ['amex', 'mc', 'visa'];\n\nexport const NON_CREDIT_CARD_TYPE_SECURED_FIELDS = ['ach', GIFT_CARD]; // Maybe, sometime in the future will include 'sepa' & 'sepadirectdebit'\n\n// Credit card (CardInput) related securedFields (based on the data-cse attribute)\nexport const CREDIT_CARD_SF_FIELDS = [\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_PWD_FIELD\n // ENCRYPTED_PIN_FIELD,// probably redundant - it was an alt. name for KCP's encryptedPassword. But maybe has a role to play if we ever encrypt ibans.\n];\n\nexport const OTHER_SF_FIELDS = [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD, ENCRYPTED_BANK_LOCATION_FIELD]; // ACH fields\n\n/** A list of all the data-cse attributes that relate to securedFields (as found in card, giftcard or ach) */\nexport const ALL_SECURED_FIELDS = CREDIT_CARD_SF_FIELDS.concat(OTHER_SF_FIELDS);\n\n// Card components created as: checkout.create({BRAND}) e.g. checkout.create('bcmc')\n// - which are dedicated to a single, core, brand e.g. 'bcmc' BUT which can in effect handle multiple brands e.g. \"bcmc\", \"maestro\", \"visa\"\nexport const DEDICATED_CARD_COMPONENTS = ['bcmc'];\n\nexport const REQUIRED = 'required';\nexport const OPTIONAL = 'optional';\nexport const HIDDEN = 'hidden';\n\nexport const CVC_POLICY_REQUIRED: CVCPolicyType = REQUIRED;\nexport const CVC_POLICY_OPTIONAL: CVCPolicyType = OPTIONAL;\nexport const CVC_POLICY_HIDDEN: CVCPolicyType = HIDDEN;\n\nexport const DATE_POLICY_REQUIRED: DatePolicyType = REQUIRED;\nexport const DATE_POLICY_OPTIONAL: DatePolicyType = OPTIONAL;\nexport const DATE_POLICY_HIDDEN: DatePolicyType = HIDDEN;\n\nexport const DATA_ENCRYPTED_FIELD_ATTR = 'data-cse';\nexport const DATA_INFO = 'data-info';\nexport const DATA_UID = 'data-uid';\n\nexport const BRAND_ICON_UI_EXCLUSION_LIST = ['accel', 'pulse', 'star', 'nyce'];\n\nexport const BRAND_READABLE_NAME_MAP = {\n visa: 'VISA',\n mc: 'MasterCard',\n amex: 'American Express',\n discover: 'Discover',\n cup: 'China Union Pay',\n jcb: 'JCB',\n diners: 'Diners Club',\n maestro: 'Maestro',\n bcmc: 'Bancontact card',\n bijcard: 'de Bijenkorf Card'\n};\n\nexport const SF_FIELDS_MAP = {\n [ENCRYPTED_CARD_NUMBER]: 'cardNumber', // ph\n [ENCRYPTED_EXPIRY_DATE]: 'expiryDate', // ph\n [ENCRYPTED_SECURITY_CODE]: 'securityCode',\n [ENCRYPTED_EXPIRY_MONTH]: 'expiryMonth', // ph\n [ENCRYPTED_EXPIRY_YEAR]: 'expiryYear', // ph\n //\n [ENCRYPTED_PWD_FIELD]: 'password',\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]: 'bankAccountNumber',\n [ENCRYPTED_BANK_LOCATION_FIELD]: 'bankLocationId',\n //\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: 'securityCodeThreeDigits', // ph\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: 'securityCodeFourDigits' // ph\n};\n\n/** time within which we expect to receive a \"configured\" message from a securedField iframe, once it has registered as having loaded */\nexport const SF_CONFIG_TIMEOUT = 6000;\n"],"names":["ENCRYPTED","ENCRYPTED_CARD_NUMBER","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_SECURITY_CODE","ENCRYPTED_PWD_FIELD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ENCRYPTED_BANK_LOCATION_FIELD","ENCRYPTED_SECURITY_CODE_3_DIGITS","ENCRYPTED_SECURITY_CODE_4_DIGITS","GIFT_CARD","SF_VERSION","DEFAULT_CARD_GROUP_TYPES","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","CREDIT_CARD_SF_FIELDS","OTHER_SF_FIELDS","ALL_SECURED_FIELDS","concat","DEDICATED_CARD_COMPONENTS","REQUIRED","OPTIONAL","HIDDEN","CVC_POLICY_REQUIRED","CVC_POLICY_OPTIONAL","CVC_POLICY_HIDDEN","DATE_POLICY_REQUIRED","DATE_POLICY_OPTIONAL","DATE_POLICY_HIDDEN","DATA_ENCRYPTED_FIELD_ATTR","DATA_INFO","DATA_UID","BRAND_ICON_UI_EXCLUSION_LIST","BRAND_READABLE_NAME_MAP","visa","mc","amex","discover","cup","jcb","diners","maestro","bcmc","bijcard","SF_FIELDS_MAP","SF_CONFIG_TIMEOUT"],"mappings":"AAEO,MAAMA,EAAY,YAEZC,EAAwB,sBACxBC,EAAwB,sBACxBC,EAAyB,uBACzBC,EAAwB,sBACxBC,EAA0B,wBAC1BC,EAAsB,oBAEtBC,EAAoC,6BACpCC,EAAgC,0BAEhCC,EAAmC,+BACnCC,EAAmC,+BAEnCC,EAAY,WAEZC,EAAa,QAEbC,EAA2B,CAAC,OAAQ,KAAM,QAE1CC,EAAsC,CAAC,MAAOH,GAG9CI,EAAwB,CACjCd,EACAC,EACAC,EACAC,EACAC,EACAC,GAISU,EAAkB,CAACT,EAAmCC,GAGtDS,EAAqBF,EAAsBG,OAAOF,GAIlDG,EAA4B,CAAC,QAE7BC,EAAW,WACXC,EAAW,WACXC,EAAS,SAETC,EAAqCH,EACrCI,EAAqCH,EACrCI,EAAmCH,EAEnCI,EAAuCN,EACvCO,EAAuCN,EACvCO,EAAqCN,EAErCO,EAA4B,WAC5BC,EAAY,YACZC,EAAW,WAEXC,EAA+B,CAAC,QAAS,QAAS,OAAQ,QAE1DC,EAA0B,CACnCC,KAAM,OACNC,GAAI,aACJC,KAAM,mBACNC,SAAU,WACVC,IAAK,kBACLC,IAAK,MACLC,OAAQ,cACRC,QAAS,UACTC,KAAM,kBACNC,QAAS,qBAGAC,EAAgB,CACzB3C,CAACA,GAAwB,aACzBC,CAACA,GAAwB,aACzBG,CAACA,GAA0B,eAC3BF,CAACA,GAAyB,cAC1BC,CAACA,GAAwB,aAEzBE,CAACA,GAAsB,WACvBC,CAACA,GAAoC,oBACrCC,CAACA,GAAgC,iBAEjCC,CAACA,GAAmC,0BACpCC,CAACA,GAAmC,0BAI3BmC,EAAoB"}
@@ -1,2 +1,2 @@
1
- import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:c,bundleType:a})=>{let l;const s={errorLevel:"fatal",loadingContext:n,path:`${c}?clientKey=${r}`};return n=>{const c={version:"6.10.0",channel:"Web",platform:"Web",buildType:a,locale:i,referrer:window.location.href,screenWidth:window.screen.width,...n};if(l)return l;if(!r)return Promise.reject("no-client-key");const m=new t("checkout-attempt-id","sessionStorage"),d=m.get();return function(e){if(!e?.id)return!1;const t=Date.now()-9e5;return e.timestamp>t}(d)?Promise.resolve(d.id):(l=e(s,c).then((e=>{if(e?.checkoutAttemptId)return m.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(o))),l)}};export{o as FAILURE_MSG,n as default};
1
+ import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:c,bundleType:a})=>{let l;const s={errorLevel:"fatal",loadingContext:n,path:`${c}?clientKey=${r}`};return n=>{const c={version:"6.11.0",channel:"Web",platform:"Web",buildType:a,locale:i,referrer:window.location.href,screenWidth:window.screen.width,...n};if(l)return l;if(!r)return Promise.reject("no-client-key");const m=new t("checkout-attempt-id","sessionStorage"),d=m.get();return function(e){if(!e?.id)return!1;const t=Date.now()-9e5;return e.timestamp>t}(d)?Promise.resolve(d.id):(l=e(s,c).then((e=>{if(e?.checkoutAttemptId)return m.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(o))),l)}};export{o as FAILURE_MSG,n as default};
2
2
  //# sourceMappingURL=collect-id.js.map
@@ -1,2 +1,2 @@
1
- import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as f}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import v from"./Services/get-translations.js";import{defaultProps as b}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as E}from"../language/utils.js";import{resolveEnvironments as A}from"./Environment/Environment.js";function P(t,o,s){return o in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}class M{static setBundleType(t){M.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await v(this.cdnTranslationsUrl,M.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=j(this.options.locale),this.options.translations=E(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:f,subtype:t.type,message:`${s} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return e(this,p,t,i)}return this.handleCreateError()}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:M.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}constructor(t){P(this,"session",void 0),P(this,"paymentMethodsResponse",void 0),P(this,"modules",void 0),P(this,"options",void 0),P(this,"analyticsContext",void 0),P(this,"loadingContext",void 0),P(this,"cdnImagesUrl",void 0),P(this,"cdnTranslationsUrl",void 0),P(this,"components",[]),P(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this)))))),P(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),P(this,"setOptions",(t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}})),a(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...b,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=A(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=M.metadata)}}P(M,"metadata",{version:"6.10.0",bundleType:"esm"}),P(M,"registry",p);export{M as default};
1
+ import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as f}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import v from"./Services/get-translations.js";import{defaultProps as b}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as E}from"../language/utils.js";import{resolveEnvironments as A}from"./Environment/Environment.js";function P(t,o,s){return o in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}class M{static setBundleType(t){M.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await v(this.cdnTranslationsUrl,M.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=j(this.options.locale),this.options.translations=E(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:f,subtype:t.type,message:`${s} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return e(this,p,t,i)}return this.handleCreateError()}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:M.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}constructor(t){P(this,"session",void 0),P(this,"paymentMethodsResponse",void 0),P(this,"modules",void 0),P(this,"options",void 0),P(this,"analyticsContext",void 0),P(this,"loadingContext",void 0),P(this,"cdnImagesUrl",void 0),P(this,"cdnTranslationsUrl",void 0),P(this,"components",[]),P(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this)))))),P(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),P(this,"setOptions",(t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}})),a(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...b,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=A(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=M.metadata)}}P(M,"metadata",{version:"6.11.0",bundleType:"esm"}),P(M,"registry",p);export{M as default};
2
2
  //# sourceMappingURL=core.js.map
@@ -1914,7 +1914,7 @@ declare class ApplePayElement extends UIElement<ApplePayConfiguration> {
1914
1914
  /**
1915
1915
  * Formats the component props
1916
1916
  */
1917
- protected formatProps(props: any): ApplePayConfiguration;
1917
+ protected formatProps(props: ApplePayConfiguration): ApplePayConfiguration;
1918
1918
  /**
1919
1919
  * Formats the component data output
1920
1920
  */
@@ -0,0 +1,2 @@
1
+ const n=()=>{if("undefined"==typeof window)return!1;try{return window.self!==window.top}catch(n){return!0}};export{n as detectInIframe};
2
+ //# sourceMappingURL=detectInIframe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectInIframe.js","sources":["../../../src/utils/detectInIframe.ts"],"sourcesContent":["/**\n * Returns true if the Checkout is hosted within an iframe, false otherwise.\n */\nconst detectInIframe = () => {\n if (typeof window !== 'undefined') {\n try {\n return window.self !== window.top;\n } catch (e) {\n // In some cross-origin scenarios, accessing window.top might throw an error.\n // In such cases, it is likely in an iframe.\n return true;\n }\n } else {\n // SSR\n return false;\n }\n};\n\nexport { detectInIframe };\n"],"names":["detectInIframe","window","self","top","e"],"mappings":"MAGMA,EAAiB,KACnB,GAAsB,oBAAXC,OAUP,OAAO,EATP,IACI,OAAOA,OAAOC,OAASD,OAAOE,GAClC,CAAE,MAAOC,GAGL,OAAO,CACX,CAIJ"}
@@ -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 r from"./components/ApplePayButton.js";import o from"./services/ApplePayService.js";import s from"../../utils/base64.js";import i from"./defaultProps.js";import{httpPost as n}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{ANALYTICS_SELECTED_STR as h,ANALYTICS_INSTANT_PAYMENT_BUTTON as u}from"../../core/Analytics/constants.js";import{resolveSupportedVersion as y}from"./utils/resolve-supported-version.js";import{formatApplePayContactToAdyenAddressFormat as m}from"./utils/format-applepay-contact-to-adyen-format.js";import{mapBrands as b}from"./utils/map-adyen-brands-to-applepay-brands.js";import P from"./services/ApplePaySdkLoader.js";function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(t){f(e,t,r[t])}))}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}class g extends t{formatProps(e){var t,r,o;const s=(null===(t=e.brands)||void 0===t?void 0:t.length)?b(e.brands):e.supportedNetworks;var i;return v(A({},e),{configuration:e.configuration,supportedNetworks:s,buttonLocale:null!==(i=e.buttonLocale)&&void 0!==i?i:null===(r=e.i18n)||void 0===r?void 0:r.locale,totalPriceLabel:e.totalPriceLabel||(null===(o=e.configuration)||void 0===o?void 0:o.merchantName)})}formatData(){const{applePayToken:e,billingAddress:t,deliveryAddress:r}=this.state,{isExpress:o}=this.props;return A({paymentMethod:A({type:g.type,applePayToken:e},o&&{subtype:"express"})},t&&{billingAddress:t},r&&{deliveryAddress:r})}submitAnalytics(e){super.submitAnalytics(A({},e),this.props)}get isValid(){return!0}async applePayCapabilities(e){const t=e||this.props.configuration.merchantId;try{var r;return await this.sdkLoader.isSdkLoaded(),await(null===(r=ApplePaySession)||void 0===r?void 0:r.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{var e;return await this.sdkLoader.isSdkLoaded(),(null===(e=ApplePaySession)||void 0===e?void 0:e.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||y(14))}configureApplePayWebOptions(){if(window.ApplePayWebOptions){const{renderApplePayCodeAs:e,onApplePayCodeClose:t}=this.props;window.ApplePayWebOptions.set(A({renderApplePayCodeAs:e},t&&{onApplePayCodeClose:t}))}}startSession(){const{onValidateMerchant:e,onPaymentMethodSelected:t,onShippingMethodSelected:r,onShippingContactSelected:s}=this.props,i=a(A({companyName:this.props.configuration.merchantName,countryCode:this.core.options.countryCode},this.props)),n=new o(i,{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:r,onShippingContactSelected:s,onValidateMerchant:e||this.validateMerchant,onPaymentAuthorized:(e,t,r)=>{const o=m(r.payment.billingContact),s=m(r.payment.shippingContact,!0);this.setState(A({applePayToken:btoa(JSON.stringify(r.payment.token.paymentData)),authorizedEvent:r},o&&{billingAddress:o},s&&{deliveryAddress:s})),this.handleAuthorization().then(this.makePaymentsCall).then(d).then(c).then(this.collectOrderTrackingDetailsIfNeeded).then((({paymentResponse:t,orderDetails:r})=>(e(A({status:ApplePaySession.STATUS_SUCCESS},r&&{orderDetails:r})),t))).then((e=>{this.handleResponse(e)})).catch((e=>{var r;const o=null==e||null===(r=e.error)||void 0===r?void 0:r.applePayError;t({status:ApplePaySession.STATUS_FAILURE,errors:o?Array.isArray(o)?o:[o]:void 0});const s=v(A({},e),{error:{applePayError:o}});this.handleFailedResult(s)}))}});return new Promise(((e,t)=>this.props.onClick(e,t))).then((()=>{n.begin()})).catch((()=>({})))}async handleAuthorization(){return new Promise(((e,t)=>{this.props.onAuthorized||e();const{authorizedEvent:r,billingAddress:o,deliveryAddress:s}=this.state;this.props.onAuthorized(A({authorizedEvent:r},o&&{billingAddress:o},s&&{deliveryAddress:s}),{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=>A({paymentResponse:e},t&&{orderDetails:t}))).catch((()=>({paymentResponse:e})))}async validateMerchant(e,t){const{hostname:r}=window.location,{clientKey:o,configuration:i,loadingContext:a,initiative:p}=this.props,{merchantName:l,merchantId:d}=i,c={loadingContext:a,path:`v1/applePay/sessions?clientKey=${o}`},h={displayName:l,domainName:r,initiative:p,merchantIdentifier:d};try{const r=await n(c,h),o=s.decode(r.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")}}render(){return this.props.showPayButton?e(r,{buttonStyle:this.props.buttonColor,buttonType:this.props.buttonType,buttonLocale:this.props.buttonLocale,onClick:this.submit}):null}constructor(e,t){super(e,t),f(this,"sdkLoader",void 0),f(this,"applePayVersionNumber",void 0),f(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:h,target:u}),this.startSession()}));const{isExpress:r,onShippingContactSelected:o,onShippingMethodSelected:s}=this.props;if(!1===r&&(o||s))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 P,this.sdkLoader.load().then(this.defineApplePayVersionNumber).then(this.configureApplePayWebOptions).catch((e=>{this.handleError(e)}))}}f(g,"type",l.applepay),f(g,"defaultProps",i);export{g as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import r from"./components/ApplePayButton.js";import o from"./services/ApplePayService.js";import s from"../../utils/base64.js";import i from"./defaultProps.js";import{httpPost as n}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{ANALYTICS_SELECTED_STR as h,ANALYTICS_INSTANT_PAYMENT_BUTTON as u}from"../../core/Analytics/constants.js";import{resolveSupportedVersion as y}from"./utils/resolve-supported-version.js";import{formatApplePayContactToAdyenAddressFormat as m}from"./utils/format-applepay-contact-to-adyen-format.js";import{mapBrands as b}from"./utils/map-adyen-brands-to-applepay-brands.js";import P from"./services/ApplePaySdkLoader.js";import{detectInIframe as f}from"../../utils/detectInIframe.js";function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(t){A(e,t,r[t])}))}return e}function g(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}class S extends t{formatProps(e){var t,r,o;const s=(null===(t=e.brands)||void 0===t?void 0:t.length)?b(e.brands):e.supportedNetworks;var i,n;return g(v({},e),{configuration:e.configuration,supportedNetworks:s,buttonLocale:null!==(i=e.buttonLocale)&&void 0!==i?i:null===(r=e.i18n)||void 0===r?void 0:r.locale,totalPriceLabel:e.totalPriceLabel||(null===(o=e.configuration)||void 0===o?void 0:o.merchantName),renderApplePayCodeAs:null!==(n=e.renderApplePayCodeAs)&&void 0!==n?n:f()?"window":"modal"})}formatData(){const{applePayToken:e,billingAddress:t,deliveryAddress:r}=this.state,{isExpress:o}=this.props;return v({paymentMethod:v({type:S.type,applePayToken:e},o&&{subtype:"express"})},t&&{billingAddress:t},r&&{deliveryAddress:r})}submitAnalytics(e){super.submitAnalytics(v({},e),this.props)}get isValid(){return!0}async applePayCapabilities(e){const t=e||this.props.configuration.merchantId;try{var r;return await this.sdkLoader.isSdkLoaded(),await(null===(r=ApplePaySession)||void 0===r?void 0:r.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{var e;return await this.sdkLoader.isSdkLoaded(),(null===(e=ApplePaySession)||void 0===e?void 0:e.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||y(14))}configureApplePayWebOptions(){if(window.ApplePayWebOptions){const{renderApplePayCodeAs:e,onApplePayCodeClose:t}=this.props;window.ApplePayWebOptions.set(v({renderApplePayCodeAs:e},t&&{onApplePayCodeClose:t}))}}startSession(){const{onValidateMerchant:e,onPaymentMethodSelected:t,onShippingMethodSelected:r,onShippingContactSelected:s}=this.props,i=a(v({companyName:this.props.configuration.merchantName,countryCode:this.core.options.countryCode},this.props)),n=new o(i,{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:r,onShippingContactSelected:s,onValidateMerchant:e||this.validateMerchant,onPaymentAuthorized:(e,t,r)=>{const o=m(r.payment.billingContact),s=m(r.payment.shippingContact,!0);this.setState(v({applePayToken:btoa(JSON.stringify(r.payment.token.paymentData)),authorizedEvent:r},o&&{billingAddress:o},s&&{deliveryAddress:s})),this.handleAuthorization().then(this.makePaymentsCall).then(d).then(c).then(this.collectOrderTrackingDetailsIfNeeded).then((({paymentResponse:t,orderDetails:r})=>(e(v({status:ApplePaySession.STATUS_SUCCESS},r&&{orderDetails:r})),t))).then((e=>{this.handleResponse(e)})).catch((e=>{var r;const o=null==e||null===(r=e.error)||void 0===r?void 0:r.applePayError;t({status:ApplePaySession.STATUS_FAILURE,errors:o?Array.isArray(o)?o:[o]:void 0});const s=g(v({},e),{error:{applePayError:o}});this.handleFailedResult(s)}))}});return new Promise(((e,t)=>this.props.onClick(e,t))).then((()=>{n.begin()})).catch((()=>({})))}async handleAuthorization(){return new Promise(((e,t)=>{this.props.onAuthorized||e();const{authorizedEvent:r,billingAddress:o,deliveryAddress:s}=this.state;this.props.onAuthorized(v({authorizedEvent:r},o&&{billingAddress:o},s&&{deliveryAddress:s}),{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=>v({paymentResponse:e},t&&{orderDetails:t}))).catch((()=>({paymentResponse:e})))}async validateMerchant(e,t){const{hostname:r}=window.location,{clientKey:o,configuration:i,loadingContext:a,initiative:p}=this.props,{merchantName:l,merchantId:d}=i,c={loadingContext:a,path:`v1/applePay/sessions?clientKey=${o}`},h={displayName:l,domainName:r,initiative:p,merchantIdentifier:d};try{const r=await n(c,h),o=s.decode(r.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")}}render(){return this.props.showPayButton?e(r,{buttonStyle:this.props.buttonColor,buttonType:this.props.buttonType,buttonLocale:this.props.buttonLocale,onClick:this.submit}):null}constructor(e,t){super(e,t),A(this,"sdkLoader",void 0),A(this,"applePayVersionNumber",void 0),A(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:h,target:u}),this.startSession()}));const{isExpress:r,onShippingContactSelected:o,onShippingMethodSelected:s}=this.props;if(!1===r&&(o||s))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 P,this.sdkLoader.load().then(this.defineApplePayVersionNumber).then(this.configureApplePayWebOptions).catch((e=>{this.handleError(e)}))}}A(S,"type",l.applepay),A(S,"defaultProps",i);export{S as default};
2
2
  //# sourceMappingURL=ApplePay.js.map