@adyen/adyen-web 6.28.0 → 6.29.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 (246) hide show
  1. package/dist/cjs/adyen.css +8 -6
  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 +2688 -2557
  6. package/dist/es/adyen.css +8 -6
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Card/Card.js +1 -1
  9. package/dist/es/components/Card/Card.js.map +1 -1
  10. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  11. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  13. package/dist/es/components/Econtext/Econtext.js +1 -1
  14. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  15. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  16. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  17. package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
  18. package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
  19. package/dist/es/components/Iris/Iris.js +2 -0
  20. package/dist/es/components/Iris/Iris.js.map +1 -0
  21. package/dist/es/components/Iris/components/IrisComponent.js +2 -0
  22. package/dist/es/components/Iris/components/IrisComponent.js.map +1 -0
  23. package/dist/es/components/Iris/components/IrisComponent.module.scss.js +2 -0
  24. package/dist/es/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
  25. package/dist/es/components/Iris/components/IrisGenerateQRCode.js +2 -0
  26. package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
  27. package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
  28. package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
  29. package/dist/es/components/Iris/components/IrisQrCodeInstructions.js +2 -0
  30. package/dist/es/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
  31. package/dist/es/components/Iris/constants.js +2 -0
  32. package/dist/es/components/Iris/constants.js.map +1 -0
  33. package/dist/es/components/Iris/types.js +2 -0
  34. package/dist/es/components/Iris/types.js.map +1 -0
  35. package/dist/es/components/Iris/utils.js +2 -0
  36. package/dist/es/components/Iris/utils.js.map +1 -0
  37. package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
  38. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  39. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  40. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  41. package/dist/es/components/components-name-map.js +1 -1
  42. package/dist/es/components/components-name-map.js.map +1 -1
  43. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  44. package/dist/es/components/index.js +1 -1
  45. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  46. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  47. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  48. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  49. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  50. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  51. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  52. package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
  53. package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
  54. package/dist/es/components/internal/Voucher/Voucher.js +1 -1
  55. package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
  56. package/dist/es/components/internal/Voucher/utils.js.map +1 -1
  57. package/dist/es/components/tx-variants.js +1 -1
  58. package/dist/es/components/tx-variants.js.map +1 -1
  59. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  60. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  61. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
  62. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
  63. package/dist/es/core/ProcessResponse/PaymentMethods/utils.js +1 -1
  64. package/dist/es/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  65. package/dist/es/core/config.js +1 -1
  66. package/dist/es/index.d.ts +2688 -2557
  67. package/dist/es/index.js +1 -1
  68. package/dist/es/language/Language.js.map +1 -1
  69. package/dist/es/utils/createSdkData.js +2 -0
  70. package/dist/es/utils/createSdkData.js.map +1 -0
  71. package/dist/es-legacy/adyen.css +8 -6
  72. package/dist/es-legacy/adyen.css.map +1 -1
  73. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  74. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  75. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
  76. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  77. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
  78. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
  79. package/dist/es-legacy/components/Card/Card.js +1 -1
  80. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  81. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  82. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  83. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  84. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  85. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  86. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  87. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  88. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  89. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  90. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  91. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  92. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  93. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  94. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  95. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  96. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  97. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  98. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  99. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  100. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  101. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  102. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  103. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  104. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  105. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  106. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  107. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  108. package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
  109. package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
  110. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  111. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  112. package/dist/es-legacy/components/GooglePay/requests.js +1 -1
  113. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  114. package/dist/es-legacy/components/Iris/Iris.js +2 -0
  115. package/dist/es-legacy/components/Iris/Iris.js.map +1 -0
  116. package/dist/es-legacy/components/Iris/components/IrisComponent.js +2 -0
  117. package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -0
  118. package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js +2 -0
  119. package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
  120. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +2 -0
  121. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
  122. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
  123. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
  124. package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js +2 -0
  125. package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
  126. package/dist/es-legacy/components/Iris/constants.js +2 -0
  127. package/dist/es-legacy/components/Iris/constants.js.map +1 -0
  128. package/dist/es-legacy/components/Iris/types.js +2 -0
  129. package/dist/es-legacy/components/Iris/types.js.map +1 -0
  130. package/dist/es-legacy/components/Iris/utils.js +2 -0
  131. package/dist/es-legacy/components/Iris/utils.js.map +1 -0
  132. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  133. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  134. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
  135. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  136. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  137. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  138. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  139. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  140. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  141. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  142. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  143. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  144. package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
  145. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  146. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  147. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  148. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  149. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  150. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  151. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  152. package/dist/es-legacy/components/components-name-map.js +1 -1
  153. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  154. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  155. package/dist/es-legacy/components/index.js +1 -1
  156. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  157. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  158. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  159. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  160. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  161. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  162. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  163. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  164. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  165. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
  166. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
  167. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  168. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  169. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  170. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  171. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
  172. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  173. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  174. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  175. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  176. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  177. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  178. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  179. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  180. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  181. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  182. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  183. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  184. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  185. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  186. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  187. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  188. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  189. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  190. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  191. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  192. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
  193. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  194. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  195. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  196. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  197. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  198. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  199. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  200. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  201. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  202. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  203. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  204. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js +1 -1
  205. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
  206. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
  207. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
  208. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
  209. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  210. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  211. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
  212. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
  213. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
  214. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
  215. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  216. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  217. package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
  218. package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
  219. package/dist/es-legacy/components/internal/Voucher/utils.js.map +1 -1
  220. package/dist/es-legacy/components/tx-variants.js +1 -1
  221. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  222. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  223. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  224. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  225. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  226. package/dist/es-legacy/core/Context/Resources.js +1 -1
  227. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  228. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
  229. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
  230. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
  231. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  232. package/dist/es-legacy/core/config.js +1 -1
  233. package/dist/es-legacy/core/core.js +1 -1
  234. package/dist/es-legacy/core/core.js.map +1 -1
  235. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
  236. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  237. package/dist/es-legacy/index.js +1 -1
  238. package/dist/es-legacy/language/Language.js.map +1 -1
  239. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  240. package/dist/es-legacy/utils/commonUtils.js.map +1 -1
  241. package/dist/es-legacy/utils/createSdkData.js +2 -0
  242. package/dist/es-legacy/utils/createSdkData.js.map +1 -0
  243. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  244. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  245. package/package.json +12 -12
  246. package/styles/adyen.css +8 -6
@@ -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';\n\nimport type { AddressData, BrowserInfo, RawPaymentMethod, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { mapGooglePayBrands } from './utils/map-adyen-brands-to-googlepay-brands';\n\nconst DEFAULT_ALLOWED_CARD_NETWORKS: google.payments.api.CardNetwork[] = ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'];\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, this.analytics, {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n });\n }\n\n /**\n * Google Pay requires custom logic due to supporting two Tx variants that lead to the same payment method.\n * If the merchant creates a standalone Google Pay component, we need to verify if the payment method is available using both tx variants\n *\n * @param type\n * @param paymentMethodId - Unique internal payment method ID\n * @returns\n */\n protected override getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n\n return (\n this.core.paymentMethodsResponse.find(type || this.constructor['type']) || this.core.paymentMethodsResponse.find(TxVariants.paywithgoogle)\n );\n }\n\n protected override formatProps(props: GooglePayConfiguration): 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 const allowedCardNetworks = this.createAllowedCardNetworksValues({\n allowedCardNetworks: props.allowedCardNetworks,\n brands: props.brands\n });\n\n return {\n ...props,\n allowedCardNetworks,\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 /**\n * Generate the 'allowedCardNetworks' value used by Google Pay\n *\n * If the 'allowedCardNetworks' is defined in the Component configuration, it will be used. Otherwise we fallback\n * to use the 'brands' returned by the backoffice. It can be that 'brands' is not returned, which in this case we\n * set default values\n *\n * @param {object} brandsConfig\n * @param brandsConfig.allowedCardNetworks - Brands set in the component config\n * @param brandsConfig.brands - Brands returned by backend\n * @private\n */\n private createAllowedCardNetworksValues({\n allowedCardNetworks,\n brands\n }: {\n allowedCardNetworks?: google.payments.api.CardNetwork[];\n brands?: string[];\n }): google.payments.api.CardNetwork[] {\n if (allowedCardNetworks?.length > 0) return allowedCardNetworks;\n if (brands?.length > 0) return mapGooglePayBrands(brands);\n\n return DEFAULT_ALLOWED_CARD_NETWORKS;\n }\n\n protected override beforeRender(configSetByMerchant?: GooglePayConfiguration) {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.isExpress && { isExpress: configSetByMerchant.isExpress }),\n ...(configSetByMerchant?.expressPage && { expressPage: configSetByMerchant.expressPage })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n /**\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 const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.selected,\n target: UiTarget.instantPaymentButton\n });\n\n this.submitAnalytics(event);\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 public get isValid(): boolean {\n return true;\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 protected override componentToRender(): h.JSX.Element {\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":["DEFAULT_ALLOWED_CARD_NETWORKS","GooglePay","UIElement","getPaymentMethodFromPaymentMethodsResponse","type","paymentMethodId","this","core","paymentMethodsResponse","findById","find","constructor","TxVariants","paywithgoogle","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","allowedCardNetworks","createAllowedCardNetworksValues","brands","_object_spread_props","_object_spread","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","state","isExpress","paymentMethod","subtype","browserInfo","origin","window","location","length","mapGooglePayBrands","beforeRender","configSetByMerchant","originalAction","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","showGooglePayPaymentSheet","googlePay","initiatePayment","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","componentToRender","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","onClick","submit","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","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","googlepay","txVariants","defaultProps"],"mappings":"8jDAiBA,MAAMA,EAAmE,CAAC,OAAQ,WAAY,MAAO,aAAc,QAEnH,MAAMC,UAAkBC,EA0CpB,0CAAAC,CAA8DC,EAAeC,GACzE,OAAIA,EAAwBC,KAAKC,KAAKC,uBAAuBC,SAASJ,GAGlEC,KAAKC,KAAKC,uBAAuBE,KAAKN,GAAQE,KAAKK,YAAY,OAAYL,KAAKC,KAAKC,uBAAuBE,KAAKE,EAAWC,cAEpI,CAEmBC,WAAAA,CAAYC,GAEmCA,IAAAA,EADvCA,EAAvB,MAAMC,EAAqC,QAApBD,EAAAA,EAAMC,sBAAND,IAAAA,EAAAA,EAAyBA,EAAME,SAAW,OAAS,SAClCF,IAAAA,EAAxC,MAAMG,EAAeC,EAAqC,QAAlBJ,EAAAA,EAAMG,oBAANH,IAAAA,EAAAA,EAAgC,QAAVA,EAAAA,EAAMK,YAANL,IAAAA,OAAAA,EAAAA,EAAYM,QAEpEC,EAAwD,IAAIP,EAAMO,gBAAiB,yBAEnFC,EAAsBjB,KAAKkB,gCAAgC,CAC7DD,oBAAqBR,EAAMQ,oBAC3BE,OAAQV,EAAMU,SAGlB,OAAOC,EAAAC,EAAA,CAAA,EACAZ,GAAAA,CACHQ,sBACAK,cAAeb,EAAMa,cACrBZ,iBACAE,eACAI,mBAER,CAKA,UAAAO,GACI,MAAMC,qBAAEA,EAAoBC,eAAEA,EAAcC,eAAEA,EAAcC,gBAAEA,GAAoB3B,KAAK4B,OACjFC,UAAEA,GAAc7B,KAAKS,MAE3B,OAAOY,EAA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C,WAAW,IACP/H,KAAKoD,UAAU4E,oBAAoBhI,KAAKS,MAAOT,KAAKC,KAAKqD,QAAQC,cAvRxEvD,KAAK+D,oBAAsB/D,KAAK+D,oBAAoBkE,KAAKjI,MACzDA,KAAKmD,0BAA4BnD,KAAKmD,0BAA0B8E,KAAKjI,MAErE,MAAM6B,UAAEA,EAASqG,qBAAEA,GAAyBlI,KAAKS,MAEjD,IAAkB,IAAdoB,IAAuBqG,aAAAA,EAAAA,EAAsBC,sBAC7C,MAAM,IAAIxE,EACN,uBACA,uGAIR,IAAK3D,KAAKS,MAAMa,cAAc8G,WAC1B,MAAM,IAAIzE,EACN,uBACA,wGAIR3D,KAAKoD,UAAY,IAAIiF,EAAiBrI,KAAKS,MAAM6H,YAAatI,KAAKiD,UAAW7B,EAAAC,EAAA,GACtEQ,IAAaqG,aAAAA,EAAAA,EAAsBC,uBAAwB,CAAEA,qBAAsBD,EAAqBC,uBAAqB,CACjI7B,oBAAqBtG,KAAKsG,sBAElC,EA/BAP,EADEpG,EACYG,OAAOQ,EAAWiI,WAChCxC,EAFEpG,EAEY6I,aAAa,CAAClI,EAAWiI,UAAWjI,EAAWC,gBAC7DwF,EAHEpG,EAGY8I,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';\n\nimport type { AddressData, BrowserInfo, RawPaymentMethod, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { mapGooglePayBrands } from './utils/map-adyen-brands-to-googlepay-brands';\n\nconst DEFAULT_ALLOWED_CARD_NETWORKS: google.payments.api.CardNetwork[] = ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'];\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, this.analytics, {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n });\n }\n\n /**\n * Google Pay requires custom logic due to supporting two Tx variants that lead to the same payment method.\n * If the merchant creates a standalone Google Pay component, we need to verify if the payment method is available using both tx variants\n *\n * @param type\n * @param paymentMethodId - Unique internal payment method ID\n * @returns\n */\n protected override getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n\n return (\n this.core.paymentMethodsResponse.find(type || this.constructor['type']) || this.core.paymentMethodsResponse.find(TxVariants.paywithgoogle)\n );\n }\n\n protected override formatProps(props: GooglePayConfiguration): 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 const allowedCardNetworks = this.createAllowedCardNetworksValues({\n allowedCardNetworks: props.allowedCardNetworks,\n brands: props.brands\n });\n\n return {\n ...props,\n allowedCardNetworks,\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 /**\n * Generate the 'allowedCardNetworks' value used by Google Pay\n *\n * If the 'allowedCardNetworks' is defined in the Component configuration, it will be used. Otherwise we fallback\n * to use the 'brands' returned by the backoffice. It can be that 'brands' is not returned, which in this case we\n * set default values\n *\n * @param {object} brandsConfig\n * @param brandsConfig.allowedCardNetworks - Brands set in the component config\n * @param brandsConfig.brands - Brands returned by backend\n * @private\n */\n private createAllowedCardNetworksValues({\n allowedCardNetworks,\n brands\n }: {\n allowedCardNetworks?: google.payments.api.CardNetwork[];\n brands?: string[];\n }): google.payments.api.CardNetwork[] {\n if (allowedCardNetworks?.length > 0) return allowedCardNetworks;\n if (brands?.length > 0) return mapGooglePayBrands(brands);\n\n return DEFAULT_ALLOWED_CARD_NETWORKS;\n }\n\n protected override beforeRender(configSetByMerchant?: GooglePayConfiguration) {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.isExpress && { isExpress: configSetByMerchant.isExpress }),\n ...(configSetByMerchant?.expressPage && { expressPage: configSetByMerchant.expressPage })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n /**\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 const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.selected,\n target: UiTarget.instantPaymentButton\n });\n\n this.submitAnalytics(event);\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 public get isValid(): boolean {\n return true;\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 protected override componentToRender(): h.JSX.Element {\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":["DEFAULT_ALLOWED_CARD_NETWORKS","GooglePay","UIElement","getPaymentMethodFromPaymentMethodsResponse","type","paymentMethodId","this","core","paymentMethodsResponse","findById","find","constructor","TxVariants","paywithgoogle","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","allowedCardNetworks","createAllowedCardNetworksValues","brands","_object_spread_props","_object_spread","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","state","isExpress","paymentMethod","subtype","browserInfo","origin","window","location","length","mapGooglePayBrands","beforeRender","configSetByMerchant","originalAction","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","showGooglePayPaymentSheet","googlePay","initiatePayment","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","componentToRender","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","onClick","submit","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","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","googlepay","txVariants","defaultProps"],"mappings":"8jDAiBA,MAAMA,EAAmE,CAAC,OAAQ,WAAY,MAAO,aAAc,QAEnH,MAAMC,UAAkBC,EA0CpB,0CAAAC,CAA8DC,EAAeC,GACzE,OAAIA,EAAwBC,KAAKC,KAAKC,uBAAuBC,SAASJ,GAGlEC,KAAKC,KAAKC,uBAAuBE,KAAKN,GAAQE,KAAKK,YAAY,OAAYL,KAAKC,KAAKC,uBAAuBE,KAAKE,EAAWC,cAEpI,CAEmBC,WAAAA,CAAYC,OACJA,EACiBA,EAAsBA,EAD9D,MAAMC,EAAqC,QAApBD,EAAAA,EAAMC,0BAAND,EAAAA,EAAyBA,EAAME,SAAW,OAAS,SACpEC,EAAeC,EAAqC,QAAlBJ,EAAAA,EAAMG,oBAANH,IAAAA,EAAAA,EAAgC,QAAVA,EAAAA,EAAMK,YAANL,IAAAA,OAAAA,EAAAA,EAAYM,QAEpEC,EAAwD,IAAIP,EAAMO,gBAAiB,yBAEnFC,EAAsBjB,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QrD,aAAAA,EAAAA,EAAgBqD,SAAU,cAClCC,SAAStD,aAAAA,EAAAA,EAAgBsD,UAAWJ,GAGlDvD,EAAQ,CACJoD,iBAAkB,QAClB5D,UAGJ,MAAMoE,EAAoBzG,EAAAC,EAAA,CAAA,EACnB+F,GAAAA,CACH3D,MAAO,CACHa,eAAgBb,KAIxBzD,KAAK8H,mBAAmBD,SA4DxC9B,OAAOtB,eAAe,IACXzE,KAAKoD,UAAUqB,aAAazE,KAAKS,QAM5CsF,OAAOgC,WAAW,IACP/H,KAAKoD,UAAU4E,oBAAoBhI,KAAKS,MAAOT,KAAKC,KAAKqD,QAAQC,cAvRxEvD,KAAK+D,oBAAsB/D,KAAK+D,oBAAoBkE,KAAKjI,MACzDA,KAAKmD,0BAA4BnD,KAAKmD,0BAA0B8E,KAAKjI,MAErE,MAAM6B,UAAEA,EAASqG,qBAAEA,GAAyBlI,KAAKS,MAEjD,IAAkB,IAAdoB,IAAuBqG,aAAAA,EAAAA,EAAsBC,sBAC7C,MAAM,IAAIxE,EACN,uBACA,uGAIR,IAAK3D,KAAKS,MAAMa,cAAc8G,WAC1B,MAAM,IAAIzE,EACN,uBACA,wGAIR3D,KAAKoD,UAAY,IAAIiF,EAAiBrI,KAAKS,MAAM6H,YAAatI,KAAKiD,UAAW7B,EAAAC,EAAA,GACtEQ,IAAaqG,aAAAA,EAAAA,EAAsBC,uBAAwB,CAAEA,qBAAsBD,EAAqBC,uBAAqB,CACjI7B,oBAAqBtG,KAAKsG,sBAElC,EA/BAP,EADEpG,EACYG,OAAOQ,EAAWiI,WAChCxC,EAFEpG,EAEY6I,aAAa,CAAClI,EAAWiI,UAAWjI,EAAWC,gBAC7DwF,EAHEpG,EAGY8I,eAAeA"}
@@ -1,2 +1,2 @@
1
- import{getDecimalAmount as e}from"../../utils/amount-util.js";import t from"./config.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){r(e,t,n[t])})}return e}function a(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function i({allowedAuthMethods:e,allowedCardNetworks:r,existingPaymentMethodRequired:n=!1}){return{apiVersion:t.API_VERSION,apiVersionMinor:t.API_VERSION_MINOR,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:e,allowedCardNetworks:r},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{}}}],existingPaymentMethodRequired:n}}function o(t){var{amount:r,countryCode:i="US",totalPriceStatus:o="FINAL"}=t,s=a(t,["amount","countryCode","totalPriceStatus"]);const l=String(e(r.value,r.currency));return n({countryCode:i,currencyCode:r.currency,totalPrice:l,totalPriceStatus:o},s.transactionInfo)}function s(e,r){var{configuration:i}=e,s=a(e,["configuration"]);return{apiVersion:t.API_VERSION,apiVersionMinor:t.API_VERSION_MINOR,transactionInfo:o(n({countryCode:r},s)),merchantInfo:n({merchantId:i.merchantId,merchantName:i.merchantName},i.merchantOrigin?{merchantOrigin:i.merchantOrigin}:{},i.authJwt?{authJwt:i.authJwt}:{}),allowedPaymentMethods:[{type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:t.GATEWAY,gatewayMerchantId:i.gatewayMerchantId}},parameters:{allowedAuthMethods:s.allowedAuthMethods,allowedCardNetworks:s.allowedCardNetworks,assuranceDetailsRequired:s.assuranceDetailsRequired,allowPrepaidCards:s.allowPrepaidCards,allowCreditCards:s.allowCreditCards,billingAddressRequired:s.billingAddressRequired,billingAddressParameters:s.billingAddressParameters}}],emailRequired:s.emailRequired,shippingAddressRequired:s.shippingAddressRequired,shippingAddressParameters:s.shippingAddressParameters,shippingOptionRequired:s.shippingOptionRequired,shippingOptionParameters:s.shippingOptionParameters,callbackIntents:s.callbackIntents}}export{o as getTransactionInfo,s as initiatePaymentRequest,i as isReadyToPayRequest};
1
+ import{getDecimalAmount as e}from"../../utils/amount-util.js";import t from"./config.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){r(e,t,n[t])})}return e}function a(e,t){if(null==e)return{};var r,n,a,i={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}if(i=function(e,t){if(null==e)return{};var r,n,a={},i=Object.getOwnPropertyNames(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}function i({allowedAuthMethods:e,allowedCardNetworks:r,existingPaymentMethodRequired:n=!1}){return{apiVersion:t.API_VERSION,apiVersionMinor:t.API_VERSION_MINOR,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:e,allowedCardNetworks:r},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{}}}],existingPaymentMethodRequired:n}}function o(t){let{amount:r,countryCode:i="US",totalPriceStatus:o="FINAL"}=t,l=a(t,["amount","countryCode","totalPriceStatus"]);const s=String(e(r.value,r.currency));return n({countryCode:i,currencyCode:r.currency,totalPrice:s,totalPriceStatus:o},l.transactionInfo)}function l(e,r){let i=[e,r],[l,...s]=i,{configuration:d}=l,c=a(l,["configuration"]),[u]=s;return{apiVersion:t.API_VERSION,apiVersionMinor:t.API_VERSION_MINOR,transactionInfo:o(n({countryCode:u},c)),merchantInfo:n({merchantId:d.merchantId,merchantName:d.merchantName},d.merchantOrigin?{merchantOrigin:d.merchantOrigin}:{},d.authJwt?{authJwt:d.authJwt}:{}),allowedPaymentMethods:[{type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:t.GATEWAY,gatewayMerchantId:d.gatewayMerchantId}},parameters:{allowedAuthMethods:c.allowedAuthMethods,allowedCardNetworks:c.allowedCardNetworks,assuranceDetailsRequired:c.assuranceDetailsRequired,allowPrepaidCards:c.allowPrepaidCards,allowCreditCards:c.allowCreditCards,billingAddressRequired:c.billingAddressRequired,billingAddressParameters:c.billingAddressParameters}}],emailRequired:c.emailRequired,shippingAddressRequired:c.shippingAddressRequired,shippingAddressParameters:c.shippingAddressParameters,shippingOptionRequired:c.shippingOptionRequired,shippingOptionParameters:c.shippingOptionParameters,callbackIntents:c.callbackIntents}}export{o as getTransactionInfo,l as initiatePaymentRequest,i as isReadyToPayRequest};
2
2
  //# sourceMappingURL=requests.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"requests.js","sources":["../../../../src/components/GooglePay/requests.ts"],"sourcesContent":["import { getDecimalAmount } from '../../utils/amount-util';\nimport config from './config';\nimport { GooglePaymentDataRequest, GooglePayConfiguration } from './types';\n\n/**\n * Configure your site's support for payment methods supported by the Google Pay API.\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#IsReadyToPayRequest|isReadyToPayRequest}\n * @returns Google Pay API version, payment methods supported by the site\n */\nexport function isReadyToPayRequest({\n allowedAuthMethods,\n allowedCardNetworks,\n existingPaymentMethodRequired = false\n}: Pick<\n GooglePayConfiguration,\n 'allowedAuthMethods' | 'allowedCardNetworks' | 'existingPaymentMethodRequired'\n>): google.payments.api.IsReadyToPayRequest {\n return {\n apiVersion: config.API_VERSION,\n apiVersionMinor: config.API_VERSION_MINOR,\n allowedPaymentMethods: [\n {\n type: 'CARD',\n parameters: {\n allowedAuthMethods,\n allowedCardNetworks\n },\n tokenizationSpecification: {\n type: 'PAYMENT_GATEWAY',\n parameters: {}\n }\n }\n ],\n existingPaymentMethodRequired\n };\n}\n\n/**\n * Provide Google Pay API with a payment amount, currency, and amount status\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#TransactionInfo|TransactionInfo}\n * @returns transaction info, suitable for use as transactionInfo property of PaymentDataRequest\n */\nexport function getTransactionInfo({\n amount,\n countryCode = 'US',\n totalPriceStatus = 'FINAL',\n ...props\n}: GooglePayConfiguration): google.payments.api.TransactionInfo {\n const formattedPrice = String(getDecimalAmount(amount.value, amount.currency));\n\n return {\n countryCode,\n currencyCode: amount.currency,\n totalPrice: formattedPrice,\n totalPriceStatus: totalPriceStatus,\n ...props.transactionInfo\n };\n}\n\nexport function initiatePaymentRequest({ configuration, ...props }: GooglePayConfiguration, countryCode: string): GooglePaymentDataRequest {\n return {\n apiVersion: config.API_VERSION,\n apiVersionMinor: config.API_VERSION_MINOR,\n transactionInfo: getTransactionInfo({ countryCode, ...props }),\n merchantInfo: {\n merchantId: configuration.merchantId,\n merchantName: configuration.merchantName,\n ...(configuration.merchantOrigin ? { merchantOrigin: configuration.merchantOrigin } : {}),\n ...(configuration.authJwt ? { authJwt: configuration.authJwt } : {})\n },\n allowedPaymentMethods: [\n {\n type: 'CARD',\n tokenizationSpecification: {\n type: 'PAYMENT_GATEWAY',\n parameters: {\n gateway: config.GATEWAY,\n gatewayMerchantId: configuration.gatewayMerchantId\n }\n },\n parameters: {\n allowedAuthMethods: props.allowedAuthMethods,\n allowedCardNetworks: props.allowedCardNetworks,\n assuranceDetailsRequired: props.assuranceDetailsRequired,\n allowPrepaidCards: props.allowPrepaidCards,\n allowCreditCards: props.allowCreditCards,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressParameters: props.billingAddressParameters\n }\n }\n ],\n emailRequired: props.emailRequired,\n shippingAddressRequired: props.shippingAddressRequired,\n shippingAddressParameters: props.shippingAddressParameters,\n shippingOptionRequired: props.shippingOptionRequired,\n shippingOptionParameters: props.shippingOptionParameters,\n callbackIntents: props.callbackIntents\n };\n}\n"],"names":["isReadyToPayRequest","allowedAuthMethods","allowedCardNetworks","existingPaymentMethodRequired","apiVersion","config","API_VERSION","apiVersionMinor","API_VERSION_MINOR","allowedPaymentMethods","type","parameters","tokenizationSpecification","getTransactionInfo","_param","amount","countryCode","totalPriceStatus","props","formattedPrice","String","getDecimalAmount","value","currency","_object_spread","currencyCode","totalPrice","transactionInfo","initiatePaymentRequest","configuration","merchantInfo","merchantId","merchantName","merchantOrigin","authJwt","gateway","GATEWAY","gatewayMerchantId","assuranceDetailsRequired","allowPrepaidCards","allowCreditCards","billingAddressRequired","billingAddressParameters","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"y4BAUO,SAASA,GAAoBC,mBAChCA,EAAkBC,oBAClBA,EAAmBC,8BACnBA,GAAgC,IAKhC,MAAO,CACHC,WAAYC,EAAOC,YACnBC,gBAAiBF,EAAOG,kBACxBC,sBAAuB,CACnB,CACIC,KAAM,OACNC,WAAY,CACRV,qBACAC,uBAEJU,0BAA2B,CACvBF,KAAM,kBACNC,WAAY,CAAA,KAIxBR,gCAER,CAQO,SAASU,EAAmBC,OAAAC,OAC/BA,EAAMC,YACNA,EAAc,KAAIC,iBAClBA,EAAmB,SAHYH,EAI5BI,EAAAA,EAJ4BJ,EAAA,CAC/BC,SACAC,cACAC,qBAGA,MAAME,EAAiBC,OAAOC,EAAiBN,EAAOO,MAAOP,EAAOQ,WAEpE,OAAOC,EAAA,CACHR,cACAS,aAAcV,EAAOQ,SACrBG,WAAYP,EACZF,iBAAkBA,GACfC,EAAMS,gBAEjB,CAEO,SAASC,EAAuBd,EAAqDE,GAArD,IAAAa,cAAEA,GAAFf,EAAoBI,EAAAA,EAApBJ,EAAA,CAAEe,kBACrC,MAAO,CACHzB,WAAYC,EAAOC,YACnBC,gBAAiBF,EAAOG,kBACxBmB,gBAAiBd,EAAmBW,EAAA,CAAER,eAAgBE,IACtDY,aAAcN,EAAA,CACVO,WAAYF,EAAcE,WAC1BC,aAAcH,EAAcG,cACxBH,EAAcI,eAAiB,CAAEA,eAAgBJ,EAAcI,gBAAmB,CAAA,EAClFJ,EAAcK,QAAU,CAAEA,QAASL,EAAcK,SAAY,IAErEzB,sBAAuB,CACnB,CACIC,KAAM,OACNE,0BAA2B,CACvBF,KAAM,kBACNC,WAAY,CACRwB,QAAS9B,EAAO+B,QAChBC,kBAAmBR,EAAcQ,oBAGzC1B,WAAY,CACRV,mBAAoBiB,EAAMjB,mBAC1BC,oBAAqBgB,EAAMhB,oBAC3BoC,yBAA0BpB,EAAMoB,yBAChCC,kBAAmBrB,EAAMqB,kBACzBC,iBAAkBtB,EAAMsB,iBACxBC,uBAAwBvB,EAAMuB,uBAC9BC,yBAA0BxB,EAAMwB,4BAI5CC,cAAezB,EAAMyB,cACrBC,wBAAyB1B,EAAM0B,wBAC/BC,0BAA2B3B,EAAM2B,0BACjCC,uBAAwB5B,EAAM4B,uBAC9BC,yBAA0B7B,EAAM6B,yBAChCC,gBAAiB9B,EAAM8B,gBAE/B"}
1
+ {"version":3,"file":"requests.js","sources":["../../../../src/components/GooglePay/requests.ts"],"sourcesContent":["import { getDecimalAmount } from '../../utils/amount-util';\nimport config from './config';\nimport { GooglePaymentDataRequest, GooglePayConfiguration } from './types';\n\n/**\n * Configure your site's support for payment methods supported by the Google Pay API.\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#IsReadyToPayRequest|isReadyToPayRequest}\n * @returns Google Pay API version, payment methods supported by the site\n */\nexport function isReadyToPayRequest({\n allowedAuthMethods,\n allowedCardNetworks,\n existingPaymentMethodRequired = false\n}: Pick<\n GooglePayConfiguration,\n 'allowedAuthMethods' | 'allowedCardNetworks' | 'existingPaymentMethodRequired'\n>): google.payments.api.IsReadyToPayRequest {\n return {\n apiVersion: config.API_VERSION,\n apiVersionMinor: config.API_VERSION_MINOR,\n allowedPaymentMethods: [\n {\n type: 'CARD',\n parameters: {\n allowedAuthMethods,\n allowedCardNetworks\n },\n tokenizationSpecification: {\n type: 'PAYMENT_GATEWAY',\n parameters: {}\n }\n }\n ],\n existingPaymentMethodRequired\n };\n}\n\n/**\n * Provide Google Pay API with a payment amount, currency, and amount status\n *\n * @see {@link https://developers.google.com/pay/api/web/reference/object#TransactionInfo|TransactionInfo}\n * @returns transaction info, suitable for use as transactionInfo property of PaymentDataRequest\n */\nexport function getTransactionInfo({\n amount,\n countryCode = 'US',\n totalPriceStatus = 'FINAL',\n ...props\n}: GooglePayConfiguration): google.payments.api.TransactionInfo {\n const formattedPrice = String(getDecimalAmount(amount.value, amount.currency));\n\n return {\n countryCode,\n currencyCode: amount.currency,\n totalPrice: formattedPrice,\n totalPriceStatus: totalPriceStatus,\n ...props.transactionInfo\n };\n}\n\nexport function initiatePaymentRequest({ configuration, ...props }: GooglePayConfiguration, countryCode: string): GooglePaymentDataRequest {\n return {\n apiVersion: config.API_VERSION,\n apiVersionMinor: config.API_VERSION_MINOR,\n transactionInfo: getTransactionInfo({ countryCode, ...props }),\n merchantInfo: {\n merchantId: configuration.merchantId,\n merchantName: configuration.merchantName,\n ...(configuration.merchantOrigin ? { merchantOrigin: configuration.merchantOrigin } : {}),\n ...(configuration.authJwt ? { authJwt: configuration.authJwt } : {})\n },\n allowedPaymentMethods: [\n {\n type: 'CARD',\n tokenizationSpecification: {\n type: 'PAYMENT_GATEWAY',\n parameters: {\n gateway: config.GATEWAY,\n gatewayMerchantId: configuration.gatewayMerchantId\n }\n },\n parameters: {\n allowedAuthMethods: props.allowedAuthMethods,\n allowedCardNetworks: props.allowedCardNetworks,\n assuranceDetailsRequired: props.assuranceDetailsRequired,\n allowPrepaidCards: props.allowPrepaidCards,\n allowCreditCards: props.allowCreditCards,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressParameters: props.billingAddressParameters\n }\n }\n ],\n emailRequired: props.emailRequired,\n shippingAddressRequired: props.shippingAddressRequired,\n shippingAddressParameters: props.shippingAddressParameters,\n shippingOptionRequired: props.shippingOptionRequired,\n shippingOptionParameters: props.shippingOptionParameters,\n callbackIntents: props.callbackIntents\n };\n}\n"],"names":["isReadyToPayRequest","allowedAuthMethods","allowedCardNetworks","existingPaymentMethodRequired","apiVersion","config","API_VERSION","apiVersionMinor","API_VERSION_MINOR","allowedPaymentMethods","type","parameters","tokenizationSpecification","getTransactionInfo","_0","amount","countryCode","totalPriceStatus","props","formattedPrice","String","getDecimalAmount","value","currency","_object_spread","currencyCode","totalPrice","transactionInfo","initiatePaymentRequest","configuration","_ref1","merchantInfo","merchantId","merchantName","merchantOrigin","authJwt","gateway","GATEWAY","gatewayMerchantId","assuranceDetailsRequired","allowPrepaidCards","allowCreditCards","billingAddressRequired","billingAddressParameters","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"soCAUO,SAASA,GAAoBC,mBAChCA,EAAkBC,oBAClBA,EAAmBC,8BACnBA,GAAgC,IAKhC,MAAO,CACHC,WAAYC,EAAOC,YACnBC,gBAAiBF,EAAOG,kBACxBC,sBAAuB,CACnB,CACIC,KAAM,OACNC,WAAY,CACRV,qBACAC,uBAEJU,0BAA2B,CACvBF,KAAM,kBACNC,WAAY,CAAA,KAIxBR,gCAER,CAQO,SAASU,EAAmBC,OAAAC,OAC/BA,EAAMC,YACNA,EAAc,KAAIC,iBAClBA,EAAmB,SAEEH,EADlBI,EAAAA,EAAAA,EAAAA,6CAEH,MAAMC,EAAiBC,OAAOC,EAAiBN,EAAOO,MAAOP,EAAOQ,WAEpE,OAAOC,EAAA,CACHR,cACAS,aAAcV,EAAOQ,SACrBG,WAAYP,EACZF,iBAAkBA,GACfC,EAAMS,gBAEjB,CAEO,SAASC,EAAuBd,EAAqDE,2BAArDa,cAAEA,GAAiDC,EAA/BZ,EAAAA,EAAAA,EAAAA,oBAAiCF,GAAAA,EACxF,MAAO,CACHZ,WAAYC,EAAOC,YACnBC,gBAAiBF,EAAOG,kBACxBmB,gBAAiBd,EAAmBW,EAAA,CAAER,eAAgBE,IACtDa,aAAcP,EAAA,CACVQ,WAAYH,EAAcG,WAC1BC,aAAcJ,EAAcI,cACxBJ,EAAcK,eAAiB,CAAEA,eAAgBL,EAAcK,gBAAmB,CAAA,EAClFL,EAAcM,QAAU,CAAEA,QAASN,EAAcM,SAAY,IAErE1B,sBAAuB,CACnB,CACIC,KAAM,OACNE,0BAA2B,CACvBF,KAAM,kBACNC,WAAY,CACRyB,QAAS/B,EAAOgC,QAChBC,kBAAmBT,EAAcS,oBAGzC3B,WAAY,CACRV,mBAAoBiB,EAAMjB,mBAC1BC,oBAAqBgB,EAAMhB,oBAC3BqC,yBAA0BrB,EAAMqB,yBAChCC,kBAAmBtB,EAAMsB,kBACzBC,iBAAkBvB,EAAMuB,iBACxBC,uBAAwBxB,EAAMwB,uBAC9BC,yBAA0BzB,EAAMyB,4BAI5CC,cAAe1B,EAAM0B,cACrBC,wBAAyB3B,EAAM2B,wBAC/BC,0BAA2B5B,EAAM4B,0BACjCC,uBAAwB7B,EAAM6B,uBAC9BC,yBAA0B9B,EAAM8B,yBAChCC,gBAAiB/B,EAAM+B,gBAE/B"}
@@ -0,0 +1,2 @@
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import e from"../../utils/isMobile.js";import o from"../helpers/IssuerListContainer/IssuerListContainer.js";import{QRLoader as r}from"../internal/QRLoader/QRLoader.js";import"../../core/Context/CoreProvider.js";import"../../external/preact/hooks/dist/hooks.js";import"../../core/Errors/AdyenCheckoutError.js";import"../../core/Errors/SRPanelContext.js";import"../internal/Button/Button.js";import"../internal/QRLoader/QRLoaderDetailsProvider.js";import{TxVariants as n}from"../tx-variants.js";import s from"./components/IrisComponent.js";import{IrisQrCodeInstructions as i}from"./components/IrisQrCodeInstructions.js";import{IrisMode as p}from"./types.js";import{DEFAULT_IRIS_COUNTDOWN_TIME as a}from"./constants.js";function u(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,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 c extends o{renderIssuerList(){return super.componentToRender()}formatData(){var t,e;return this.mode===p.BANK_LIST?{paymentMethod:{type:this.type,issuer:null===(e=this.state)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.issuer}}:{paymentMethod:{type:this.type}}}formatProps(t){var e;return m(function(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){u(t,e,o[e])})}return t}({},super.formatProps(t)),{countdownTime:null!==(e=t.countdownTime)&&void 0!==e?e:a})}get isValid(){return this.mode!==p.BANK_LIST||super.isValid}componentToRender(){return"qrCode"===this.props.type?t(r,{type:n.iris,brandLogo:this.icon,clientKey:this.props.clientKey,qrCodeData:this.props.qrCodeData?encodeURIComponent(this.props.qrCodeData):null,countdownTime:this.props.countdownTime,paymentData:this.props.paymentData,amount:this.props.amount,delay:this.props.delay,onActionHandled:this.onActionHandled,onError:this.props.onError,onComplete:this.onComplete,introduction:i,showAmount:!0,copyBtn:!1}):t(s,{setComponentRef:this.setComponentRef,defaultMode:this.mode,onUpdateMode:this.onUpdateMode,issuerListUI:this.renderIssuerList(),showPayButton:this.props.showPayButton,payButton:this.payButton,issuers:this.props.issuers})}constructor(t,o){super(t,o),u(this,"mode",void 0),u(this,"onUpdateMode",t=>{this.mode=t}),this.mode=e()?p.BANK_LIST:p.QR_CODE}}u(c,"type",n.iris);export{c as Iris,c as default};
2
+ //# sourceMappingURL=Iris.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Iris.js","sources":["../../../../src/components/Iris/Iris.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { ICore } from '../../types';\nimport isMobile from '../../utils/isMobile';\nimport IssuerListContainer from '../helpers/IssuerListContainer/IssuerListContainer';\nimport { QRLoader } from '../internal/QRLoader';\nimport { TxVariants } from '../tx-variants';\nimport IrisComponent from './components/IrisComponent';\nimport { IrisQrCodeInstructions } from './components/IrisQrCodeInstructions';\nimport { IrisConfiguration, IrisData, IrisMode } from './types';\nimport { DEFAULT_IRIS_COUNTDOWN_TIME } from './constants';\n\nexport class Iris extends IssuerListContainer<IrisConfiguration, IrisData> {\n public static readonly type = TxVariants.iris;\n\n private mode: IrisMode;\n\n constructor(checkout: ICore, props: IrisConfiguration) {\n super(checkout, props);\n this.mode = isMobile() ? IrisMode.BANK_LIST : IrisMode.QR_CODE;\n }\n\n private readonly onUpdateMode = (mode: IrisMode): void => {\n this.mode = mode;\n };\n\n private renderIssuerList(): h.JSX.Element {\n return super.componentToRender();\n }\n\n formatData(): IrisData {\n if (this.mode === IrisMode.BANK_LIST) {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n };\n }\n\n return {\n paymentMethod: {\n type: this.type\n }\n };\n }\n\n formatProps(props: IrisConfiguration): IrisConfiguration {\n return {\n ...super.formatProps(props),\n countdownTime: props.countdownTime ?? DEFAULT_IRIS_COUNTDOWN_TIME\n };\n }\n\n get isValid() {\n if (this.mode === IrisMode.BANK_LIST) {\n return super.isValid;\n }\n\n return true;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.type === 'qrCode') {\n return (\n <QRLoader\n type={TxVariants.iris}\n brandLogo={this.icon}\n clientKey={this.props.clientKey}\n qrCodeData={this.props.qrCodeData ? encodeURIComponent(this.props.qrCodeData) : null}\n countdownTime={this.props.countdownTime}\n paymentData={this.props.paymentData}\n amount={this.props.amount}\n delay={this.props.delay}\n onActionHandled={this.onActionHandled}\n onError={this.props.onError}\n onComplete={this.onComplete}\n introduction={IrisQrCodeInstructions}\n showAmount\n copyBtn={false}\n />\n );\n }\n\n return (\n <IrisComponent\n setComponentRef={this.setComponentRef}\n defaultMode={this.mode}\n onUpdateMode={this.onUpdateMode}\n issuerListUI={this.renderIssuerList()}\n showPayButton={this.props.showPayButton}\n payButton={this.payButton}\n issuers={this.props.issuers}\n />\n );\n }\n}\n\nexport default Iris;\n"],"names":["Iris","IssuerListContainer","renderIssuerList","super","componentToRender","formatData","_this_state_data","_this_state","this","mode","IrisMode","BANK_LIST","paymentMethod","type","issuer","state","data","formatProps","props","_object_spread_props","_object_spread","countdownTime","DEFAULT_IRIS_COUNTDOWN_TIME","isValid","h","QRLoader","TxVariants","iris","brandLogo","icon","clientKey","qrCodeData","encodeURIComponent","paymentData","amount","delay","onActionHandled","onError","onComplete","introduction","IrisQrCodeInstructions","showAmount","copyBtn","IrisComponent","setComponentRef","defaultMode","onUpdateMode","issuerListUI","showPayButton","payButton","issuers","constructor","checkout","_define_property","isMobile","QR_CODE"],"mappings":"uvCAWO,MAAMA,UAAaC,EAcdC,gBAAAA,GACJ,OAAOC,MAAMC,mBACjB,CAEAC,UAAAA,OAKwBC,EAAAC,EAJpB,OAAIC,KAAKC,OAASC,EAASC,UAChB,CACHC,cAAe,CACXC,KAAML,KAAKK,KACXC,OAAkB,QAAVP,EAAAC,KAAKO,a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,OAC3D,EAPAF,EADSrD,EACca,OAAOa,EAAWC"}
@@ -0,0 +1,2 @@
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{IrisMode as e}from"../types.js";import{useState as o,useMemo as s,useRef as n,useEffect as r}from"../../../external/preact/hooks/dist/hooks.js";import{IRIS_ALLY_LABELS as a}from"../constants.js";import{getIrisSegmentedControlOptions as i}from"../utils.js";import{useCoreContext as d}from"../../../core/Context/CoreProvider.js";import{SegmentedControl as l}from"../../internal/SegmentedControl/SegmentedControl.js";import{SegmentedControlRegion as m}from"../../internal/SegmentedControl/SegmentedControlRegion.js";import u from"./IrisGenerateQRCode.js";import p from"./IrisComponent.module.scss.js";import{AnalyticsInfoEvent as c,UiTarget as f,InfoEventType as y}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import{TxVariants as C}from"../../tx-variants.js";import B from"../../../core/Analytics/useAnalytics.js";function j(j){const{i18n:g}=d(),{analytics:A}=B(),[I,R]=o(j.defaultMode),[S,h]=o("ready"),E=s(()=>i(g,j.defaultMode),[g,j.defaultMode]),L=j.issuers.length>0,_=(t,e=!1)=>{if(R(t),j.onUpdateMode(t),e){const e=new c({type:y.selected,target:f.segmentedControl,component:C.iris,selectedValue:t});A.sendAnalytics(e)}},w=n({setStatus:h});return r(()=>{j.setComponentRef(w.current)},[j.setComponentRef]),r(()=>{if(L){const t=new c({type:y.displayed,target:f.segmentedControl,component:C.iris,selectedValue:j.defaultMode});A.sendAnalytics(t)}},[]),r(()=>{L||_(e.QR_CODE)},[L]),L?t("div",null,t(l,{onChange:t=>_(t,!0),selectedValue:I,disabled:"loading"===S,options:E}),I===e.BANK_LIST&&t(m,{id:a.AreaId.BANK_LIST,ariaLabelledBy:a.ButtonId.BANK_LIST,className:p.bankList},j.issuerListUI),I===e.QR_CODE&&t(m,{id:a.AreaId.QR_CODE,ariaLabelledBy:a.ButtonId.QR_CODE},t(u,{showPayButton:j.showPayButton,payButton:j.payButton,status:S}))):t(u,{showPayButton:j.showPayButton,payButton:j.payButton,status:S})}export{j as default};
2
+ //# sourceMappingURL=IrisComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IrisComponent.js","sources":["../../../../../src/components/Iris/components/IrisComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport { IrisMode } from '../types';\nimport { useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport { IRIS_ALLY_LABELS } from '../constants';\nimport { getIrisSegmentedControlOptions } from '../utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { SegmentedControl, SegmentedControlRegion } from '../../internal/SegmentedControl';\nimport { ComponentMethodsRef, UIElementStatus } from '../../types';\nimport { IssuerItem } from '../../internal/IssuerList/types';\nimport IrisGenerateQRCode from './IrisGenerateQRCode';\nimport styles from './IrisComponent.module.scss';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { TxVariants } from '../../tx-variants';\nimport useAnalytics from '../../../core/Analytics/useAnalytics';\n\ninterface IrisComponentProps {\n defaultMode: IrisMode;\n showPayButton?: boolean;\n issuers: IssuerItem[];\n issuerListUI: h.JSX.Element;\n onUpdateMode: (mode: IrisMode) => void;\n payButton: (props: Partial<PayButtonProps>) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n}\n\nexport default function IrisComponent(props: Readonly<IrisComponentProps>) {\n const { i18n } = useCoreContext();\n const { analytics } = useAnalytics();\n\n const [mode, setMode] = useState<IrisMode>(props.defaultMode);\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const segmentedControlOptions = useMemo(() => getIrisSegmentedControlOptions(i18n, props.defaultMode), [i18n, props.defaultMode]);\n\n const issuersAvailable = props.issuers.length > 0;\n\n const handleModeChange = (mode: IrisMode, sendAnalytics = false) => {\n setMode(mode);\n props.onUpdateMode(mode);\n if (sendAnalytics) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.selected,\n target: UiTarget.segmentedControl,\n component: TxVariants.iris,\n selectedValue: mode\n });\n analytics.sendAnalytics(event);\n }\n };\n\n const irisRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus\n });\n\n useEffect(() => {\n props.setComponentRef(irisRef.current);\n }, [props.setComponentRef]);\n\n useEffect(() => {\n if (issuersAvailable) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.displayed,\n target: UiTarget.segmentedControl,\n component: TxVariants.iris,\n selectedValue: props.defaultMode\n });\n analytics.sendAnalytics(event);\n }\n }, []);\n\n useEffect(() => {\n if (!issuersAvailable) {\n handleModeChange(IrisMode.QR_CODE);\n }\n }, [issuersAvailable]);\n\n if (!issuersAvailable) {\n return <IrisGenerateQRCode showPayButton={props.showPayButton} payButton={props.payButton} status={status} />;\n }\n\n return (\n <div>\n <SegmentedControl\n onChange={mode => handleModeChange(mode, true)}\n selectedValue={mode}\n disabled={status === 'loading'}\n options={segmentedControlOptions}\n />\n {mode === IrisMode.BANK_LIST && (\n <SegmentedControlRegion\n id={IRIS_ALLY_LABELS.AreaId.BANK_LIST}\n ariaLabelledBy={IRIS_ALLY_LABELS.ButtonId.BANK_LIST}\n className={styles.bankList}\n >\n {props.issuerListUI}\n </SegmentedControlRegion>\n )}\n {mode === IrisMode.QR_CODE && (\n <SegmentedControlRegion id={IRIS_ALLY_LABELS.AreaId.QR_CODE} ariaLabelledBy={IRIS_ALLY_LABELS.ButtonId.QR_CODE}>\n <IrisGenerateQRCode showPayButton={props.showPayButton} payButton={props.payButton} status={status} />\n </SegmentedControlRegion>\n )}\n </div>\n );\n}\n"],"names":["IrisComponent","props","i18n","useCoreContext","analytics","useAnalytics","mode","setMode","useState","defaultMode","status","setStatus","segmentedControlOptions","useMemo","getIrisSegmentedControlOptions","issuersAvailable","issuers","length","handleModeChange","sendAnalytics","onUpdateMode","event","AnalyticsInfoEvent","type","InfoEventType","selected","target","UiTarget","segmentedControl","component","TxVariants","iris","selectedValue","irisRef","useRef","useEffect","setComponentRef","current","displayed","IrisMode","QR_CODE","h","div","SegmentedControl","onChange","disabled","options","BANK_LIST","SegmentedControlRegion","id","IRIS_ALLY_LABELS","AreaId","ariaLabelledBy","ButtonId","className","styles","bankList","issuerListUI","IrisGenerateQRCode","showPayButton","payButton"],"mappings":"y4BA0Be,SAASA,EAAcC,GAClC,MAAMC,KAAEA,GAASC,KACXC,UAAEA,GAAcC,KAEfC,EAAMC,GAAWC,EAAmBP,EAAMQ,cAC1CC,EAAQC,GAAaH,EAA0B,SAChDI,EAA0BC,EAAQ,IAAMC,EAA+BZ,EAAMD,EAAMQ,aAAc,CAACP,EAAMD,EAAMQ,cAE9GM,EAAmBd,EAAMe,QAAQC,OAAS,EAE1CC,EAAmB,CAACZ,EAAgBa,GAAgB,KAGtD,GAFAZ,EAAQD,GACRL,EAAMmB,aAAad,GACfa,EAAe,CACf,MAAME,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcC,SACpBC,OAAQC,EAASC,iBACjBC,UAAWC,EAAWC,KACtBC,cAAe1B,IAEnBF,EAAUe,cAAcE,EAC5B,GAGEY,EAAUC,EAA4B,CACxCvB,UAAWA,IAyBf,OAtBAwB,EAAU,KACNlC,EAAMmC,gBAAgBH,EAAQI,UAC/B,CAACpC,EAAMmC,kBAEVD,EAAU,KACN,GAAIpB,EAAkB,CAClB,MAAMM,EAAQ,IAAIC,EAAmB,CACjCC,KAAMC,EAAcc,UACpBZ,OAAQC,EAASC,iBACjBC,UAAWC,EAAWC,KACtBC,cAAe/B,EAAMQ,cAEzBL,EAAUe,cAAcE,EAC5B,GACD,IAEHc,EAAU,KACDpB,GACDG,EAAiBqB,EAASC,UAE/B,CAACzB,IAECA,EAKD0B,EAACC,WACGD,EAACE,EAAAA,CACGC,SAAUtC,GAAQY,EAAiBZ,GAAM,GACzC0B,cAAe1B,EACfuC,SAAqB,YAAXnC,EACVoC,QAASlC,IAEZN,IAASiC,EAASQ,WACfN,EAACO,EAAAA,CACGC,GAAIC,EAAiBC,OAAOJ,UAC5BK,eAAgBF,EAAiBG,SAASN,UAC1CO,UAAWC,EAAOC,UAEjBvD,EAAMwD,cAGdnD,IAASiC,EAASC,SACfC,EAACO,EAAAA,CAAuBC,GAAIC,EAAiBC,OAAOX,QAASY,eAAgBF,EAAiBG,SAASb,SACnGC,EAACiB,EAAAA,CAAmBC,cAAe1D,EAAM0D,cAAeC,UAAW3D,EAAM2D,UAAWlD,OAAQA,MAtBjG+B,EAACiB,EAAAA,CAAmBC,cAAe1D,EAAM0D,cAAeC,UAAW3D,EAAM2D,UAAWlD,OAAQA,GA2B3G"}
@@ -0,0 +1,2 @@
1
+ var a={bankList:"IrisComponent-module_bankList__fehP-"};export{a as default};
2
+ //# sourceMappingURL=IrisComponent.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IrisComponent.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import o from"../../../core/Context/useImage.js";import r from"./IrisGenerateQRCode.module.scss.js";function s(s){const{i18n:n}=t(),a=o();return e("div",null,e("p",{className:r.instruction},n.get("iris.instructions.generateQrCode")),s.showPayButton&&s.payButton({label:n.get("generateQRCode"),icon:a({imageFolder:"components/"})("qr"),status:s.status}))}export{s as default};
2
+ //# sourceMappingURL=IrisGenerateQRCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IrisGenerateQRCode.js","sources":["../../../../../src/components/Iris/components/IrisGenerateQRCode.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport useImage from '../../../core/Context/useImage';\nimport { UIElementStatus } from '../../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport styles from './IrisGenerateQRCode.module.scss';\n\ninterface IrisGenerateQRCodeProps {\n showPayButton?: boolean;\n payButton: (props: Partial<PayButtonProps>) => h.JSX.Element;\n status: UIElementStatus;\n}\n\nexport default function IrisGenerateQRCode(props: Readonly<IrisGenerateQRCodeProps>) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div>\n <p className={styles.instruction}>{i18n.get('iris.instructions.generateQrCode')}</p>\n {props.showPayButton &&\n props.payButton({\n label: i18n.get('generateQRCode'),\n icon: getImage({ imageFolder: 'components/' })('qr'),\n status: props.status\n })}\n </div>\n );\n}\n"],"names":["IrisGenerateQRCode","props","i18n","useCoreContext","getImage","useImage","h","div","p","className","styles","instruction","get","showPayButton","payButton","label","icon","imageFolder","status"],"mappings":"mPAae,SAASA,EAAmBC,GACvC,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAEjB,OACIC,EAACC,WACGD,EAACE,IAAAA,CAAEC,UAAWC,EAAOC,aAAcT,EAAKU,IAAI,qCAC3CX,EAAMY,eACHZ,EAAMa,UAAU,CACZC,MAAOb,EAAKU,IAAI,kBAChBI,KAAMZ,EAAS,CAAEa,YAAa,eAAxBb,CAAyC,MAC/Cc,OAAQjB,EAAMiB,SAIlC"}
@@ -0,0 +1,2 @@
1
+ var e={instruction:"IrisGenerateQRCode-module_instruction__uDTb-"};export{e as default};
2
+ //# sourceMappingURL=IrisGenerateQRCode.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IrisGenerateQRCode.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{TimelineWrapper as e}from"../../internal/Timeline/TimelineWrapper.js";import{Timeline as i}from"../../internal/Timeline/Timeline.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";const n=()=>{const{i18n:n}=r();return t(e,null,t(i,{instructions:[n.get("iris.instructions.payment.step1"),n.get("iris.instructions.payment.step2"),n.get("iris.instructions.payment.step3")]}))};export{n as IrisQrCodeInstructions};
2
+ //# sourceMappingURL=IrisQrCodeInstructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IrisQrCodeInstructions.js","sources":["../../../../../src/components/Iris/components/IrisQrCodeInstructions.tsx"],"sourcesContent":["import { h } from 'preact';\n\nimport { Timeline, TimelineWrapper } from '../../internal/Timeline';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\nexport const IrisQrCodeInstructions = () => {\n const { i18n } = useCoreContext();\n return (\n <TimelineWrapper>\n <Timeline\n instructions={[\n i18n.get('iris.instructions.payment.step1'),\n i18n.get('iris.instructions.payment.step2'),\n i18n.get('iris.instructions.payment.step3')\n ]}\n />\n </TimelineWrapper>\n );\n};\n"],"names":["IrisQrCodeInstructions","i18n","useCoreContext","h","TimelineWrapper","Timeline","instructions","get"],"mappings":"iSAKaA,EAAyB,KAClC,MAAMC,KAAEA,GAASC,IACjB,OACIC,EAACC,OACGD,EAACE,EAAAA,CACGC,aAAc,CACVL,EAAKM,IAAI,mCACTN,EAAKM,IAAI,mCACTN,EAAKM,IAAI"}
@@ -0,0 +1,2 @@
1
+ const i={ButtonId:{BANK_LIST:"iris-button-bank-list",QR_CODE:"iris-button-qrCode"},AreaId:{BANK_LIST:"iris-area-bank-list",QR_CODE:"iris-area-qrCode"}},r=10;export{r as DEFAULT_IRIS_COUNTDOWN_TIME,i as IRIS_ALLY_LABELS};
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/Iris/constants.ts"],"sourcesContent":["export const IRIS_ALLY_LABELS = {\n ButtonId: {\n BANK_LIST: 'iris-button-bank-list',\n QR_CODE: 'iris-button-qrCode'\n },\n AreaId: {\n BANK_LIST: 'iris-area-bank-list',\n QR_CODE: 'iris-area-qrCode'\n }\n};\n\nexport const DEFAULT_IRIS_COUNTDOWN_TIME = 10;\n"],"names":["IRIS_ALLY_LABELS","ButtonId","BANK_LIST","QR_CODE","AreaId","DEFAULT_IRIS_COUNTDOWN_TIME"],"mappings":"MAAaA,EAAmB,CAC5BC,SAAU,CACNC,UAAW,wBACXC,QAAS,sBAEbC,OAAQ,CACJF,UAAW,sBACXC,QAAS,qBAIJE,EAA8B"}
@@ -0,0 +1,2 @@
1
+ var r=function(r){return r.QR_CODE="qrCode",r.BANK_LIST="bankList",r}({});export{r as IrisMode};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../src/components/Iris/types.ts"],"sourcesContent":["import { IssuerListConfiguration, QRLoaderConfiguration } from '../types';\n\nexport type IrisConfiguration = IssuerListConfiguration & Pick<QRLoaderConfiguration, 'countdownTime' | 'qrCodeData' | 'paymentData' | 'delay'>;\n\n/**\n * Iris data format for /payment request\n * @internal\n */\nexport interface IrisData {\n paymentMethod: {\n type: string;\n issuer?: string;\n };\n}\n\n/**\n * Iris component display modes\n * @internal\n */\nexport enum IrisMode {\n QR_CODE = 'qrCode',\n BANK_LIST = 'bankList'\n}\n"],"names":["IrisMode"],"mappings":"AAmBO,IAAKA,EAAAA,SAAAA,GAAAA,iDAAAA,CAGX,CAHWA,CAGX,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{IRIS_ALLY_LABELS as t}from"./constants.js";import{IrisMode as o}from"./types.js";const e=(e,r)=>[{label:e.get("qrCode"),value:o.QR_CODE,id:t.ButtonId.QR_CODE,controls:t.AreaId.QR_CODE},{label:e.get("bankList"),value:o.BANK_LIST,id:t.ButtonId.BANK_LIST,controls:t.AreaId.BANK_LIST}].sort((t,o)=>t.value===r?-1:o.value===r?1:0);export{e as getIrisSegmentedControlOptions};
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/Iris/utils.ts"],"sourcesContent":["import Language from '../../language';\nimport { SegmentedControlOption } from '../internal/SegmentedControl/SegmentedControl';\nimport { IRIS_ALLY_LABELS } from './constants';\nimport { IrisMode } from './types';\n\nexport const getIrisSegmentedControlOptions = (i18n: Language, defaultMode: IrisMode): SegmentedControlOption<IrisMode>[] => {\n const options = [\n {\n label: i18n.get('qrCode'),\n value: IrisMode.QR_CODE,\n id: IRIS_ALLY_LABELS.ButtonId.QR_CODE,\n controls: IRIS_ALLY_LABELS.AreaId.QR_CODE\n },\n {\n label: i18n.get('bankList'),\n value: IrisMode.BANK_LIST,\n id: IRIS_ALLY_LABELS.ButtonId.BANK_LIST,\n controls: IRIS_ALLY_LABELS.AreaId.BANK_LIST\n }\n ];\n\n return options.sort((a, b) => {\n if (a.value === defaultMode) return -1;\n if (b.value === defaultMode) return 1;\n return 0;\n });\n};\n"],"names":["getIrisSegmentedControlOptions","i18n","defaultMode","label","get","value","IrisMode","QR_CODE","id","IRIS_ALLY_LABELS","ButtonId","controls","AreaId","BANK_LIST","sort","a","b"],"mappings":"wFAKO,MAAMA,EAAiC,CAACC,EAAgBC,IAC3C,CACZ,CACIC,MAAOF,EAAKG,IAAI,UAChBC,MAAOC,EAASC,QAChBC,GAAIC,EAAiBC,SAASH,QAC9BI,SAAUF,EAAiBG,OAAOL,SAEtC,CACIJ,MAAOF,EAAKG,IAAI,YAChBC,MAAOC,EAASO,UAChBL,GAAIC,EAAiBC,SAASG,UAC9BF,SAAUF,EAAiBG,OAAOC,YAI3BC,KAAK,CAACC,EAAGC,IAChBD,EAAEV,QAAUH,GAAoB,EAChCc,EAAEX,QAAUH,EAAoB,EAC7B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useState as t,useRef as n,useEffect as r}from"../../../../external/preact/hooks/dist/hooks.js";import{KlarnaWidget as o}from"../KlarnaWidget/KlarnaWidget.js";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function c(c){var{setComponentRef:s}=c,p=l(c,["setComponentRef"]);const[u,y]=t(null),[f,d]=t(),[b,m]=t("ready"),O=n({setAction:e=>{d(e),y((new Date).getTime())},setStatus:e=>m(e),reinitializeWidget:()=>{y((new Date).getTime())}});return r(()=>{s(O.current)},[s]),(null==f?void 0:f.sdkData)?e(o,{widgetInitializationTime:u,sdkData:f.sdkData,paymentMethodType:f.paymentMethodType,paymentData:f.paymentData,payButton:p.payButton,onComplete:p.onComplete,onError:p.onError,onLoaded:()=>{var e;null===(e=p.onActionHandled)||void 0===e||e.call(p,{componentType:p.type,actionDescription:"sdk-loaded",originalAction:f}),p.onLoaded()}}):p.showPayButton?p.payButton(i(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){a(e,t,n[t])})}return e}({},p),{status:b,disabled:"loading"===b,classNameModifiers:["standalone"],label:`${this.props.i18n.get("continueTo")} ${p.displayName}`})):null}export{c as KlarnaContainer};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useState as t,useRef as n,useEffect as r}from"../../../../external/preact/hooks/dist/hooks.js";import{KlarnaWidget as o}from"../KlarnaWidget/KlarnaWidget.js";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l(e,t){if(null==e)return{};var n,r,o,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=function(e,t){if(null==e)return{};var n,r,o={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}function c(c){let{setComponentRef:p}=c,s=l(c,["setComponentRef"]);const[u,y]=t(null),[f,d]=t(),[b,O]=t("ready"),m=n({setAction:e=>{d(e),y((new Date).getTime())},setStatus:e=>O(e),reinitializeWidget:()=>{y((new Date).getTime())}});return r(()=>{p(m.current)},[p]),(null==f?void 0:f.sdkData)?e(o,{widgetInitializationTime:u,sdkData:f.sdkData,paymentMethodType:f.paymentMethodType,paymentData:f.paymentData,payButton:s.payButton,onComplete:s.onComplete,onError:s.onError,onLoaded:()=>{var e;null===(e=s.onActionHandled)||void 0===e||e.call(s,{componentType:s.type,actionDescription:"sdk-loaded",originalAction:f}),s.onLoaded()}}):s.showPayButton?s.payButton(i(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){a(e,t,n[t])})}return e}({},s),{status:b,disabled:"loading"===b,classNameModifiers:["standalone"],label:`${this.props.i18n.get("continueTo")} ${s.displayName}`})):null}export{c as KlarnaContainer};
2
2
  //# sourceMappingURL=KlarnaContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KlarnaContainer.js","sources":["../../../../../../src/components/Klarna/components/KlarnaContainer/KlarnaContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { KlarnaWidget } from '../KlarnaWidget/KlarnaWidget';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementStatus } from '../../../internal/UIElement/types';\nimport type { ActionHandledReturnObject } from '../../../../types/global-types';\nimport type { AdyenCheckoutError, KlarnaAction, KlarnaAdditionalDetailsData, KlarnaComponentRef } from '../../../../types';\n\ninterface KlarnaContainerProps {\n setComponentRef: (ref: ComponentMethodsRef) => void;\n displayName: string;\n showPayButton: boolean;\n type: string;\n onComplete(state: KlarnaAdditionalDetailsData): void;\n onError(error: AdyenCheckoutError): void;\n payButton(props?: PayButtonFunctionProps): h.JSX.Element;\n onLoaded(): void;\n onActionHandled(actionHandled: ActionHandledReturnObject): void;\n}\n\nexport function KlarnaContainer({ setComponentRef, ...props }: KlarnaContainerProps) {\n const [widgetInitializationTime, setWidgetInitializationTime] = useState<number>(null);\n const [action, setAction] = useState<KlarnaAction>();\n const [status, setStatus] = useState('ready');\n const klarnaRef = useRef<KlarnaComponentRef>({\n setAction: (action: KlarnaAction) => {\n setAction(action);\n setWidgetInitializationTime(new Date().getTime());\n },\n setStatus: (status: UIElementStatus) => setStatus(status),\n reinitializeWidget: () => {\n setWidgetInitializationTime(new Date().getTime());\n }\n });\n\n useEffect(() => {\n setComponentRef(klarnaRef.current);\n }, [setComponentRef]);\n\n if (action?.sdkData) {\n return (\n <KlarnaWidget\n widgetInitializationTime={widgetInitializationTime}\n sdkData={action.sdkData}\n paymentMethodType={action.paymentMethodType}\n paymentData={action.paymentData}\n payButton={props.payButton}\n onComplete={props.onComplete}\n onError={props.onError}\n onLoaded={() => {\n props.onActionHandled?.({ componentType: props.type, actionDescription: 'sdk-loaded', originalAction: action });\n props.onLoaded();\n }}\n />\n );\n }\n\n if (props.showPayButton) {\n return props.payButton({\n ...props,\n status,\n disabled: status === 'loading',\n classNameModifiers: ['standalone'],\n label: `${this.props.i18n.get('continueTo')} ${props.displayName}`\n });\n }\n\n return null;\n}\n"],"names":["KlarnaContainer","_param","setComponentRef","props","widgetInitializationTime","setWidgetInitializationTime","useState","action","setAction","status","setStatus","klarnaRef","useRef","Date","getTime","reinitializeWidget","useEffect","current","sdkData","h","KlarnaWidget","paymentMethodType","paymentData","payButton","onComplete","onError","onLoaded","onActionHandled","componentType","type","actionDescription","originalAction","showPayButton","_object_spread_props","_object_spread","disabled","classNameModifiers","label","this","i18n","get","displayName"],"mappings":"ykCAmBO,SAASA,EAAgBC,GAAA,IAAAC,gBAAEA,GAAFD,EAAsBE,EAAAA,EAAtBF,EAAA,CAAEC,oBAC9B,MAAOE,EAA0BC,GAA+BC,EAAiB,OAC1EC,EAAQC,GAAaF,KACrBG,EAAQC,GAAaJ,EAAS,SAC/BK,EAAYC,EAA2B,CACzCJ,UAAYD,IACRC,EAAUD,GACVF,GAA4B,IAAIQ,MAAOC,YAE3CJ,UAAYD,GAA4BC,EAAUD,GAClDM,mBAAoB,KAChBV,GAA4B,IAAIQ,MAAOC,cAQ/C,OAJAE,EAAU,KACNd,EAAgBS,EAAUM,UAC3B,CAACf,KAEAK,aAAAA,EAAAA,EAAQW,SAEJC,EAACC,EAAAA,CACGhB,yBAA0BA,EAC1Bc,QAASX,EAAOW,QAChBG,kBAAmBd,EAAOc,kBAC1BC,YAAaf,EAAOe,YACpBC,UAAWpB,EAAMoB,UACjBC,WAAYrB,EAAMqB,WAClBC,QAAStB,EAAMsB,QACfC,SAAU,KACNvB,IAAAA,EAAqB,QAArBA,EAAAA,EAAMwB,uBAANxB,IAAAA,GAAAA,OAAAA,EAAwB,CAAEyB,cAAezB,EAAM0B,KAAMC,kBAAmB,aAAcC,eAAgBxB,IACtGJ,EAAMuB,cAMlBvB,EAAM6B,cACC7B,EAAMoB,UAAUU,oUAAAC,CAAA,CAAA,EAChB/B,GAAAA,CACHM,SACA0B,SAAqB,YAAX1B,EACV2B,mBAAoB,CAAC,cACrBC,MAAO,GAAGC,KAAKnC,MAAMoC,KAAKC,IAAI,iBAAiBrC,EAAMsC,iBAItD,IACX"}
1
+ {"version":3,"file":"KlarnaContainer.js","sources":["../../../../../../src/components/Klarna/components/KlarnaContainer/KlarnaContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { KlarnaWidget } from '../KlarnaWidget/KlarnaWidget';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementStatus } from '../../../internal/UIElement/types';\nimport type { ActionHandledReturnObject } from '../../../../types/global-types';\nimport type { AdyenCheckoutError, KlarnaAction, KlarnaAdditionalDetailsData, KlarnaComponentRef } from '../../../../types';\n\ninterface KlarnaContainerProps {\n setComponentRef: (ref: ComponentMethodsRef) => void;\n displayName: string;\n showPayButton: boolean;\n type: string;\n onComplete(state: KlarnaAdditionalDetailsData): void;\n onError(error: AdyenCheckoutError): void;\n payButton(props?: PayButtonFunctionProps): h.JSX.Element;\n onLoaded(): void;\n onActionHandled(actionHandled: ActionHandledReturnObject): void;\n}\n\nexport function KlarnaContainer({ setComponentRef, ...props }: KlarnaContainerProps) {\n const [widgetInitializationTime, setWidgetInitializationTime] = useState<number>(null);\n const [action, setAction] = useState<KlarnaAction>();\n const [status, setStatus] = useState('ready');\n const klarnaRef = useRef<KlarnaComponentRef>({\n setAction: (action: KlarnaAction) => {\n setAction(action);\n setWidgetInitializationTime(new Date().getTime());\n },\n setStatus: (status: UIElementStatus) => setStatus(status),\n reinitializeWidget: () => {\n setWidgetInitializationTime(new Date().getTime());\n }\n });\n\n useEffect(() => {\n setComponentRef(klarnaRef.current);\n }, [setComponentRef]);\n\n if (action?.sdkData) {\n return (\n <KlarnaWidget\n widgetInitializationTime={widgetInitializationTime}\n sdkData={action.sdkData}\n paymentMethodType={action.paymentMethodType}\n paymentData={action.paymentData}\n payButton={props.payButton}\n onComplete={props.onComplete}\n onError={props.onError}\n onLoaded={() => {\n props.onActionHandled?.({ componentType: props.type, actionDescription: 'sdk-loaded', originalAction: action });\n props.onLoaded();\n }}\n />\n );\n }\n\n if (props.showPayButton) {\n return props.payButton({\n ...props,\n status,\n disabled: status === 'loading',\n classNameModifiers: ['standalone'],\n label: `${this.props.i18n.get('continueTo')} ${props.displayName}`\n });\n }\n\n return null;\n}\n"],"names":["KlarnaContainer","_0","setComponentRef","props","widgetInitializationTime","setWidgetInitializationTime","useState","action","setAction","status","setStatus","klarnaRef","useRef","Date","getTime","reinitializeWidget","useEffect","current","sdkData","h","KlarnaWidget","paymentMethodType","paymentData","payButton","onComplete","onError","onLoaded","onActionHandled","componentType","type","actionDescription","originalAction","showPayButton","_object_spread_props","_object_spread","disabled","classNameModifiers","label","this","i18n","get","displayName"],"mappings":"s0CAmBO,SAASA,EAAgBC,OAAAC,gBAAEA,GAAiDD,EAA7BE,EAAAA,EAAAA,EAAAA,qBAClD,MAAOC,EAA0BC,GAA+BC,EAAiB,OAC1EC,EAAQC,GAAaF,KACrBG,EAAQC,GAAaJ,EAAS,SAC/BK,EAAYC,EAA2B,CACzCJ,UAAYD,IACRC,EAAUD,GACVF,GAA4B,IAAIQ,MAAOC,YAE3CJ,UAAYD,GAA4BC,EAAUD,GAClDM,mBAAoB,KAChBV,GAA4B,IAAIQ,MAAOC,cAQ/C,OAJAE,EAAU,KACNd,EAAgBS,EAAUM,UAC3B,CAACf,KAEAK,aAAAA,EAAAA,EAAQW,SAEJC,EAACC,EAAAA,CACGhB,yBAA0BA,EAC1Bc,QAASX,EAAOW,QAChBG,kBAAmBd,EAAOc,kBAC1BC,YAAaf,EAAOe,YACpBC,UAAWpB,EAAMoB,UACjBC,WAAYrB,EAAMqB,WAClBC,QAAStB,EAAMsB,QACfC,SAAU,KACNvB,IAAAA,EAAqB,QAArBA,EAAAA,EAAMwB,uBAANxB,IAAAA,GAAAA,OAAAA,EAAwB,CAAEyB,cAAezB,EAAM0B,KAAMC,kBAAmB,aAAcC,eAAgBxB,IACtGJ,EAAMuB,cAMlBvB,EAAM6B,cACC7B,EAAMoB,UAAUU,oUAAAC,CAAA,CAAA,EAChB/B,GAAAA,CACHM,SACA0B,SAAqB,YAAX1B,EACV2B,mBAAoB,CAAC,cACrBC,MAAO,GAAGC,KAAKnC,MAAMoC,KAAKC,IAAI,iBAAiBrC,EAAMsC,iBAItD,IACX"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../../external/preact/dist/preact.js";import{useRef as e,useState as a,useCallback as n,useEffect as o}from"../../../../external/preact/hooks/dist/hooks.js";import r from"../../../../utils/Script.js";import{KLARNA_REFUSED_RESULT_CODE as i,KLARNA_WIDGET_URL as l}from"../../constants.js";import s from"../../../../core/Analytics/useAnalytics.js";function c(t,e){if(null==t)return{};var a,n,o=function(t,e){if(null==t)return{};var a,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)a=r[n],e.indexOf(a)>=0||(o[a]=t[a]);return o}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)a=r[n],e.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(o[a]=t[a])}return o}function m(m){var{sdkData:d,paymentMethodType:y,widgetInitializationTime:p,payButton:u}=m,f=c(m,["sdkData","paymentMethodType","widgetInitializationTime","payButton"]);const _=e(null),[h,w]=a("ready"),{analytics:k}=s(),g=n(()=>{w("error"),f.onComplete({data:{paymentData:f.paymentData,details:{resultCode:i}}})},[f.paymentData,f.onComplete]),v=n(()=>{window.Klarna.Payments.init({client_token:d.client_token}),window.Klarna.Payments.load({container:_.current,payment_method_category:d.payment_method_category},function(t){!t.show_form||t.error?g():f.onLoaded()})},[d.client_token,d.payment_method_category]),b=n(()=>{w("loading");try{window.Klarna.Payments.authorize({payment_method_category:d.payment_method_category},function(t){!0===t.approved&&!0===t.show_form?(w("success"),f.onComplete({data:{paymentData:f.paymentData,details:{authorization_token:t.authorization_token}}})):t.approved||!0!==t.show_form?g():(w("ready"),f.onError(t))})}catch(t){g()}},[d.payment_method_category,f.onComplete,f.onError]),j=t=>{"Enter"!==t.key&&"Enter"!==t.code||(t.preventDefault(),b())};return o(()=>{var t,e;(null===(e=window.Klarna)||void 0===e||null===(t=e.Payments)||void 0===t?void 0:t.init)&&v()},[p]),o(()=>{window.klarnaAsyncCallback=function(){v()};const t=new r({src:l,component:"klarna",analytics:k});return t.load(),()=>{t.remove()}},[v,k]),"error"!==h&&"success"!==h?t("div",{className:"adyen-checkout__klarna-widget"},t("div",{ref:_}),u({status:h,disabled:"loading"===h,onClick:b,onKeyDown:j})):null}export{m as KlarnaWidget};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as t,useState as n,useCallback as o,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import r from"../../../../utils/Script.js";import{KLARNA_REFUSED_RESULT_CODE as i,KLARNA_WIDGET_URL as l}from"../../constants.js";import s from"../../../../core/Analytics/useAnalytics.js";function c(e,t){if(null==e)return{};var n,o,a,r={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),a=0;a<n.length;a++)o=n[a],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}if(r=function(e,t){if(null==e)return{};var n,o,a={},r=Object.getOwnPropertyNames(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),a=0;a<n.length;a++)o=n[a],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}function p(p){let{sdkData:m,paymentMethodType:y,widgetInitializationTime:d,payButton:u}=p,f=c(p,["sdkData","paymentMethodType","widgetInitializationTime","payButton"]);const w=t(null),[_,h]=n("ready"),{analytics:g}=s(),k=o(()=>{h("error"),f.onComplete({data:{paymentData:f.paymentData,details:{resultCode:i}}})},[f.paymentData,f.onComplete]),b=o(()=>{window.Klarna.Payments.init({client_token:m.client_token}),window.Klarna.Payments.load({container:w.current,payment_method_category:m.payment_method_category},function(e){!e.show_form||e.error?k():f.onLoaded()})},[m.client_token,m.payment_method_category]),v=o(()=>{h("loading");try{window.Klarna.Payments.authorize({payment_method_category:m.payment_method_category},function(e){!0===e.approved&&!0===e.show_form?(h("success"),f.onComplete({data:{paymentData:f.paymentData,details:{authorization_token:e.authorization_token}}})):e.approved||!0!==e.show_form?k():(h("ready"),f.onError(e))})}catch(e){k()}},[m.payment_method_category,f.onComplete,f.onError]),O=e=>{"Enter"!==e.key&&"Enter"!==e.code||(e.preventDefault(),v())};return a(()=>{var e,t;(null===(t=window.Klarna)||void 0===t||null===(e=t.Payments)||void 0===e?void 0:e.init)&&b()},[d]),a(()=>{window.klarnaAsyncCallback=function(){b()};const e=new r({src:l,component:"klarna",analytics:g});return e.load(),()=>{e.remove()}},[b,g]),"error"!==_&&"success"!==_?e("div",{className:"adyen-checkout__klarna-widget"},e("div",{ref:w}),u({status:_,disabled:"loading"===_,onClick:v,onKeyDown:O})):null}export{p as KlarnaWidget};
2
2
  //# sourceMappingURL=KlarnaWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KlarnaWidget.js","sources":["../../../../../../src/components/Klarna/components/KlarnaWidget/KlarnaWidget.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState, useCallback } from 'preact/hooks';\nimport Script from '../../../../utils/Script';\nimport { KLARNA_WIDGET_URL, KLARNA_REFUSED_RESULT_CODE } from '../../constants';\nimport type { KlarnaWidgetAuthorizeResponse, KlarnaWidgetProps } from '../../types';\nimport './KlarnaWidget.scss';\nimport useAnalytics from '../../../../core/Analytics/useAnalytics';\n\nexport function KlarnaWidget({ sdkData, paymentMethodType, widgetInitializationTime, payButton, ...props }: KlarnaWidgetProps) {\n const klarnaWidgetRef = useRef(null);\n const [status, setStatus] = useState('ready');\n const { analytics } = useAnalytics();\n\n const handleError = useCallback(() => {\n setStatus('error');\n props.onComplete({\n data: {\n paymentData: props.paymentData,\n details: { resultCode: KLARNA_REFUSED_RESULT_CODE }\n }\n });\n }, [props.paymentData, props.onComplete]);\n\n const initializeKlarnaWidget = useCallback(() => {\n window.Klarna.Payments.init({\n client_token: sdkData.client_token\n });\n\n window.Klarna.Payments.load(\n {\n container: klarnaWidgetRef.current,\n payment_method_category: sdkData.payment_method_category\n },\n function (res: { show_form: boolean; error: unknown }) {\n // If show_form: true is received together with an error, something fixable is wrong and the consumer\n // needs to take action before moving forward\n // If show_form: false, the payment method in the loaded widget will not be offered for this order\n // based on Klarna’s pre-assessment.\n if (!res.show_form || !!res.error) {\n handleError();\n } else {\n props.onLoaded();\n }\n }\n );\n }, [sdkData.client_token, sdkData.payment_method_category]);\n\n const authorizeKlarna = useCallback(() => {\n setStatus('loading');\n try {\n window.Klarna.Payments.authorize(\n {\n payment_method_category: sdkData.payment_method_category\n },\n function (res: KlarnaWidgetAuthorizeResponse) {\n if (res.approved === true && res.show_form === true) {\n // Klarna has approved the authorization of credit for this order.\n setStatus('success');\n props.onComplete({\n data: {\n paymentData: props.paymentData,\n details: {\n authorization_token: res.authorization_token\n }\n }\n });\n } else if (!res.approved && res.show_form === true) {\n // Fixable error\n setStatus('ready');\n props.onError(res);\n } else {\n // The purchase is declined. The widget should be hidden and the user\n // should select another payment method.\n handleError();\n }\n }\n );\n } catch (e) {\n handleError();\n }\n }, [sdkData.payment_method_category, props.onComplete, props.onError]);\n\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n const handleKeyDown = (e: h.JSX.TargetedKeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault();\n authorizeKlarna();\n }\n };\n\n /**\n * Initializes Klarna SDK if it is already available and reinitialize\n * it when the init time refreshes\n */\n useEffect(() => {\n const isKlarnaAvailable = window.Klarna?.Payments?.init;\n if (isKlarnaAvailable) {\n initializeKlarnaWidget();\n }\n }, [widgetInitializationTime]);\n\n useEffect(() => {\n window.klarnaAsyncCallback = function () {\n initializeKlarnaWidget();\n };\n const script = new Script({\n src: KLARNA_WIDGET_URL,\n component: 'klarna',\n analytics\n });\n\n void script.load();\n\n return () => {\n script.remove();\n };\n }, [initializeKlarnaWidget, analytics]);\n\n if (status !== 'error' && status !== 'success') {\n return (\n <div className=\"adyen-checkout__klarna-widget\">\n <div ref={klarnaWidgetRef} />\n {payButton({\n status,\n disabled: status === 'loading',\n onClick: authorizeKlarna,\n onKeyDown: handleKeyDown\n })}\n </div>\n );\n }\n\n return null;\n}\n"],"names":["KlarnaWidget","_param","sdkData","paymentMethodType","widgetInitializationTime","payButton","props","klarnaWidgetRef","useRef","status","setStatus","useState","analytics","useAnalytics","handleError","useCallback","onComplete","data","paymentData","details","resultCode","KLARNA_REFUSED_RESULT_CODE","initializeKlarnaWidget","window","Klarna","Payments","init","client_token","load","container","current","payment_method_category","res","show_form","error","onLoaded","authorizeKlarna","authorize","approved","authorization_token","onError","e","handleKeyDown","key","code","preventDefault","useEffect","klarnaAsyncCallback","script","Script","src","KLARNA_WIDGET_URL","component","remove","h","div","className","ref","disabled","onClick","onKeyDown"],"mappings":"kvBAQO,SAASA,EAAaC,OAAAC,QAAEA,EAAOC,kBAAEA,EAAiBC,yBAAEA,EAAwBC,UAAEA,GAAxDJ,EAAsEK,EAAAA,EAAtEL,EAAA,CAAEC,UAASC,oBAAmBC,2BAA0BC,cACjF,MAAME,EAAkBC,EAAO,OACxBC,EAAQC,GAAaC,EAAS,UAC/BC,UAAEA,GAAcC,IAEhB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,UAAW,SACXxC,cAKJ,OAFKoC,EAAOpB,OAEL,KACHoB,EAAOK,WAEZ,CAAC/B,EAAwBV,IAEb,UAAXH,GAAiC,YAAXA,EAElB6C,EAACC,MAAAA,CAAIC,UAAU,iCACXF,EAACC,MAAAA,CAAIE,IAAKlD,IACTF,EAAU,CACPI,SACAiD,SAAqB,YAAXjD,EACVkD,QAASvB,EACTwB,UAAWlB,KAMpB,IACX"}
1
+ {"version":3,"file":"KlarnaWidget.js","sources":["../../../../../../src/components/Klarna/components/KlarnaWidget/KlarnaWidget.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState, useCallback } from 'preact/hooks';\nimport Script from '../../../../utils/Script';\nimport { KLARNA_WIDGET_URL, KLARNA_REFUSED_RESULT_CODE } from '../../constants';\nimport type { KlarnaWidgetAuthorizeResponse, KlarnaWidgetProps } from '../../types';\nimport './KlarnaWidget.scss';\nimport useAnalytics from '../../../../core/Analytics/useAnalytics';\n\nexport function KlarnaWidget({ sdkData, paymentMethodType, widgetInitializationTime, payButton, ...props }: KlarnaWidgetProps) {\n const klarnaWidgetRef = useRef(null);\n const [status, setStatus] = useState('ready');\n const { analytics } = useAnalytics();\n\n const handleError = useCallback(() => {\n setStatus('error');\n props.onComplete({\n data: {\n paymentData: props.paymentData,\n details: { resultCode: KLARNA_REFUSED_RESULT_CODE }\n }\n });\n }, [props.paymentData, props.onComplete]);\n\n const initializeKlarnaWidget = useCallback(() => {\n window.Klarna.Payments.init({\n client_token: sdkData.client_token\n });\n\n window.Klarna.Payments.load(\n {\n container: klarnaWidgetRef.current,\n payment_method_category: sdkData.payment_method_category\n },\n function (res: { show_form: boolean; error: unknown }) {\n // If show_form: true is received together with an error, something fixable is wrong and the consumer\n // needs to take action before moving forward\n // If show_form: false, the payment method in the loaded widget will not be offered for this order\n // based on Klarna’s pre-assessment.\n if (!res.show_form || !!res.error) {\n handleError();\n } else {\n props.onLoaded();\n }\n }\n );\n }, [sdkData.client_token, sdkData.payment_method_category]);\n\n const authorizeKlarna = useCallback(() => {\n setStatus('loading');\n try {\n window.Klarna.Payments.authorize(\n {\n payment_method_category: sdkData.payment_method_category\n },\n function (res: KlarnaWidgetAuthorizeResponse) {\n if (res.approved === true && res.show_form === true) {\n // Klarna has approved the authorization of credit for this order.\n setStatus('success');\n props.onComplete({\n data: {\n paymentData: props.paymentData,\n details: {\n authorization_token: res.authorization_token\n }\n }\n });\n } else if (!res.approved && res.show_form === true) {\n // Fixable error\n setStatus('ready');\n props.onError(res);\n } else {\n // The purchase is declined. The widget should be hidden and the user\n // should select another payment method.\n handleError();\n }\n }\n );\n } catch (e) {\n handleError();\n }\n }, [sdkData.payment_method_category, props.onComplete, props.onError]);\n\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n const handleKeyDown = (e: h.JSX.TargetedKeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault();\n authorizeKlarna();\n }\n };\n\n /**\n * Initializes Klarna SDK if it is already available and reinitialize\n * it when the init time refreshes\n */\n useEffect(() => {\n const isKlarnaAvailable = window.Klarna?.Payments?.init;\n if (isKlarnaAvailable) {\n initializeKlarnaWidget();\n }\n }, [widgetInitializationTime]);\n\n useEffect(() => {\n window.klarnaAsyncCallback = function () {\n initializeKlarnaWidget();\n };\n const script = new Script({\n src: KLARNA_WIDGET_URL,\n component: 'klarna',\n analytics\n });\n\n void script.load();\n\n return () => {\n script.remove();\n };\n }, [initializeKlarnaWidget, analytics]);\n\n if (status !== 'error' && status !== 'success') {\n return (\n <div className=\"adyen-checkout__klarna-widget\">\n <div ref={klarnaWidgetRef} />\n {payButton({\n status,\n disabled: status === 'loading',\n onClick: authorizeKlarna,\n onKeyDown: handleKeyDown\n })}\n </div>\n );\n }\n\n return null;\n}\n"],"names":["KlarnaWidget","_0","sdkData","paymentMethodType","widgetInitializationTime","payButton","props","klarnaWidgetRef","useRef","status","setStatus","useState","analytics","useAnalytics","handleError","useCallback","onComplete","data","paymentData","details","resultCode","KLARNA_REFUSED_RESULT_CODE","initializeKlarnaWidget","window","Klarna","Payments","init","client_token","load","container","current","payment_method_category","res","show_form","error","onLoaded","authorizeKlarna","authorize","approved","authorization_token","onError","e","handleKeyDown","key","code","preventDefault","useEffect","klarnaAsyncCallback","script","Script","src","KLARNA_WIDGET_URL","component","remove","h","div","className","ref","disabled","onClick","onKeyDown"],"mappings":"++BAQO,SAASA,EAAaC,OAAAC,QAAEA,EAAOC,kBAAEA,EAAiBC,yBAAEA,EAAwBC,UAAEA,GAAwCJ,EAA1BK,EAAAA,EAAAA,EAAAA,wEAC/F,MAAMC,EAAkBC,EAAO,OACxBC,EAAQC,GAAaC,EAAS,UAC/BC,UAAEA,GAAcC,IAEhBC,EAAcC,EAAY,KAC5BL,EAAU,SACVJ,EAAMU,WAAW,CACbC,KAAM,CACFC,YAAaZ,EAAMY,YACnBC,QAAS,CAAEC,WAAYC,OAGhC,CAACf,EAAMY,YAAaZ,EAAMU,aAEvBM,EAAyBP,EAAY,KACvCQ,OAAOC,OAAOC,SAASC,KAAK,CACxBC,aAAczB,EAAQyB,eAG1BJ,OAAOC,OAAOC,SAASG,KACnB,CACIC,UAAWtB,EAAgBuB,QAC3BC,wBAAyB7B,EAAQ6B,yBAErC,SAAUC,IAKDA,EAAIC,WAAeD,EAAIE,MACxBpB,IAEAR,EAAM6B,UAEd,IAEL,CAACjC,EAAQyB,aAAczB,EAAQ6B,0BAE5BK,EAAkBrB,EAAY,KAChCL,EAAU,WACV,IACIa,OAAOC,OAAOC,SAASY,UACnB,CACIN,wBAAyB7B,EAAQ6B,yBAErC,SAAUC,IACe,IAAjBA,EAAIM,WAAuC,IAAlBN,EAAIC,WAE7BvB,EAAU,WACVJ,EAAMU,WAAW,CACbC,KAAM,CACFC,YAAaZ,EAAMY,YACnBC,QAAS,CACLoB,oBAAqBP,EAAIO,yBAI7BP,EAAIM,WAA8B,IAAlBN,EAAIC,UAO5BnB,KALAJ,EAAU,SACVJ,EAAMkC,QAAQR,GAMtB,EAER,CAAE,MAAOS,GACL3B,GACJ,GACD,CAACZ,EAAQ6B,wBAAyBzB,EAAMU,WAAYV,EAAMkC,UAGvDE,EAAiBD,IACL,UAAVA,EAAEE,KAA8B,UAAXF,EAAEG,OACvBH,EAAEI,iBACFT,MAgCR,OAxBAU,EAAU,SACoBvB,EAAAA,GAAa,QAAbA,EAAAA,OAAOC,cAAPD,IAAAA,GAAuB,QAAvBA,EAAAA,EAAeE,gBAAfF,IAAAA,OAAAA,EAAAA,EAAyBG,OAE/CJ,KAEL,CAAClB,IAEJ0C,EAAU,KACNvB,OAAOwB,oBAAsB,WACzBzB,GACJ,EACA,MAAM0B,EAAS,IAAIC,EAAO,CACtBC,IAAKC,EACLC,UAAW,SACXxC,cAKJ,OAFKoC,EAAOpB,OAEL,KACHoB,EAAOK,WAEZ,CAAC/B,EAAwBV,IAEb,UAAXH,GAAiC,YAAXA,EAElB6C,EAACC,MAAAA,CAAIC,UAAU,iCACXF,EAACC,MAAAA,CAAIE,IAAKlD,IACTF,EAAU,CACPI,SACAiD,SAAqB,YAAXjD,EACVkD,QAASvB,EACTwB,UAAWlB,KAMpB,IACX"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{TxVariants as e}from"../tx-variants.js";import{UIElement as n}from"../internal/UIElement/UIElement.js";import r from"../internal/RedirectButton/RedirectButton.js";import i,{ERROR as o}from"../../core/Errors/AdyenCheckoutError.js";import{PasskeyService as s}from"./services/PasskeyService.js";import{authorizeEnrollment as a}from"./services/authorizeEnrollment.js";import{authorizePayment as p}from"./services/authorizePayment.js";import d from"./components/StoredPayment/StoredPayment.js";import l from"./components/Enrollment/Enrollment.js";function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){c(t,e,n[e])})}return t}function y(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 n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e}(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}function m(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}class u extends n{get isValid(){var t;return!(this.props._isAdyenHosted&&!this.props.storedPaymentMethodId)||!!(null===(t=this.state)||void 0===t?void 0:t.isValid)}get additionalInfo(){var t,e;return this.props.storedPaymentMethodId?this.props.i18n.get("paybybankpix.storedPayment.additionalLabel",{values:{receiver:null===(e=this.props)||void 0===e||null===(t=e.payByBankPixDetails)||void 0===t?void 0:t.receiver}}):""}get icon(){var t,e;return this.props.storedPaymentMethodId?this.resources.getImage({parentFolder:`${u.type}/`})(null===(e=this.props)||void 0===e||null===(t=e.payByBankPixDetails)||void 0===t?void 0:t.ispb):super.icon}async isAvailable(){const t=await this.passkeyService.getWebAuthnUnsupportedReason();if(t)return Promise.reject(new i(o,t));if(!this.props._isAdyenHosted)return Promise.resolve();try{if(await this.passkeyService.initialize(),this.props.storedPaymentMethodId){return await this.passkeyService.canUseStoredCredential()?Promise.resolve():Promise.reject(new i("ERROR","The stored payment method is not available on this device"))}return Promise.resolve()}catch(t){return Promise.reject(t instanceof Error?null==t?void 0:t.message:"Unknown error")}}handleAction(t,e={}){const n=this.core.createFromAction(t,y(h({},this.elementRef.props,e),{onAdditionalDetails:this.handleAdditionalDetails}));return n?(this.unmount(),n.isAvailable().then(()=>{n.mount(this._node)}),n):null}formatData(){if(!this.props._isAdyenHosted)return{paymentMethod:{type:e.paybybank_pix}};const t=null==this.props.storedPaymentMethodId;return h({paymentMethod:h({type:e.paybybank_pix},this.state.data)},t?{storePaymentMethod:!0}:{})}componentToRender(){var e,n,i;return this.props._isAdyenHosted?null!=this.props.storedPaymentMethodId?t(d,{txVariant:u.type,type:this.props.type,clientKey:this.props.clientKey,amount:this.props.amount,enrollmentId:null===(e=this.props.paymentMethodData)||void 0===e?void 0:e.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,setComponentRef:this.setComponentRef,onPay:this.payWithStoredPayment,onAuthorize:this.authorizePayment}):t(l,{onError:this.handleError,txVariant:u.type,type:this.props.type,clientKey:this.props.clientKey,enrollmentId:null===(i=this.props.paymentMethodData)||void 0===i?void 0:i.enrollmentId,countdownTime:this.props.countdownTime,onEnroll:this.authorizeEnrollment,issuers:this.props.issuers,payButton:this.payButton,onChange:this.onIssuerSelected,onSubmitAnalytics:this.submitAnalytics,setComponentRef:this.setComponentRef}):t(r,{showPayButton:this.props.showPayButton,name:this.displayName,label:this.props.i18n.get("paybybankpix.redirectBtn.label"),amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}})}constructor(t,e){var n,r;super(t,e),c(this,"passkeyService",void 0),c(this,"onIssuerSelected",async t=>{try{const{data:e={}}=t;if(!e.issuer)return;const n=await this.passkeyService.captureRiskSignalsEnrollment(),{deviceId:r}=n,i=m(n,["deviceId"]);this.setState(y(h({},t),{data:y(h({},e),{riskSignals:i,deviceId:r})}))}catch(t){const e=t instanceof Error?t.message:"Unknown error in the onIssuerSelected";this.handleError(t instanceof i?t:new i(o,e))}}),c(this,"authorizeEnrollment",async t=>{try{var e;const n=await this.passkeyService.createCredentialForEnrollment(t),r={enrollmentId:null===(e=this.props.paymentMethodData)||void 0===e?void 0:e.enrollmentId,fidoAssertion:n},{redirectResult:i}=await a({enrollment:r,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:i}}})}catch(t){const e=t instanceof Error?t.message:"Unknown error in the authorizeEnrollment";this.handleError(t instanceof i?t:new i(o,e))}}),c(this,"payWithStoredPayment",async()=>{try{const t=await this.passkeyService.captureRiskSignalsAuthentication(),{deviceId:e}=t,n=m(t,["deviceId"]);this.state=h({},this.state,{data:{storedPaymentMethodId:this.props.storedPaymentMethodId,riskSignals:n,deviceId:e}}),super.submit()}catch(t){const e=t instanceof Error?t.message:"Unknown error in the payWithStoredPayment";this.handleError(t instanceof i?t:new i(o,e))}}),c(this,"authorizePayment",async t=>{try{var e,n;const r=await this.passkeyService.authenticateWithCredential(t),i={enrollmentId:null===(e=this.props.paymentMethodData)||void 0===e?void 0:e.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,fidoAssertion:r},{redirectResult:o}=await p({payment:i,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:o}}})}catch(t){const e=t instanceof Error?t.message:"Unknown error in the authorizePayment";this.handleError(t instanceof i?t:new i(o,e))}});const d=this.props.storedPaymentMethodId?null===(r=this.props)||void 0===r||null===(n=r.payByBankPixDetails)||void 0===n?void 0:n.deviceId:this.props.deviceId;this.passkeyService=new s({environment:this.props.environment,deviceId:d},this.analytics),this.props._isAdyenHosted&&this.passkeyService.initialize()}}c(u,"type",e.paybybank_pix),c(u,"TIMEOUT_MINUTES",1),c(u,"defaultProps",{showPayButton:!0,_isAdyenHosted:(()=>{try{return new URL(window.location.href).hostname.endsWith(".adyen.com")}catch(t){return!1}})(),countdownTime:u.TIMEOUT_MINUTES});export{u as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{TxVariants as t}from"../tx-variants.js";import{UIElement as n}from"../internal/UIElement/UIElement.js";import r from"../internal/RedirectButton/RedirectButton.js";import o,{ERROR as i}from"../../core/Errors/AdyenCheckoutError.js";import{PasskeyService as s}from"./services/PasskeyService.js";import{authorizeEnrollment as a}from"./services/authorizeEnrollment.js";import{authorizePayment as p}from"./services/authorizePayment.js";import l from"./components/StoredPayment/StoredPayment.js";import d from"./components/Enrollment/Enrollment.js";function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){c(e,t,n[t])})}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function m(e,t){if(null==e)return{};var n,r,o,i={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}class u extends n{get isValid(){var e;return!(this.props._isAdyenHosted&&!this.props.storedPaymentMethodId)||!!(null===(e=this.state)||void 0===e?void 0:e.isValid)}get additionalInfo(){var e,t;return this.props.storedPaymentMethodId?this.props.i18n.get("paybybankpix.storedPayment.additionalLabel",{values:{receiver:null===(t=this.props)||void 0===t||null===(e=t.payByBankPixDetails)||void 0===e?void 0:e.receiver}}):""}get icon(){var e,t;return this.props.storedPaymentMethodId?this.resources.getImage({parentFolder:`${u.type}/`})(null===(t=this.props)||void 0===t||null===(e=t.payByBankPixDetails)||void 0===e?void 0:e.ispb):super.icon}async isAvailable(){const e=await this.passkeyService.getWebAuthnUnsupportedReason();if(e)return Promise.reject(new o(i,e));if(!this.props._isAdyenHosted)return Promise.resolve();try{if(await this.passkeyService.initialize(),this.props.storedPaymentMethodId){return await this.passkeyService.canUseStoredCredential()?Promise.resolve():Promise.reject(new o("ERROR","The stored payment method is not available on this device"))}return Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?null==e?void 0:e.message:"Unknown error")}}handleAction(e,t={}){const n=this.core.createFromAction(e,y(h({},this.elementRef.props,t),{onAdditionalDetails:this.handleAdditionalDetails}));return n?(this.unmount(),n.isAvailable().then(()=>{n.mount(this._node)}),n):null}formatData(){if(!this.props._isAdyenHosted)return{paymentMethod:{type:t.paybybank_pix}};const e=null==this.props.storedPaymentMethodId;return h({paymentMethod:h({type:t.paybybank_pix},this.state.data)},e?{storePaymentMethod:!0}:{})}componentToRender(){var t,n,o;return this.props._isAdyenHosted?null!=this.props.storedPaymentMethodId?e(l,{txVariant:u.type,type:this.props.type,clientKey:this.props.clientKey,amount:this.props.amount,enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,setComponentRef:this.setComponentRef,onPay:this.payWithStoredPayment,onAuthorize:this.authorizePayment}):e(d,{onError:this.handleError,txVariant:u.type,type:this.props.type,clientKey:this.props.clientKey,enrollmentId:null===(o=this.props.paymentMethodData)||void 0===o?void 0:o.enrollmentId,countdownTime:this.props.countdownTime,onEnroll:this.authorizeEnrollment,issuers:this.props.issuers,payButton:this.payButton,onChange:this.onIssuerSelected,onSubmitAnalytics:this.submitAnalytics,setComponentRef:this.setComponentRef}):e(r,{showPayButton:this.props.showPayButton,name:this.displayName,label:this.props.i18n.get("paybybankpix.redirectBtn.label"),amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:e=>{this.componentRef=e}})}constructor(e,t){var n,r;super(e,t),c(this,"passkeyService",void 0),c(this,"onIssuerSelected",async e=>{try{const{data:t={}}=e;if(!t.issuer)return;const n=await this.passkeyService.captureRiskSignalsEnrollment(),{deviceId:r}=n,o=m(n,["deviceId"]);this.setState(y(h({},e),{data:y(h({},t),{riskSignals:o,deviceId:r})}))}catch(e){const t=e instanceof Error?e.message:"Unknown error in the onIssuerSelected";this.handleError(e instanceof o?e:new o(i,t))}}),c(this,"authorizeEnrollment",async e=>{try{var t;const n=await this.passkeyService.createCredentialForEnrollment(e),r={enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,fidoAssertion:n},{redirectResult:o}=await a({enrollment:r,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:o}}})}catch(e){const t=e instanceof Error?e.message:"Unknown error in the authorizeEnrollment";this.handleError(e instanceof o?e:new o(i,t))}}),c(this,"payWithStoredPayment",async()=>{try{const e=await this.passkeyService.captureRiskSignalsAuthentication(),{deviceId:t}=e,n=m(e,["deviceId"]);this.state=h({},this.state,{data:{storedPaymentMethodId:this.props.storedPaymentMethodId,riskSignals:n,deviceId:t}}),super.submit()}catch(e){const t=e instanceof Error?e.message:"Unknown error in the payWithStoredPayment";this.handleError(e instanceof o?e:new o(i,t))}}),c(this,"authorizePayment",async e=>{try{var t,n;const r=await this.passkeyService.authenticateWithCredential(e),o={enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,fidoAssertion:r},{redirectResult:i}=await p({payment:o,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:i}}})}catch(e){const t=e instanceof Error?e.message:"Unknown error in the authorizePayment";this.handleError(e instanceof o?e:new o(i,t))}});const l=this.props.storedPaymentMethodId?null===(r=this.props)||void 0===r||null===(n=r.payByBankPixDetails)||void 0===n?void 0:n.deviceId:this.props.deviceId;this.passkeyService=new s({environment:this.props.environment,deviceId:l},this.analytics),this.props._isAdyenHosted&&this.passkeyService.initialize()}}c(u,"type",t.paybybank_pix),c(u,"TIMEOUT_MINUTES",1),c(u,"defaultProps",{showPayButton:!0,_isAdyenHosted:(()=>{try{return new URL(window.location.href).hostname.endsWith(".adyen.com")}catch(e){return!1}})(),countdownTime:u.TIMEOUT_MINUTES});export{u as default};
2
2
  //# sourceMappingURL=PayByBankPix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayByBankPix.js","sources":["../../../../src/components/PayByBankPix/PayByBankPix.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { PayByBankPixData, PayByBankPixConfiguration } from './types';\nimport { TxVariants } from '../tx-variants';\nimport UIElement from '../internal/UIElement';\nimport RedirectButton from '../internal/RedirectButton';\nimport AdyenCheckoutError, { ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { PasskeyService } from './services/PasskeyService';\nimport { authorizeEnrollment } from './services/authorizeEnrollment';\nimport { authorizePayment } from './services/authorizePayment';\nimport StoredPayment from './components/StoredPayment';\nimport Enrollment from './components/Enrollment';\nimport { PaymentAction } from '../../types/global-types';\nimport type { ICore } from '../../core/types';\n\nconst isAdyenHosted = () => {\n try {\n const currentUrl = new URL(window.location.href);\n return currentUrl.hostname.endsWith('.adyen.com');\n } catch (e) {\n // SSR, or it fails to parse the full url\n return false;\n }\n};\nclass PayByBankPixElement extends UIElement<PayByBankPixConfiguration> {\n public static readonly type = TxVariants.paybybank_pix;\n private static readonly TIMEOUT_MINUTES = 1;\n private readonly passkeyService: PasskeyService;\n\n public static readonly defaultProps: PayByBankPixConfiguration = {\n showPayButton: true,\n _isAdyenHosted: isAdyenHosted(),\n countdownTime: PayByBankPixElement.TIMEOUT_MINUTES\n };\n\n constructor(checkout: ICore, props?: PayByBankPixConfiguration) {\n super(checkout, props);\n const deviceId = this.props.storedPaymentMethodId ? this.props?.payByBankPixDetails?.deviceId : this.props.deviceId;\n\n this.passkeyService = new PasskeyService(\n {\n environment: this.props.environment,\n deviceId\n },\n this.analytics\n );\n\n if (this.props._isAdyenHosted) {\n void this.passkeyService.initialize();\n }\n }\n\n get isValid(): boolean {\n // Always true for non-hosted page or stored payment\n if (!this.props._isAdyenHosted || this.props.storedPaymentMethodId) {\n return true;\n }\n return !!this.state?.isValid;\n }\n\n /**\n * Display in the drop-in\n */\n get additionalInfo() {\n return this.props.storedPaymentMethodId\n ? this.props.i18n.get('paybybankpix.storedPayment.additionalLabel', { values: { receiver: this.props?.payByBankPixDetails?.receiver } })\n : '';\n }\n\n /**\n * Display in the drop-in\n */\n public override get icon() {\n return this.props.storedPaymentMethodId\n ? this.resources.getImage({ parentFolder: `${PayByBankPixElement.type}/` })(this.props?.payByBankPixDetails?.ispb)\n : super.icon;\n }\n\n /**\n * Method used to let the merchant know if the shopper's device supports WebAuthn APIs: https://featuredetect.passkeys.dev/\n */\n public override async isAvailable(): Promise<void> {\n const unsupportedReason = await this.passkeyService.getWebAuthnUnsupportedReason();\n if (unsupportedReason) {\n return Promise.reject(new AdyenCheckoutError(ERROR, unsupportedReason));\n }\n if (!this.props._isAdyenHosted) {\n return Promise.resolve();\n }\n\n // Load passkey sdk on the hosted page\n try {\n await this.passkeyService.initialize();\n\n if (this.props.storedPaymentMethodId) {\n // If the provided deviceId from the server does not match the localstorage deviceId, do not render the stored payment component.\n const shouldShowStoredPaymentMethod = await this.passkeyService.canUseStoredCredential();\n return shouldShowStoredPaymentMethod\n ? Promise.resolve()\n : Promise.reject(new AdyenCheckoutError('ERROR', 'The stored payment method is not available on this device'));\n }\n\n return Promise.resolve();\n } catch (error) {\n return Promise.reject(error instanceof Error ? error?.message : 'Unknown error');\n }\n }\n\n /**\n * Make sure the await action UIElement is available before mounting\n */\n public override handleAction(action: PaymentAction, props: {} = {}): UIElement | null {\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n if (paymentAction) {\n this.unmount();\n void paymentAction.isAvailable().then(() => {\n paymentAction.mount(this._node);\n });\n return paymentAction;\n }\n\n return null;\n }\n\n formatData(): PayByBankPixData {\n if (!this.props._isAdyenHosted) {\n return {\n paymentMethod: { type: TxVariants.paybybank_pix }\n };\n }\n\n const isEnrollment = this.props.storedPaymentMethodId == null;\n return {\n paymentMethod: { type: TxVariants.paybybank_pix, ...this.state.data },\n // Always store the payment method for the enrollment flow.\n ...(isEnrollment ? { storePaymentMethod: true } : {})\n };\n }\n\n /**\n * There are 3 endpoints (stages) we need to call for the enrollment flow.\n * The first one is the regular payments call on issuer selection - we indicate to store the payment token for the selected issuer.\n * The second one is to poll the enrollment eligibility - we poll the server to get the enrollment challenge in the `getEnrollmentStatus` function.\n * The third one is in the `authorizeEnrollment` function - we create passkeys and authorize the enrollment with shopper's passkey.\n */\n private readonly onIssuerSelected = async payload => {\n try {\n const { data = {} } = payload;\n if (!data.issuer) {\n return;\n }\n\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsEnrollment();\n this.setState({ ...payload, data: { ...data, riskSignals, deviceId } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the onIssuerSelected';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizeEnrollment = async (registrationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.createCredentialForEnrollment(registrationOptions); // Create passkey and trigger biometrics\n const enrollment = { enrollmentId: this.props.paymentMethodData?.enrollmentId, fidoAssertion };\n const { redirectResult } = await authorizeEnrollment({\n enrollment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n // Make paymentDetails call to finalize the enrollment.\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizeEnrollment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n /**\n * There are 3 endpoints (stages) we need to call for the payment flow.\n * The first one `payWithStoredPayment` is the regular payments call - we attempt to pay with the stored payment token.\n * The second one is to poll the authorization options - we poll the server to get the challenge in the `getAuthorizationStatus` function.\n * The third one is in the `authorizePayment` function - we authorize the payment with shopper's passkey.\n */\n private readonly payWithStoredPayment = async () => {\n try {\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsAuthentication();\n this.state = { ...this.state, ...{ data: { storedPaymentMethodId: this.props.storedPaymentMethodId, riskSignals, deviceId } } };\n super.submit();\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the payWithStoredPayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizePayment = async (authenticationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.authenticateWithCredential(authenticationOptions);\n const payment = {\n enrollmentId: this.props.paymentMethodData?.enrollmentId,\n initiationId: this.props.paymentMethodData?.initiationId,\n fidoAssertion\n };\n const { redirectResult } = await authorizePayment({\n payment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizePayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n protected override componentToRender(): h.JSX.Element {\n // Always render the redirect button on the merchant's page\n if (!this.props._isAdyenHosted) {\n return (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n label={this.props.i18n.get('paybybankpix.redirectBtn.label')}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n );\n }\n\n return this.props.storedPaymentMethodId != null ? (\n <StoredPayment\n txVariant={PayByBankPixElement.type}\n type={this.props.type}\n clientKey={this.props.clientKey}\n amount={this.props.amount}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n initiationId={this.props.paymentMethodData?.initiationId}\n setComponentRef={this.setComponentRef}\n onPay={this.payWithStoredPayment}\n onAuthorize={this.authorizePayment}\n />\n ) : (\n <Enrollment\n onError={this.handleError}\n txVariant={PayByBankPixElement.type}\n // Await\n type={this.props.type}\n clientKey={this.props.clientKey}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n countdownTime={this.props.countdownTime}\n onEnroll={this.authorizeEnrollment}\n // Issuer List\n issuers={this.props.issuers}\n payButton={this.payButton}\n onChange={this.onIssuerSelected}\n onSubmitAnalytics={this.submitAnalytics}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n//\nexport default PayByBankPixElement;\n"],"names":["PayByBankPixElement","UIElement","isValid","_this_state","this","props","_isAdyenHosted","storedPaymentMethodId","state","additionalInfo","_this_props_payByBankPixDetails","_this_props","i18n","get","values","receiver","payByBankPixDetails","icon","resources","getImage","parentFolder","type","ispb","super","isAvailable","unsupportedReason","passkeyService","getWebAuthnUnsupportedReason","Promise","reject","AdyenCheckoutError","ERROR","resolve","initialize","canUseStoredCredential","error","Error","message","handleAction","action","paymentAction","core","createFromAction","_object_spread_props","_object_spread","elementRef","onAdditionalDetails","handleAdditionalDetails","unmount","then","mount","_node","formatData","paymentMethod","TxVariants","paybybank_pix","isEnrollment","data","storePaymentMethod","componentToRender","_this_props_paymentMethodData","_this_props_paymentMethodData1","_this_props_paymentMethodData2","h","StoredPayment","txVariant","clientKey","amount","enrollmentId","paymentMethodData","initiationId","setComponentRef","onPay","payWithStoredPayment","onAuthorize","authorizePayment","Enrollment","onError","handleError","countdownTime","onEnroll","authorizeEnrollment","issuers","payButton","onChange","onIssuerSelected","onSubmitAnalytics","submitAnalytics","RedirectButton","showPayButton","name","displayName","label","onSubmit","submit","ref","componentRef","constructor","checkout","_define_property","async","payload","issuer","_ref","captureRiskSignalsEnrollment","deviceId","riskSignals","setState","errorMsg","registrationOptions","fidoAssertion","createCredentialForEnrollment","enrollment","redirectResult","loadingContext","details","captureRiskSignalsAuthentication","authenticationOptions","authenticateWithCredential","payment","PasskeyService","environment","analytics","TIMEOUT_MINUTES","defaultProps","URL","window","location","href","hostname","endsWith","e","isAdyenHosted"],"mappings":"uwDAuBA,MAAMA,UAA4BC,EA4B9B,WAAIC,GAKS,IAAAC,EAHT,QAAKC,KAAKC,MAAMC,iBAAkBF,KAAKC,MAAME,2BAG1B,QAAVJ,EAAAC,KAAKI,aAAL,IAAAL,OAAA,EAAAA,EAAYD,QACzB,CAKA,kBAAIO,OAE8FC,EAAAC,EAD9F,OAAOP,KAAKC,MAAME,sBACZH,KAAKC,MAAMO,KAAKC,IAAI,6CAA8C,CAAEC,OAAQ,CAAEC,SAAoB,QAAVJ,EAAAP,KAAKC,aAAL,IAAAM,GAA+B,QAA/BD,EAAAC,EAAYK,2BAAZ,IAAAN,OAAA,EAAAA,EAAiCK,YACzH,EACV,CAKA,QAAoBE,OAEgEP,EAAAC,EADhF,OAAOP,KAAKC,MAAME,sBACZH,KAAKc,UAAUC,SAAS,CAAEC,aAAc,GAAGpB,EAAoBqB,SAA/DjB,SAA0EO,EAAAP,KAAKC,aAAL,IAAAM,WAAAD,EAAAC,EAAYK,2BAAZ,IAAAN,OAAA,EAAAA,EAAiCY,MAC3GC,MAAMN,IAChB,CAKA,iBAAsBO,GAClB,MAAMC,QAA0BrB,KAAKsB,eAAeC,+BACpD,GAAIF,EACA,OAAOG,QAAQC,OAAO,IAAIC,E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B,MAAMiD,QAAsB1G,KAAKsB,eAAe4F,2BAA2BD,GACrEE,EAAU,CACZnD,aAA0C,QAA5BR,EAAAxD,KAAKC,MAAMgE,yBAAX,IAAAT,OAAA,EAAAA,EAA8BQ,aAC5CE,aAA0C,QAA5BT,EAAAzD,KAAKC,MAAMgE,yBAAX,IAAAR,OAAA,EAAAA,EAA8BS,aAC5CwC,kBAEEG,eAAEA,SAAyBtC,EAAiB,CAC9C4C,UACArD,UAAW9D,KAAKC,MAAM6D,UACtBgD,eAAgB9G,KAAKC,MAAM6G,iBAE/B9G,KAAK2C,wBAAwB,CAAEU,KAAM,CAAE0D,QAAS,CAAEF,oBACtD,CAAE,MAAO9E,GACL,MAAMyE,EAAWzE,aAAiBC,MAAQD,EAAME,QAAU,wCAC1DjC,KAAK0E,YAAY3C,aAAiBL,EAAqBK,EAAQ,IAAIL,EAAmBC,EAAO6E,GACjG,IAlLA,MAAMH,EAAWrG,KAAKC,MAAME,sBAAkC,QAAVI,EAAAP,KAAKC,iBAALM,GAA+B,QAA/BD,EAAAC,EAAYK,2BAAZ,IAAAN,SAAAA,EAAiC+F,SAAWrG,KAAKC,MAAMoG,SAE3GrG,KAAKsB,eAAiB,IAAI8F,EACtB,CACIC,YAAarH,KAAKC,MAAMoH,YACxBhB,YAEJrG,KAAKsH,WAGLtH,KAAKC,MAAMC,gBACNF,KAAKsB,eAAeO,YAEjC,EAzBAkE,EADEnG,EACqBqB,OAAOiC,EAAWC,eACzC4C,EAFEnG,EAEsB2H,kBAAkB,GAG1CxB,EALEnG,EAKqB4H,eAA0C,CAC7DnC,eAAe,EACfnF,eAhBc,MAClB,IAEI,OADmB,IAAIuH,IAAIC,OAAOC,SAASC,MACzBC,SAASC,SAAS,aACxC,CAAE,MAAOC,GAEL,OAAO,CACX,GASoBC,GAChBrD,cAAe/E,EAAoB2H"}
1
+ {"version":3,"file":"PayByBankPix.js","sources":["../../../../src/components/PayByBankPix/PayByBankPix.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { PayByBankPixData, PayByBankPixConfiguration } from './types';\nimport { TxVariants } from '../tx-variants';\nimport UIElement from '../internal/UIElement';\nimport RedirectButton from '../internal/RedirectButton';\nimport AdyenCheckoutError, { ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { PasskeyService } from './services/PasskeyService';\nimport { authorizeEnrollment } from './services/authorizeEnrollment';\nimport { authorizePayment } from './services/authorizePayment';\nimport StoredPayment from './components/StoredPayment';\nimport Enrollment from './components/Enrollment';\nimport { PaymentAction } from '../../types/global-types';\nimport type { ICore } from '../../core/types';\n\nconst isAdyenHosted = () => {\n try {\n const currentUrl = new URL(window.location.href);\n return currentUrl.hostname.endsWith('.adyen.com');\n } catch (e) {\n // SSR, or it fails to parse the full url\n return false;\n }\n};\nclass PayByBankPixElement extends UIElement<PayByBankPixConfiguration> {\n public static readonly type = TxVariants.paybybank_pix;\n private static readonly TIMEOUT_MINUTES = 1;\n private readonly passkeyService: PasskeyService;\n\n public static readonly defaultProps: PayByBankPixConfiguration = {\n showPayButton: true,\n _isAdyenHosted: isAdyenHosted(),\n countdownTime: PayByBankPixElement.TIMEOUT_MINUTES\n };\n\n constructor(checkout: ICore, props?: PayByBankPixConfiguration) {\n super(checkout, props);\n const deviceId = this.props.storedPaymentMethodId ? this.props?.payByBankPixDetails?.deviceId : this.props.deviceId;\n\n this.passkeyService = new PasskeyService(\n {\n environment: this.props.environment,\n deviceId\n },\n this.analytics\n );\n\n if (this.props._isAdyenHosted) {\n void this.passkeyService.initialize();\n }\n }\n\n get isValid(): boolean {\n // Always true for non-hosted page or stored payment\n if (!this.props._isAdyenHosted || this.props.storedPaymentMethodId) {\n return true;\n }\n return !!this.state?.isValid;\n }\n\n /**\n * Display in the drop-in\n */\n get additionalInfo() {\n return this.props.storedPaymentMethodId\n ? this.props.i18n.get('paybybankpix.storedPayment.additionalLabel', { values: { receiver: this.props?.payByBankPixDetails?.receiver } })\n : '';\n }\n\n /**\n * Display in the drop-in\n */\n public override get icon() {\n return this.props.storedPaymentMethodId\n ? this.resources.getImage({ parentFolder: `${PayByBankPixElement.type}/` })(this.props?.payByBankPixDetails?.ispb)\n : super.icon;\n }\n\n /**\n * Method used to let the merchant know if the shopper's device supports WebAuthn APIs: https://featuredetect.passkeys.dev/\n */\n public override async isAvailable(): Promise<void> {\n const unsupportedReason = await this.passkeyService.getWebAuthnUnsupportedReason();\n if (unsupportedReason) {\n return Promise.reject(new AdyenCheckoutError(ERROR, unsupportedReason));\n }\n if (!this.props._isAdyenHosted) {\n return Promise.resolve();\n }\n\n // Load passkey sdk on the hosted page\n try {\n await this.passkeyService.initialize();\n\n if (this.props.storedPaymentMethodId) {\n // If the provided deviceId from the server does not match the localstorage deviceId, do not render the stored payment component.\n const shouldShowStoredPaymentMethod = await this.passkeyService.canUseStoredCredential();\n return shouldShowStoredPaymentMethod\n ? Promise.resolve()\n : Promise.reject(new AdyenCheckoutError('ERROR', 'The stored payment method is not available on this device'));\n }\n\n return Promise.resolve();\n } catch (error) {\n return Promise.reject(error instanceof Error ? error?.message : 'Unknown error');\n }\n }\n\n /**\n * Make sure the await action UIElement is available before mounting\n */\n public override handleAction(action: PaymentAction, props: {} = {}): UIElement | null {\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n if (paymentAction) {\n this.unmount();\n void paymentAction.isAvailable().then(() => {\n paymentAction.mount(this._node);\n });\n return paymentAction;\n }\n\n return null;\n }\n\n formatData(): PayByBankPixData {\n if (!this.props._isAdyenHosted) {\n return {\n paymentMethod: { type: TxVariants.paybybank_pix }\n };\n }\n\n const isEnrollment = this.props.storedPaymentMethodId == null;\n return {\n paymentMethod: { type: TxVariants.paybybank_pix, ...this.state.data },\n // Always store the payment method for the enrollment flow.\n ...(isEnrollment ? { storePaymentMethod: true } : {})\n };\n }\n\n /**\n * There are 3 endpoints (stages) we need to call for the enrollment flow.\n * The first one is the regular payments call on issuer selection - we indicate to store the payment token for the selected issuer.\n * The second one is to poll the enrollment eligibility - we poll the server to get the enrollment challenge in the `getEnrollmentStatus` function.\n * The third one is in the `authorizeEnrollment` function - we create passkeys and authorize the enrollment with shopper's passkey.\n */\n private readonly onIssuerSelected = async payload => {\n try {\n const { data = {} } = payload;\n if (!data.issuer) {\n return;\n }\n\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsEnrollment();\n this.setState({ ...payload, data: { ...data, riskSignals, deviceId } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the onIssuerSelected';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizeEnrollment = async (registrationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.createCredentialForEnrollment(registrationOptions); // Create passkey and trigger biometrics\n const enrollment = { enrollmentId: this.props.paymentMethodData?.enrollmentId, fidoAssertion };\n const { redirectResult } = await authorizeEnrollment({\n enrollment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n // Make paymentDetails call to finalize the enrollment.\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizeEnrollment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n /**\n * There are 3 endpoints (stages) we need to call for the payment flow.\n * The first one `payWithStoredPayment` is the regular payments call - we attempt to pay with the stored payment token.\n * The second one is to poll the authorization options - we poll the server to get the challenge in the `getAuthorizationStatus` function.\n * The third one is in the `authorizePayment` function - we authorize the payment with shopper's passkey.\n */\n private readonly payWithStoredPayment = async () => {\n try {\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsAuthentication();\n this.state = { ...this.state, ...{ data: { storedPaymentMethodId: this.props.storedPaymentMethodId, riskSignals, deviceId } } };\n super.submit();\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the payWithStoredPayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizePayment = async (authenticationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.authenticateWithCredential(authenticationOptions);\n const payment = {\n enrollmentId: this.props.paymentMethodData?.enrollmentId,\n initiationId: this.props.paymentMethodData?.initiationId,\n fidoAssertion\n };\n const { redirectResult } = await authorizePayment({\n payment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizePayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n protected override componentToRender(): h.JSX.Element {\n // Always render the redirect button on the merchant's page\n if (!this.props._isAdyenHosted) {\n return (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n label={this.props.i18n.get('paybybankpix.redirectBtn.label')}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n );\n }\n\n return this.props.storedPaymentMethodId != null ? (\n <StoredPayment\n txVariant={PayByBankPixElement.type}\n type={this.props.type}\n clientKey={this.props.clientKey}\n amount={this.props.amount}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n initiationId={this.props.paymentMethodData?.initiationId}\n setComponentRef={this.setComponentRef}\n onPay={this.payWithStoredPayment}\n onAuthorize={this.authorizePayment}\n />\n ) : (\n <Enrollment\n onError={this.handleError}\n txVariant={PayByBankPixElement.type}\n // Await\n type={this.props.type}\n clientKey={this.props.clientKey}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n countdownTime={this.props.countdownTime}\n onEnroll={this.authorizeEnrollment}\n // Issuer List\n issuers={this.props.issuers}\n payButton={this.payButton}\n onChange={this.onIssuerSelected}\n onSubmitAnalytics={this.submitAnalytics}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n//\nexport default PayByBankPixElement;\n"],"names":["PayByBankPixElement","UIElement","isValid","_this_state","this","props","_isAdyenHosted","storedPaymentMethodId","state","additionalInfo","_this_props_payByBankPixDetails","_this_props","i18n","get","values","receiver","payByBankPixDetails","icon","resources","getImage","parentFolder","type","ispb","super","isAvailable","unsupportedReason","passkeyService","getWebAuthnUnsupportedReason","Promise","reject","AdyenCheckoutError","ERROR","resolve","initialize","canUseStoredCredential","error","Error","message","handleAction","action","paymentAction","core","createFromAction","_object_spread_props","_object_spread","elementRef","onAdditionalDetails","handleAdditionalDetails","unmount","then","mount","_node","formatData","paymentMethod","TxVariants","paybybank_pix","isEnrollment","data","storePaymentMethod","componentToRender","_this_props_paymentMethodData","_this_props_paymentMethodData1","_this_props_paymentMethodData2","h","StoredPayment","txVariant","clientKey","amount","enrollmentId","paymentMethodData","initiationId","setComponentRef","onPay","payWithStoredPayment","onAuthorize","authorizePayment","Enrollment","onError","handleError","countdownTime","onEnroll","authorizeEnrollment","issuers","payButton","onChange","onIssuerSelected","onSubmitAnalytics","submitAnalytics","RedirectButton","showPayButton","name","displayName","label","onSubmit","submit","ref","componentRef","constructor","checkout","_define_property","async","payload","issuer","_ref","captureRiskSignalsEnrollment","deviceId","riskSignals","setState","errorMsg","registrationOptions","fidoAssertion","createCredentialForEnrollment","enrollment","redirectResult","loadingContext","details","captureRiskSignalsAuthentication","authenticationOptions","authenticateWithCredential","payment","PasskeyService","environment","analytics","TIMEOUT_MINUTES","defaultProps","URL","window","location","href","hostname","endsWith","e","isAdyenHosted"],"mappings":"ogEAuBA,MAAMA,UAA4BC,EA4B9B,WAAIC,GAKS,IAAAC,EAHT,QAAKC,KAAKC,MAAMC,iBAAkBF,KAAKC,MAAME,2BAG1B,QAAVJ,EAAAC,KAAKI,aAAL,IAAAL,OAAA,EAAAA,EAAYD,QACzB,CAKA,kBAAIO,OAE8FC,EAAAC,EAD9F,OAAOP,KAAK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