@adyen/adyen-web 6.0.0-beta.0 → 6.0.0-beta.1

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 (258) hide show
  1. package/README.md +123 -182
  2. package/dist/cjs/adyen.css +6 -6
  3. package/dist/cjs/adyen.css.map +1 -1
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/index.d.cts +57 -23
  7. package/dist/es/adyen.css +6 -6
  8. package/dist/es/adyen.css.map +1 -1
  9. package/dist/es/components/Ach/Ach.js +1 -1
  10. package/dist/es/components/Ach/Ach.js.map +1 -1
  11. package/dist/es/components/Ach/components/AchInput/AchInput.js +1 -1
  12. package/dist/es/components/Ach/components/AchInput/AchInput.js.map +1 -1
  13. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  14. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  15. package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
  16. package/dist/es/components/ApplePay/ApplePayService.js.map +1 -1
  17. package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
  18. package/dist/es/components/Card/Card.js +1 -1
  19. package/dist/es/components/Card/Card.js.map +1 -1
  20. package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  21. package/dist/es/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.js.map +1 -1
  22. package/dist/es/components/Card/components/CardInput/handlers.js.map +1 -1
  23. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  24. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  25. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  26. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  27. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  28. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  29. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  30. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  31. package/dist/es/components/Dropin/Dropin.js +1 -1
  32. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  33. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  34. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  35. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  36. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  37. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  38. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  39. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  40. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  41. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  42. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  43. package/dist/es/components/GooglePay/components/GooglePayButton.js.map +1 -1
  44. package/dist/es/components/GooglePay/requests.js.map +1 -1
  45. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  46. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  47. package/dist/es/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
  48. package/dist/es/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  49. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  50. package/dist/es/components/PayPal/Paypal.js +1 -1
  51. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  52. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js +1 -1
  53. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  54. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  55. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  56. package/dist/es/components/components-name-map.js +1 -1
  57. package/dist/es/components/components-name-map.js.map +1 -1
  58. package/dist/es/components/internal/Address/components/AddressSearch.js +1 -1
  59. package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
  60. package/dist/es/components/internal/Await/Await.js.map +1 -1
  61. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  62. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  63. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  64. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  65. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  66. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  67. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
  68. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
  69. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  70. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  71. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  72. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  73. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  74. package/dist/es/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  75. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  76. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  77. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  78. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  79. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  80. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  81. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  82. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  83. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  84. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  85. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  86. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  87. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  88. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  89. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  90. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  91. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  92. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
  93. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
  94. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  95. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  96. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  97. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  98. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  99. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  100. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  101. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  102. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  103. package/dist/es/components/internal/SecuredFields/lib/utilities/commonUtils.js.map +1 -1
  104. package/dist/es/components/internal/SecuredFields/lib/utilities/dom.js +1 -1
  105. package/dist/es/components/internal/SecuredFields/lib/utilities/dom.js.map +1 -1
  106. package/dist/es/components/internal/SecuredFields/lib/utilities/logger.js.map +1 -1
  107. package/dist/es/components/internal/SecuredFields/utils.js.map +1 -1
  108. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  109. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  110. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  111. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  112. package/dist/es/components/tx-variants.js +1 -1
  113. package/dist/es/components/tx-variants.js.map +1 -1
  114. package/dist/es/core/Analytics/Analytics.js +1 -1
  115. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  116. package/dist/es/core/Environment/Environment.js +1 -1
  117. package/dist/es/core/Environment/Environment.js.map +1 -1
  118. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  119. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  120. package/dist/es/core/Services/http.js.map +1 -1
  121. package/dist/es/core/config.js +1 -1
  122. package/dist/es/core/config.js.map +1 -1
  123. package/dist/es/core/core.js +1 -1
  124. package/dist/es/core/core.js.map +1 -1
  125. package/dist/es/core/utils.js +1 -1
  126. package/dist/es/core/utils.js.map +1 -1
  127. package/dist/es/index.d.ts +57 -23
  128. package/dist/es/utils/browserInfo.js +1 -1
  129. package/dist/es/utils/browserInfo.js.map +1 -1
  130. package/dist/es/utils/listenerUtils.js +2 -0
  131. package/dist/es/utils/listenerUtils.js.map +1 -0
  132. package/dist/es/utils/regex.js.map +1 -1
  133. package/dist/es-legacy/adyen.css +6 -6
  134. package/dist/es-legacy/adyen.css.map +1 -1
  135. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  136. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  137. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
  138. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
  139. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  140. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  141. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
  142. package/dist/es-legacy/components/ApplePay/ApplePayService.js.map +1 -1
  143. package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js.map +1 -1
  144. package/dist/es-legacy/components/Card/Card.js +1 -1
  145. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  146. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  147. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandingIcon/DualBrandingIcon.js.map +1 -1
  148. package/dist/es-legacy/components/Card/components/CardInput/handlers.js.map +1 -1
  149. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  150. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  151. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  152. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  153. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  154. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  155. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  156. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  157. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  158. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  159. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  160. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  161. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  162. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  163. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  164. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  165. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  166. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  167. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  168. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  169. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js.map +1 -1
  170. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  171. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  172. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  173. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
  174. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  175. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  176. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  177. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  178. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js +1 -1
  179. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  180. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  181. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  182. package/dist/es-legacy/components/components-name-map.js +1 -1
  183. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  184. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js +1 -1
  185. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
  186. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  187. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  188. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  189. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  190. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  191. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  192. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  193. package/dist/es-legacy/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
  194. package/dist/es-legacy/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
  195. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  196. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  197. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  198. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  199. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  200. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  201. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  202. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  203. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  204. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  205. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  206. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  207. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  208. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  209. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  210. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  211. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  212. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  213. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  214. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  215. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  216. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  217. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  218. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
  219. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
  220. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  221. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  222. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  223. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  224. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  225. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  226. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  227. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  228. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  229. package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/commonUtils.js.map +1 -1
  230. package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/dom.js +1 -1
  231. package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/dom.js.map +1 -1
  232. package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/logger.js.map +1 -1
  233. package/dist/es-legacy/components/internal/SecuredFields/utils.js.map +1 -1
  234. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  235. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  236. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  237. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  238. package/dist/es-legacy/components/tx-variants.js +1 -1
  239. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  240. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  241. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  242. package/dist/es-legacy/core/Environment/Environment.js +1 -1
  243. package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
  244. package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  245. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  246. package/dist/es-legacy/core/Services/http.js.map +1 -1
  247. package/dist/es-legacy/core/config.js +1 -1
  248. package/dist/es-legacy/core/config.js.map +1 -1
  249. package/dist/es-legacy/core/core.js +1 -1
  250. package/dist/es-legacy/core/core.js.map +1 -1
  251. package/dist/es-legacy/core/utils.js +1 -1
  252. package/dist/es-legacy/core/utils.js.map +1 -1
  253. package/dist/es-legacy/utils/browserInfo.js +1 -1
  254. package/dist/es-legacy/utils/browserInfo.js.map +1 -1
  255. package/dist/es-legacy/utils/listenerUtils.js +2 -0
  256. package/dist/es-legacy/utils/listenerUtils.js.map +1 -0
  257. package/dist/es-legacy/utils/regex.js.map +1 -1
  258. package/package.json +8 -4
@@ -1 +1 @@
1
- {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_SUBMIT_STR } from '../../../core/Analytics/constants';\n\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from '../../../core/types';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type {\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentResponse\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { NewableComponent } from '../../../core/core.registry';\n\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n const isStoredPaymentMethod = !!componentProps?.isStoredPaymentMethod;\n const paymentMethodsResponseProps = isStoredPaymentMethod\n ? {}\n : this.core.paymentMethodsResponse.find(componentProps?.type || this.constructor['type']);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodsResponseProps,\n ...componentProps\n };\n\n const isDropin = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropin), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj: SendAnalyticsObject, uiElementProps?) {\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n try {\n let component = this.constructor['analyticsType'];\n if (!component) {\n component = this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc' ? this.constructor['type'] : this.props.type;\n }\n\n this.props.modules.analytics.sendAnalytics(component, analyticsObj, uiElementProps);\n } catch (error) {\n console.warn('Failed to submit the analytics event. Error:', error);\n }\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall().then(sanitizeResponse).then(verifyPaymentDidNotFail).then(this.handleResponse).catch(this.handleFailedResult);\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n // sessionData:\n // 'Ab02b4c0!BQABAgBKGgqfEz8uQlU4yCIOWjA8bkEwmbJ7Qt4r+x5IPXREu1rMjwNk5MDoHFNlv+MWvinS6nXIDniXgRzXCdSC4ksw9CNDBAjOa+B88wRoj/rLTieuWh/0leR88qkV24vtIkjsIsbJTDB78Pd8wX8MEDsXhaAdEIyX9E8eqxuQ3bwPbvLs1Dlgo1ZrfkQRzaNiuVM8ejRG0IWE1bGThJzY+sJvZZHvlDMXIlxhZcDoQvsMj/WwE6+nFJxBiC3oRzmvVn3AbkLQGtvwq16UUSfYbPzG9dXypJMtcrZAQYq2g/2+BSibCcmee9AXq/wij11BERrYmjbDt5NkkdUnDVgAB7pdqbnWX0A2sxBKeYtLSP2kxp+5LoU/Wty3fmcVA3VKVkHfgmIihkeL8lY++5hvHjnkzOE4tyx/sheiKS4zqoWE43TD6n8mpFskAzwMHq4G2o6vkXqvaKFEq7y/R2fVrCypenmRhkPASizpM265rKLU+L4E/C+LMHfN0LYKRMCrLr0gI2GAp+1PZLHgh0tCtiJC/zcJJtJs6sHNQxLUN+kxJuELUHOcuL3ivjG+mWteUnBENZu7KqOSZYetiWYRiyLOXDiBHqbxuQwTuO54L15VLkS/mYB20etibM1nn+fRmbo+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gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a session /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * @param rawResponse -\n */\n protected handleResponse(rawResponse: RawPaymentResponse): void {\n const response = sanitizeResponse(rawResponse);\n\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protect _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return reject(new Error('onPaymentMethodsRequest is not implemented'));\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","componentRef","resources","elementRef","static","undefined","constructor","checkout","props","super","this","core","register","submit","bind","setState","onComplete","handleAction","handleOrder","handleAdditionalDetails","handleResponse","setElementStatus","submitAnalytics","makePaymentsCall","makeAdditionalDetailsCall","submitUsingSessionsFlow","modules","storeElementRefOnCore","buildElementProps","componentProps","finalProps","showPayButton","getCorePropsForComponent","isStoredPaymentMethod","paymentMethodsResponse","find","type","isDropin","assertIsDropin","formatProps","getRegulatoryDefaults","options","countryCode","storeElementReference","isAvailable","Promise","resolve","newState","state","onChange","showValidation","status","setStatus","data","isValid","errors","valid","setUpAnalytics","setUpAnalyticsObj","sessionId","session","id","analytics","setUp","analyticsObj","uiElementProps","component","sendAnalytics","error","console","warn","then","sanitizeResponse","verifyPaymentDidNotFail","catch","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","handleError","AdyenCheckoutError","ANALYTICS_SUBMIT_STR","submitPayment","cause","onError","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","response","order","update","handleAdvanceFlowPaymentMethodsUpdate","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","handleSuccessResult","onPaymentCompleted","rawResponse","remainingAmount","value","updateParent","setComponentRef","ref","icon","paymentMethodType","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","payButton","h","PayButton","amount","secondaryAmount","onClick","onPaymentMethodsRequest","orderData","pspReference","locale"],"mappings":"wfA4BO,MAAeA,UAA6DC,EACrEC,aAEAC,UAEHC,WAEPC,iBAAqBC,EAKrBD,kBAAqC,GAErCE,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEhBE,KAAKC,KAAKC,SAASF,KAAKJ,aAExBI,KAAKG,OAASH,KAAKG,OAAOC,KAAKJ,MAC/BA,KAAKK,SAAWL,KAAKK,SAASD,KAAKJ,MACnCA,KAAKM,WAAaN,KAAKM,WAAWF,KAAKJ,MACvCA,KAAKO,aAAeP,KAAKO,aAAaH,KAAKJ,MAC3CA,KAAKQ,YAAcR,KAAKQ,YAAYJ,KAAKJ,MACzCA,KAAKS,wBAA0BT,KAAKS,wBAAwBL,KAAKJ,MACjEA,KAAKU,eAAiBV,KAAKU,eAAeN,KAAKJ,MAC/CA,KAAKW,iBAAmBX,KAAKW,iBAAiBP,KAAKJ,MACnDA,KAAKY,gBAAkBZ,KAAKY,gBAAgBR,KAAKJ,MACjDA,KAAKa,iBAAmBb,KAAKa,iBAAiBT,KAAKJ,MACnDA,KAAKc,0BAA4Bd,KAAKc,0BAA0BV,KAAKJ,MACrEA,KAAKe,wBAA0Bf,KAAKe,wBAAwBX,KAAKJ,MAEjEA,KAAKP,WAAcK,GAASA,EAAML,YAAeO,KACjDA,KAAKR,UAAYQ,KAAKF,MAAMkB,QAAUhB,KAAKF,MAAMkB,QAAQxB,eAAYG,EAErEK,KAAKiB,sBAAsBjB,KAAKF,MACpC,CAEmBoB,iBAAAA,CAAkBC,GACjC,MAMMC,EAAa,CACfC,eAAe,KAPKrB,KAAKC,KAAKqB,gCACFH,GAAgBI,sBAE1C,GACAvB,KAAKC,KAAKuB,uBAAuBC,KAAKN,GAAgBO,MAAQ1B,KAAKJ,YAAmB,SAMrFuB,GAGDQ,EAAWC,EAA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,KAAKJ,YAAmB,IACtD,CAKUsH,UAAapH,GACZqH,EAACC,EAAAA,IAActH,EAAOuH,OAAQrH,KAAKF,MAAMuH,OAAQC,gBAAiBtH,KAAKF,MAAMwH,gBAAiBC,QAASvH,KAAKG,SASvH,2CAAgBuF,CAAsCF,EAAqB6B,GACvE,OAAO,IAAIlF,SAAgC,CAACC,EAASiC,KACjD,IAAKrE,KAAKF,MAAM0H,wBACZ,OAAOnD,EAAO,IAAIY,MAAM,+CAG5BjF,KAAKF,MAAM0H,wBACP,IACQhC,GAAS,CACTA,MAAO,CACHiC,UAAWjC,EAAMiC,UACjBC,aAAclC,EAAMkC,eAG5BC,OAAQ3H,KAAKC,KAAK8B,QAAQ4F,QAE9B,CAAEvF,UAASiC,UAAO,IAGrBL,OAAMN,IACH1D,KAAKsE,YACD,IAAIC,EACA,uBACA,gGACA,CACIG,MAAOhB,IACX,IAIXG,MAAKrC,GAKKxB,KAAKC,KAAKwF,OAAO,IAChBjE,GAA0B,CAAEA,0BAChCgE,QACA6B,OAAQ7B,EAAQA,EAAMW,gBAAkBkB,KAGxD"}
1
+ {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { h } from 'preact';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_SUBMIT_STR } from '../../../core/Analytics/constants';\n\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from '../../../core/types';\nimport type { ComponentMethodsRef, PayButtonFunctionProps, UIElementProps, UIElementStatus } from './types';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type {\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentResponse\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { NewableComponent } from '../../../core/core.registry';\n\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n protected componentRef: any;\n\n protected resources: Resources;\n\n public elementRef: UIElement;\n\n public static type = undefined;\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static txVariants: string[] = [];\n\n constructor(checkout: ICore, props?: P) {\n super(checkout, props);\n\n this.core.register(this.constructor as NewableComponent);\n\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleAdditionalDetails = this.handleAdditionalDetails.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n this.makePaymentsCall = this.makePaymentsCall.bind(this);\n this.makeAdditionalDetailsCall = this.makeAdditionalDetailsCall.bind(this);\n this.submitUsingSessionsFlow = this.submitUsingSessionsFlow.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n\n this.storeElementRefOnCore(this.props);\n\n this.onEnterKeyPressed = this.onEnterKeyPressed.bind(this);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n const isStoredPaymentMethod = !!componentProps?.isStoredPaymentMethod;\n const paymentMethodsResponseProps = isStoredPaymentMethod\n ? {}\n : this.core.paymentMethodsResponse.find(componentProps?.type || this.constructor['type']);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodsResponseProps,\n ...componentProps\n };\n\n const isDropin = assertIsDropin(this as unknown as IDropin);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropin), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected storeElementRefOnCore(props?: P) {\n if (!props?.isDropin) {\n this.core.storeElementReference(this);\n }\n }\n\n public isAvailable(): Promise<void> {\n return Promise.resolve();\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n protected onChange(): void {\n this.props.onChange?.(\n {\n data: this.data,\n isValid: this.isValid,\n errors: this.state.errors,\n valid: this.state.valid\n },\n this.elementRef\n );\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject, uiElementProps?) {\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n try {\n let component = this.constructor['analyticsType'];\n if (!component) {\n component = this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc' ? this.constructor['type'] : this.props.type;\n }\n\n this.props.modules.analytics.sendAnalytics(component, analyticsObj, uiElementProps);\n } catch (error) {\n console.warn('Failed to submit the analytics event. Error:', error);\n }\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall().then(sanitizeResponse).then(verifyPaymentDidNotFail).then(this.handleResponse).catch(this.handleFailedResult);\n }\n\n protected makePaymentsCall(): Promise<CheckoutAdvancedFlowResponse | CheckoutSessionPaymentResponse> {\n this.setElementStatus('loading');\n\n if (this.props.onSubmit) {\n return this.submitUsingAdvancedFlow();\n }\n\n if (this.core.session) {\n const beforeSubmitEvent: Promise<PaymentData> = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject\n })\n )\n : Promise.resolve(this.data);\n\n return beforeSubmitEvent.then(this.submitUsingSessionsFlow);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments call. Callback \"onSubmit\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitUsingAdvancedFlow(): Promise<CheckoutAdvancedFlowResponse> {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n this.props.onSubmit(\n {\n data: this.data,\n isValid: this.isValid\n },\n this.elementRef,\n { resolve, reject }\n );\n });\n }\n\n private async submitUsingSessionsFlow(data: PaymentData): Promise<CheckoutSessionPaymentResponse> {\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n try {\n return await this.core.session.submitPayment(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n\n return Promise.reject(error);\n }\n\n // // Uncomment to simulate failed\n // return {\n // resultCode: 'Refused',\n //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ZiQ9LLMTis2BA7Ap9pdNq8FVXL4fnoVHNZiiANOf3uvSknPKBID8sdOXUStA0crmO322FYjDqh1n6FG+D7+OJSayNsXIz6Zoy0eFn4HbT8nt8L2X2tdzkMayCYHXRwKh13Xyleqxt4WoEZmhwTmB3p9d1F0SylWnjcC6o/DnshJ9mMW/8D3oWS30Z7BwRODqKGVahRD0YGRzwMbVnEe5JFRfNvJZdLGl35L9632DVmuFQ0lr/8WNL/NrAJNtI6PXrZMNiza0/omPwPfe5ZYuD1Jgq59TX4h9d+3fdkArcJYL7AdoMZON1YEiWY5EzazQwtHd9yzdty9ZHPxAfuOfCh4OhbhFNp+v5YQ+PzKZ+UpM1VxV863+9XgWEURPNvX7qq1cpUSRzrSGq01QBBM3MKzRh5mAgqIdXgtl7L0EXAep0MECc7QY0/o3tW3VR8eEJGsSzrNxpFItqj0SEaIWo25dRfkl5zuw47GQrN9Qzxl2WV3A38MQPUqFtIr/71Rjkphgg49ZGWEYCwgFmm8jJc2/5qTabSGk4bzwiETCTzeydq30bUGqCwglj8CrFViAuQeTJm7dp+PYKMkUNvQRpnSXMj6Kz7rvAMzhzJgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails(state: AdditionalDetailsData): void {\n this.makeAdditionalDetailsCall(state)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n private makeAdditionalDetailsCall(state: AdditionalDetailsData): Promise<CheckoutSessionDetailsResponse | CheckoutAdvancedFlowResponse> {\n if (this.props.onAdditionalDetails) {\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\n this.props.onAdditionalDetails(state, this.elementRef, { resolve, reject });\n });\n }\n\n if (this.core.session) {\n return this.submitAdditionalDetailsUsingSessionsFlow(state.data);\n }\n\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not perform /payments/details call. Callback \"onAdditionalDetails\" is missing or Checkout session is not available'\n )\n );\n }\n\n private async submitAdditionalDetailsUsingSessionsFlow(data: any): Promise<CheckoutSessionDetailsResponse> {\n try {\n return await this.core.session.submitDetails(data);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.handleError(error);\n else this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /details call', { cause: error }));\n\n return Promise.reject(error);\n }\n }\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected handleOrder = (response: PaymentResponseData): void => {\n const { order } = response;\n\n const updateCorePromise = this.core.session ? this.core.update({ order }) : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n /**\n * Handles when the payment fails. The payment fails when:\n * - adv flow: the merchant rejects the payment due to a critical error\n * - adv flow: the merchant resolves the payment with a failed resultCode\n * - sessions: a network error occurs when making the payment\n * - sessions: the payment fails with a failed resultCode\n *\n * @param result\n */\n protected handleFailedResult = (result?: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('error');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentFailed?.(result, this.elementRef);\n };\n\n protected handleSuccessResult = (result: PaymentResponseData): void => {\n if (assertIsDropin(this.elementRef)) {\n this.elementRef.displayFinalAnimation('success');\n }\n\n cleanupFinalResult(result);\n this.props.onPaymentCompleted?.(result, this.elementRef);\n };\n\n /**\n * Handles a session /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * @param rawResponse -\n */\n protected handleResponse(rawResponse: RawPaymentResponse): void {\n const response = sanitizeResponse(rawResponse);\n\n if (response.action) {\n this.elementRef.handleAction(response.action);\n return;\n }\n\n if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n return;\n }\n\n this.handleSuccessResult(response);\n }\n\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement> | KeyboardEvent) {\n if (e.key === 'Enter' || e.code === 'Enter') {\n e.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n\n this.onEnterKeyPressed(document?.activeElement, this);\n }\n }\n\n /**\n * Handle Enter key pressed from a UIElement (called via handleKeyPress)\n * @param obj\n */\n protected onEnterKeyPressed(activeElement: Element, component: UIElement) {\n if (this.props.onEnterKeyPressed) {\n this.props.onEnterKeyPressed(activeElement, component);\n } else {\n (activeElement as HTMLElement).blur();\n this.submit();\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protected _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreConfiguration = {}): Promise<ICore> {\n return this.elementRef.core.update(options);\n }\n\n public setComponentRef = (ref: ComponentMethodsRef) => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n public get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n\n public get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n public get displayName(): string {\n const paymentMethodFromResponse = this.core.paymentMethodsResponse?.paymentMethods?.find(pm => pm.type === this.type);\n return this.props.name || paymentMethodFromResponse?.name || this.type;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n public get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Return the type of an element\n */\n public get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return <PayButton {...props} amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} onClick={this.submit} />;\n };\n\n /**\n * Used in the Partial Orders flow.\n * When the Order is updated, the merchant can request new payment methods based on the new remaining amount\n *\n * @private\n */\n protected async handleAdvanceFlowPaymentMethodsUpdate(order: Order | null, amount?: PaymentAmount) {\n return new Promise<void | PaymentMethodsResponse>((resolve, reject) => {\n if (!this.props.onPaymentMethodsRequest) {\n return resolve();\n }\n\n this.props.onPaymentMethodsRequest(\n {\n ...(order && {\n order: {\n orderData: order.orderData,\n pspReference: order.pspReference\n }\n }),\n locale: this.core.options.locale\n },\n { resolve, reject }\n );\n })\n .catch(error => {\n this.handleError(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'Something failed during payment methods update or onPaymentMethodsRequest was not implemented',\n {\n cause: error\n }\n )\n );\n })\n .then(paymentMethodsResponse => {\n // in the case of the session flow we get order, amount, countryCode and shopperLocale from initialize()\n // apply the same logic here for order and amount\n // in the future it might be worth moving this logic to be performed by the core on update()\n // it would make this more consistent\n return this.core.update({\n ...(paymentMethodsResponse && { paymentMethodsResponse }),\n order,\n amount: order ? order.remainingAmount : amount\n });\n });\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","componentRef","resources","elementRef","static","undefined","constructor","checkout","props","super","this","core","register","submit","bind","setState","onComplete","handleAction","handleOrder","handleAdditionalDetails","handleResponse","setElementStatus","submitAnalytics","makePaymentsCall","makeAdditionalDetailsCall","submitUsingSessionsFlow","modules","storeElementRefOnCore","onEnterKeyPressed","buildElementProps","componentProps","finalProps","showPayButton","getCorePropsForComponent","isStoredPaymentMethod","paymentMethodsResponse","find","type","isDropin","assertIsDropin","formatProps","getRegulatoryDefaults","options","countryCode","storeElementReference","isAvailable","Promise","resolve","newState","state","onChange","showValidation","status","setStatus","data","isValid","errors","valid","setUpAnalytics","setUpAnalyticsObj","sessionId","session","id","analytics","setUp","analyticsObj","uiElementProps","component","sendAnalytics","error","console","warn","then","sanitizeResponse","verifyPaymentDidNotFail","catch","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","handleError","AdyenCheckoutError","ANALYTICS_SUBMIT_STR","submitPayment","cause","onError","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","response","order","update","handleAdvanceFlowPaymentMethodsUpdate","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","handleSuccessResult","onPaymentCompleted","rawResponse","remainingAmount","value","handleKeyPress","e","key","code","preventDefault","document","activeElement","blur","updateParent","setComponentRef","ref","icon","paymentMethodType","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","payButton","h","PayButton","amount","secondaryAmount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wB6F,gBAAgB5F,MAAK6F,GAAMA,EAAG5F,OAAS3B,KAAK2B,OAChH,OAAO3B,KAAKF,MAAM0H,MAAQH,GAA2BG,MAAQxH,KAAK2B,IACtE,CAKA,kBAAW8F,GACP,OAAOzH,KAAKoH,WAChB,CAKA,kBAAIM,GACA,OAAO,IACX,CAKA,QAAW/F,GACP,OAAO3B,KAAKF,MAAM6B,MAAQ3B,KAAKJ,YAAmB,IACtD,CAKU+H,UAAa7H,GACZ8H,EAACC,EAAAA,IAAc/H,EAAOgI,OAAQ9H,KAAKF,MAAMgI,OAAQC,gBAAiB/H,KAAKF,MAAMiI,gBAAiBC,QAAShI,KAAKG,SASvH,2CAAgBwF,CAAsCF,EAAqBqC,GACvE,OAAO,IAAI1F,SAAuC,CAACC,EAASiC,KACxD,IAAKtE,KAAKF,MAAMmI,wBACZ,OAAO5F,IAGXrC,KAAKF,MAAMmI,wBACP,IACQxC,GAAS,CACTA,MAAO,CACHyC,UAAWzC,EAAMyC,UACjBC,aAAc1C,EAAM0C,eAG5BC,OAAQpI,KAAKC,KAAK+B,QAAQoG,QAE9B,CAAE/F,UAASiC,UAAO,IAGrBL,OAAMN,IACH3D,KAAKuE,YACD,IAAIC,EACA,uBACA,gGACA,CACIG,MAAOhB,IACX,IAIXG,MAAKrC,GAKKzB,KAAKC,KAAKyF,OAAO,IAChBjE,GAA0B,CAAEA,0BAChCgE,QACAqC,OAAQrC,EAAQA,EAAMW,gBAAkB0B,KAGxD"}
@@ -1,2 +1,2 @@
1
- var a;!function(a){a.address="address",a.bankTransfer_IBAN="bankTransfer_IBAN",a.donation="donation",a.personal_details="personal_details",a.dropin="dropin",a.bcmc="bcmc",a.card="card",a.scheme="scheme",a.storedCard="storedCard",a.customCard="customcard",a.threeDS2Challenge="threeDS2Challenge",a.threeDS2Fingerprint="threeDS2Fingerprint",a.threeDS2DeviceFingerprint="threeDS2DeviceFingerprint",a.ach="ach",a.directdebit_GB="directdebit_GB",a.sepadirectdebit="sepadirectdebit",a.affirm="affirm",a.afterpay="afterpay",a.afterpay_default="afterpay_default",a.afterpay_b2b="afterpay_b2b",a.atome="atome",a.facilypay_3x="facilypay_3x",a.facilypay_4x="facilypay_4x",a.facilypay_6x="facilypay_6x",a.facilypay_10x="facilypay_10x",a.facilypay_12x="facilypay_12x",a.ratepay="ratepay",a.ratepay_directdebit="ratepay_directdebit",a.riverty="riverty",a.amazonpay="amazonpay",a.applepay="applepay",a.cashapp="cashapp",a.clicktopay="clicktopay",a.googlepay="googlepay",a.paypal="paypal",a.paywithgoogle="paywithgoogle",a.boletobancario="boletobancario",a.boletobancario_itau="boletobancario_itau",a.boletobancario_santander="boletobancario_santander",a.primeiropay_boleto="primeiropay_boleto",a.doku="doku",a.doku_alfamart="doku_alfamart",a.doku_permata_lite_atm="doku_permata_lite_atm",a.doku_indomaret="doku_indomaret",a.doku_atm_mandiri_va="doku_atm_mandiri_va",a.doku_sinarmas_va="doku_sinarmas_va",a.doku_mandiri_va="doku_mandiri_va",a.doku_cimb_va="doku_cimb_va",a.doku_danamon_va="doku_danamon_va",a.doku_bri_va="doku_bri_va",a.doku_bni_va="doku_bni_va",a.doku_bca_va="doku_bca_va",a.doku_wallet="doku_wallet",a.oxxo="oxxo",a.billdesk_online="billdesk_online",a.billdesk_wallet="billdesk_wallet",a.dotpay="dotpay",a.eps="eps",a.molpay_ebanking_fpx_MY="molpay_ebanking_fpx_MY",a.molpay_ebanking_TH="molpay_ebanking_TH",a.molpay_ebanking_VN="molpay_ebanking_VN",a.onlineBanking_CZ="onlineBanking_CZ",a.onlinebanking_IN="onlinebanking_IN",a.onlineBanking_PL="onlineBanking_PL",a.onlineBanking_SK="onlineBanking_SK",a.paybybank="paybybank",a.payu_IN_cashcard="payu_IN_cashcard",a.payu_IN_nb="payu_IN_nb",a.wallet_IN="wallet_IN",a.dragonpay="dragonpay",a.dragonpay_ebanking="dragonpay_ebanking",a.dragonpay_otc_banking="dragonpay_otc_banking",a.dragonpay_otc_non_banking="dragonpay_otc_non_banking",a.dragonpay_otc_philippines="dragonpay_otc_philippines",a.econtext="econtext",a.econtext_atm="econtext_atm",a.econtext_online="econtext_online",a.econtext_seven_eleven="econtext_seven_eleven",a.econtext_stores="econtext_stores",a.giropay="giropay",a.multibanco="multibanco",a.redirect="redirect",a.twint="twint",a.vipps="vipps",a.trustly="trustly",a.klarna="klarna",a.klarna_account="klarna_account",a.klarna_paynow="klarna_paynow",a.bcmc_mobile="bcmc_mobile",a.bcmc_mobile_QR="bcmc_mobile_QR",a.pix="pix",a.swish="swish",a.wechatpay="wechatpay",a.wechatpayQR="wechatpayQR",a.promptpay="promptpay",a.paynow="paynow",a.duitnow="duitnow",a.blik="blik",a.mbway="mbway",a.ancv="ancv",a.upi="upi",a.upi_qr="upi_qr",a.upi_collect="upi_collect",a.giftcard="giftcard",a.mealVoucher_FR="mealVoucher_FR",a.mealVoucher_FR_natixis="mealVoucher_FR_natixis",a.mealVoucher_FR_sodexo="mealVoucher_FR_sodexo",a.mealVoucher_FR_groupeup="mealVoucher_FR_groupeup"}(a||(a={}));export{a as TxVariants};
1
+ var a;!function(a){a.address="address",a.bankTransfer_IBAN="bankTransfer_IBAN",a.donation="donation",a.personal_details="personal_details",a.dropin="dropin",a.bcmc="bcmc",a.card="card",a.scheme="scheme",a.storedCard="storedCard",a.customCard="customcard",a.threeDS2Challenge="threeDS2Challenge",a.threeDS2Fingerprint="threeDS2Fingerprint",a.threeDS2DeviceFingerprint="threeDS2DeviceFingerprint",a.ach="ach",a.directdebit_GB="directdebit_GB",a.sepadirectdebit="sepadirectdebit",a.affirm="affirm",a.afterpay="afterpay",a.afterpay_default="afterpay_default",a.afterpay_b2b="afterpay_b2b",a.atome="atome",a.facilypay_3x="facilypay_3x",a.facilypay_4x="facilypay_4x",a.facilypay_6x="facilypay_6x",a.facilypay_10x="facilypay_10x",a.facilypay_12x="facilypay_12x",a.ratepay="ratepay",a.ratepay_directdebit="ratepay_directdebit",a.riverty="riverty",a.amazonpay="amazonpay",a.applepay="applepay",a.cashapp="cashapp",a.clicktopay="clicktopay",a.googlepay="googlepay",a.paypal="paypal",a.paywithgoogle="paywithgoogle",a.boletobancario="boletobancario",a.boletobancario_itau="boletobancario_itau",a.boletobancario_santander="boletobancario_santander",a.primeiropay_boleto="primeiropay_boleto",a.doku="doku",a.doku_alfamart="doku_alfamart",a.doku_permata_lite_atm="doku_permata_lite_atm",a.doku_indomaret="doku_indomaret",a.doku_atm_mandiri_va="doku_atm_mandiri_va",a.doku_sinarmas_va="doku_sinarmas_va",a.doku_mandiri_va="doku_mandiri_va",a.doku_cimb_va="doku_cimb_va",a.doku_danamon_va="doku_danamon_va",a.doku_bri_va="doku_bri_va",a.doku_bni_va="doku_bni_va",a.doku_bca_va="doku_bca_va",a.doku_wallet="doku_wallet",a.oxxo="oxxo",a.billdesk_online="billdesk_online",a.billdesk_wallet="billdesk_wallet",a.dotpay="dotpay",a.eps="eps",a.molpay_ebanking_fpx_MY="molpay_ebanking_fpx_MY",a.molpay_ebanking_TH="molpay_ebanking_TH",a.molpay_ebanking_VN="molpay_ebanking_VN",a.onlineBanking_CZ="onlineBanking_CZ",a.onlinebanking_IN="onlinebanking_IN",a.onlineBanking_PL="onlineBanking_PL",a.onlineBanking_SK="onlineBanking_SK",a.paybybank="paybybank",a.payu_IN_cashcard="payu_IN_cashcard",a.payu_IN_nb="payu_IN_nb",a.wallet_IN="wallet_IN",a.dragonpay="dragonpay",a.dragonpay_ebanking="dragonpay_ebanking",a.dragonpay_otc_banking="dragonpay_otc_banking",a.dragonpay_otc_non_banking="dragonpay_otc_non_banking",a.dragonpay_otc_philippines="dragonpay_otc_philippines",a.econtext="econtext",a.econtext_atm="econtext_atm",a.econtext_online="econtext_online",a.econtext_seven_eleven="econtext_seven_eleven",a.econtext_stores="econtext_stores",a.giropay="giropay",a.multibanco="multibanco",a.redirect="redirect",a.twint="twint",a.vipps="vipps",a.trustly="trustly",a.klarna="klarna",a.klarna_account="klarna_account",a.klarna_paynow="klarna_paynow",a.klarna_b2b="klarna_b2b",a.bcmc_mobile="bcmc_mobile",a.bcmc_mobile_QR="bcmc_mobile_QR",a.pix="pix",a.swish="swish",a.wechatpay="wechatpay",a.wechatpayQR="wechatpayQR",a.promptpay="promptpay",a.paynow="paynow",a.duitnow="duitnow",a.blik="blik",a.mbway="mbway",a.ancv="ancv",a.upi="upi",a.upi_qr="upi_qr",a.upi_collect="upi_collect",a.giftcard="giftcard",a.mealVoucher_FR="mealVoucher_FR",a.mealVoucher_FR_natixis="mealVoucher_FR_natixis",a.mealVoucher_FR_sodexo="mealVoucher_FR_sodexo",a.mealVoucher_FR_groupeup="mealVoucher_FR_groupeup"}(a||(a={}));export{a as TxVariants};
2
2
  //# sourceMappingURL=tx-variants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tx-variants.js","sources":["../../../src/components/tx-variants.ts"],"sourcesContent":["export enum TxVariants {\n /** internal */\n address = 'address',\n bankTransfer_IBAN = 'bankTransfer_IBAN',\n donation = 'donation',\n personal_details = 'personal_details',\n dropin = 'dropin',\n /** internal */\n\n /** Card */\n bcmc = 'bcmc',\n card = 'card',\n scheme = 'scheme',\n storedCard = 'storedCard',\n customCard = 'customcard',\n /** Card */\n\n /** ThreeDS */\n threeDS2Challenge = 'threeDS2Challenge',\n threeDS2Fingerprint = 'threeDS2Fingerprint',\n threeDS2DeviceFingerprint = 'threeDS2DeviceFingerprint',\n /** ThreeDS */\n\n /** Direct debit */\n ach = 'ach',\n directdebit_GB = 'directdebit_GB',\n sepadirectdebit = 'sepadirectdebit',\n /** Direct debit */\n\n /** Open Invoice */\n affirm = 'affirm',\n afterpay = 'afterpay',\n afterpay_default = 'afterpay_default',\n afterpay_b2b = 'afterpay_b2b',\n atome = 'atome',\n facilypay_3x = 'facilypay_3x',\n facilypay_4x = 'facilypay_4x',\n facilypay_6x = 'facilypay_6x',\n facilypay_10x = 'facilypay_10x',\n facilypay_12x = 'facilypay_12x',\n ratepay = 'ratepay',\n ratepay_directdebit = 'ratepay_directdebit',\n riverty = 'riverty',\n /** Open Invoice */\n\n /** Wallets */\n amazonpay = 'amazonpay',\n applepay = 'applepay',\n cashapp = 'cashapp',\n clicktopay = 'clicktopay',\n googlepay = 'googlepay',\n paypal = 'paypal',\n paywithgoogle = 'paywithgoogle',\n /** Wallets */\n\n /** Voucher */\n boletobancario = 'boletobancario',\n boletobancario_itau = 'boletobancario_itau',\n boletobancario_santander = 'boletobancario_santander',\n primeiropay_boleto = 'primeiropay_boleto',\n doku = 'doku',\n doku_alfamart = 'doku_alfamart',\n doku_permata_lite_atm = 'doku_permata_lite_atm',\n doku_indomaret = 'doku_indomaret',\n doku_atm_mandiri_va = 'doku_atm_mandiri_va',\n doku_sinarmas_va = 'doku_sinarmas_va',\n doku_mandiri_va = 'doku_mandiri_va',\n doku_cimb_va = 'doku_cimb_va',\n doku_danamon_va = 'doku_danamon_va',\n doku_bri_va = 'doku_bri_va',\n doku_bni_va = 'doku_bni_va',\n doku_bca_va = 'doku_bca_va',\n doku_wallet = 'doku_wallet',\n oxxo = 'oxxo',\n /** Voucher */\n\n /** issuerList */\n billdesk_online = 'billdesk_online',\n billdesk_wallet = 'billdesk_wallet',\n dotpay = 'dotpay',\n eps = 'eps',\n molpay_ebanking_fpx_MY = 'molpay_ebanking_fpx_MY',\n molpay_ebanking_TH = 'molpay_ebanking_TH',\n molpay_ebanking_VN = 'molpay_ebanking_VN',\n onlineBanking_CZ = 'onlineBanking_CZ',\n onlinebanking_IN = 'onlinebanking_IN',\n onlineBanking_PL = 'onlineBanking_PL',\n onlineBanking_SK = 'onlineBanking_SK',\n paybybank = 'paybybank',\n payu_IN_cashcard = 'payu_IN_cashcard',\n payu_IN_nb = 'payu_IN_nb',\n wallet_IN = 'wallet_IN',\n /** issuerList */\n\n /** Dragonpay */\n dragonpay = 'dragonpay',\n dragonpay_ebanking = 'dragonpay_ebanking',\n dragonpay_otc_banking = 'dragonpay_otc_banking',\n dragonpay_otc_non_banking = 'dragonpay_otc_non_banking',\n dragonpay_otc_philippines = 'dragonpay_otc_philippines',\n /** Dragonpay */\n\n /** Econtext */\n econtext = 'econtext',\n econtext_atm = 'econtext_atm',\n econtext_online = 'econtext_online',\n econtext_seven_eleven = 'econtext_seven_eleven',\n econtext_stores = 'econtext_stores',\n /** Econtext */\n\n /** Redirect */\n giropay = 'giropay',\n multibanco = 'multibanco',\n redirect = 'redirect',\n twint = 'twint',\n vipps = 'vipps',\n trustly = 'trustly',\n /** Redirect */\n\n /** Klarna */\n klarna = 'klarna',\n klarna_account = 'klarna_account',\n klarna_paynow = 'klarna_paynow',\n /** Klarna */\n\n /** QRLoader */\n bcmc_mobile = 'bcmc_mobile',\n bcmc_mobile_QR = 'bcmc_mobile_QR',\n pix = 'pix',\n swish = 'swish',\n wechatpay = 'wechatpay',\n wechatpayQR = 'wechatpayQR',\n promptpay = 'promptpay',\n paynow = 'paynow',\n duitnow = 'duitnow',\n /** QRLoader */\n\n /** Await */\n blik = 'blik',\n mbway = 'mbway',\n ancv = 'ancv',\n upi = 'upi', // also QR\n upi_qr = 'upi_qr', // also QR\n upi_collect = 'upi_collect', // also QR\n /** Await */\n\n /** Giftcard */\n giftcard = 'giftcard',\n mealVoucher_FR = 'mealVoucher_FR',\n mealVoucher_FR_natixis = 'mealVoucher_FR_natixis',\n mealVoucher_FR_sodexo = 'mealVoucher_FR_sodexo',\n mealVoucher_FR_groupeup = 'mealVoucher_FR_groupeup'\n /** Giftcard */\n}\n"],"names":["TxVariants"],"mappings":"OAAYA,SAAAA,GACKA,EAAA,QAAA,gIAQJA,EAAA,KAAA,2FAQGA,EAAA,kBAAA,wHAMKA,EAAA,IAAA,4EAMAA,EAAA,OAAA,iWAgBLA,EAAA,UAAA,0JAUAA,EAAA,eAAA,mlBAqBGA,EAAA,gBAAA,keAkBDA,EAAA,UAAA,sNAQDA,EAAA,SAAA,iKAQAA,EAAA,QAAA,8GASFA,EAAA,OAAA,2EAMEA,EAAA,YAAA,8LAYHA,EAAA,KAAA,+FASGA,EAAA,SAAA,mMAlJLA,CAAAA,IAAAA,EAAAA,CAAAA"}
1
+ {"version":3,"file":"tx-variants.js","sources":["../../../src/components/tx-variants.ts"],"sourcesContent":["export enum TxVariants {\n /** internal */\n address = 'address',\n bankTransfer_IBAN = 'bankTransfer_IBAN',\n donation = 'donation',\n personal_details = 'personal_details',\n dropin = 'dropin',\n /** internal */\n\n /** Card */\n bcmc = 'bcmc',\n card = 'card',\n scheme = 'scheme',\n storedCard = 'storedCard',\n customCard = 'customcard',\n /** Card */\n\n /** ThreeDS */\n threeDS2Challenge = 'threeDS2Challenge',\n threeDS2Fingerprint = 'threeDS2Fingerprint',\n threeDS2DeviceFingerprint = 'threeDS2DeviceFingerprint',\n /** ThreeDS */\n\n /** Direct debit */\n ach = 'ach',\n directdebit_GB = 'directdebit_GB',\n sepadirectdebit = 'sepadirectdebit',\n /** Direct debit */\n\n /** Open Invoice */\n affirm = 'affirm',\n afterpay = 'afterpay',\n afterpay_default = 'afterpay_default',\n afterpay_b2b = 'afterpay_b2b',\n atome = 'atome',\n facilypay_3x = 'facilypay_3x',\n facilypay_4x = 'facilypay_4x',\n facilypay_6x = 'facilypay_6x',\n facilypay_10x = 'facilypay_10x',\n facilypay_12x = 'facilypay_12x',\n ratepay = 'ratepay',\n ratepay_directdebit = 'ratepay_directdebit',\n riverty = 'riverty',\n /** Open Invoice */\n\n /** Wallets */\n amazonpay = 'amazonpay',\n applepay = 'applepay',\n cashapp = 'cashapp',\n clicktopay = 'clicktopay',\n googlepay = 'googlepay',\n paypal = 'paypal',\n paywithgoogle = 'paywithgoogle',\n /** Wallets */\n\n /** Voucher */\n boletobancario = 'boletobancario',\n boletobancario_itau = 'boletobancario_itau',\n boletobancario_santander = 'boletobancario_santander',\n primeiropay_boleto = 'primeiropay_boleto',\n doku = 'doku',\n doku_alfamart = 'doku_alfamart',\n doku_permata_lite_atm = 'doku_permata_lite_atm',\n doku_indomaret = 'doku_indomaret',\n doku_atm_mandiri_va = 'doku_atm_mandiri_va',\n doku_sinarmas_va = 'doku_sinarmas_va',\n doku_mandiri_va = 'doku_mandiri_va',\n doku_cimb_va = 'doku_cimb_va',\n doku_danamon_va = 'doku_danamon_va',\n doku_bri_va = 'doku_bri_va',\n doku_bni_va = 'doku_bni_va',\n doku_bca_va = 'doku_bca_va',\n doku_wallet = 'doku_wallet',\n oxxo = 'oxxo',\n /** Voucher */\n\n /** issuerList */\n billdesk_online = 'billdesk_online',\n billdesk_wallet = 'billdesk_wallet',\n dotpay = 'dotpay',\n eps = 'eps',\n molpay_ebanking_fpx_MY = 'molpay_ebanking_fpx_MY',\n molpay_ebanking_TH = 'molpay_ebanking_TH',\n molpay_ebanking_VN = 'molpay_ebanking_VN',\n onlineBanking_CZ = 'onlineBanking_CZ',\n onlinebanking_IN = 'onlinebanking_IN',\n onlineBanking_PL = 'onlineBanking_PL',\n onlineBanking_SK = 'onlineBanking_SK',\n paybybank = 'paybybank',\n payu_IN_cashcard = 'payu_IN_cashcard',\n payu_IN_nb = 'payu_IN_nb',\n wallet_IN = 'wallet_IN',\n /** issuerList */\n\n /** Dragonpay */\n dragonpay = 'dragonpay',\n dragonpay_ebanking = 'dragonpay_ebanking',\n dragonpay_otc_banking = 'dragonpay_otc_banking',\n dragonpay_otc_non_banking = 'dragonpay_otc_non_banking',\n dragonpay_otc_philippines = 'dragonpay_otc_philippines',\n /** Dragonpay */\n\n /** Econtext */\n econtext = 'econtext',\n econtext_atm = 'econtext_atm',\n econtext_online = 'econtext_online',\n econtext_seven_eleven = 'econtext_seven_eleven',\n econtext_stores = 'econtext_stores',\n /** Econtext */\n\n /** Redirect */\n giropay = 'giropay',\n multibanco = 'multibanco',\n redirect = 'redirect',\n twint = 'twint',\n vipps = 'vipps',\n trustly = 'trustly',\n /** Redirect */\n\n /** Klarna */\n klarna = 'klarna',\n klarna_account = 'klarna_account',\n klarna_paynow = 'klarna_paynow',\n klarna_b2b = 'klarna_b2b',\n /** Klarna */\n\n /** QRLoader */\n bcmc_mobile = 'bcmc_mobile',\n bcmc_mobile_QR = 'bcmc_mobile_QR',\n pix = 'pix',\n swish = 'swish',\n wechatpay = 'wechatpay',\n wechatpayQR = 'wechatpayQR',\n promptpay = 'promptpay',\n paynow = 'paynow',\n duitnow = 'duitnow',\n /** QRLoader */\n\n /** Await */\n blik = 'blik',\n mbway = 'mbway',\n ancv = 'ancv',\n upi = 'upi', // also QR\n upi_qr = 'upi_qr', // also QR\n upi_collect = 'upi_collect', // also QR\n /** Await */\n\n /** Giftcard */\n giftcard = 'giftcard',\n mealVoucher_FR = 'mealVoucher_FR',\n mealVoucher_FR_natixis = 'mealVoucher_FR_natixis',\n mealVoucher_FR_sodexo = 'mealVoucher_FR_sodexo',\n mealVoucher_FR_groupeup = 'mealVoucher_FR_groupeup'\n /** Giftcard */\n}\n"],"names":["TxVariants"],"mappings":"OAAYA,SAAAA,GACKA,EAAA,QAAA,gIAQJA,EAAA,KAAA,2FAQGA,EAAA,kBAAA,wHAMKA,EAAA,IAAA,4EAMAA,EAAA,OAAA,iWAgBLA,EAAA,UAAA,0JAUAA,EAAA,eAAA,mlBAqBGA,EAAA,gBAAA,keAkBDA,EAAA,UAAA,sNAQDA,EAAA,SAAA,iKAQAA,EAAA,QAAA,8GASFA,EAAA,OAAA,qGAOEA,EAAA,YAAA,8LAYHA,EAAA,KAAA,+FASGA,EAAA,SAAA,mMAnJLA,CAAAA,IAAAA,EAAAA,CAAAA"}
@@ -1,2 +1,2 @@
1
- import t from"../Services/analytics/collect-id.js";import e from"./EventsQueue.js";import{ANALYTICS_EVENT_INFO as n,ANALYTICS_INFO_TIMER_INTERVAL as a,ANALYTICS_EVENT_LOG as l,ANALYTICS_EVENT_ERROR as s,ANALYTICS_PATH as c}from"./constants.js";import{debounce as o}from"../../utils/debounce.js";import{processAnalyticsData as i,createAnalyticsObject as r}from"./utils.js";import{analyticsPreProcessor as u}from"./analyticsPreProcessor.js";let y=null,m=null;const d=({locale:d,clientKey:p,analytics:f,amount:b,analyticsContext:h,bundleType:j})=>{const v={enabled:!0,checkoutAttemptId:null,analyticsData:{},...f},A=t({analyticsContext:h,clientKey:p,locale:d,amount:b,analyticsPath:c,bundleType:j}),g=e({analyticsContext:h,clientKey:p,analyticsPath:c}),E=()=>y?g.run(y):Promise.resolve(null),P={setUp:async t=>{const{enabled:e,payload:n}=v,a=i(v.analyticsData);if(!0===e&&!y)try{const e=await A({...t,...n&&{...n},...Object.keys(a).length&&{...a}});y=e}catch(t){console.warn("Fetching checkoutAttemptId failed."+(t?` Error=${t}`:""))}},getCheckoutAttemptId:()=>y,getEventsQueue:()=>g,createAnalyticsEvent:({event:t,data:e})=>{const c=r({event:t,...e});return((t,e)=>{const c=t===n?t:`${t}s`;g.add(`${c}`,e),t===n&&(clearTimeout(m),m=setTimeout(E,a)),t!==l&&t!==s||(clearTimeout(m),o(E)())})(t,c),c},getEnabled:()=>v.enabled,sendAnalytics:null};return P.sendAnalytics=u(P),P};export{d as default};
1
+ import t from"../Services/analytics/collect-id.js";import e from"./EventsQueue.js";import{ANALYTICS_EVENT_INFO as n,ANALYTICS_INFO_TIMER_INTERVAL as a,ANALYTICS_EVENT_LOG as l,ANALYTICS_EVENT_ERROR as s,ANALYTICS_PATH as c}from"./constants.js";import{debounce as o}from"../../utils/debounce.js";import{processAnalyticsData as i,createAnalyticsObject as r}from"./utils.js";import{analyticsPreProcessor as u}from"./analyticsPreProcessor.js";let y=null,m=null;const d=({locale:d,clientKey:p,analytics:f,amount:b,analyticsContext:h,bundleType:j})=>{const v={enabled:!0,checkoutAttemptId:null,analyticsData:{},...f},A=t({analyticsContext:h,clientKey:p,locale:d,amount:b,analyticsPath:c,bundleType:j}),g=e({analyticsContext:h,clientKey:p,analyticsPath:c}),E=()=>y?g.run(y):Promise.resolve(null),P={setUp:async t=>{const{enabled:e,payload:n}=v,a=i(v.analyticsData);if(!0===e&&!y)try{const e=await A({...t,...n&&{...n},...Object.keys(a).length&&{...a}});y=e}catch(t){console.warn("Fetching checkoutAttemptId failed."+(t?` Error=${t}`:""))}},getCheckoutAttemptId:()=>y,getEventsQueue:()=>g,createAnalyticsEvent:({event:t,data:e})=>{const c=r({event:t,...e});return((t,e)=>{const c=t===n?t:`${t}s`;g.add(`${c}`,e),t===n&&(clearTimeout(m),m=setTimeout((()=>{E()}),a)),t!==l&&t!==s||(clearTimeout(m),o(E)())})(t,c),c},getEnabled:()=>v.enabled,sendAnalytics:null};return P.sendAnalytics=u(P),P};export{d as default};
2
2
  //# sourceMappingURL=Analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Analytics.js","sources":["../../../../src/core/Analytics/Analytics.ts"],"sourcesContent":["import CollectId from '../Services/analytics/collect-id';\nimport EventsQueue, { EventsQueueModule } from './EventsQueue';\nimport { ANALYTICS_EVENT, AnalyticsInitialEvent, AnalyticsObject, AnalyticsProps, CreateAnalyticsEventObject } from './types';\nimport { ANALYTICS_EVENT_ERROR, ANALYTICS_EVENT_INFO, ANALYTICS_EVENT_LOG, ANALYTICS_INFO_TIMER_INTERVAL, ANALYTICS_PATH } from './constants';\nimport { debounce } from '../../utils/debounce';\nimport { AnalyticsModule } from '../../types/global-types';\nimport { createAnalyticsObject, processAnalyticsData } from './utils';\nimport { analyticsPreProcessor } from './analyticsPreProcessor';\n\nlet capturedCheckoutAttemptId = null;\nlet sendEventsTimerId = null;\n\nconst Analytics = ({ locale, clientKey, analytics, amount, analyticsContext, bundleType }: AnalyticsProps): AnalyticsModule => {\n const defaultProps = {\n enabled: true,\n checkoutAttemptId: null,\n analyticsData: {}\n };\n\n const props = { ...defaultProps, ...analytics };\n\n const collectId = CollectId({ analyticsContext, clientKey, locale, amount, analyticsPath: ANALYTICS_PATH, bundleType });\n const eventsQueue: EventsQueueModule = EventsQueue({ analyticsContext, clientKey, analyticsPath: ANALYTICS_PATH });\n\n const sendAnalyticsEvents = () => {\n if (capturedCheckoutAttemptId) {\n return eventsQueue.run(capturedCheckoutAttemptId);\n }\n return Promise.resolve(null);\n };\n\n const addAnalyticsEvent = (type: ANALYTICS_EVENT, obj: AnalyticsObject) => {\n const arrayName = type === ANALYTICS_EVENT_INFO ? type : `${type}s`;\n eventsQueue.add(`${arrayName}`, obj);\n\n /**\n * The logic is:\n * - info events are stored until a log or error comes along,\n * but, if after a set time, no other analytics event (log or error) has come along then we send the info events anyway\n */\n if (type === ANALYTICS_EVENT_INFO) {\n clearTimeout(sendEventsTimerId);\n sendEventsTimerId = setTimeout(sendAnalyticsEvents, ANALYTICS_INFO_TIMER_INTERVAL);\n }\n\n /**\n * The logic is:\n * - errors and logs get sent straightaway\n * ...but... tests with the 3DS2 process show that many logs can happen almost at the same time (or you can have an error followed immediately by a log),\n * so instead of making several sequential api calls we see if we can \"batch\" them using debounce\n */\n if (type === ANALYTICS_EVENT_LOG || type === ANALYTICS_EVENT_ERROR) {\n clearTimeout(sendEventsTimerId); // clear any timer that might be about to dispatch the info events array\n\n debounce(sendAnalyticsEvents)();\n }\n };\n\n const anlModule: AnalyticsModule = {\n /**\n * Make \"setup\" call, to pass containerWidth, buildType, channel etc, and receive a checkoutAttemptId in return\n * @param initialEvent -\n */\n setUp: async (initialEvent: AnalyticsInitialEvent) => {\n const { enabled, payload } = props; // TODO what is payload, is it ever used?\n\n const analyticsData = processAnalyticsData(props.analyticsData);\n\n if (enabled === true && !capturedCheckoutAttemptId) {\n try {\n const checkoutAttemptId = await collectId({\n ...initialEvent,\n ...(payload && { ...payload }),\n ...(Object.keys(analyticsData).length && { ...analyticsData })\n });\n capturedCheckoutAttemptId = checkoutAttemptId;\n } catch (e) {\n console.warn(`Fetching checkoutAttemptId failed.${e ? ` Error=${e}` : ''}`);\n }\n }\n },\n\n getCheckoutAttemptId: (): string => capturedCheckoutAttemptId,\n\n // Expose getter for testing purposes\n getEventsQueue: () => eventsQueue,\n\n createAnalyticsEvent: ({ event, data }: CreateAnalyticsEventObject): AnalyticsObject => {\n const aObj: AnalyticsObject = createAnalyticsObject({\n event,\n ...data\n });\n // console.log('### Analytics::createAnalyticsEvent:: event=', event, ' aObj=', aObj);\n\n addAnalyticsEvent(event, aObj);\n\n return aObj;\n },\n\n getEnabled: () => props.enabled,\n\n sendAnalytics: null\n };\n\n anlModule.sendAnalytics = analyticsPreProcessor(anlModule);\n\n return anlModule;\n};\n\nexport default Analytics;\n"],"names":["capturedCheckoutAttemptId","sendEventsTimerId","Analytics","locale","clientKey","analytics","amount","analyticsContext","bundleType","props","enabled","checkoutAttemptId","analyticsData","collectId","CollectId","analyticsPath","ANALYTICS_PATH","eventsQueue","EventsQueue","sendAnalyticsEvents","run","Promise","resolve","anlModule","setUp","async","initialEvent","payload","processAnalyticsData","Object","keys","length","e","console","warn","getCheckoutAttemptId","getEventsQueue","createAnalyticsEvent","event","data","aObj","createAnalyticsObject","type","obj","arrayName","ANALYTICS_EVENT_INFO","add","clearTimeout","setTimeout","ANALYTICS_INFO_TIMER_INTERVAL","ANALYTICS_EVENT_LOG","ANALYTICS_EVENT_ERROR","debounce","addAnalyticsEvent","getEnabled","sendAnalytics","analyticsPreProcessor"],"mappings":"ubASA,IAAIA,EAA4B,KAC5BC,EAAoB,KAExB,MAAMC,EAAY,EAAGC,SAAQC,YAAWC,YAAWC,SAAQC,mBAAkBC,iBACzE,MAMMC,EAAQ,CALVC,SAAS,EACTC,kBAAmB,KACnBC,cAAe,CAAC,KAGgBP,GAE9BQ,EAAYC,EAAU,CAAEP,mBAAkBH,YAAWD,SAAQG,SAAQS,cAAeC,EAAgBR,eACpGS,EAAiCC,EAAY,CAAEX,mBAAkBH,YAAWW,cAAeC,IAE3FG,EAAsB,IACpBnB,EACOiB,EAAYG,IAAIpB,GAEpBqB,QAAQC,QAAQ,MA8BrBC,EAA6B,CAK/BC,MAAOC,MAAOC,IACV,MAAMhB,QAAEA,EAAOiB,QAAEA,GAAYlB,EAEvBG,EAAgBgB,EAAqBnB,EAAMG,eAEjD,IAAgB,IAAZF,IAAqBV,EACrB,IACI,MAAMW,QAA0BE,EAAU,IACnCa,KACCC,GAAW,IAAKA,MAChBE,OAAOC,KAAKlB,GAAemB,QAAU,IAAKnB,KAElDZ,EAA4BW,CAChC,CAAE,MAAOqB,GACLC,QAAQC,KAAK,sCAAqCF,EAAI,UAAUA,IAAM,IAC1E,CACJ,EAGJG,qBAAsB,IAAcnC,EAGpCoC,eAAgB,IAAMnB,EAEtBoB,qBAAsB,EAAGC,QAAOC,WAC5B,MAAMC,EAAwBC,EAAsB,CAChDH,WACGC,IAMP,MAjEkB,EAACG,EAAuBC,KAC9C,MAAMC,EAAYF,IAASG,EAAuBH,EAAO,GAAGA,KAC5DzB,EAAY6B,IAAI,GAAGF,IAAaD,GAO5BD,IAASG,IACTE,aAAa9C,GACbA,EAAoB+C,WAAW7B,EAAqB8B,IASpDP,IAASQ,GAAuBR,IAASS,IACzCJ,aAAa9C,GAEbmD,EAASjC,EAATiC,GACJ,EAuCIC,CAAkBf,EAAOE,GAElBA,CAAAA,EAGXc,WAAY,IAAM7C,EAAMC,QAExB6C,cAAe,MAKnB,OAFAhC,EAAUgC,cAAgBC,EAAsBjC,GAEzCA,CAAAA"}
1
+ {"version":3,"file":"Analytics.js","sources":["../../../../src/core/Analytics/Analytics.ts"],"sourcesContent":["import CollectId from '../Services/analytics/collect-id';\nimport EventsQueue, { EventsQueueModule } from './EventsQueue';\nimport { ANALYTICS_EVENT, AnalyticsInitialEvent, AnalyticsObject, AnalyticsProps, CreateAnalyticsEventObject } from './types';\nimport { ANALYTICS_EVENT_ERROR, ANALYTICS_EVENT_INFO, ANALYTICS_EVENT_LOG, ANALYTICS_INFO_TIMER_INTERVAL, ANALYTICS_PATH } from './constants';\nimport { debounce } from '../../utils/debounce';\nimport { AnalyticsModule } from '../../types/global-types';\nimport { createAnalyticsObject, processAnalyticsData } from './utils';\nimport { analyticsPreProcessor } from './analyticsPreProcessor';\n\nlet capturedCheckoutAttemptId = null;\nlet sendEventsTimerId = null;\n\nconst Analytics = ({ locale, clientKey, analytics, amount, analyticsContext, bundleType }: AnalyticsProps): AnalyticsModule => {\n const defaultProps = {\n enabled: true,\n checkoutAttemptId: null,\n analyticsData: {}\n };\n\n const props = { ...defaultProps, ...analytics };\n\n const collectId = CollectId({ analyticsContext, clientKey, locale, amount, analyticsPath: ANALYTICS_PATH, bundleType });\n const eventsQueue: EventsQueueModule = EventsQueue({ analyticsContext, clientKey, analyticsPath: ANALYTICS_PATH });\n\n const sendAnalyticsEvents = () => {\n if (capturedCheckoutAttemptId) {\n return eventsQueue.run(capturedCheckoutAttemptId);\n }\n return Promise.resolve(null);\n };\n\n const addAnalyticsEvent = (type: ANALYTICS_EVENT, obj: AnalyticsObject) => {\n const arrayName = type === ANALYTICS_EVENT_INFO ? type : `${type}s`;\n eventsQueue.add(`${arrayName}`, obj);\n\n /**\n * The logic is:\n * - info events are stored until a log or error comes along,\n * but, if after a set time, no other analytics event (log or error) has come along then we send the info events anyway\n */\n if (type === ANALYTICS_EVENT_INFO) {\n clearTimeout(sendEventsTimerId);\n sendEventsTimerId = setTimeout(() => void sendAnalyticsEvents(), ANALYTICS_INFO_TIMER_INTERVAL);\n }\n\n /**\n * The logic is:\n * - errors and logs get sent straightaway\n * ...but... tests with the 3DS2 process show that many logs can happen almost at the same time (or you can have an error followed immediately by a log),\n * so instead of making several sequential api calls we see if we can \"batch\" them using debounce\n */\n if (type === ANALYTICS_EVENT_LOG || type === ANALYTICS_EVENT_ERROR) {\n clearTimeout(sendEventsTimerId); // clear any timer that might be about to dispatch the info events array\n\n debounce(sendAnalyticsEvents)();\n }\n };\n\n const anlModule: AnalyticsModule = {\n /**\n * Make \"setup\" call, to pass containerWidth, buildType, channel etc, and receive a checkoutAttemptId in return\n * @param initialEvent -\n */\n setUp: async (initialEvent: AnalyticsInitialEvent) => {\n const { enabled, payload } = props; // TODO what is payload, is it ever used?\n\n const analyticsData = processAnalyticsData(props.analyticsData);\n\n if (enabled === true && !capturedCheckoutAttemptId) {\n try {\n const checkoutAttemptId = await collectId({\n ...initialEvent,\n ...(payload && { ...payload }),\n ...(Object.keys(analyticsData).length && { ...analyticsData })\n });\n capturedCheckoutAttemptId = checkoutAttemptId;\n } catch (e: any) {\n console.warn(`Fetching checkoutAttemptId failed.${e ? ` Error=${e}` : ''}`);\n }\n }\n },\n\n getCheckoutAttemptId: (): string => capturedCheckoutAttemptId,\n\n // Expose getter for testing purposes\n getEventsQueue: () => eventsQueue,\n\n createAnalyticsEvent: ({ event, data }: CreateAnalyticsEventObject): AnalyticsObject => {\n const aObj: AnalyticsObject = createAnalyticsObject({\n event,\n ...data\n });\n // console.log('### Analytics::createAnalyticsEvent:: event=', event, ' aObj=', aObj);\n\n addAnalyticsEvent(event, aObj);\n\n return aObj;\n },\n\n getEnabled: () => props.enabled,\n\n sendAnalytics: null\n };\n\n anlModule.sendAnalytics = analyticsPreProcessor(anlModule);\n\n return anlModule;\n};\n\nexport default Analytics;\n"],"names":["capturedCheckoutAttemptId","sendEventsTimerId","Analytics","locale","clientKey","analytics","amount","analyticsContext","bundleType","props","enabled","checkoutAttemptId","analyticsData","collectId","CollectId","analyticsPath","ANALYTICS_PATH","eventsQueue","EventsQueue","sendAnalyticsEvents","run","Promise","resolve","anlModule","setUp","async","initialEvent","payload","processAnalyticsData","Object","keys","length","e","console","warn","getCheckoutAttemptId","getEventsQueue","createAnalyticsEvent","event","data","aObj","createAnalyticsObject","type","obj","arrayName","ANALYTICS_EVENT_INFO","add","clearTimeout","setTimeout","ANALYTICS_INFO_TIMER_INTERVAL","ANALYTICS_EVENT_LOG","ANALYTICS_EVENT_ERROR","debounce","addAnalyticsEvent","getEnabled","sendAnalytics","analyticsPreProcessor"],"mappings":"ubASA,IAAIA,EAA4B,KAC5BC,EAAoB,KAExB,MAAMC,EAAY,EAAGC,SAAQC,YAAWC,YAAWC,SAAQC,mBAAkBC,iBACzE,MAMMC,EAAQ,CALVC,SAAS,EACTC,kBAAmB,KACnBC,cAAe,CAAC,KAGgBP,GAE9BQ,EAAYC,EAAU,CAAEP,mBAAkBH,YAAWD,SAAQG,SAAQS,cAAeC,EAAgBR,eACpGS,EAAiCC,EAAY,CAAEX,mBAAkBH,YAAWW,cAAeC,IAE3FG,EAAsB,IACpBnB,EACOiB,EAAYG,IAAIpB,GAEpBqB,QAAQC,QAAQ,MA8BrBC,EAA6B,CAK/BC,MAAOC,MAAOC,IACV,MAAMhB,QAAEA,EAAOiB,QAAEA,GAAYlB,EAEvBG,EAAgBgB,EAAqBnB,EAAMG,eAEjD,IAAgB,IAAZF,IAAqBV,EACrB,IACI,MAAMW,QAA0BE,EAAU,IACnCa,KACCC,GAAW,IAAKA,MAChBE,OAAOC,KAAKlB,GAAemB,QAAU,IAAKnB,KAElDZ,EAA4BW,CAChC,CAAE,MAAOqB,GACLC,QAAQC,KAAK,sCAAqCF,EAAI,UAAUA,IAAM,IAC1E,CACJ,EAGJG,qBAAsB,IAAcnC,EAGpCoC,eAAgB,IAAMnB,EAEtBoB,qBAAsB,EAAGC,QAAOC,WAC5B,MAAMC,EAAwBC,EAAsB,CAChDH,WACGC,IAMP,MAjEkB,EAACG,EAAuBC,KAC9C,MAAMC,EAAYF,IAASG,EAAuBH,EAAO,GAAGA,KAC5DzB,EAAY6B,IAAI,GAAGF,IAAaD,GAO5BD,IAASG,IACTE,aAAa9C,GACbA,EAAoB+C,YAAW,KAAW7B,GAAuB8B,GAAAA,IASjEP,IAASQ,GAAuBR,IAASS,IACzCJ,aAAa9C,GAEbmD,EAASjC,EAATiC,GACJ,EAuCIC,CAAkBf,EAAOE,GAElBA,CAAAA,EAGXc,WAAY,IAAM7C,EAAMC,QAExB6C,cAAe,MAKnB,OAFAhC,EAAUgC,cAAgBC,EAAsBjC,GAEzCA,CAAAA"}
@@ -1,2 +1,2 @@
1
- import{API_ENVIRONMENTS as a,ANALYTICS_ENVIRONMENTS as n,CDN_ENVIRONMENTS as s}from"./constants.js";const t=(a="",n,s)=>s||(n[a.toLowerCase()]||n.fallback),l=(l,r)=>({apiUrl:t(l,a,r?.api),analyticsUrl:t(l,n,r?.analytics),cdnImagesUrl:t(l,s,r?.cdn?.images),cdnTranslationsUrl:t(l,s,r?.cdn?.translations)});export{l as resolveEnvironments};
1
+ import{API_ENVIRONMENTS as a,ANALYTICS_ENVIRONMENTS as n,CDN_ENVIRONMENTS as s}from"./constants.js";const t=(a,n,s)=>s||(n[a?.toLowerCase()]||n.fallback),l=(l,r)=>({apiUrl:t(l,a,r?.api),analyticsUrl:t(l,n,r?.analytics),cdnImagesUrl:t(l,s,r?.cdn?.images),cdnTranslationsUrl:t(l,s,r?.cdn?.translations)});export{l as resolveEnvironments};
2
2
  //# sourceMappingURL=Environment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Environment.js","sources":["../../../../src/core/Environment/Environment.ts"],"sourcesContent":["import { ANALYTICS_ENVIRONMENTS, API_ENVIRONMENTS, CDN_ENVIRONMENTS } from './constants';\nimport type { CoreConfiguration } from '../types';\n\nconst getUrlFromMap = (env: CoreConfiguration['environment'] = '', environmentMap: Record<string, string>, environmentUrl?: string): string => {\n if (environmentUrl) {\n return environmentUrl;\n }\n return environmentMap[env.toLowerCase()] || environmentMap.fallback;\n};\n\nexport const resolveEnvironments = (environment: CoreConfiguration['environment'], environmentsUrls?: CoreConfiguration['_environmentUrls']) => {\n const apiUrl = getUrlFromMap(environment, API_ENVIRONMENTS, environmentsUrls?.api);\n const analyticsUrl = getUrlFromMap(environment, ANALYTICS_ENVIRONMENTS, environmentsUrls?.analytics);\n const cdnImagesUrl = getUrlFromMap(environment, CDN_ENVIRONMENTS, environmentsUrls?.cdn?.images);\n const cdnTranslationsUrl =\n process.env.NODE_ENV === 'development' ? '/' : getUrlFromMap(environment, CDN_ENVIRONMENTS, environmentsUrls?.cdn?.translations);\n\n return {\n apiUrl,\n analyticsUrl,\n cdnImagesUrl,\n cdnTranslationsUrl\n };\n};\n"],"names":["getUrlFromMap","env","environmentMap","environmentUrl","toLowerCase","fallback","resolveEnvironments","environment","environmentsUrls","apiUrl","API_ENVIRONMENTS","api","analyticsUrl","ANALYTICS_ENVIRONMENTS","analytics","cdnImagesUrl","CDN_ENVIRONMENTS","cdn","images","cdnTranslationsUrl","translations"],"mappings":"oGAGA,MAAMA,EAAgB,CAACC,EAAwC,GAAIC,EAAwCC,IACnGA,IAGGD,EAAeD,EAAIG,gBAAkBF,EAAeG,UAGlDC,EAAsB,CAACC,EAA+CC,KAOxE,CACHC,OAPWT,EAAcO,EAAaG,EAAkBF,GAAkBG,KAQ1EC,aAPiBZ,EAAcO,EAAaM,EAAwBL,GAAkBM,WAQtFC,aAPiBf,EAAcO,EAAaS,EAAkBR,GAAkBS,KAAKC,QAQrFC,mBAN+CnB,EAAcO,EAAaS,EAAkBR,GAAkBS,KAAKG"}
1
+ {"version":3,"file":"Environment.js","sources":["../../../../src/core/Environment/Environment.ts"],"sourcesContent":["import { ANALYTICS_ENVIRONMENTS, API_ENVIRONMENTS, CDN_ENVIRONMENTS } from './constants';\nimport type { CoreConfiguration } from '../types';\n\nconst getUrlFromMap = (env: CoreConfiguration['environment'], environmentMap: Record<string, string>, environmentUrl?: string): string => {\n if (environmentUrl) {\n return environmentUrl;\n }\n return environmentMap[env?.toLowerCase()] || environmentMap.fallback;\n};\n\nexport const resolveEnvironments = (environment: CoreConfiguration['environment'], environmentsUrls?: CoreConfiguration['_environmentUrls']) => {\n const apiUrl = getUrlFromMap(environment, API_ENVIRONMENTS, environmentsUrls?.api);\n const analyticsUrl = getUrlFromMap(environment, ANALYTICS_ENVIRONMENTS, environmentsUrls?.analytics);\n const cdnImagesUrl = getUrlFromMap(environment, CDN_ENVIRONMENTS, environmentsUrls?.cdn?.images);\n const cdnTranslationsUrl =\n process.env.NODE_ENV === 'development' ? '/' : getUrlFromMap(environment, CDN_ENVIRONMENTS, environmentsUrls?.cdn?.translations);\n\n return {\n apiUrl,\n analyticsUrl,\n cdnImagesUrl,\n cdnTranslationsUrl\n };\n};\n"],"names":["getUrlFromMap","env","environmentMap","environmentUrl","toLowerCase","fallback","resolveEnvironments","environment","environmentsUrls","apiUrl","API_ENVIRONMENTS","api","analyticsUrl","ANALYTICS_ENVIRONMENTS","analytics","cdnImagesUrl","CDN_ENVIRONMENTS","cdn","images","cdnTranslationsUrl","translations"],"mappings":"oGAGA,MAAMA,EAAgB,CAACC,EAAuCC,EAAwCC,IAC9FA,IAGGD,EAAeD,GAAKG,gBAAkBF,EAAeG,UAGnDC,EAAsB,CAACC,EAA+CC,KAOxE,CACHC,OAPWT,EAAcO,EAAaG,EAAkBF,GAAkBG,KAQ1EC,aAPiBZ,EAAcO,EAAaM,EAAwBL,GAAkBM,WAQtFC,aAPiBf,EAAcO,EAAaS,EAAkBR,GAAkBS,KAAKC,QAQrFC,mBAN+CnB,EAAcO,EAAaS,EAAkBR,GAAkBS,KAAKG"}
@@ -1 +1 @@
1
- {"version":3,"file":"GetDeviceFingerprint.js","sources":["../../../../../../src/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Iframe from '../../../../components/internal/IFrame';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport { DEVICE_FINGERPRINT, DF_TIMEOUT, FAILED_DFP_RESOLVE_OBJECT_TIMEOUT } from '../../constants';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { getOrigin } from '../../../../utils/getOrigin';\nimport { GetDeviceFingerprintProps } from './types';\n\nconst iframeName = 'dfIframe';\nconst allowProperties = 'geolocation; microphone; camera;';\n\nclass GetDeviceFingerprint extends Component<GetDeviceFingerprintProps> {\n public postMessageDomain;\n public processMessageHandler;\n public deviceFingerPrintPromise;\n\n constructor(props) {\n super(props);\n\n this.postMessageDomain = getOrigin(this.props.loadingContext) || this.props.loadingContext;\n }\n\n getDfpPromise(): Promise<any> {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.postMessageDomain, resolve, reject, DEVICE_FINGERPRINT);\n\n /* eslint-disable-next-line */\n window.addEventListener('message', this.processMessageHandler);\n });\n }\n\n componentDidMount() {\n // Get device fingerprint\n this.deviceFingerPrintPromise = promiseTimeout(DF_TIMEOUT, this.getDfpPromise(), FAILED_DFP_RESOLVE_OBJECT_TIMEOUT);\n this.deviceFingerPrintPromise.promise\n .then(resolveObject => {\n this.props.onCompleteFingerprint(resolveObject);\n window.removeEventListener('message', this.processMessageHandler);\n })\n .catch(rejectObject => {\n this.props.onErrorFingerprint(rejectObject);\n window.removeEventListener('message', this.processMessageHandler);\n });\n }\n\n render({ dfpURL }) {\n return (\n <div className=\"adyen-checkout-risk__device-fingerprint\">\n <Iframe name={iframeName} src={dfpURL} allow={allowProperties} title=\"devicefingerprinting iframe\" />\n </div>\n );\n }\n}\n\nexport default GetDeviceFingerprint;\n"],"names":["GetDeviceFingerprint","Component","postMessageDomain","processMessageHandler","deviceFingerPrintPromise","constructor","props","super","this","getOrigin","loadingContext","getDfpPromise","Promise","resolve","reject","getProcessMessageHandler","DEVICE_FINGERPRINT","window","addEventListener","componentDidMount","promiseTimeout","DF_TIMEOUT","FAILED_DFP_RESOLVE_OBJECT_TIMEOUT","promise","then","resolveObject","onCompleteFingerprint","removeEventListener","catch","rejectObject","onErrorFingerprint","render","dfpURL","h","div","className","Iframe","name","src","allow","title"],"mappings":"ubAWA,MAAMA,UAA6BC,EACxBC,kBACAC,sBACAC,yBAEPC,WAAAA,CAAYC,GACRC,MAAMD,GAENE,KAAKN,kBAAoBO,EAAUD,KAAKF,MAAMI,iBAAmBF,KAAKF,MAAMI,cAChF,CAEAC,aAAAA,GACI,OAAO,IAAIC,SAAQ,CAACC,EAASC,KAIzBN,KAAKL,sBAAwBY,EAAyBP,KAAKN,kBAAmBW,EAASC,EAAQE,GAG/FC,OAAOC,iBAAiB,UAAWV,KAAKL,sBAAqB,GAErE,CAEAgB,iBAAAA,GAEIX,KAAKJ,yBAA2BgB,EAAeC,EAAYb,KAAKG,gBAAiBW,GACjFd,KAAKJ,yBAAyBmB,QACzBC,MAAKC,IACFjB,KAAKF,MAAMoB,sBAAsBD,GACjCR,OAAOU,oBAAoB,UAAWnB,KAAKL,sBAAqB,IAEnEyB,OAAMC,IACHrB,KAAKF,MAAMwB,mBAAmBD,GAC9BZ,OAAOU,oBAAoB,UAAWnB,KAAKL,sBAAqB,GAE5E,CAEA4B,MAAAA,EAAOC,OAAEA,IACL,OACIC,EAACC,MAAAA,CAAIC,UAAU,2CACXF,EAACG,EAAAA,CAAOC,KA3CL,WA2CuBC,IAAKN,EAAQO,MA1C/B,mCA0CuDC,MAAM,gCAGjF"}
1
+ {"version":3,"file":"GetDeviceFingerprint.js","sources":["../../../../../../src/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Iframe from '../../../../components/internal/IFrame';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport { DEVICE_FINGERPRINT, DF_TIMEOUT, FAILED_DFP_RESOLVE_OBJECT_TIMEOUT } from '../../constants';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { getOrigin } from '../../../../utils/getOrigin';\nimport { GetDeviceFingerprintProps } from './types';\n\nconst iframeName = 'dfIframe';\nconst allowProperties = 'geolocation; microphone; camera;';\n\nclass GetDeviceFingerprint extends Component<GetDeviceFingerprintProps> {\n public postMessageDomain;\n public processMessageHandler;\n public deviceFingerPrintPromise;\n\n constructor(props) {\n super(props);\n\n this.postMessageDomain = getOrigin(this.props.loadingContext) || this.props.loadingContext;\n }\n\n getDfpPromise(): Promise<any> {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.postMessageDomain, resolve, reject, DEVICE_FINGERPRINT);\n\n window.addEventListener('message', this.processMessageHandler);\n });\n }\n\n componentDidMount() {\n // Get device fingerprint\n this.deviceFingerPrintPromise = promiseTimeout(DF_TIMEOUT, this.getDfpPromise(), FAILED_DFP_RESOLVE_OBJECT_TIMEOUT);\n this.deviceFingerPrintPromise.promise\n .then(resolveObject => {\n this.props.onCompleteFingerprint(resolveObject);\n window.removeEventListener('message', this.processMessageHandler);\n })\n .catch(rejectObject => {\n this.props.onErrorFingerprint(rejectObject);\n window.removeEventListener('message', this.processMessageHandler);\n });\n }\n\n render({ dfpURL }) {\n return (\n <div className=\"adyen-checkout-risk__device-fingerprint\">\n <Iframe name={iframeName} src={dfpURL} allow={allowProperties} title=\"devicefingerprinting iframe\" />\n </div>\n );\n }\n}\n\nexport default GetDeviceFingerprint;\n"],"names":["GetDeviceFingerprint","Component","postMessageDomain","processMessageHandler","deviceFingerPrintPromise","constructor","props","super","this","getOrigin","loadingContext","getDfpPromise","Promise","resolve","reject","getProcessMessageHandler","DEVICE_FINGERPRINT","window","addEventListener","componentDidMount","promiseTimeout","DF_TIMEOUT","FAILED_DFP_RESOLVE_OBJECT_TIMEOUT","promise","then","resolveObject","onCompleteFingerprint","removeEventListener","catch","rejectObject","onErrorFingerprint","render","dfpURL","h","div","className","Iframe","name","src","allow","title"],"mappings":"ubAWA,MAAMA,UAA6BC,EACxBC,kBACAC,sBACAC,yBAEPC,WAAAA,CAAYC,GACRC,MAAMD,GAENE,KAAKN,kBAAoBO,EAAUD,KAAKF,MAAMI,iBAAmBF,KAAKF,MAAMI,cAChF,CAEAC,aAAAA,GACI,OAAO,IAAIC,SAAQ,CAACC,EAASC,KAIzBN,KAAKL,sBAAwBY,EAAyBP,KAAKN,kBAAmBW,EAASC,EAAQE,GAE/FC,OAAOC,iBAAiB,UAAWV,KAAKL,sBAAqB,GAErE,CAEAgB,iBAAAA,GAEIX,KAAKJ,yBAA2BgB,EAAeC,EAAYb,KAAKG,gBAAiBW,GACjFd,KAAKJ,yBAAyBmB,QACzBC,MAAKC,IACFjB,KAAKF,MAAMoB,sBAAsBD,GACjCR,OAAOU,oBAAoB,UAAWnB,KAAKL,sBAAqB,IAEnEyB,OAAMC,IACHrB,KAAKF,MAAMwB,mBAAmBD,GAC9BZ,OAAOU,oBAAoB,UAAWnB,KAAKL,sBAAqB,GAE5E,CAEA4B,MAAAA,EAAOC,OAAEA,IACL,OACIC,EAACC,MAAAA,CAAIC,UAAU,2CACXF,EAACG,EAAAA,CAAOC,KA1CL,WA0CuBC,IAAKN,EAAQO,MAzC/B,mCAyCuDC,MAAM,gCAGjF"}
@@ -1,2 +1,2 @@
1
- import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:c,bundleType:a})=>{let l;const s={errorLevel:"fatal",loadingContext:n,path:`${c}?clientKey=${r}`};return n=>{const c={version:"6.0.0-beta.0",channel:"Web",platform:"Web",buildType:a,locale:i,referrer:window.location.href,screenWidth:window.screen.width,...n};if(l)return l;if(!r)return Promise.reject("no-client-key");const m=new t("checkout-attempt-id","sessionStorage"),d=m.get();return function(e){if(!e?.id)return!1;const t=Date.now()-9e5;return e.timestamp>t}(d)?Promise.resolve(d.id):(l=e(s,c).then((e=>{if(e?.checkoutAttemptId)return m.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(o))),l)}};export{o as FAILURE_MSG,n as default};
1
+ import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:c,bundleType:a})=>{let l;const s={errorLevel:"fatal",loadingContext:n,path:`${c}?clientKey=${r}`};return n=>{const c={version:"6.0.0-beta.1",channel:"Web",platform:"Web",buildType:a,locale:i,referrer:window.location.href,screenWidth:window.screen.width,...n};if(l)return l;if(!r)return Promise.reject("no-client-key");const m=new t("checkout-attempt-id","sessionStorage"),d=m.get();return function(e){if(!e?.id)return!1;const t=Date.now()-9e5;return e.timestamp>t}(d)?Promise.resolve(d.id):(l=e(s,c).then((e=>{if(e?.checkoutAttemptId)return m.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(o))),l)}};export{o as FAILURE_MSG,n as default};
2
2
  //# sourceMappingURL=collect-id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sources":["../../../../src/core/Services/http.ts"],"sourcesContent":["import { DEFAULT_HTTP_TIMEOUT, FALLBACK_CONTEXT } from '../config';\nimport AdyenCheckoutError from '../Errors/AdyenCheckoutError';\n\nexport interface HttpOptions {\n accept?: string;\n contentType?: string;\n headers?;\n loadingContext?: string;\n method?: string;\n path: string;\n timeout?: number;\n errorLevel?: ErrorLevel;\n errorMessage?: string;\n}\n\ntype ErrorLevel = 'silent' | 'info' | 'warn' | 'error' | 'fatal';\n\ntype AdyenApiErrorResponse = {\n errorCode: string;\n message: string;\n errorType: string;\n status: number;\n};\n\nfunction isAdyenApiErrorResponse(data: any): data is AdyenApiErrorResponse {\n return data && data.errorCode && data.errorType && data.message && data.status;\n}\n\nexport function http<T>(options: HttpOptions, data?: any): Promise<T> {\n const { headers = [], errorLevel = 'warn', loadingContext = FALLBACK_CONTEXT, method = 'GET', path, timeout = DEFAULT_HTTP_TIMEOUT } = options;\n\n const request: RequestInit = {\n method,\n mode: 'cors',\n cache: 'default',\n credentials: 'same-origin',\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': method === 'POST' ? 'application/json' : 'text/plain',\n ...headers\n },\n redirect: 'follow',\n referrerPolicy: 'no-referrer-when-downgrade',\n ...(AbortSignal?.timeout && { signal: AbortSignal?.timeout(timeout) }),\n ...(data && { body: JSON.stringify(data) })\n };\n\n const url = `${loadingContext}${path}`;\n\n return (\n fetch(url, request)\n .then(async response => {\n const data = await response.json();\n\n if (response.ok) {\n return data;\n }\n\n if (isAdyenApiErrorResponse(data)) {\n handleFetchError(data.message, errorLevel, data);\n return;\n }\n\n const errorMessage = options.errorMessage || `Service at ${url} is not available`;\n handleFetchError(errorMessage, errorLevel, data);\n return;\n })\n /**\n * Catch block handles Network error, CORS error, or exception throw by the `handleFetchError`\n * inside the `then` block\n */\n .catch((error: unknown) => {\n /**\n * If error is instance of AdyenCheckoutError, which means that it was already\n * handled by the `handleFetchError` on the `then` block, then we just throw it.\n * There is no need to create it again\n */\n if (error instanceof AdyenCheckoutError) {\n throw error;\n }\n\n const errorMessage = options.errorMessage || `Call to ${url} failed. Error= ${error}`;\n handleFetchError(errorMessage, errorLevel, error);\n })\n );\n}\n\nfunction handleFetchError(message: string, level: ErrorLevel, error: unknown): void {\n switch (level) {\n case 'silent': {\n break;\n }\n case 'info':\n case 'warn':\n case 'error': {\n console[level](message);\n break;\n }\n default:\n throw new AdyenCheckoutError('NETWORK_ERROR', message, { cause: error });\n }\n}\n\nexport function httpGet<T = any>(options: HttpOptions, data?: any): Promise<T> {\n return http<T>({ ...options, method: 'GET' }, data);\n}\n\nexport function httpPost<T = any>(options: HttpOptions, data?: any): Promise<T> {\n return http<T>({ ...options, method: 'POST' }, data);\n}\n"],"names":["http","options","data","headers","errorLevel","loadingContext","FALLBACK_CONTEXT","method","path","timeout","DEFAULT_HTTP_TIMEOUT","request","mode","cache","credentials","Accept","redirect","referrerPolicy","AbortSignal","signal","body","JSON","stringify","url","fetch","then","async","response","json","ok","errorCode","errorType","message","status","isAdyenApiErrorResponse","handleFetchError","errorMessage","catch","error","AdyenCheckoutError","level","console","cause","httpGet","httpPost"],"mappings":"yHA4BO,SAASA,EAAQC,EAAsBC,GAC1C,MAAMC,QAAEA,EAAU,GAAEC,WAAEA,EAAa,OAAMC,eAAEA,EAAiBC,EAAgBC,OAAEA,EAAS,MAAKC,KAAEA,EAAIC,QAAEA,EAAUC,GAAyBT,EAEjIU,EAAuB,CACzBJ,SACAK,KAAM,OACNC,MAAO,UACPC,YAAa,cACbX,QAAS,CACLY,OAAQ,oCACR,eAA2B,SAAXR,EAAoB,mBAAqB,gBACtDJ,GAEPa,SAAU,SACVC,eAAgB,gCACZC,aAAaT,SAAW,CAAEU,OAAQD,aAAaT,QAAQA,OACvDP,GAAQ,CAAEkB,KAAMC,KAAKC,UAAUpB,KAGjCqB,EAAM,GAAGlB,IAAiBG,IAEhC,OACIgB,MAAMD,EAAKZ,GACNc,MAAKC,MAAMC,IACR,MAAMzB,QAAayB,EAASC,OAE5B,GAAID,EAASE,GACT,OAAO3B,EAGX,GAlChB,SAAiCA,GAC7B,OAAOA,GAAQA,EAAK4B,WAAa5B,EAAK6B,WAAa7B,EAAK8B,SAAW9B,EAAK+B,MAC5E,CAgCoBC,CAAwBhC,GAExB,YADAiC,EAAiBjC,EAAK8B,QAAS5B,EAAYF,GAK/CiC,EADqBlC,EAAQmC,cAAgB,cAAcb,qBAC5BnB,EAAYF,EAC3C,IAMHmC,OAAOC,IAMJ,GAAIA,aAAiBC,EACjB,MAAMD,EAIVH,EADqBlC,EAAQmC,cAAgB,WAAWb,oBAAsBe,IAC/ClC,EAAYkC,EAAAA,GAG3D,CAEA,SAASH,EAAiBH,EAAiBQ,EAAmBF,GAC1D,OAAQE,GACJ,IAAK,SACD,MAEJ,IAAK,OACL,IAAK,OACL,IAAK,QACDC,QAAQD,GAAOR,GACf,MAEJ,QACI,MAAM,IAAIO,EAAmB,gBAAiBP,EAAS,CAAEU,MAAOJ,IAE5E,CAEO,SAASK,EAAiB1C,EAAsBC,GACnD,OAAOF,EAAQ,IAAKC,EAASM,OAAQ,OAASL,EAClD,CAEO,SAAS0C,EAAkB3C,EAAsBC,GACpD,OAAOF,EAAQ,IAAKC,EAASM,OAAQ,QAAUL,EACnD"}
1
+ {"version":3,"file":"http.js","sources":["../../../../src/core/Services/http.ts"],"sourcesContent":["import { DEFAULT_HTTP_TIMEOUT, FALLBACK_CONTEXT } from '../config';\nimport AdyenCheckoutError from '../Errors/AdyenCheckoutError';\n\nexport interface HttpOptions {\n accept?: string;\n contentType?: string;\n headers?;\n loadingContext?: string;\n method?: string;\n path: string;\n timeout?: number;\n errorLevel?: ErrorLevel;\n errorMessage?: string;\n}\n\ntype ErrorLevel = 'silent' | 'info' | 'warn' | 'error' | 'fatal';\n\ntype AdyenApiErrorResponse = {\n errorCode: string;\n message: string;\n errorType: string;\n status: number;\n};\n\nfunction isAdyenApiErrorResponse(data: any): data is AdyenApiErrorResponse {\n return data && data.errorCode && data.errorType && data.message && data.status;\n}\n\nexport function http<T>(options: HttpOptions, data?: any): Promise<T> {\n const { headers = [], errorLevel = 'warn', loadingContext = FALLBACK_CONTEXT, method = 'GET', path, timeout = DEFAULT_HTTP_TIMEOUT } = options;\n\n const request: RequestInit = {\n method,\n mode: 'cors',\n cache: 'default',\n credentials: 'same-origin',\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': method === 'POST' ? 'application/json' : 'text/plain',\n ...headers\n },\n redirect: 'follow',\n referrerPolicy: 'no-referrer-when-downgrade',\n ...(AbortSignal?.timeout && { signal: AbortSignal?.timeout(timeout) }),\n ...(data && { body: JSON.stringify(data) })\n };\n\n const url = `${loadingContext}${path}`;\n\n return (\n fetch(url, request)\n .then(async response => {\n const data = await response.json();\n\n if (response.ok) {\n return data;\n }\n\n if (isAdyenApiErrorResponse(data)) {\n handleFetchError(data.message, errorLevel, data);\n return;\n }\n\n const errorMessage = options.errorMessage || `Service at ${url} is not available`;\n handleFetchError(errorMessage, errorLevel, data);\n return;\n })\n /**\n * Catch block handles Network error, CORS error, or exception throw by the `handleFetchError`\n * inside the `then` block\n */\n .catch((error: unknown) => {\n /**\n * If error is instance of AdyenCheckoutError, which means that it was already\n * handled by the `handleFetchError` on the `then` block, then we just throw it.\n * There is no need to create it again\n */\n if (error instanceof AdyenCheckoutError) {\n throw error;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions\n const errorMessage = options.errorMessage || `Call to ${url} failed. Error= ${error}`;\n handleFetchError(errorMessage, errorLevel, error);\n })\n );\n}\n\nfunction handleFetchError(message: string, level: ErrorLevel, error: unknown): void {\n switch (level) {\n case 'silent': {\n break;\n }\n case 'info':\n case 'warn':\n case 'error': {\n console[level](message);\n break;\n }\n default:\n throw new AdyenCheckoutError('NETWORK_ERROR', message, { cause: error });\n }\n}\n\nexport function httpGet<T = any>(options: HttpOptions, data?: any): Promise<T> {\n return http<T>({ ...options, method: 'GET' }, data);\n}\n\nexport function httpPost<T = any>(options: HttpOptions, data?: any): Promise<T> {\n return http<T>({ ...options, method: 'POST' }, data);\n}\n"],"names":["http","options","data","headers","errorLevel","loadingContext","FALLBACK_CONTEXT","method","path","timeout","DEFAULT_HTTP_TIMEOUT","request","mode","cache","credentials","Accept","redirect","referrerPolicy","AbortSignal","signal","body","JSON","stringify","url","fetch","then","async","response","json","ok","errorCode","errorType","message","status","isAdyenApiErrorResponse","handleFetchError","errorMessage","catch","error","AdyenCheckoutError","level","console","cause","httpGet","httpPost"],"mappings":"yHA4BO,SAASA,EAAQC,EAAsBC,GAC1C,MAAMC,QAAEA,EAAU,GAAEC,WAAEA,EAAa,OAAMC,eAAEA,EAAiBC,EAAgBC,OAAEA,EAAS,MAAKC,KAAEA,EAAIC,QAAEA,EAAUC,GAAyBT,EAEjIU,EAAuB,CACzBJ,SACAK,KAAM,OACNC,MAAO,UACPC,YAAa,cACbX,QAAS,CACLY,OAAQ,oCACR,eAA2B,SAAXR,EAAoB,mBAAqB,gBACtDJ,GAEPa,SAAU,SACVC,eAAgB,gCACZC,aAAaT,SAAW,CAAEU,OAAQD,aAAaT,QAAQA,OACvDP,GAAQ,CAAEkB,KAAMC,KAAKC,UAAUpB,KAGjCqB,EAAM,GAAGlB,IAAiBG,IAEhC,OACIgB,MAAMD,EAAKZ,GACNc,MAAKC,MAAMC,IACR,MAAMzB,QAAayB,EAASC,OAE5B,GAAID,EAASE,GACT,OAAO3B,EAGX,GAlChB,SAAiCA,GAC7B,OAAOA,GAAQA,EAAK4B,WAAa5B,EAAK6B,WAAa7B,EAAK8B,SAAW9B,EAAK+B,MAC5E,CAgCoBC,CAAwBhC,GAExB,YADAiC,EAAiBjC,EAAK8B,QAAS5B,EAAYF,GAK/CiC,EADqBlC,EAAQmC,cAAgB,cAAcb,qBAC5BnB,EAAYF,EAC3C,IAMHmC,OAAOC,IAMJ,GAAIA,aAAiBC,EACjB,MAAMD,EAKVH,EADqBlC,EAAQmC,cAAgB,WAAWb,oBAAsBe,IAC/ClC,EAAYkC,EAAAA,GAG3D,CAEA,SAASH,EAAiBH,EAAiBQ,EAAmBF,GAC1D,OAAQE,GACJ,IAAK,SACD,MAEJ,IAAK,OACL,IAAK,OACL,IAAK,QACDC,QAAQD,GAAOR,GACf,MAEJ,QACI,MAAM,IAAIO,EAAmB,gBAAiBP,EAAS,CAAEU,MAAOJ,IAE5E,CAEO,SAASK,EAAiB1C,EAAsBC,GACnD,OAAOF,EAAQ,IAAKC,EAASM,OAAQ,OAASL,EAClD,CAEO,SAAS0C,EAAkB3C,EAAsBC,GACpD,OAAOF,EAAQ,IAAKC,EAASM,OAAQ,QAAUL,EACnD"}
@@ -1,2 +1,2 @@
1
- const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onError","onBalanceCheck","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],n=6e4;export{n as DEFAULT_HTTP_TIMEOUT,e as FALLBACK_CONTEXT,o as GENERIC_OPTIONS};
1
+ const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],n=6e4;export{n as DEFAULT_HTTP_TIMEOUT,e as FALLBACK_CONTEXT,o as GENERIC_OPTIONS};
2
2
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n '_environmentUrls',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onOrderUpdated',\n 'onPaymentMethodsRequest'\n];\n\nexport const DEFAULT_HTTP_TIMEOUT = 60000;\n\nexport default {\n FALLBACK_CONTEXT,\n GENERIC_OPTIONS,\n DEFAULT_HTTP_TIMEOUT\n};\n"],"names":["FALLBACK_CONTEXT","GENERIC_OPTIONS","DEFAULT_HTTP_TIMEOUT"],"mappings":"AAGaA,MAAAA,EAAmB,0DAEnBC,EAAkB,CAC3B,SACA,kBACA,cACA,cACA,mBACA,iBACA,OACA,UACA,QACA,UACA,YACA,gBACA,8BAGA,qBACA,kBACA,iBACA,eACA,WACA,kBACA,sBACA,WACA,UACA,iBACA,iBACA,iBACA,2BAGSC,EAAuB"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n '_environmentUrls',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onEnterKeyPressed',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onOrderUpdated',\n 'onPaymentMethodsRequest'\n];\n\nexport const DEFAULT_HTTP_TIMEOUT = 60000;\n\nexport default {\n FALLBACK_CONTEXT,\n GENERIC_OPTIONS,\n DEFAULT_HTTP_TIMEOUT\n};\n"],"names":["FALLBACK_CONTEXT","GENERIC_OPTIONS","DEFAULT_HTTP_TIMEOUT"],"mappings":"AAGaA,MAAAA,EAAmB,0DAEnBC,EAAkB,CAC3B,SACA,kBACA,cACA,cACA,mBACA,iBACA,OACA,UACA,QACA,UACA,YACA,gBACA,8BAGA,qBACA,kBACA,iBACA,eACA,WACA,kBACA,sBACA,WACA,oBACA,UACA,iBACA,iBACA,iBACA,2BAGSC,EAAuB"}
@@ -1,2 +1,2 @@
1
- import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import n from"./Analytics/Analytics.js";import{assertConfigurationPropertiesAreValid as i,processGlobalOptions as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as C}from"./Analytics/constants.js";import{THREEDS2_FULL as g}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import j from"./Services/get-translations.js";import{defaultProps as E}from"./core.defaultProps.js";import{formatLocale as A,formatCustomTranslations as P}from"../language/utils.js";import{resolveEnvironments as v}from"./Environment/Environment.js";class M{session;paymentMethodsResponse;modules;options;analyticsContext;loadingContext;cdnImagesUrl;cdnTranslationsUrl;components=[];static metadata={version:"6.0.0-beta.0",bundleType:"esm"};static registry=p;static setBundleType(t){M.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}constructor(t){i(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...E,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:n}=v(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=n,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const a=this.options.clientKey?.substr(0,4);if(("test"===a||"live"===a)&&!this.loadingContext.includes(a))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${a} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=M.metadata)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:n,...i}=t;return this.setOptions({...i,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(n),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await j(this.cdnTranslationsUrl,M.metadata.version,this.options.locale,this.options.translations)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=A(this.options.locale),this.options.translations=P(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===g?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:C,subtype:t.type,message:`${s} action was handled by the SDK`});const n={...this.getCorePropsForComponent(),...o};return e(this,p,t,n)}return this.handleCreateError()}update=(t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this))));remove=t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this);setOptions=t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}};getCorePropsForComponent(){return{...a(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:n({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:M.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}}export{M as default};
1
+ import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{assertConfigurationPropertiesAreValid as n,processGlobalOptions as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as g}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import E from"./Services/get-translations.js";import{defaultProps as j}from"./core.defaultProps.js";import{formatLocale as v,formatCustomTranslations as A}from"../language/utils.js";import{resolveEnvironments as M}from"./Environment/Environment.js";class P{session;paymentMethodsResponse;modules;options;analyticsContext;loadingContext;cdnImagesUrl;cdnTranslationsUrl;components=[];static metadata={version:"6.0.0-beta.1",bundleType:"esm"};static registry=p;static setBundleType(t){P.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}constructor(t){n(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...j,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=M(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const a=this.options.clientKey?.substring(0,4);if(("test"===a||"live"===a)&&!this.loadingContext.includes(a))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${a} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);if("pub."===a)throw new y("IMPLEMENTATION_ERROR",`Error: the value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`);this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=P.metadata)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await E(this.cdnTranslationsUrl,P.metadata.version,this.options.locale,this.options.translations)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=v(this.options.locale),this.options.translations=A(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:g,subtype:t.type,message:`${s} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return e(this,p,t,i)}return this.handleCreateError()}update=(t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this))));remove=t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this);setOptions=t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}};getCorePropsForComponent(){return{...a(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:P.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}}export{P as default};
2
2
  //# sourceMappingURL=core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\n\nimport type { AnalyticsModule, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: Readonly<{\n risk: RiskModule;\n analytics: AnalyticsModule;\n resources: Resources;\n i18n: Language;\n srPanel: SRPanel;\n }>;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: process.env.VERSION,\n bundleType: process.env.BUNDLE_TYPE\n };\n\n public static registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substr(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n const translation = await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale, this.options.translations);\n return translation;\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...options,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount,\n bundleType: Core.metadata.bundleType\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","session","paymentMethodsResponse","modules","options","analyticsContext","loadingContext","cdnImagesUrl","cdnTranslationsUrl","components","static","version","bundleType","registry","setBundleType","type","metadata","register","items","add","getComponent","txVariant","constructor","props","assertConfigurationPropertiesAreValid","this","createFromAction","bind","setOptions","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","environment","_environmentUrls","Session","clientKey","clientKeyType","substr","includes","AdyenCheckoutError","api","exposeLibraryMetadata","window","initialize","initializeCore","validateCoreConfiguration","createCoreModules","setupSession","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","translations","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","cleanupFinalResult","onPaymentCompleted","onPaymentFailed","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","getCorePropsForComponent","getComponentForAction","handleCreateError","update","forEach","newProps","remove","filter","c","_id","unmount","processGlobalOptions","core","i18n","cdnContext","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig"],"mappings":"kvCA2BA,MAAMA,EACKC,QACAC,uBACAC,QAOAC,QAEAC,iBACAC,eACAC,aACAC,mBAECC,WAA0B,GAElCC,gBAAkC,CAC9BC,QAAS,eACTC,WA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AQsD,OACrBU,eACAgE,mBAAoB3G,KAAKrB,QAAQgE,eAErCiE,QAAS,IAAIC,EAAQ7G,KAAM,IAAKA,KAAKrB,QAAQmI,YAErD"}
1
+ {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\n\nimport type { AnalyticsModule, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: Readonly<{\n risk: RiskModule;\n analytics: AnalyticsModule;\n resources: Resources;\n i18n: Language;\n srPanel: SRPanel;\n }>;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: process.env.VERSION,\n bundleType: process.env.BUNDLE_TYPE\n };\n\n public static registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: the value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n const translation = await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale, this.options.translations);\n return translation;\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...options,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount,\n bundleType: Core.metadata.bundleType\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","session","paymentMethodsResponse","modules","options","analyticsContext","loadingContext","cdnImagesUrl","cdnTranslationsUrl","components","static","version","bundleType","registry","setBundleType","type","metadata","register","items","add","getComponent","txVariant","constructor","props","assertConfigurationPropertiesAreValid","this","createFromAction","bind","setOptions","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","environment","_environmentUrls","Session","clientKey","clientKeyType","substring","includes","AdyenCheckoutError","api","exposeLibraryMetadata","window","initialize","initializeCore","validateCoreConfiguration","createCoreModules","setupSession","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","translations","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","cleanupFinalResult","onPaymentCompleted","onPaymentFailed","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","getCorePropsForComponent","getComponentForAction","handleCreateError","update","forEach","newProps","remove","filter","c","_id","unmount","processGlobalOptions","core","i18n","cdnContext","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig"],"mappings":"kvCA2BA,MAAMA,EACKC,QACAC,uBACAC,QAOAC,QAEAC,iBACAC,eACAC,aACAC,mBAECC,WAA0B,GAElCC,gBAAkC,CAC9BC,QAAS,eACTC,WAAY,OAGhBF,gB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UAAW,IAAIC,EAAUzG,KAAKlB,cAC9B0G,KAAM,IAAIkB,EAAS,CACfzE,OAAQjC,KAAKrB,QAAQsD,OACrBU,eACAgE,mBAAoB3G,KAAKrB,QAAQgE,eAErCiE,QAAS,IAAIC,EAAQ7G,KAAM,IAAKA,KAAKrB,QAAQmI,YAErD"}
@@ -1,2 +1,2 @@
1
- import{GENERIC_OPTIONS as e}from"./config.js";function o(o){return Object.keys(o).reduce(((n,t)=>(e.includes(t)&&(n[t]=o[t]),n)),{})}function n(e){const o=(e=>e)(["session","environment","_environmentUrls","showPayButton","clientKey","locale","translations","paymentMethodsResponse","amount","secondaryAmount","countryCode","allowPaymentMethods","removePaymentMethods","srConfig","analytics","risk","order","exposeLibraryMetadata","beforeRedirect","beforeSubmit","onPaymentCompleted","onPaymentFailed","onSubmit","onAdditionalDetails","onActionHandled","onChange","onError","onBalanceCheck","onOrderRequest","onPaymentMethodsRequest","onOrderCancel","onOrderUpdated","loadingContext"]);Object.keys(e).forEach((e=>{o.includes(e)||console.warn(`AdyenCheckout - Configuration property "${e}" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to "paymentMethodsConfiguration" object`)}))}export{n as assertConfigurationPropertiesAreValid,o as processGlobalOptions};
1
+ import{GENERIC_OPTIONS as e}from"./config.js";function o(o){return Object.keys(o).reduce(((n,t)=>(e.includes(t)&&(n[t]=o[t]),n)),{})}function n(e){const o=(e=>e)(["session","environment","_environmentUrls","showPayButton","clientKey","locale","translations","paymentMethodsResponse","amount","secondaryAmount","countryCode","allowPaymentMethods","removePaymentMethods","srConfig","analytics","risk","order","exposeLibraryMetadata","beforeRedirect","beforeSubmit","onPaymentCompleted","onPaymentFailed","onSubmit","onAdditionalDetails","onActionHandled","onChange","onError","onBalanceCheck","onOrderRequest","onPaymentMethodsRequest","onOrderCancel","onOrderUpdated","loadingContext","onEnterKeyPressed"]);Object.keys(e).forEach((e=>{o.includes(e)||console.warn(`AdyenCheckout - Configuration property "${e}" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to "paymentMethodsConfiguration" object`)}))}export{n as assertConfigurationPropertiesAreValid,o as processGlobalOptions};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/core/utils.ts"],"sourcesContent":["import { GENERIC_OPTIONS } from './config';\nimport type { CoreConfiguration } from './types';\n\n/**\n * Filter properties in a global configuration object from an allow list (GENERIC_OPTIONS)\n * @param globalOptions -\n * @returns any\n */\nexport function processGlobalOptions(globalOptions) {\n return Object.keys(globalOptions).reduce((r, e) => {\n if (GENERIC_OPTIONS.includes(e)) r[e] = globalOptions[e];\n return r;\n }, {});\n}\n\n/**\n * Validates that there is no unknown property as part of the CoreConfiguration.\n * The validator makes sure to throw a lint error in case a property is added to CoreConfiguration, but it is not added here\n *\n * @param props - AdyenCheckout props\n */\nexport function assertConfigurationPropertiesAreValid(propsSetByMerchant: CoreConfiguration): void {\n /** Helper that creates a function that validates the array contain ALL CoreConfiguration properties in it */\n function createConfigurationKeysValidator<T>() {\n const arrayOfAll =\n <T>() =>\n <U extends T[]>(array: U & ([T] extends [U[number]] ? unknown : 'Invalid')) =>\n array;\n const arrayWithAllKeys = arrayOfAll<T>();\n return arrayWithAllKeys;\n }\n\n const validator = createConfigurationKeysValidator<keyof CoreConfiguration>();\n const possibleFields = validator([\n 'session',\n 'environment',\n '_environmentUrls',\n 'showPayButton',\n 'clientKey',\n 'locale',\n 'translations',\n 'paymentMethodsResponse',\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'allowPaymentMethods',\n 'removePaymentMethods',\n 'srConfig',\n 'analytics',\n 'risk',\n 'order',\n 'exposeLibraryMetadata',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'onSubmit',\n 'onAdditionalDetails',\n 'onActionHandled',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onPaymentMethodsRequest',\n 'onOrderCancel',\n 'onOrderUpdated',\n 'loadingContext'\n ]);\n\n Object.keys(propsSetByMerchant).forEach((prop: keyof CoreConfiguration) => {\n if (!possibleFields.includes(prop)) {\n console.warn(\n `AdyenCheckout - Configuration property \"${prop}\" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to \"paymentMethodsConfiguration\" object`\n );\n }\n });\n}\n"],"names":["processGlobalOptions","globalOptions","Object","keys","reduce","r","e","GENERIC_OPTIONS","includes","assertConfigurationPropertiesAreValid","propsSetByMerchant","possibleFields","array","validator","forEach","prop","console","warn"],"mappings":"8CAQO,SAASA,EAAqBC,GACjC,OAAOC,OAAOC,KAAKF,GAAeG,QAAO,CAACC,EAAGC,KACrCC,EAAgBC,SAASF,KAAID,EAAEC,GAAKL,EAAcK,IAC/CD,IACR,CAAC,EACR,CAQO,SAASI,EAAsCC,GAWlD,MACMC,EAPE,CAAgBC,GACZA,EAMWC,CAAU,CAC7B,UACA,cACA,mBACA,gBACA,YACA,SACA,eACA,yBACA,SACA,kBACA,cACA,sBACA,uBACA,WACA,YACA,OACA,QACA,wBACA,iBACA,eACA,qBACA,kBACA,WACA,sBACA,kBACA,WACA,UACA,iBACA,iBACA,0BACA,gBACA,iBACA,mBAGJX,OAAOC,KAAKO,GAAoBI,SAASC,IAChCJ,EAAeH,SAASO,IACzBC,QAAQC,KACJ,2CAA2CF,4NAEnD,GAER"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/core/utils.ts"],"sourcesContent":["import { GENERIC_OPTIONS } from './config';\nimport type { CoreConfiguration } from './types';\n\n/**\n * Filter properties in a global configuration object from an allow list (GENERIC_OPTIONS)\n * @param globalOptions -\n * @returns any\n */\nexport function processGlobalOptions(globalOptions) {\n return Object.keys(globalOptions).reduce((r, e) => {\n if (GENERIC_OPTIONS.includes(e)) r[e] = globalOptions[e];\n return r;\n }, {});\n}\n\n/**\n * Validates that there is no unknown property as part of the CoreConfiguration.\n * The validator makes sure to throw a lint error in case a property is added to CoreConfiguration, but it is not added here\n *\n * @param props - AdyenCheckout props\n */\nexport function assertConfigurationPropertiesAreValid(propsSetByMerchant: CoreConfiguration): void {\n /** Helper that creates a function that validates the array contain ALL CoreConfiguration properties in it */\n function createConfigurationKeysValidator<T>() {\n const arrayOfAll =\n <T>() =>\n <U extends T[]>(array: U & ([T] extends [U[number]] ? unknown : 'Invalid')) =>\n array;\n const arrayWithAllKeys = arrayOfAll<T>();\n return arrayWithAllKeys;\n }\n\n const validator = createConfigurationKeysValidator<keyof CoreConfiguration>();\n const possibleFields = validator([\n 'session',\n 'environment',\n '_environmentUrls',\n 'showPayButton',\n 'clientKey',\n 'locale',\n 'translations',\n 'paymentMethodsResponse',\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'allowPaymentMethods',\n 'removePaymentMethods',\n 'srConfig',\n 'analytics',\n 'risk',\n 'order',\n 'exposeLibraryMetadata',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'onSubmit',\n 'onAdditionalDetails',\n 'onActionHandled',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onPaymentMethodsRequest',\n 'onOrderCancel',\n 'onOrderUpdated',\n 'loadingContext',\n 'onEnterKeyPressed'\n ]);\n\n Object.keys(propsSetByMerchant).forEach((prop: keyof CoreConfiguration) => {\n if (!possibleFields.includes(prop)) {\n console.warn(\n `AdyenCheckout - Configuration property \"${prop}\" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to \"paymentMethodsConfiguration\" object`\n );\n }\n });\n}\n"],"names":["processGlobalOptions","globalOptions","Object","keys","reduce","r","e","GENERIC_OPTIONS","includes","assertConfigurationPropertiesAreValid","propsSetByMerchant","possibleFields","array","validator","forEach","prop","console","warn"],"mappings":"8CAQO,SAASA,EAAqBC,GACjC,OAAOC,OAAOC,KAAKF,GAAeG,QAAO,CAACC,EAAGC,KACrCC,EAAgBC,SAASF,KAAID,EAAEC,GAAKL,EAAcK,IAC/CD,IACR,CAAC,EACR,CAQO,SAASI,EAAsCC,GAWlD,MACMC,EAPE,CAAgBC,GACZA,EAMWC,CAAU,CAC7B,UACA,cACA,mBACA,gBACA,YACA,SACA,eACA,yBACA,SACA,kBACA,cACA,sBACA,uBACA,WACA,YACA,OACA,QACA,wBACA,iBACA,eACA,qBACA,kBACA,WACA,sBACA,kBACA,WACA,UACA,iBACA,iBACA,0BACA,gBACA,iBACA,iBACA,sBAGJX,OAAOC,KAAKO,GAAoBI,SAASC,IAChCJ,EAAeH,SAASO,IACzBC,QAAQC,KACJ,2CAA2CF,4NAEnD,GAER"}