@adyen/adyen-web 6.9.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 (114) hide show
  1. package/dist/cjs/adyen.css +13 -13
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +54 -23
  6. package/dist/es/adyen.css +13 -13
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  9. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  10. package/dist/es/components/ApplePay/components/ApplePayButton.js +1 -1
  11. package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
  12. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js +2 -0
  13. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -0
  14. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -0
  15. package/dist/es/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js +2 -0
  16. package/dist/es/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js.map +1 -0
  17. package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js +2 -0
  18. package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -0
  19. package/dist/es/components/ApplePay/utils/payment-request.js +2 -0
  20. package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -0
  21. package/dist/es/components/ApplePay/utils/resolve-supported-version.js +2 -0
  22. package/dist/es/components/ApplePay/utils/resolve-supported-version.js.map +1 -0
  23. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  24. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  25. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  26. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  27. package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
  28. package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  29. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  30. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  31. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  32. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  33. package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js +1 -1
  34. package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  35. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  36. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  37. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  38. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  39. package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
  40. package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  41. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js +1 -1
  42. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js.map +1 -1
  43. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  44. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  45. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  46. package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
  47. package/dist/es/core/core.js +1 -1
  48. package/dist/es/core/core.js.map +1 -1
  49. package/dist/es/index.d.ts +54 -23
  50. package/dist/es/utils/detectInIframe.js +2 -0
  51. package/dist/es/utils/detectInIframe.js.map +1 -0
  52. package/dist/es-legacy/adyen.css +13 -13
  53. package/dist/es-legacy/adyen.css.map +1 -1
  54. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  55. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  56. package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js +1 -1
  57. package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js.map +1 -1
  58. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js +2 -0
  59. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -0
  60. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -0
  61. package/dist/es-legacy/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js +2 -0
  62. package/dist/es-legacy/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js.map +1 -0
  63. package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js +2 -0
  64. package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -0
  65. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +2 -0
  66. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -0
  67. package/dist/es-legacy/components/ApplePay/utils/resolve-supported-version.js +2 -0
  68. package/dist/es-legacy/components/ApplePay/utils/resolve-supported-version.js.map +1 -0
  69. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  70. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  71. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  72. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  73. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
  74. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  75. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  76. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  77. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  78. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  79. package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js +1 -1
  80. package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  81. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  82. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  83. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  84. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  85. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
  86. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  87. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js +1 -1
  88. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js.map +1 -1
  89. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  90. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  91. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  92. package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
  93. package/dist/es-legacy/core/core.js +1 -1
  94. package/dist/es-legacy/core/core.js.map +1 -1
  95. package/dist/es-legacy/utils/detectInIframe.js +2 -0
  96. package/dist/es-legacy/utils/detectInIframe.js.map +1 -0
  97. package/package.json +13 -12
  98. package/styles/adyen.css +13 -13
  99. package/dist/es/components/ApplePay/ApplePayService.js.map +0 -1
  100. package/dist/es/components/ApplePay/config.js +0 -2
  101. package/dist/es/components/ApplePay/config.js.map +0 -1
  102. package/dist/es/components/ApplePay/payment-request.js +0 -2
  103. package/dist/es/components/ApplePay/payment-request.js.map +0 -1
  104. package/dist/es/components/ApplePay/utils.js +0 -2
  105. package/dist/es/components/ApplePay/utils.js.map +0 -1
  106. package/dist/es-legacy/components/ApplePay/ApplePayService.js.map +0 -1
  107. package/dist/es-legacy/components/ApplePay/config.js +0 -2
  108. package/dist/es-legacy/components/ApplePay/config.js.map +0 -1
  109. package/dist/es-legacy/components/ApplePay/payment-request.js +0 -2
  110. package/dist/es-legacy/components/ApplePay/payment-request.js.map +0 -1
  111. package/dist/es-legacy/components/ApplePay/utils.js +0 -2
  112. package/dist/es-legacy/components/ApplePay/utils.js.map +0 -1
  113. /package/dist/es/components/ApplePay/{ApplePayService.js → services/ApplePayService.js} +0 -0
  114. /package/dist/es-legacy/components/ApplePay/{ApplePayService.js → services/ApplePayService.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./GooglePayService.js";import r from"./components/GooglePayButton.js";import n from"./defaultProps.js";import{getGooglePayLocale as s,formatGooglePayContactToAdyenAddressFormat as i}from"./utils.js";import a from"../../utils/browserInfo.js";import l from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as h}from"../tx-variants.js";import{sanitizeResponse as p,verifyPaymentDidNotFail as u}from"../internal/UIElement/utils.js";import{ANALYTICS_SELECTED_STR as d,ANALYTICS_INSTANT_PAYMENT_BUTTON as y}from"../../core/Analytics/constants.js";function c(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function g(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})))),r.forEach((function(e){c(t,e,o[e])}))}return t}function m(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})),t}class P extends e{formatProps(t){var e,o;const r=null!==(o=t.buttonSizeMode)&&void 0!==o?o:t.isDropin?"fill":"static";var n;const i=s(null!==(n=t.buttonLocale)&&void 0!==n?n:null===(e=t.i18n)||void 0===e?void 0:e.locale),a=[...t.callbackIntents,"PAYMENT_AUTHORIZATION"];return m(g({},t),{configuration:t.configuration,buttonSizeMode:r,buttonLocale:i,callbackIntents:a})}formatData(){const{googlePayCardNetwork:t,googlePayToken:e,billingAddress:o,deliveryAddress:r}=this.state,{isExpress:n}=this.props;return g({paymentMethod:g({type:this.type,googlePayCardNetwork:t,googlePayToken:e},n&&{subtype:"express"}),browserInfo:this.browserInfo,origin:!!window&&window.location.origin},o&&{billingAddress:o},r&&{deliveryAddress:r})}submitAnalytics(t){super.submitAnalytics(g({},t),this.props)}showGooglePayPaymentSheet(){this.googlePay.initiatePayment(this.props,this.core.options.countryCode).catch((t=>{this.handleError(new l("CANCELED"===t.statusCode?"CANCEL":"ERROR",t.toString(),{cause:t}))}))}async handleAuthorization(){return new Promise(((t,e)=>{this.props.onAuthorized||t();const{authorizedEvent:o,billingAddress:r,deliveryAddress:n}=this.state;this.props.onAuthorized(g({authorizedEvent:o},r&&{billingAddress:r},n&&{deliveryAddress:n}),{resolve:t,reject:e})})).catch((t=>{const e={error:{googlePayError:t}};return Promise.reject(e)}))}get isValid(){return!!this.state.googlePayToken}async isAvailable(){return this.isReadyToPay().then((t=>{if(!t.result)throw new l("ERROR","GooglePay is not available");if(!1===t.paymentMethodPresent)throw new l("ERROR","GooglePay - No paymentMethodPresent");return Promise.resolve()})).catch((t=>Promise.reject(t)))}get browserInfo(){return a()}get icon(){var t;return null!==(t=this.props.icon)&&void 0!==t?t:this.resources.getImage()("googlepay")}render(){return this.props.showPayButton?t(r,{buttonColor:this.props.buttonColor,buttonType:this.props.buttonType,buttonSizeMode:this.props.buttonSizeMode,buttonLocale:this.props.buttonLocale,buttonRootNode:this.props.buttonRootNode,buttonRadius:this.props.buttonRadius,paymentsClient:this.googlePay.paymentsClient,onClick:this.submit}):null}constructor(t,e){super(t,e),c(this,"googlePay",void 0),c(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:d,target:y}),new Promise(((t,e)=>this.props.onClick(t,e))).then(this.showGooglePayPaymentSheet).catch((()=>{}))})),c(this,"onPaymentAuthorized",(async t=>{const e=i(t.paymentMethodData.info.billingAddress),o=i(t.shippingAddress,!0);return this.setState(g({authorizedEvent:t,googlePayToken:t.paymentMethodData.tokenizationData.token,googlePayCardNetwork:t.paymentMethodData.info.cardNetwork},e&&{billingAddress:e},o&&{deliveryAddress:o})),new Promise((t=>{this.handleAuthorization().then(this.makePaymentsCall).then(p).then(u).then((e=>(t({transactionState:"SUCCESS"}),e))).then((t=>{this.handleResponse(t)})).catch((e=>{var o;this.setElementStatus("ready");const r=null==e||null===(o=e.error)||void 0===o?void 0:o.googlePayError,n=this.props.i18n.get("error.subtitle.payment"),s="string"==typeof r?{intent:"PAYMENT_AUTHORIZATION",reason:"OTHER_ERROR",message:r||n}:{intent:(null==r?void 0:r.intent)||"PAYMENT_AUTHORIZATION",reason:(null==r?void 0:r.reason)||"OTHER_ERROR",message:(null==r?void 0:r.message)||n};t({transactionState:"ERROR",error:s});const i=m(g({},e),{error:{googlePayError:s}});this.handleFailedResult(i)}))}))})),c(this,"isReadyToPay",(()=>this.googlePay.isReadyToPay(this.props))),c(this,"prefetch",(()=>this.googlePay.prefetchPaymentData(this.props,this.core.options.countryCode))),this.handleAuthorization=this.handleAuthorization.bind(this),this.showGooglePayPaymentSheet=this.showGooglePayPaymentSheet.bind(this);const{isExpress:r,paymentDataCallbacks:n}=this.props;if(!1===r&&(null==n?void 0:n.onPaymentDataChanged))throw new l("IMPLEMENTATION_ERROR",'GooglePay - You must set "isExpress" flag to "true" in order to use "onPaymentDataChanged" callback');this.googlePay=new o(this.props.environment,m(g({},r&&(null==n?void 0:n.onPaymentDataChanged)&&{onPaymentDataChanged:n.onPaymentDataChanged}),{onPaymentAuthorized:this.onPaymentAuthorized}))}}c(P,"type",h.googlepay),c(P,"txVariants",[h.googlepay,h.paywithgoogle]),c(P,"defaultProps",n);export{P as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./GooglePayService.js";import r from"./components/GooglePayButton.js";import n from"./defaultProps.js";import{getGooglePayLocale as s,formatGooglePayContactToAdyenAddressFormat as i}from"./utils.js";import a from"../../utils/browserInfo.js";import l from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as h}from"../tx-variants.js";import{sanitizeResponse as p,verifyPaymentDidNotFail as u}from"../internal/UIElement/utils.js";import{ANALYTICS_SELECTED_STR as c,ANALYTICS_INSTANT_PAYMENT_BUTTON as d}from"../../core/Analytics/constants.js";function y(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function g(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})))),r.forEach((function(e){y(t,e,o[e])}))}return t}function m(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})),t}class P extends e{formatProps(t){var e,o;const r=null!==(o=t.buttonSizeMode)&&void 0!==o?o:t.isDropin?"fill":"static";var n;const i=s(null!==(n=t.buttonLocale)&&void 0!==n?n:null===(e=t.i18n)||void 0===e?void 0:e.locale),a=[...t.callbackIntents,"PAYMENT_AUTHORIZATION"];return m(g({},t),{configuration:t.configuration,buttonSizeMode:r,buttonLocale:i,callbackIntents:a})}formatData(){const{googlePayCardNetwork:t,googlePayToken:e,billingAddress:o,deliveryAddress:r}=this.state,{isExpress:n}=this.props;return g({paymentMethod:g({type:this.type,googlePayCardNetwork:t,googlePayToken:e},n&&{subtype:"express"}),browserInfo:this.browserInfo,origin:!!window&&window.location.origin},o&&{billingAddress:o},r&&{deliveryAddress:r})}submitAnalytics(t){super.submitAnalytics(g({},t),this.props)}showGooglePayPaymentSheet(){this.googlePay.initiatePayment(this.props,this.core.options.countryCode).catch((t=>{this.handleError(new l("CANCELED"===t.statusCode?"CANCEL":"ERROR",t.toString(),{cause:t}))}))}async handleAuthorization(){return new Promise(((t,e)=>{this.props.onAuthorized||t();const{authorizedEvent:o,billingAddress:r,deliveryAddress:n}=this.state;this.props.onAuthorized(g({authorizedEvent:o},r&&{billingAddress:r},n&&{deliveryAddress:n}),{resolve:t,reject:e})})).catch((t=>{const e={error:{googlePayError:t}};return Promise.reject(e)}))}get isValid(){return!!this.state.googlePayToken}async isAvailable(){return this.isReadyToPay().then((t=>{if(!t.result)throw new l("ERROR","GooglePay is not available");if(!1===t.paymentMethodPresent)throw new l("ERROR","GooglePay - No paymentMethodPresent");return Promise.resolve()})).catch((t=>Promise.reject(t)))}get browserInfo(){return a()}get icon(){var t;return null!==(t=this.props.icon)&&void 0!==t?t:this.resources.getImage()("googlepay")}render(){return this.props.showPayButton?t(r,{buttonColor:this.props.buttonColor,buttonType:this.props.buttonType,buttonSizeMode:this.props.buttonSizeMode,buttonLocale:this.props.buttonLocale,buttonRootNode:this.props.buttonRootNode,buttonRadius:this.props.buttonRadius,paymentsClient:this.googlePay.paymentsClient,onClick:this.submit}):null}constructor(t,e){super(t,e),y(this,"googlePay",void 0),y(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:c,target:d}),new Promise(((t,e)=>this.props.onClick(t,e))).then(this.showGooglePayPaymentSheet).catch((()=>{}))})),y(this,"onPaymentAuthorized",(async t=>{const e=i(t.paymentMethodData.info.billingAddress),o=i(t.shippingAddress,!0);return this.setState(g({authorizedEvent:t,googlePayToken:t.paymentMethodData.tokenizationData.token,googlePayCardNetwork:t.paymentMethodData.info.cardNetwork},e&&{billingAddress:e},o&&{deliveryAddress:o})),new Promise((t=>{this.handleAuthorization().then(this.makePaymentsCall).then(p).then(u).then((e=>(t({transactionState:"SUCCESS"}),e))).then((t=>{this.handleResponse(t)})).catch((e=>{var o;this.setElementStatus("ready");const r=null==e||null===(o=e.error)||void 0===o?void 0:o.googlePayError,n=this.props.i18n.get("error.subtitle.payment"),s="string"==typeof r?{intent:"PAYMENT_AUTHORIZATION",reason:"OTHER_ERROR",message:r||n}:{intent:(null==r?void 0:r.intent)||"PAYMENT_AUTHORIZATION",reason:(null==r?void 0:r.reason)||"OTHER_ERROR",message:(null==r?void 0:r.message)||n};t({transactionState:"ERROR",error:s});const i=m(g({},e),{error:{googlePayError:s}});this.handleFailedResult(i)}))}))})),y(this,"isReadyToPay",(()=>this.googlePay.isReadyToPay(this.props))),y(this,"prefetch",(()=>this.googlePay.prefetchPaymentData(this.props,this.core.options.countryCode))),this.handleAuthorization=this.handleAuthorization.bind(this),this.showGooglePayPaymentSheet=this.showGooglePayPaymentSheet.bind(this);const{isExpress:r,paymentDataCallbacks:n}=this.props;if(!1===r&&(null==n?void 0:n.onPaymentDataChanged))throw new l("IMPLEMENTATION_ERROR",'GooglePay - You must set "isExpress" flag to "true" in order to use "onPaymentDataChanged" callback');if(!this.props.configuration.merchantId)throw new l("IMPLEMENTATION_ERROR","GooglePay - Missing merchantId. Please ensure that it is correctly configured in your customer area.");this.googlePay=new o(this.props.environment,m(g({},r&&(null==n?void 0:n.onPaymentDataChanged)&&{onPaymentDataChanged:n.onPaymentDataChanged}),{onPaymentAuthorized:this.onPaymentAuthorized}))}}y(P,"type",h.googlepay),y(P,"txVariants",[h.googlepay,h.paywithgoogle]),y(P,"defaultProps",n);export{P as default};
2
2
  //# sourceMappingURL=GooglePay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GooglePay.js","sources":["../../../../src/components/GooglePay/GooglePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GooglePayService from './GooglePayService';\nimport GooglePayButton from './components/GooglePayButton';\nimport defaultProps from './defaultProps';\nimport { formatGooglePayContactToAdyenAddressFormat, getGooglePayLocale } from './utils';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\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 { SendAnalyticsObject } from '../../core/Analytics/types';\n\nimport type { AddressData, BrowserInfo, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\n\nclass GooglePay extends UIElement<GooglePayConfiguration> {\n public static type = TxVariants.googlepay;\n public static txVariants = [TxVariants.googlepay, TxVariants.paywithgoogle];\n public static defaultProps = defaultProps;\n\n protected readonly googlePay;\n\n constructor(checkout: ICore, props?: GooglePayConfiguration) {\n super(checkout, props);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.showGooglePayPaymentSheet = this.showGooglePayPaymentSheet.bind(this);\n\n const { isExpress, paymentDataCallbacks } = this.props;\n\n if (isExpress === false && paymentDataCallbacks?.onPaymentDataChanged) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - You must set \"isExpress\" flag to \"true\" in order to use \"onPaymentDataChanged\" callback'\n );\n }\n\n this.googlePay = new GooglePayService(this.props.environment, {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n });\n }\n\n protected override formatProps(props): GooglePayConfiguration {\n const buttonSizeMode = props.buttonSizeMode ?? (props.isDropin ? 'fill' : 'static');\n const buttonLocale = getGooglePayLocale(props.buttonLocale ?? props.i18n?.locale);\n\n const callbackIntents: google.payments.api.CallbackIntent[] = [...props.callbackIntents, 'PAYMENT_AUTHORIZATION'];\n\n return {\n ...props,\n configuration: props.configuration,\n buttonSizeMode,\n buttonLocale,\n callbackIntents\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData() {\n const { googlePayCardNetwork, googlePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: this.type,\n googlePayCardNetwork,\n googlePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin,\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 /**\n * Displays the Google Pay payment sheet overlay\n */\n private showGooglePayPaymentSheet() {\n this.googlePay.initiatePayment(this.props, this.core.options.countryCode).catch((error: google.payments.api.PaymentsError) => {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n this.handleError(new AdyenCheckoutError(error.statusCode === 'CANCELED' ? 'CANCEL' : 'ERROR', error.toString(), { cause: error }));\n });\n }\n\n public override submit = () => {\n if (this.props.isInstantPayment) {\n this.submitAnalytics({ type: ANALYTICS_SELECTED_STR, target: ANALYTICS_INSTANT_PAYMENT_BUTTON });\n }\n\n new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject)).then(this.showGooglePayPaymentSheet).catch(() => {\n // Swallow exception triggered by onClick reject\n });\n };\n\n /**\n * Method called when the payment is authorized in the payment sheet\n *\n * @see https://developers.google.com/pay/api/web/reference/client#onPaymentAuthorized\n **/\n private onPaymentAuthorized = async (paymentData: google.payments.api.PaymentData): Promise<google.payments.api.PaymentAuthorizationResult> => {\n const billingAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.paymentMethodData.info.billingAddress);\n const deliveryAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.shippingAddress, true);\n\n this.setState({\n authorizedEvent: paymentData,\n googlePayToken: paymentData.paymentMethodData.tokenizationData.token,\n googlePayCardNetwork: paymentData.paymentMethodData.info.cardNetwork,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<google.payments.api.PaymentAuthorizationResult>(resolve => {\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((paymentResponse: PaymentResponseData) => {\n resolve({ transactionState: 'SUCCESS' });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n this.setElementStatus('ready');\n\n const googlePayError = paymentResponse?.error?.googlePayError;\n const fallbackMessage = this.props.i18n.get('error.subtitle.payment');\n\n const error: google.payments.api.PaymentDataError =\n typeof googlePayError === 'string' || undefined\n ? {\n intent: 'PAYMENT_AUTHORIZATION',\n reason: 'OTHER_ERROR',\n message: (googlePayError as string) || fallbackMessage\n }\n : {\n intent: googlePayError?.intent || 'PAYMENT_AUTHORIZATION',\n reason: googlePayError?.reason || 'OTHER_ERROR',\n message: googlePayError?.message || fallbackMessage\n };\n\n resolve({\n transactionState: 'ERROR',\n error\n });\n\n const responseWithError = {\n ...paymentResponse,\n error: {\n googlePayError: error\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\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 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?: google.payments.api.PaymentDataError | string) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { googlePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Validation\n */\n get isValid(): boolean {\n return !!this.state.googlePayToken;\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public override async isAvailable(): Promise<void> {\n return this.isReadyToPay()\n .then(response => {\n if (!response.result) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay is not available');\n }\n\n if (response.paymentMethodPresent === false) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay - No paymentMethodPresent');\n }\n\n return Promise.resolve();\n })\n .catch(error => {\n return Promise.reject(error);\n });\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public isReadyToPay = (): Promise<google.payments.api.IsReadyToPayResponse> => {\n return this.googlePay.isReadyToPay(this.props);\n };\n\n /**\n * Use this method to prefetch a PaymentDataRequest configuration to improve loadPaymentData execution time on later user interaction. No value is returned.\n */\n public prefetch = (): void => {\n return this.googlePay.prefetchPaymentData(this.props, this.core.options.countryCode);\n };\n\n get browserInfo(): BrowserInfo {\n return collectBrowserInfo();\n }\n\n get icon(): string {\n return this.props.icon ?? this.resources.getImage()('googlepay');\n }\n\n render() {\n if (this.props.showPayButton) {\n return (\n <GooglePayButton\n buttonColor={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonSizeMode={this.props.buttonSizeMode}\n buttonLocale={this.props.buttonLocale}\n buttonRootNode={this.props.buttonRootNode}\n buttonRadius={this.props.buttonRadius}\n paymentsClient={this.googlePay.paymentsClient}\n onClick={this.submit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default GooglePay;\n"],"names":["GooglePay","UIElement","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","_object_spread_props","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","this","state","isExpress","_object_spread","paymentMethod","type","subtype","browserInfo","origin","window","location","submitAnalytics","analyticsObj","super","showGooglePayPaymentSheet","googlePay","initiatePayment","core","options","countryCode","catch","error","handleError","AdyenCheckoutError","statusCode","toString","cause","handleAuthorization","Promise","resolve","reject","onAuthorized","authorizedEvent","data","googlePayError","isValid","isAvailable","isReadyToPay","then","response","result","paymentMethodPresent","collectBrowserInfo","icon","_this_props_icon","resources","getImage","render","showPayButton","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","onClick","submit","constructor","checkout","_define_property","isInstantPayment","ANALYTICS_SELECTED_STR","target","ANALYTICS_INSTANT_PAYMENT_BUTTON","onPaymentAuthorized","async","paymentData","formatGooglePayContactToAdyenAddressFormat","paymentMethodData","info","shippingAddress","setState","tokenizationData","token","cardNetwork","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","paymentResponse","transactionState","handleResponse","setElementStatus","fallbackMessage","get","intent","reason","message","responseWithError","handleFailedResult","prefetch","prefetchPaymentData","bind","paymentDataCallbacks","onPaymentDataChanged","GooglePayService","environment","TxVariants","googlepay","txVariants","paywithgoogle","defaultProps"],"mappings":"w+CAiBA,MAAMA,UAAkBC,EA2BDC,WAAAA,CAAYC,GAEmCA,IAAAA,EADvCA,EAAvB,MAAMC,EAAiBD,QAAAA,EAAAA,EAAMC,sBAAND,IAAAA,EAAAA,EAAyBA,EAAME,SAAW,OAAS,SAClCF,IAAAA,EAAxC,MAAMG,EAAeC,EAAqC,QAAlBJ,EAAAA,EAAMG,oBAANH,IAAAA,EAAAA,EAAsBA,QAAAA,EAAAA,EAAMK,YAANL,IAAAA,OAAAA,EAAAA,EAAYM,QAEpEC,EAAwD,IAAIP,EAAMO,gBAAiB,yBAEzF,OAAOC,EACAR,EAAAA,CAAAA,EAAAA,GAAAA,CACHS,cAAeT,EAAMS,cACrBR,iBACAE,eACAI,mBAER,CAKA,UAAAG,GACI,MAAMC,qBAAEA,EAAoBC,eAAEA,EAAcC,eAAEA,EAAcC,gBAAEA,GAAoBC,KAAKC,OACjFC,UAAEA,GAAc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uBAAqB,CACjI7B,oBAAqBjE,KAAKiE,sBAElC,EAxBAL,EADE9E,EACYuB,OAAO4F,EAAWC,WAChCtC,EAFE9E,EAEYqH,aAAa,CAACF,EAAWC,UAAWD,EAAWG,gBAC7DxC,EAHE9E,EAGYuH,eAAeA"}
1
+ {"version":3,"file":"GooglePay.js","sources":["../../../../src/components/GooglePay/GooglePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GooglePayService from './GooglePayService';\nimport GooglePayButton from './components/GooglePayButton';\nimport defaultProps from './defaultProps';\nimport { formatGooglePayContactToAdyenAddressFormat, getGooglePayLocale } from './utils';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\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 { SendAnalyticsObject } from '../../core/Analytics/types';\n\nimport type { AddressData, BrowserInfo, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\n\nclass GooglePay extends UIElement<GooglePayConfiguration> {\n public static type = TxVariants.googlepay;\n public static txVariants = [TxVariants.googlepay, TxVariants.paywithgoogle];\n public static defaultProps = defaultProps;\n\n protected readonly googlePay;\n\n constructor(checkout: ICore, props?: GooglePayConfiguration) {\n super(checkout, props);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.showGooglePayPaymentSheet = this.showGooglePayPaymentSheet.bind(this);\n\n const { isExpress, paymentDataCallbacks } = this.props;\n\n if (isExpress === false && paymentDataCallbacks?.onPaymentDataChanged) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - You must set \"isExpress\" flag to \"true\" in order to use \"onPaymentDataChanged\" callback'\n );\n }\n\n if (!this.props.configuration.merchantId) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - Missing merchantId. Please ensure that it is correctly configured in your customer area.'\n );\n }\n\n this.googlePay = new GooglePayService(this.props.environment, {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n });\n }\n\n protected override formatProps(props): GooglePayConfiguration {\n const buttonSizeMode = props.buttonSizeMode ?? (props.isDropin ? 'fill' : 'static');\n const buttonLocale = getGooglePayLocale(props.buttonLocale ?? props.i18n?.locale);\n\n const callbackIntents: google.payments.api.CallbackIntent[] = [...props.callbackIntents, 'PAYMENT_AUTHORIZATION'];\n\n return {\n ...props,\n configuration: props.configuration,\n buttonSizeMode,\n buttonLocale,\n callbackIntents\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData() {\n const { googlePayCardNetwork, googlePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: this.type,\n googlePayCardNetwork,\n googlePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin,\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 /**\n * Displays the Google Pay payment sheet overlay\n */\n private showGooglePayPaymentSheet() {\n this.googlePay.initiatePayment(this.props, this.core.options.countryCode).catch((error: google.payments.api.PaymentsError) => {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n this.handleError(new AdyenCheckoutError(error.statusCode === 'CANCELED' ? 'CANCEL' : 'ERROR', error.toString(), { cause: error }));\n });\n }\n\n public override submit = () => {\n if (this.props.isInstantPayment) {\n this.submitAnalytics({ type: ANALYTICS_SELECTED_STR, target: ANALYTICS_INSTANT_PAYMENT_BUTTON });\n }\n\n new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject)).then(this.showGooglePayPaymentSheet).catch(() => {\n // Swallow exception triggered by onClick reject\n });\n };\n\n /**\n * Method called when the payment is authorized in the payment sheet\n *\n * @see https://developers.google.com/pay/api/web/reference/client#onPaymentAuthorized\n **/\n private onPaymentAuthorized = async (paymentData: google.payments.api.PaymentData): Promise<google.payments.api.PaymentAuthorizationResult> => {\n const billingAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.paymentMethodData.info.billingAddress);\n const deliveryAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.shippingAddress, true);\n\n this.setState({\n authorizedEvent: paymentData,\n googlePayToken: paymentData.paymentMethodData.tokenizationData.token,\n googlePayCardNetwork: paymentData.paymentMethodData.info.cardNetwork,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<google.payments.api.PaymentAuthorizationResult>(resolve => {\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((paymentResponse: PaymentResponseData) => {\n resolve({ transactionState: 'SUCCESS' });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n this.setElementStatus('ready');\n\n const googlePayError = paymentResponse?.error?.googlePayError;\n const fallbackMessage = this.props.i18n.get('error.subtitle.payment');\n\n const error: google.payments.api.PaymentDataError =\n typeof googlePayError === 'string' || undefined\n ? {\n intent: 'PAYMENT_AUTHORIZATION',\n reason: 'OTHER_ERROR',\n message: (googlePayError as string) || fallbackMessage\n }\n : {\n intent: googlePayError?.intent || 'PAYMENT_AUTHORIZATION',\n reason: googlePayError?.reason || 'OTHER_ERROR',\n message: googlePayError?.message || fallbackMessage\n };\n\n resolve({\n transactionState: 'ERROR',\n error\n });\n\n const responseWithError = {\n ...paymentResponse,\n error: {\n googlePayError: error\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\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 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?: google.payments.api.PaymentDataError | string) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { googlePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Validation\n */\n get isValid(): boolean {\n return !!this.state.googlePayToken;\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public override async isAvailable(): Promise<void> {\n return this.isReadyToPay()\n .then(response => {\n if (!response.result) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay is not available');\n }\n\n if (response.paymentMethodPresent === false) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay - No paymentMethodPresent');\n }\n\n return Promise.resolve();\n })\n .catch(error => {\n return Promise.reject(error);\n });\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public isReadyToPay = (): Promise<google.payments.api.IsReadyToPayResponse> => {\n return this.googlePay.isReadyToPay(this.props);\n };\n\n /**\n * Use this method to prefetch a PaymentDataRequest configuration to improve loadPaymentData execution time on later user interaction. No value is returned.\n */\n public prefetch = (): void => {\n return this.googlePay.prefetchPaymentData(this.props, this.core.options.countryCode);\n };\n\n get browserInfo(): BrowserInfo {\n return collectBrowserInfo();\n }\n\n get icon(): string {\n return this.props.icon ?? this.resources.getImage()('googlepay');\n }\n\n render() {\n if (this.props.showPayButton) {\n return (\n <GooglePayButton\n buttonColor={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonSizeMode={this.props.buttonSizeMode}\n buttonLocale={this.props.buttonLocale}\n buttonRootNode={this.props.buttonRootNode}\n buttonRadius={this.props.buttonRadius}\n paymentsClient={this.googlePay.paymentsClient}\n onClick={this.submit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default GooglePay;\n"],"names":["GooglePay","UIElement","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","_object_spread_props","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","this","state","isExpress","_object_spread","paymentMethod","type","subtype","browserInfo","origin","window","location","submitAnalytics","analyticsObj","super","showGooglePayPaymentSheet","googlePay","initiatePayment","core","options","countryCode","catch","error","handleError","AdyenCheckoutError","statusCode","toString","cause","handleAuthorization","Promise","resolve","reject","onAuthorized","authorizedEvent","data","googlePayError","isValid","isAvailable","isReadyToPay","then","response","result","paymentMethodPresent","collectBrowserInfo","icon","_this_props_icon","resources","getImage","render","showPayButton","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","onClick","submit","constructor","checkout","_define_property","isInstantPayment","ANALYTICS_SELECTED_STR","target","ANALYTICS_INSTANT_PAYMENT_BUTTON","onPaymentAuthorized","async","paymentData","formatGooglePayContactToAdyenAddressFormat","paymentMethodData","info","shippingAddress","setState","tokenizationData","token","cardNetwork","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","paymentResponse","transactionState","handleResponse","setElementStatus","fallbackMessage","get","intent","reason","message","responseWithError","handleFailedResult","prefetch","prefetchPaymentData","bind","paymentDataCallbacks","onPaymentDataChanged","merchantId","GooglePayService","environment","TxVariants","googlepay","txVariants","paywithgoogle","defaultProps"],"mappings":"w+CAiBA,MAAMA,UAAkBC,EAkCDC,WAAAA,CAAYC,GAEmCA,IAAAA,EADvCA,EAAvB,MAAMC,EAAiBD,QAAAA,EAAAA,EAAMC,sBAAND,IAAAA,EAAAA,EAAyBA,EAAME,SAAW,OA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AzNxEnB,KAAK2B,oBAAsB3B,KAAK2B,oBAAoBiE,KAAK5F,MACzDA,KAAKc,0BAA4Bd,KAAKc,0BAA0B8E,KAAK5F,MAErE,MAAME,UAAEA,EAAS2F,qBAAEA,GAAyB7F,KAAKf,MAEjD,IAAkB,IAAdiB,IAAuB2F,aAAAA,EAAAA,EAAsBC,sBAC7C,MAAM,IAAIvE,EACN,uBACA,uGAIR,IAAKvB,KAAKf,MAAMS,cAAcqG,WAC1B,MAAM,IAAIxE,EACN,uBACA,wGAIRvB,KAAKe,UAAY,IAAIiF,EAAiBhG,KAAKf,MAAMgH,YAAaxG,EACtDS,EAAAA,CAAAA,EAAAA,IAAa2F,aAAAA,EAAAA,EAAsBC,uBAAwB,CAAEA,qBAAsBD,EAAqBC,uBAAqB,CACjI7B,oBAAqBjE,KAAKiE,sBAElC,EA/BAL,EADE9E,EACYuB,OAAO6F,EAAWC,WAChCvC,EAFE9E,EAEYsH,aAAa,CAACF,EAAWC,UAAWD,EAAWG,gBAC7DzC,EAHE9E,EAGYwH,eAAeA"}
@@ -1,2 +1,2 @@
1
- import e from"../../../_virtual/index.js";import{createElement as t}from"../../../external/preact/dist/preact.js";function a({buttonId:a,showRadioButton:d,isSelected:o,expandContentId:n,children:r,classNameModifiers:c=[]}){return t("button",{className:e("adyen-checkout__payment-method__header__title",...c.map((e=>`adyen-checkout-expand-button--${e}`))),id:a,role:"radio","aria-checked":o,"aria-expanded":o,"aria-controls":n,type:"button"},d&&t("span",{className:e({"adyen-checkout__payment-method__radio":!0,"adyen-checkout__payment-method__radio--selected":o}),"aria-hidden":"true"}),r)}export{a as default};
1
+ import e from"../../../_virtual/index.js";import{createElement as t}from"../../../external/preact/dist/preact.js";function a({buttonId:a,showRadioButton:o,isSelected:d,expandContentId:n,children:r,classNameModifiers:c=[]}){return t("button",{className:e("adyen-checkout__payment-method__header__title",...c.map((e=>`adyen-checkout-expand-button--${e}`))),id:a,role:"radio","aria-checked":d,"aria-controls":n,type:"button"},o&&t("span",{className:e({"adyen-checkout__payment-method__radio":!0,"adyen-checkout__payment-method__radio--selected":d}),"aria-hidden":"true"}),r)}export{a as default};
2
2
  //# sourceMappingURL=ExpandButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandButton.js","sources":["../../../../../src/components/internal/ExpandButton/ExpandButton.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ComponentChildren, h } from 'preact';\nimport './ExpandButton.scss';\n\ninterface ExpandButton {\n buttonId: string;\n isSelected: boolean;\n expandContentId: string;\n children?: ComponentChildren;\n showRadioButton?: boolean;\n classNameModifiers?: string[];\n}\n\nfunction ExpandButton({ buttonId, showRadioButton, isSelected, expandContentId, children, classNameModifiers = [] }: Readonly<ExpandButton>) {\n return (\n // See discussion: https://github.com/w3c/aria/issues/1404\n // eslint-disable-next-line jsx-a11y/role-supports-aria-props\n <button\n className={classNames(\n 'adyen-checkout__payment-method__header__title',\n ...classNameModifiers.map(modifier => `adyen-checkout-expand-button--${modifier}`)\n )}\n id={buttonId}\n role={'radio'}\n aria-checked={isSelected}\n aria-expanded={isSelected}\n aria-controls={expandContentId}\n type=\"button\"\n >\n {showRadioButton && (\n <span\n className={classNames({\n 'adyen-checkout__payment-method__radio': true,\n 'adyen-checkout__payment-method__radio--selected': isSelected\n })}\n aria-hidden=\"true\"\n />\n )}\n {children}\n </button>\n );\n}\n\nexport default ExpandButton;\n"],"names":["ExpandButton","buttonId","showRadioButton","isSelected","expandContentId","children","classNameModifiers","h","button","className","classNames","map","modifier","id","role","aria-checked","aria-expanded","aria-controls","type","span","aria-hidden"],"mappings":"kHAaA,SAASA,GAAaC,SAAEA,EAAQC,gBAAEA,EAAeC,WAAEA,EAAUC,gBAAEA,EAAeC,SAAEA,EAAQC,mBAAEA,EAAqB,KAC3G,OAGIC,EAACC,SAAAA,CACGC,UAAWC,EACP,mDACGJ,EAAmBK,KAAIC,GAAY,iCAAiCA,OAE3EC,GAAIZ,EACJa,KAAM,QACNC,eAAcZ,EACda,gBAAeb,EACfc,gBAAeb,EACfc,KAAK,UAEJhB,GACGK,EAACY,OAAAA,CACGV,UAAWC,EAAW,CAClB,yCAAyC,EACzC,kDAAmDP,IAEvDiB,cAAY,SAGnBf,EAGb"}
1
+ {"version":3,"file":"ExpandButton.js","sources":["../../../../../src/components/internal/ExpandButton/ExpandButton.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ComponentChildren, h } from 'preact';\nimport './ExpandButton.scss';\n\ninterface ExpandButton {\n buttonId: string;\n isSelected: boolean;\n expandContentId: string;\n children?: ComponentChildren;\n showRadioButton?: boolean;\n classNameModifiers?: string[];\n}\n\nfunction ExpandButton({ buttonId, showRadioButton, isSelected, expandContentId, children, classNameModifiers = [] }: Readonly<ExpandButton>) {\n return (\n // See discussion: https://github.com/w3c/aria/issues/1404\n // this has been disabled as we got quite a few complains\n // mainly from merchants running automated systems\n <button\n className={classNames(\n 'adyen-checkout__payment-method__header__title',\n ...classNameModifiers.map(modifier => `adyen-checkout-expand-button--${modifier}`)\n )}\n id={buttonId}\n role={'radio'}\n aria-checked={isSelected}\n //aria-expanded={isSelected} - disabled for now\n aria-controls={expandContentId}\n type=\"button\"\n >\n {showRadioButton && (\n <span\n className={classNames({\n 'adyen-checkout__payment-method__radio': true,\n 'adyen-checkout__payment-method__radio--selected': isSelected\n })}\n aria-hidden=\"true\"\n />\n )}\n {children}\n </button>\n );\n}\n\nexport default ExpandButton;\n"],"names":["ExpandButton","buttonId","showRadioButton","isSelected","expandContentId","children","classNameModifiers","h","button","className","classNames","map","modifier","id","role","aria-checked","aria-controls","type","span","aria-hidden"],"mappings":"kHAaA,SAASA,GAAaC,SAAEA,EAAQC,gBAAEA,EAAeC,WAAEA,EAAUC,gBAAEA,EAAeC,SAAEA,EAAQC,mBAAEA,EAAqB,KAC3G,OAIIC,EAACC,SAAAA,CACGC,UAAWC,EACP,mDACGJ,EAAmBK,KAAIC,GAAY,iCAAiCA,OAE3EC,GAAIZ,EACJa,KAAM,QACNC,eAAcZ,EAEda,gBAAeZ,EACfa,KAAK,UAEJf,GACGK,EAACW,OAAAA,CACGT,UAAWC,EAAW,CAClB,yCAAyC,EACzC,kDAAmDP,IAEvDgB,cAAY,SAGnBd,EAGb"}
@@ -1,2 +1,2 @@
1
- import e from"../utils/cardType.js";import{error as t}from"../../utilities/logger.js";import{CVC_POLICY_REQUIRED as o}from"../../constants.js";function r({csfState:r,csfConfig:i,csfProps:s,csfCallbacks:n},c){r.isConfigured=!0;const f={iframesConfigured:!0,type:r.type,rootNode:s.rootNode};if(n.onConfigSuccess(f),1===r.numIframes&&i.isCreditCardType){if("card"===r.type)return t("ERROR: Payment method with a single secured field - but 'type' has not been set to a specific card brand"),!1;const i=e.getCardByBrand(r.type);if(i){var a;(null!==(a=i.cvcPolicy)&&void 0!==a?a:o)!==o&&c()}}return!0}export{r as isConfigured};
1
+ import t from"../utils/cardType.js";import{error as e}from"../../utilities/logger.js";import{CVC_POLICY_REQUIRED as r}from"../../constants.js";function o({csfState:o,csfConfig:i,csfProps:s,csfCallbacks:n},a){o.isConfigured=!0;const c={iframesConfigured:!0,type:o.type,rootNode:s.rootNode};if(n.onConfigSuccess(c),1===o.numIframes&&i.isCreditCardType){if("card"===o.type)return e("ERROR: Payment method with a single secured field - but 'brands' has not been set to an array containing the specific card brand"),!1;const i=t.getCardByBrand(o.type);if(i){var f;(null!==(f=i.cvcPolicy)&&void 0!==f?f:r)!==r&&a()}}return!0}export{o as isConfigured};
2
2
  //# sourceMappingURL=isConfigured.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isConfigured.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/partials/isConfigured.ts"],"sourcesContent":["import cardType from '../utils/cardType';\nimport { CardObject, CardConfigSuccessData } from '../../types';\nimport * as logger from '../../utilities/logger';\nimport { CVC_POLICY_REQUIRED } from '../../constants';\nimport { CSFThisObject } from '../types';\n\n/**\n * @param csfState - comes from initial, partial, implementation\n * @param csfConfig - comes from initial, partial, implementation\n * @param csfProps - comes from initial, partial, implementation\n * @param csfCallbacks - comes from initial, partial, implementation\n * @param validateForm - comes from initial, partial, implementation\n */\nexport function isConfigured({ csfState, csfConfig, csfProps, csfCallbacks }: CSFThisObject, validateForm): boolean {\n csfState.isConfigured = true;\n\n const callbackObj: CardConfigSuccessData = { iframesConfigured: true, type: csfState.type, rootNode: csfProps.rootNode as HTMLElement };\n\n csfCallbacks.onConfigSuccess(callbackObj);\n\n // If a recurring card\n if (csfState.numIframes === 1 && csfConfig.isCreditCardType) {\n if (csfState.type === 'card') {\n logger.error(\"ERROR: Payment method with a single secured field - but 'type' has not been set to a specific card brand\");\n return false;\n }\n\n // Get card object from txVariant\n const card: CardObject = cardType.getCardByBrand(csfState.type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (card) {\n // Assess whether cvc field is required\n const cvcPolicy = card.cvcPolicy ?? CVC_POLICY_REQUIRED;\n\n // If cvc is optional - the form can be considered valid\n if (cvcPolicy !== CVC_POLICY_REQUIRED) {\n validateForm();\n }\n }\n }\n return true;\n}\n"],"names":["isConfigured","csfState","csfConfig","csfProps","csfCallbacks","validateForm","callbackObj","iframesConfigured","type","rootNode","onConfigSuccess","numIframes","isCreditCardType","logger","card","cardType","getCardByBrand","cvcPolicy","CVC_POLICY_REQUIRED"],"mappings":"+IAaO,SAASA,GAAaC,SAAEA,EAAQC,UAAEA,EAASC,SAAEA,EAAQC,aAAEA,GAA+BC,GACzFJ,EAASD,cAAe,EAExB,MAAMM,EAAqC,CAAEC,mBAAmB,EAAMC,KAAMP,EAASO,KAAMC,SAAUN,EAASM,UAK9G,GAHAL,EAAaM,gBAAgBJ,GAGD,IAAxBL,EAASU,YAAoBT,EAAUU,iBAAkB,CACzD,GAAsB,SAAlBX,EAASO,KAET,OADAK,EAAa,6GACN,EAIX,MAAMC,EAAmBC,EAASC,eAAef,EAASO,MAI1D,GAAIM,EAAM,CAEYA,IAAAA,GAAc,QAAdA,EAAAA,EAAKG,qBAALH,EAAAA,EAAkBI,KAGlBA,GACdb,GAER,CACJ,CACA,OAAO,CACX"}
1
+ {"version":3,"file":"isConfigured.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/partials/isConfigured.ts"],"sourcesContent":["import cardType from '../utils/cardType';\nimport { CardObject, CardConfigSuccessData } from '../../types';\nimport * as logger from '../../utilities/logger';\nimport { CVC_POLICY_REQUIRED } from '../../constants';\nimport { CSFThisObject } from '../types';\n\n/**\n * @param csfState - comes from initial, partial, implementation\n * @param csfConfig - comes from initial, partial, implementation\n * @param csfProps - comes from initial, partial, implementation\n * @param csfCallbacks - comes from initial, partial, implementation\n * @param validateForm - comes from initial, partial, implementation\n */\nexport function isConfigured({ csfState, csfConfig, csfProps, csfCallbacks }: CSFThisObject, validateForm): boolean {\n csfState.isConfigured = true;\n\n const callbackObj: CardConfigSuccessData = { iframesConfigured: true, type: csfState.type, rootNode: csfProps.rootNode as HTMLElement };\n\n csfCallbacks.onConfigSuccess(callbackObj);\n\n // If a recurring card\n if (csfState.numIframes === 1 && csfConfig.isCreditCardType) {\n if (csfState.type === 'card') {\n logger.error(\n \"ERROR: Payment method with a single secured field - but 'brands' has not been set to an array containing the specific card brand\"\n );\n return false;\n }\n\n // Get card object from txVariant\n const card: CardObject = cardType.getCardByBrand(csfState.type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (card) {\n // Assess whether cvc field is required\n const cvcPolicy = card.cvcPolicy ?? CVC_POLICY_REQUIRED;\n\n // If cvc is optional - the form can be considered valid\n if (cvcPolicy !== CVC_POLICY_REQUIRED) {\n validateForm();\n }\n }\n }\n return true;\n}\n"],"names":["isConfigured","csfState","csfConfig","csfProps","csfCallbacks","validateForm","callbackObj","iframesConfigured","type","rootNode","onConfigSuccess","numIframes","isCreditCardType","logger","card","cardType","getCardByBrand","cvcPolicy","CVC_POLICY_REQUIRED"],"mappings":"+IAaO,SAASA,GAAaC,SAAEA,EAAQC,UAAEA,EAASC,SAAEA,EAAQC,aAAEA,GAA+BC,GACzFJ,EAASD,cAAe,EAExB,MAAMM,EAAqC,CAAEC,mBAAmB,EAAMC,KAAMP,EAASO,KAAMC,SAAUN,EAASM,UAK9G,GAHAL,EAAaM,gBAAgBJ,GAGD,IAAxBL,EAASU,YAAoBT,EAAUU,iBAAkB,CACzD,GAAsB,SAAlBX,EAASO,KAIT,OAHAK,EACI,qIAEG,EAIX,MAAMC,EAAmBC,EAASC,eAAef,EAASO,MAI1D,GAAIM,EAAM,CAEYA,IAAAA,GAAc,QAAdA,EAAAA,EAAKG,qBAALH,EAAAA,EAAkBI,KAGlBA,GACdb,GAER,CACJ,CACA,OAAO,CACX"}
@@ -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";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const r='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const o=({analyticsContext:o,clientKey:i,locale:c,analyticsPath:l,bundleType:a})=>{let s;const u={errorLevel:"fatal",loadingContext:o,path:`${l}?clientKey=${i}`};return o=>{const l=function(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){n(e,t,r[t])}))}return e}({version:"6.9.0",channel:"Web",platform:"Web",buildType:a,locale:c,referrer:window.location.href,screenWidth:window.screen.width},o);if(s)return s;if(!i)return Promise.reject("no-client-key");const f=new t("checkout-attempt-id","sessionStorage"),p=f.get();return function(e){if(!(null==e?void 0:e.id))return!1;const t=Date.now()-9e5;return e.timestamp>t}(p)?Promise.resolve(p.id):(s=e(u,l).then((e=>{if(null==e?void 0:e.checkoutAttemptId)return f.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(r))),s)}};export{r as FAILURE_MSG,o as default};
1
+ import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const r='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const o=({analyticsContext:o,clientKey:i,locale:c,analyticsPath:l,bundleType:a})=>{let s;const u={errorLevel:"fatal",loadingContext:o,path:`${l}?clientKey=${i}`};return o=>{const l=function(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){n(e,t,r[t])}))}return e}({version:"6.11.0",channel:"Web",platform:"Web",buildType:a,locale:c,referrer:window.location.href,screenWidth:window.screen.width},o);if(s)return s;if(!i)return Promise.reject("no-client-key");const f=new t("checkout-attempt-id","sessionStorage"),p=f.get();return function(e){if(!(null==e?void 0:e.id))return!1;const t=Date.now()-9e5;return e.timestamp>t}(p)?Promise.resolve(p.id):(s=e(u,l).then((e=>{if(null==e?void 0:e.checkoutAttemptId)return f.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(r))),s)}};export{r as FAILURE_MSG,o as default};
2
2
  //# sourceMappingURL=collect-id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collect-id.js","sources":["../../../../../src/core/Services/analytics/collect-id.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Storage from '../../../utils/Storage';\nimport { CheckoutAttemptIdSession, CollectIdEvent, CollectIdProps, TelemetryEvent } from './types';\n\nexport const FAILURE_MSG =\n 'WARNING: Failed to retrieve \"checkoutAttemptId\". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession: CheckoutAttemptIdSession): boolean {\n if (!checkoutAttemptIdSession?.id) return false;\n\n const fifteenMinInMs = 1000 * 60 * 15;\n const fifteenMinAgoTimestamp = Date.now() - fifteenMinInMs;\n return checkoutAttemptIdSession.timestamp > fifteenMinAgoTimestamp;\n}\n\n/**\n * Send an event to Adyen with some basic telemetry info and receive a checkoutAttemptId in response\n * @param config - object containing values needed to calculate the url for the request; and also some that need to be serialized and included in the body of request\n * @returns a function returning a promise containing the response of the call (an object containing a checkoutAttemptId property)\n */\n// const collectId = ({ analyticsContext, clientKey, locale, amount }: CollectIdProps) => { // TODO - amount will be supported in the future\nconst collectId = ({ analyticsContext, clientKey, locale, analyticsPath, bundleType }: CollectIdProps) => {\n let promise;\n\n const options = {\n errorLevel: 'fatal' as const, // ensure our catch block is called\n loadingContext: analyticsContext,\n path: `${analyticsPath}?clientKey=${clientKey}`\n };\n\n return (event: CollectIdEvent): Promise<string> => {\n const telemetryEvent: TelemetryEvent = {\n // amount, // TODO will be supported in the future\n version: process.env.VERSION,\n // The data team want both platform & channel properties:\n channel: 'Web',\n platform: 'Web',\n buildType: bundleType,\n locale,\n referrer: window.location.href,\n screenWidth: window.screen.width,\n ...event\n };\n\n if (promise) return promise; // Prevents multiple standalone components on the same page from making multiple calls to collect a checkoutAttemptId\n if (!clientKey) return Promise.reject('no-client-key');\n\n const storage = new Storage<CheckoutAttemptIdSession>('checkout-attempt-id', 'sessionStorage');\n const checkoutAttemptIdSession = storage.get();\n\n // In some cases, e.g. where the merchant has redirected the shopper and then returned them to checkout, we still have a valid checkoutAttemptId\n // so there is no need for the re-initialised Checkout to generate another one\n if (confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession)) {\n return Promise.resolve(checkoutAttemptIdSession.id);\n }\n\n promise = httpPost(options, telemetryEvent)\n .then(conversion => {\n if (conversion?.checkoutAttemptId) {\n storage.set({ id: conversion.checkoutAttemptId, timestamp: Date.now() });\n return conversion.checkoutAttemptId;\n }\n return undefined;\n })\n .catch(() => {\n return Promise.reject(FAILURE_MSG);\n });\n\n return promise;\n };\n};\n\nexport default collectId;\n"],"names":["FAILURE_MSG","collectId","analyticsContext","clientKey","locale","analyticsPath","bundleType","promise","options","errorLevel","loadingContext","path","event","telemetryEvent","_object_spread","version","channel","platform","buildType","referrer","window","location","href","screenWidth","screen","width","Promise","reject","storage","Storage","checkoutAttemptIdSession","get","id","fifteenMinAgoTimestamp","Date","now","timestamp","confirmSessionDurationIsMaxFifteenMinutes","resolve","httpPost","then","conversion","checkoutAttemptId","set","undefined","catch"],"mappings":"uMAIO,MAAMA,EACT,uKAoBJ,MAAMC,EAAY,EAAGC,mBAAkBC,YAAWC,SAAQC,gBAAeC,iBACrE,IAAIC,EAEJ,MAAMC,EAAU,CACZC,WAAY,QACZC,eAAgBR,EAChBS,KAAM,GAAGN,eAA2BF,KAGxC,OAAQS,IACJ,MAAMC,wUAAiCC,CAAA,CAEnCC,QAAS,QAETC,QAAS,MACTC,SAAU,MACVC,UAAWZ,EACXF,SACAe,SAAUC,OAAOC,SAASC,KAC1BC,YAAaH,OAAOI,OAAOC,OACxBb,GAGP,GAAIL,EAAS,OAAOA,EACpB,IAAKJ,EAAW,OAAOuB,QAAQC,OAAO,iBAEtC,MAAMC,EAAU,IAAIC,EAAkC,sBAAuB,kBACvEC,EAA2BF,EAAQG,MAIzC,OA7CR,SAAmDD,GAC/C,KAAKA,aAAAA,EAAAA,EAA0BE,IAAI,OAAO,EAE1C,MACMC,EAAyBC,KAAKC,MADb,IAEvB,OAAOL,EAAyBM,UAAYH,CAChD,CAuCYI,CAA0CP,GACnCJ,QAAQY,QAAQR,EAAyBE,KAGpDzB,EAAUgC,EAAS/B,EAASK,GACvB2B,MAAKC,IACF,GAAIA,aAAAA,EAAAA,EAAYC,kBAEZ,OADAd,EAAQe,IAAI,CAAEX,GAAIS,EAAWC,kBAAmBN,UAAWF,KAAKC,QACzDM,EAAWC,iBAEfE,IAEVC,OAAM,IACInB,QAAQC,OAAO3B,KAGvBO,EAAAA,CACX"}
1
+ {"version":3,"file":"collect-id.js","sources":["../../../../../src/core/Services/analytics/collect-id.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Storage from '../../../utils/Storage';\nimport { CheckoutAttemptIdSession, CollectIdEvent, CollectIdProps, TelemetryEvent } from './types';\n\nexport const FAILURE_MSG =\n 'WARNING: Failed to retrieve \"checkoutAttemptId\". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession: CheckoutAttemptIdSession): boolean {\n if (!checkoutAttemptIdSession?.id) return false;\n\n const fifteenMinInMs = 1000 * 60 * 15;\n const fifteenMinAgoTimestamp = Date.now() - fifteenMinInMs;\n return checkoutAttemptIdSession.timestamp > fifteenMinAgoTimestamp;\n}\n\n/**\n * Send an event to Adyen with some basic telemetry info and receive a checkoutAttemptId in response\n * @param config - object containing values needed to calculate the url for the request; and also some that need to be serialized and included in the body of request\n * @returns a function returning a promise containing the response of the call (an object containing a checkoutAttemptId property)\n */\n// const collectId = ({ analyticsContext, clientKey, locale, amount }: CollectIdProps) => { // TODO - amount will be supported in the future\nconst collectId = ({ analyticsContext, clientKey, locale, analyticsPath, bundleType }: CollectIdProps) => {\n let promise;\n\n const options = {\n errorLevel: 'fatal' as const, // ensure our catch block is called\n loadingContext: analyticsContext,\n path: `${analyticsPath}?clientKey=${clientKey}`\n };\n\n return (event: CollectIdEvent): Promise<string> => {\n const telemetryEvent: TelemetryEvent = {\n // amount, // TODO will be supported in the future\n version: process.env.VERSION,\n // The data team want both platform & channel properties:\n channel: 'Web',\n platform: 'Web',\n buildType: bundleType,\n locale,\n referrer: window.location.href,\n screenWidth: window.screen.width,\n ...event\n };\n\n if (promise) return promise; // Prevents multiple standalone components on the same page from making multiple calls to collect a checkoutAttemptId\n if (!clientKey) return Promise.reject('no-client-key');\n\n const storage = new Storage<CheckoutAttemptIdSession>('checkout-attempt-id', 'sessionStorage');\n const checkoutAttemptIdSession = storage.get();\n\n // In some cases, e.g. where the merchant has redirected the shopper and then returned them to checkout, we still have a valid checkoutAttemptId\n // so there is no need for the re-initialised Checkout to generate another one\n if (confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession)) {\n return Promise.resolve(checkoutAttemptIdSession.id);\n }\n\n promise = httpPost(options, telemetryEvent)\n .then(conversion => {\n if (conversion?.checkoutAttemptId) {\n storage.set({ id: conversion.checkoutAttemptId, timestamp: Date.now() });\n return conversion.checkoutAttemptId;\n }\n return undefined;\n })\n .catch(() => {\n return Promise.reject(FAILURE_MSG);\n });\n\n return promise;\n };\n};\n\nexport default collectId;\n"],"names":["FAILURE_MSG","collectId","analyticsContext","clientKey","locale","analyticsPath","bundleType","promise","options","errorLevel","loadingContext","path","event","telemetryEvent","_object_spread","version","channel","platform","buildType","referrer","window","location","href","screenWidth","screen","width","Promise","reject","storage","Storage","checkoutAttemptIdSession","get","id","fifteenMinAgoTimestamp","Date","now","timestamp","confirmSessionDurationIsMaxFifteenMinutes","resolve","httpPost","then","conversion","checkoutAttemptId","set","undefined","catch"],"mappings":"uMAIO,MAAMA,EACT,uKAoBJ,MAAMC,EAAY,EAAGC,mBAAkBC,YAAWC,SAAQC,gBAAeC,iBACrE,IAAIC,EAEJ,MAAMC,EAAU,CACZC,WAAY,QACZC,eAAgBR,EAChBS,KAAM,GAAGN,eAA2BF,KAGxC,OAAQS,IACJ,MAAMC,wUAAiCC,CAAA,CAEnCC,QAAS,SAETC,QAAS,MACTC,SAAU,MACVC,UAAWZ,EACXF,SACAe,SAAUC,OAAOC,SAASC,KAC1BC,YAAaH,OAAOI,OAAOC,OACxBb,GAGP,GAAIL,EAAS,OAAOA,EACpB,IAAKJ,EAAW,OAAOuB,QAAQC,OAAO,iBAEtC,MAAMC,EAAU,IAAIC,EAAkC,sBAAuB,kBACvEC,EAA2BF,EAAQG,MAIzC,OA7CR,SAAmDD,GAC/C,KAAKA,aAAAA,EAAAA,EAA0BE,IAAI,OAAO,EAE1C,MACMC,EAAyBC,KAAKC,MADb,IAEvB,OAAOL,EAAyBM,UAAYH,CAChD,CAuCYI,CAA0CP,GACnCJ,QAAQY,QAAQR,EAAyBE,KAGpDzB,EAAUgC,EAAS/B,EAASK,GACvB2B,MAAKC,IACF,GAAIA,aAAAA,EAAAA,EAAYC,kBAEZ,OADAd,EAAQe,IAAI,CAAEX,GAAIS,EAAWC,kBAAmBN,UAAWF,KAAKC,QACzDM,EAAWC,iBAEfE,IAEVC,OAAM,IACInB,QAAQC,OAAO3B,KAGvBO,EAAAA,CACX"}
@@ -1,2 +1,2 @@
1
- import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import e from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as s}from"./ProcessResponse/PaymentAction/PaymentAction.js";import n from"./Analytics/Analytics.js";import{processGlobalOptions as i,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as l}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as h}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as g}from"./Analytics/constants.js";import{THREEDS2_FULL as v}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as b}from"../language/constants.js";import C from"./Services/get-translations.js";import{defaultProps as j}from"./core.defaultProps.js";import{formatLocale as w,formatCustomTranslations as O}from"../language/utils.js";import{resolveEnvironments as P}from"./Environment/Environment.js";function E(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function A(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})))),s.forEach((function(o){E(t,o,e[o])}))}return t}function M(t,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):function(t){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);o.push.apply(o,e)}return o}(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})),t}function x(t,o){if(null==t)return{};var e,s,n=function(t,o){if(null==t)return{};var e,s,n={},i=Object.keys(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||(n[e]=t[e]);return n}(t,o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}class T{static setBundleType(t){T.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:e,countryCode:s,paymentMethods:n}=t,i=x(t,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(M(A({},i),{amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||e,countryCode:this.options.countryCode||s})),this.createPaymentMethodsList(n),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await C(this.cdnTranslationsUrl,T.metadata.version,this.options.locale)}catch(n){var t,o,e,s;n instanceof y?null===(t=(o=this.options).onError)||void 0===t||t.call(o,n):null===(e=(s=this.options).onError)||void 0===e||e.call(s,new y("ERROR","Failed to fetch translation",{cause:n}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:b}),this.options.locale=w(this.options.locale),this.options.translations=O(this.options.translations)}submitDetails(t){let o=null;var e,s;(this.options.onAdditionalDetails&&(o=new Promise(((o,e)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:e})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>{var o,e;return null===(o=(e=this.options).onError)||void 0===o||o.call(e,t),Promise.reject(t)}))),o)?o.then(d).then(m).then((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentCompleted)||void 0===o||o.call(e,t)})).catch((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentFailed)||void 0===o||o.call(e,t)})):null===(e=(s=this.options).onError)||void 0===e||e.call(s,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(l(t,"action")&&l(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 e=t.type===v?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(e,{type:g,subtype:t.type,message:`${e} action was handled by the SDK`});const n=A({},this.getCorePropsForComponent(),o);return s(this,p,t,n)}return this.handleCreateError()}getCorePropsForComponent(){return M(A({},i(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){var o;const e=null!==(o=null==t?void 0:t.name)&&void 0!==o?o:"The passed payment method",s=t?`${e} 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(s)}createPaymentMethodsList(t){this.paymentMethodsResponse=new e(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const e=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,M(A({},this.options),{loadingContext:this.loadingContext})),analytics:n({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:T.metadata.bundleType}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:e,customTranslations:this.options.translations}),srPanel:new h(this,A({},this.options.srConfig))})}constructor(t){var o;E(this,"session",void 0),E(this,"paymentMethodsResponse",void 0),E(this,"modules",void 0),E(this,"options",void 0),E(this,"analyticsContext",void 0),E(this,"loadingContext",void 0),E(this,"cdnImagesUrl",void 0),E(this,"cdnTranslationsUrl",void 0),E(this,"components",[]),E(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const e=A({},t,this.session&&{session:this.session});o.update(e)})),this)))))),E(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),E(this,"setOptions",(t=>{var o;this.options=M(A({},this.options,t),{locale:(null==t?void 0:t.locale)||(null===(o=this.options)||void 0===o?void 0:o.locale)})})),r(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions(A({},j,t));const{apiUrl:e,analyticsUrl:s,cdnImagesUrl:n,cdnTranslationsUrl:i}=P(this.options.environment,this.options._environmentUrls);this.loadingContext=e,this.analyticsContext=s,this.cdnImagesUrl=n,this.cdnTranslationsUrl=i,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const l=null===(o=this.options.clientKey)||void 0===o?void 0:o.substring(0,4);var c,h;if(("test"===l||"live"===l)&&!this.loadingContext.includes(l))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${l} clientKey against the ${(null===(c=this.options._environmentUrls)||void 0===c?void 0:c.api)||this.options.environment} environment`);"pub."===l&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${null===(h=this.options.clientKey)||void 0===h?void 0:h.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=T.metadata)}}E(T,"metadata",{version:"6.9.0",bundleType:"eslegacy"}),E(T,"registry",p);export{T as default};
1
+ import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import e from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as s}from"./ProcessResponse/PaymentAction/PaymentAction.js";import n from"./Analytics/Analytics.js";import{processGlobalOptions as i,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as l}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as h}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as g}from"./Analytics/constants.js";import{THREEDS2_FULL as v}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as b}from"../language/constants.js";import C from"./Services/get-translations.js";import{defaultProps as j}from"./core.defaultProps.js";import{formatLocale as w,formatCustomTranslations as O}from"../language/utils.js";import{resolveEnvironments as P}from"./Environment/Environment.js";function E(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function A(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})))),s.forEach((function(o){E(t,o,e[o])}))}return t}function M(t,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):function(t){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);o.push.apply(o,e)}return o}(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})),t}function x(t,o){if(null==t)return{};var e,s,n=function(t,o){if(null==t)return{};var e,s,n={},i=Object.keys(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||(n[e]=t[e]);return n}(t,o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}class T{static setBundleType(t){T.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:e,countryCode:s,paymentMethods:n}=t,i=x(t,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(M(A({},i),{amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||e,countryCode:this.options.countryCode||s})),this.createPaymentMethodsList(n),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await C(this.cdnTranslationsUrl,T.metadata.version,this.options.locale)}catch(n){var t,o,e,s;n instanceof y?null===(t=(o=this.options).onError)||void 0===t||t.call(o,n):null===(e=(s=this.options).onError)||void 0===e||e.call(s,new y("ERROR","Failed to fetch translation",{cause:n}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:b}),this.options.locale=w(this.options.locale),this.options.translations=O(this.options.translations)}submitDetails(t){let o=null;var e,s;(this.options.onAdditionalDetails&&(o=new Promise(((o,e)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:e})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>{var o,e;return null===(o=(e=this.options).onError)||void 0===o||o.call(e,t),Promise.reject(t)}))),o)?o.then(d).then(m).then((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentCompleted)||void 0===o||o.call(e,t)})).catch((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentFailed)||void 0===o||o.call(e,t)})):null===(e=(s=this.options).onError)||void 0===e||e.call(s,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(l(t,"action")&&l(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 e=t.type===v?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(e,{type:g,subtype:t.type,message:`${e} action was handled by the SDK`});const n=A({},this.getCorePropsForComponent(),o);return s(this,p,t,n)}return this.handleCreateError()}getCorePropsForComponent(){return M(A({},i(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){var o;const e=null!==(o=null==t?void 0:t.name)&&void 0!==o?o:"The passed payment method",s=t?`${e} 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(s)}createPaymentMethodsList(t){this.paymentMethodsResponse=new e(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const e=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,M(A({},this.options),{loadingContext:this.loadingContext})),analytics:n({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:T.metadata.bundleType}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:e,customTranslations:this.options.translations}),srPanel:new h(this,A({},this.options.srConfig))})}constructor(t){var o;E(this,"session",void 0),E(this,"paymentMethodsResponse",void 0),E(this,"modules",void 0),E(this,"options",void 0),E(this,"analyticsContext",void 0),E(this,"loadingContext",void 0),E(this,"cdnImagesUrl",void 0),E(this,"cdnTranslationsUrl",void 0),E(this,"components",[]),E(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const e=A({},t,this.session&&{session:this.session});o.update(e)})),this)))))),E(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),E(this,"setOptions",(t=>{var o;this.options=M(A({},this.options,t),{locale:(null==t?void 0:t.locale)||(null===(o=this.options)||void 0===o?void 0:o.locale)})})),r(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions(A({},j,t));const{apiUrl:e,analyticsUrl:s,cdnImagesUrl:n,cdnTranslationsUrl:i}=P(this.options.environment,this.options._environmentUrls);this.loadingContext=e,this.analyticsContext=s,this.cdnImagesUrl=n,this.cdnTranslationsUrl=i,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const l=null===(o=this.options.clientKey)||void 0===o?void 0:o.substring(0,4);var c,h;if(("test"===l||"live"===l)&&!this.loadingContext.includes(l))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${l} clientKey against the ${(null===(c=this.options._environmentUrls)||void 0===c?void 0:c.api)||this.options.environment} environment`);"pub."===l&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${null===(h=this.options.clientKey)||void 0===h?void 0:h.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=T.metadata)}}E(T,"metadata",{version:"6.11.0",bundleType:"eslegacy"}),E(T,"registry",p);export{T as default};
2
2
  //# sourceMappingURL=core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\n\nimport type { AnalyticsModule, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: Readonly<{\n risk: RiskModule;\n analytics: AnalyticsModule;\n resources: Resources;\n i18n: Language;\n srPanel: SRPanel;\n }>;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: process.env.VERSION,\n bundleType: process.env.BUNDLE_TYPE\n };\n\n public static registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `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.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...options,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount,\n bundleType: Core.metadata.bundleType\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","_object_spread_props","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cdnTranslationsUrl","version","_this_options_onError","_this_options","_this_options_onError1","_this_options1","AdyenCheckoutError","call","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","_this_options_onPaymentCompleted","cleanupFinalResult","onPaymentCompleted","_this_options_onPaymentFailed","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","modules","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","props","_object_spread","getCorePropsForComponent","getComponentForAction","handleCreateError","globalOptions","processGlobalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","components","push","paymentMethod","paymentMethodName","name","errorMessage","JSON","stringify","paymentMethodsResponse","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","analyticsContext","clientKey","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig","constructor","_this_options_clientKey","_define_property","update","forEach","newProps","remove","filter","c","_id","unmount","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","environment","_environmentUrls","Session","clientKeyType","substring","_this_options__environmentUrls","_this_options_clientKey1","includes","api","debug","exposeLibraryMetadata","window"],"mappings":"q5EA2BA,MAAMA,EA0BF,oBAAcC,CAAcC,GACxBF,EAAKG,SAASC,WAAaF,CAC/B,CAEA,eAAcG,IAAYC,GACtBC,EAASC,OAAOF,EACpB,CAMA,QAAAD,IAAmBC,GACfC,EAASC,OAAOF,EACpB,CAEOG,YAAAA,CAAaC,GAChB,OAAOH,EAASE,aAAaC,EACjC,CAuCA,gBAAaC,GAIT,aAHMC,KAAKC,iBACXD,KAAKE,kCACCF,KAAKG,oBACJH,IACX,CAEA,oBAAcC,GACV,OAAID,KAAKI,QACEJ,KAAKI,QACPC,aAAaL,KAAKM,SAClBC,MAAKC,IACF,MAAMC,OAAEA,EAAMC,cAAEA,EAAaC,YAAEA,EAAWC,eAAEA,GAA4BJ,EAATK,EAASL,EAAAA,EAAAA,CAAhEC,SAAQC,gBAAeC,cAAaC,mBAW5C,OATAZ,KAAKc,WAAWC,EACTF,EAAAA,CAAAA,EAAAA,GAAAA,CACHJ,OAAQT,KAAKM,QAAQU,MAAQhB,KAAKM,QAAQU,MAAMC,gBAAkBR,EAClES,OAAQlB,KAAKM,QAAQY,QAAUR,EAC/BC,YAAaX,KAAKM,QAAQK,aAAeA,KAG7CX,KAAKmB,yBAAyBP,GAEvBZ,IAAI,IAEdoB,OAAMC,IACCrB,KAAKM,QAAQgB,SAAStB,KAAKM,QAAQgB,QAAQD,GACxCE,QAAQC,OAAOH,OAIlCrB,KAAKmB,2BACEI,QAAQE,QAAQzB,MAC3B,CAEA,6BAAc0B,GACV,IACI,aAAaC,EA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GAIc,IAAAC,EAKSC,EARlF,IAAuB,SAAlBH,GAA8C,SAAlBA,KAA8BlI,KAAKiF,eAAeqD,SAASJ,GACxF,MAAM,IAAIhG,EACN,uBACA,0BAA0BgG,4BAAuC,QAAAE,EAAApI,KAAKM,QAAQ0H,wBAAb,IAAAI,OAAA,EAAAA,EAA+BG,MAAOvI,KAAKM,QAAQyH,2BAGtG,SAAlBG,GACA5F,QAAQkG,MACJ,0EAAgG,QAAtBH,EAAArI,KAAKM,QAAQgG,qBAAb+B,SAAAA,EAAwBF,UAAU,EAAG,oQAInHnI,KAAKM,QAAQmI,wBACbC,OAAO,iBAAsBtJ,EAAKG,SAE1C,EA9DAyH,EAnBE5H,EAmBqBG,WAAW,CAC9BsC,QAAS,QACTrC,WAAY,aAGhBwH,EAxBE5H,EAwBYO,WAAWA"}
1
+ {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\n\nimport type { AnalyticsModule, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: Readonly<{\n risk: RiskModule;\n analytics: AnalyticsModule;\n resources: Resources;\n i18n: Language;\n srPanel: SRPanel;\n }>;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: process.env.VERSION,\n bundleType: process.env.BUNDLE_TYPE\n };\n\n public static registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `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.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...options,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount,\n bundleType: Core.metadata.bundleType\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","_object_spread_props","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cdnTranslationsUrl","version","_this_options_onError","_this_options","_this_options_onError1","_this_options1","AdyenCheckoutError","call","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","_this_options_onPaymentCompleted","cleanupFinalResult","onPaymentCompleted","_this_options_onPaymentFailed","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","modules","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","props","_object_spread","getCorePropsForComponent","getComponentForAction","handleCreateError","globalOptions","processGlobalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","components","push","paymentMethod","paymentMethodName","name","errorMessage","JSON","stringify","paymentMethodsResponse","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","analyticsContext","clientKey","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig","constructor","_this_options_clientKey","_define_property","update","forEach","newProps","remove","filter","c","_id","unmount","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","environment","_environmentUrls","Session","clientKeyType","substring","_this_options__environmentUrls","_this_options_clientKey1","includes","api","debug","exposeLibraryMetadata","window"],"mappings":"q5EA2BA,MAAMA,EA0BF,oBAAcC,CAAcC,GACxBF,EAAKG,SAASC,WAAaF,CAC/B,CAEA,eAAcG,IAAYC,GACtBC,EAASC,OAAOF,EACpB,CAMA,QAAAD,IAAmBC,GACfC,EAASC,OAAOF,EACpB,CAEOG,YAAAA,CAAaC,GAChB,OAAOH,EAASE,aAAaC,EACjC,CAuCA,gBAAaC,GAIT,aAHMC,KAAKC,iBACXD,KAAKE,kCACCF,KAAKG,oBACJH,IACX,CAEA,oBAAcC,GACV,OAAID,KAAKI,QACEJ,KAAKI,QACPC,aAAaL,KAAKM,SAClBC,MAAKC,IACF,MAAMC,OAAEA,EAAMC,cAAEA,EAAaC,YAAEA,EAAWC,eAAEA,GAA4BJ,EAATK,EAASL,EAAAA,EAAAA,CAAhEC,SAAQC,gBAAeC,cAAaC,mBAW5C,OATAZ,KAAKc,WAAWC,EACTF,EAAAA,CAAAA,EAAAA,GAAAA,CACHJ,OAAQT,KAAKM,QAAQU,MAAQhB,KAAKM,QAAQU,MAAMC,gBAAkBR,EAClES,OAAQlB,KAAKM,QAAQY,QAAUR,EAC/BC,YAAaX,KAAKM,QAAQK,aAAeA,KAG7CX,KAAKmB,yBAAyBP,GAEvBZ,IAAI,IAEdoB,OAAMC,IACCrB,KAAKM,QAAQgB,SAAStB,KAAKM,QAAQgB,QAAQD,GACxCE,QAAQC,OAAOH,OAIl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BnB,EAAA/G,KAAKM,QAAQgG,iBAAb,IAAAS,OAAA,EAAAA,EAAwBoB,UAAU,EAAG,GAIc,IAAAC,EAKSC,EARlF,IAAuB,SAAlBH,GAA8C,SAAlBA,KAA8BlI,KAAKiF,eAAeqD,SAASJ,GACxF,MAAM,IAAIhG,EACN,uBACA,0BAA0BgG,4BAAuC,QAAAE,EAAApI,KAAKM,QAAQ0H,wBAAb,IAAAI,OAAA,EAAAA,EAA+BG,MAAOvI,KAAKM,QAAQyH,2BAGtG,SAAlBG,GACA5F,QAAQkG,MACJ,0EAAgG,QAAtBH,EAAArI,KAAKM,QAAQgG,qBAAb+B,SAAAA,EAAwBF,UAAU,EAAG,oQAInHnI,KAAKM,QAAQmI,wBACbC,OAAO,iBAAsBtJ,EAAKG,SAE1C,EA9DAyH,EAnBE5H,EAmBqBG,WAAW,CAC9BsC,QAAS,SACTrC,WAAY,aAGhBwH,EAxBE5H,EAwBYO,WAAWA"}
@@ -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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/adyen-web",
3
- "version": "6.9.0",
3
+ "version": "6.11.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://docs.adyen.com/checkout",
6
6
  "type": "module",
@@ -61,15 +61,16 @@
61
61
  "start": "npm run dev-server",
62
62
  "story": "storybook dev --port 3020 --disable-telemetry",
63
63
  "dev-server": "rollup --watch --config config/rollup.dev.js",
64
- "build": "rm -rf dist/ && npm run lint && npm run lint-styles && npm run type-check && npm run types:generate && rollup --config config/rollup.prod.js && rm -rf dist/temp-types",
64
+ "build": "rm -rf dist/ && npm run lint && npm run lint-styles && npm run type-check && npm run build:types && rollup --config config/rollup.prod.js && rm -rf dist/temp-types",
65
+ "build:types": "tsc --emitDeclarationOnly && node scripts/add-type-references.cjs",
65
66
  "docs:generate": "typedoc --out docs src --exclude \"**/*+(index|.test).ts\"",
66
67
  "start:storybook": "node .storybook/run.cjs",
68
+ "start:storybook:e2e": "cross-env DISABLE_MSW=true node .storybook/run.cjs",
67
69
  "build:storybook": "storybook build --disable-telemetry",
68
70
  "test": "jest --config config/jest.config.cjs",
69
71
  "test:watch": "npm run test -- --watchAll",
70
72
  "test:coverage": "npm run test -- --coverage",
71
73
  "type-check": "tsc --noEmit",
72
- "types:generate": "tsc --emitDeclarationOnly",
73
74
  "format": "npm run lint:fix && npm run prettier:fix && npm run styles:fix",
74
75
  "lint": "eslint .",
75
76
  "lint-styles": "stylelint \"**/*.scss\"",
@@ -92,16 +93,16 @@
92
93
  "@rollup/plugin-replace": "5.0.7",
93
94
  "@rollup/plugin-terser": "0.4.4",
94
95
  "@size-limit/preset-big-lib": "11.1.6",
95
- "@storybook/addon-a11y": "^8.3.4",
96
- "@storybook/addon-essentials": "^8.3.4",
97
- "@storybook/manager-api": "^8.3.4",
98
- "@storybook/preact": "^8.3.4",
99
- "@storybook/preact-vite": "^8.3.4",
96
+ "@storybook/addon-a11y": "8.6.3",
97
+ "@storybook/addon-essentials": "8.6.3",
98
+ "@storybook/manager-api": "8.6.3",
99
+ "@storybook/preact": "8.6.3",
100
+ "@storybook/preact-vite": "8.6.3",
100
101
  "@swc/core": "1.10.17",
101
102
  "@testing-library/jest-dom": "6.6.3",
102
103
  "@testing-library/preact": "3.2.4",
103
104
  "@testing-library/preact-hooks": "1.1.0",
104
- "@testing-library/user-event": "14.6.1",
105
+ "@testing-library/user-event": "14.5.2",
105
106
  "@types/eslint__js": "8.42.3",
106
107
  "@types/jest": "29.5.14",
107
108
  "autoprefixer": "10.4.20",
@@ -114,7 +115,7 @@
114
115
  "eslint-plugin-import": "2.31.0",
115
116
  "eslint-plugin-jsx-a11y": "6.10.2",
116
117
  "eslint-plugin-react": "7.37.4",
117
- "eslint-plugin-storybook": "0.11.1",
118
+ "eslint-plugin-storybook": "0.11.3",
118
119
  "eslint-plugin-testing-library": "6.5.0",
119
120
  "globals": "15.14.0",
120
121
  "husky": "9.1.7",
@@ -133,7 +134,7 @@
133
134
  "rollup-plugin-swc3": "0.12.1",
134
135
  "sass": "1.77.8",
135
136
  "size-limit": "11.1.6",
136
- "storybook": "^8.3.4",
137
+ "storybook": "8.6.3",
137
138
  "stylelint": "16.12.0",
138
139
  "stylelint-config-standard-scss": "13.1.0",
139
140
  "ts-jest": "29.2.5",
@@ -146,7 +147,7 @@
146
147
  "whatwg-fetch": "3.6.20"
147
148
  },
148
149
  "dependencies": {
149
- "@types/applepayjs": "14.0.8",
150
+ "@types/applepayjs": "14.0.9",
150
151
  "@types/googlepay": "0.7.6",
151
152
  "classnames": "2.5.1",
152
153
  "preact": "10.22.1"