@adyen/adyen-web 6.8.0 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (440) hide show
  1. package/dist/cjs/adyen.css +21 -17
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +265 -71
  6. package/dist/es/_virtual/index.js +1 -1
  7. package/dist/es/_virtual/index2.js +2 -0
  8. package/dist/es/_virtual/index2.js.map +1 -0
  9. package/dist/es/adyen.css +21 -17
  10. package/dist/es/adyen.css.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/Ach/components/AchInput/components/AchSFInput.js +1 -1
  14. package/dist/es/components/Ach/components/AchInput/components/AchSFInput.js.map +1 -1
  15. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  16. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  17. package/dist/es/components/ApplePay/components/ApplePayButton.js +1 -1
  18. package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
  19. package/dist/es/components/ApplePay/defaultProps.js +1 -1
  20. package/dist/es/components/ApplePay/defaultProps.js.map +1 -1
  21. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js +2 -0
  22. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -0
  23. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -0
  24. package/dist/es/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js +2 -0
  25. package/dist/es/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js.map +1 -0
  26. package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js +2 -0
  27. package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -0
  28. package/dist/es/components/ApplePay/utils/payment-request.js +2 -0
  29. package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -0
  30. package/dist/es/components/ApplePay/utils/resolve-supported-version.js +2 -0
  31. package/dist/es/components/ApplePay/utils/resolve-supported-version.js.map +1 -0
  32. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  33. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  34. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  35. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  36. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  37. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  38. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  39. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  40. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  41. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  42. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  43. package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
  44. package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  45. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  46. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  47. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  48. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  49. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  50. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  51. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  52. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  53. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  54. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  55. package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js +1 -1
  56. package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  57. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  58. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  59. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  60. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  61. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  62. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  63. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  64. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  65. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  66. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  67. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  68. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  69. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  70. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  71. package/dist/es/components/Giftcard/components/GiftcardNumberField.js +1 -1
  72. package/dist/es/components/Giftcard/components/GiftcardNumberField.js.map +1 -1
  73. package/dist/es/components/Giftcard/components/GiftcardPinField.js +1 -1
  74. package/dist/es/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  75. package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
  76. package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
  77. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  78. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  79. package/dist/es/components/MBWay/MBWay.js +1 -1
  80. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  81. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  82. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  83. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  84. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  85. package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
  86. package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
  87. package/dist/es/components/PayTo/PayTo.js +2 -0
  88. package/dist/es/components/PayTo/PayTo.js.map +1 -0
  89. package/dist/es/components/PayTo/components/BSBInput.js +2 -0
  90. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -0
  91. package/dist/es/components/PayTo/components/IdentifierSelector.js +2 -0
  92. package/dist/es/components/PayTo/components/IdentifierSelector.js.map +1 -0
  93. package/dist/es/components/PayTo/components/MandateSummary.js +2 -0
  94. package/dist/es/components/PayTo/components/MandateSummary.js.map +1 -0
  95. package/dist/es/components/PayTo/components/PayIDInput.js +2 -0
  96. package/dist/es/components/PayTo/components/PayIDInput.js.map +1 -0
  97. package/dist/es/components/PayTo/components/PayToComponent.js +2 -0
  98. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -0
  99. package/dist/es/components/PayTo/components/PayToInstructions.js +2 -0
  100. package/dist/es/components/PayTo/components/PayToInstructions.js.map +1 -0
  101. package/dist/es/components/PayTo/components/PayToNameFields.js +2 -0
  102. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -0
  103. package/dist/es/components/PayTo/components/PayToPhone.js +2 -0
  104. package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -0
  105. package/dist/es/components/PayTo/components/validate.js +2 -0
  106. package/dist/es/components/PayTo/components/validate.js.map +1 -0
  107. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  108. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  109. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  110. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  111. package/dist/es/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +1 -1
  112. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  113. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  114. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  115. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  116. package/dist/es/components/components-name-map.js +1 -1
  117. package/dist/es/components/components-name-map.js.map +1 -1
  118. package/dist/es/components/index.js +1 -1
  119. package/dist/es/components/internal/Alert/Alert.js +1 -1
  120. package/dist/es/components/internal/Alert/Alert.js.map +1 -1
  121. package/dist/es/components/internal/Await/Await.js +1 -1
  122. package/dist/es/components/internal/Await/Await.js.map +1 -1
  123. package/dist/es/components/internal/Button/Button.js +1 -1
  124. package/dist/es/components/internal/Button/Button.js.map +1 -1
  125. package/dist/es/components/internal/ButtonGroup/ButtonGroup.js +1 -1
  126. package/dist/es/components/internal/ButtonGroup/ButtonGroup.js.map +1 -1
  127. package/dist/es/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js +1 -1
  128. package/dist/es/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js.map +1 -1
  129. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js +1 -1
  130. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js.map +1 -1
  131. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  132. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  133. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js +1 -1
  134. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js.map +1 -1
  135. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  136. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  137. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  138. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  139. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  140. package/dist/es/components/internal/ContentSeparator/ContentSeparator.js +1 -1
  141. package/dist/es/components/internal/ContentSeparator/ContentSeparator.js.map +1 -1
  142. package/dist/es/components/internal/DetailsTable/DetailsTable.js +2 -0
  143. package/dist/es/components/internal/DetailsTable/DetailsTable.js.map +1 -0
  144. package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
  145. package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  146. package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  147. package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  148. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  149. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  150. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  151. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  152. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  153. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  154. package/dist/es/components/internal/FormFields/RadioGroup/RadioGroup.js +1 -1
  155. package/dist/es/components/internal/FormFields/RadioGroup/RadioGroup.js.map +1 -1
  156. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  157. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  158. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  159. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  160. package/dist/es/components/internal/FormFields/Select/components/SelectList.js +1 -1
  161. package/dist/es/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  162. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  163. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  164. package/dist/es/components/internal/IFrame/Iframe.js +1 -1
  165. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  166. package/dist/es/components/internal/Icon/Icon.js +1 -1
  167. package/dist/es/components/internal/Icon/Icon.js.map +1 -1
  168. package/dist/es/components/internal/Img/Img.js +1 -1
  169. package/dist/es/components/internal/Img/Img.js.map +1 -1
  170. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js +1 -1
  171. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js.map +1 -1
  172. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  173. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  174. package/dist/es/components/internal/Modal/Modal.js +1 -1
  175. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  176. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  177. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  178. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  179. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js +2 -0
  180. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js.map +1 -0
  181. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +2 -0
  182. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -0
  183. package/dist/es/components/internal/PhoneInput/validate.js +1 -1
  184. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js +1 -1
  185. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js.map +1 -1
  186. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  187. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  188. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  189. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  190. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  191. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  192. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  193. package/dist/es/components/internal/Voucher/Voucher.js +1 -1
  194. package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
  195. package/dist/es/components/tx-variants.js +1 -1
  196. package/dist/es/components/tx-variants.js.map +1 -1
  197. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  198. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  199. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  200. package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
  201. package/dist/es/core/core.js +1 -1
  202. package/dist/es/core/core.js.map +1 -1
  203. package/dist/es/core/utils.js +1 -1
  204. package/dist/es/core/utils.js.map +1 -1
  205. package/dist/es/external/classnames/index.js +2 -2
  206. package/dist/es/external/classnames/index.js.map +1 -1
  207. package/dist/es/index.d.ts +265 -71
  208. package/dist/es/index.js +1 -1
  209. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  210. package/dist/es/utils/Validator/Validator.js.map +1 -1
  211. package/dist/es/utils/inIframe.js +2 -0
  212. package/dist/es/utils/inIframe.js.map +1 -0
  213. package/dist/es-legacy/_virtual/index.js +1 -1
  214. package/dist/es-legacy/_virtual/index2.js +2 -0
  215. package/dist/es-legacy/_virtual/index2.js.map +1 -0
  216. package/dist/es-legacy/adyen.css +21 -17
  217. package/dist/es-legacy/adyen.css.map +1 -1
  218. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
  219. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
  220. package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js +1 -1
  221. package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js.map +1 -1
  222. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  223. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  224. package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js +1 -1
  225. package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js.map +1 -1
  226. package/dist/es-legacy/components/ApplePay/defaultProps.js +1 -1
  227. package/dist/es-legacy/components/ApplePay/defaultProps.js.map +1 -1
  228. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js +2 -0
  229. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -0
  230. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -0
  231. package/dist/es-legacy/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js +2 -0
  232. package/dist/es-legacy/components/ApplePay/utils/format-applepay-contact-to-adyen-format.js.map +1 -0
  233. package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js +2 -0
  234. package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -0
  235. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +2 -0
  236. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -0
  237. package/dist/es-legacy/components/ApplePay/utils/resolve-supported-version.js +2 -0
  238. package/dist/es-legacy/components/ApplePay/utils/resolve-supported-version.js.map +1 -0
  239. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  240. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  241. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  242. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  243. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  244. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  245. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  246. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  247. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  248. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  249. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  250. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
  251. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  252. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  253. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  254. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  255. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  256. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  257. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  258. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  259. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  260. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  261. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  262. package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js +1 -1
  263. package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  264. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  265. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  266. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  267. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  268. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  269. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  270. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  271. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  272. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  273. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  274. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  275. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  276. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  277. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  278. package/dist/es-legacy/components/Giftcard/components/GiftcardNumberField.js +1 -1
  279. package/dist/es-legacy/components/Giftcard/components/GiftcardNumberField.js.map +1 -1
  280. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js +1 -1
  281. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  282. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
  283. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
  284. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  285. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  286. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  287. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  288. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  289. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  290. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  291. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  292. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  293. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  294. package/dist/es-legacy/components/PayTo/PayTo.js +2 -0
  295. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -0
  296. package/dist/es-legacy/components/PayTo/components/BSBInput.js +2 -0
  297. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -0
  298. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js +2 -0
  299. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js.map +1 -0
  300. package/dist/es-legacy/components/PayTo/components/MandateSummary.js +2 -0
  301. package/dist/es-legacy/components/PayTo/components/MandateSummary.js.map +1 -0
  302. package/dist/es-legacy/components/PayTo/components/PayIDInput.js +2 -0
  303. package/dist/es-legacy/components/PayTo/components/PayIDInput.js.map +1 -0
  304. package/dist/es-legacy/components/PayTo/components/PayToComponent.js +2 -0
  305. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -0
  306. package/dist/es-legacy/components/PayTo/components/PayToInstructions.js +2 -0
  307. package/dist/es-legacy/components/PayTo/components/PayToInstructions.js.map +1 -0
  308. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +2 -0
  309. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -0
  310. package/dist/es-legacy/components/PayTo/components/PayToPhone.js +2 -0
  311. package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -0
  312. package/dist/es-legacy/components/PayTo/components/validate.js +2 -0
  313. package/dist/es-legacy/components/PayTo/components/validate.js.map +1 -0
  314. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  315. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  316. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  317. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  318. package/dist/es-legacy/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +1 -1
  319. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  320. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  321. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  322. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  323. package/dist/es-legacy/components/components-name-map.js +1 -1
  324. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  325. package/dist/es-legacy/components/index.js +1 -1
  326. package/dist/es-legacy/components/internal/Alert/Alert.js +1 -1
  327. package/dist/es-legacy/components/internal/Alert/Alert.js.map +1 -1
  328. package/dist/es-legacy/components/internal/Await/Await.js +1 -1
  329. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  330. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  331. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  332. package/dist/es-legacy/components/internal/ButtonGroup/ButtonGroup.js +1 -1
  333. package/dist/es-legacy/components/internal/ButtonGroup/ButtonGroup.js.map +1 -1
  334. package/dist/es-legacy/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js +1 -1
  335. package/dist/es-legacy/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js.map +1 -1
  336. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js +1 -1
  337. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js.map +1 -1
  338. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  339. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  340. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js +1 -1
  341. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js.map +1 -1
  342. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  343. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  344. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  345. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  346. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  347. package/dist/es-legacy/components/internal/ContentSeparator/ContentSeparator.js +1 -1
  348. package/dist/es-legacy/components/internal/ContentSeparator/ContentSeparator.js.map +1 -1
  349. package/dist/es-legacy/components/internal/DetailsTable/DetailsTable.js +2 -0
  350. package/dist/es-legacy/components/internal/DetailsTable/DetailsTable.js.map +1 -0
  351. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
  352. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  353. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  354. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  355. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  356. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  357. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  358. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  359. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  360. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  361. package/dist/es-legacy/components/internal/FormFields/RadioGroup/RadioGroup.js +1 -1
  362. package/dist/es-legacy/components/internal/FormFields/RadioGroup/RadioGroup.js.map +1 -1
  363. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  364. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  365. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  366. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  367. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
  368. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  369. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  370. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  371. package/dist/es-legacy/components/internal/IFrame/Iframe.js +1 -1
  372. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  373. package/dist/es-legacy/components/internal/Icon/Icon.js +1 -1
  374. package/dist/es-legacy/components/internal/Icon/Icon.js.map +1 -1
  375. package/dist/es-legacy/components/internal/Img/Img.js +1 -1
  376. package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
  377. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js +1 -1
  378. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js.map +1 -1
  379. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  380. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  381. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  382. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  383. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  384. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  385. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  386. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +2 -0
  387. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -0
  388. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +2 -0
  389. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -0
  390. package/dist/es-legacy/components/internal/PhoneInput/validate.js +1 -1
  391. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js +1 -1
  392. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js.map +1 -1
  393. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  394. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  395. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  396. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  397. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  398. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  399. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  400. package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
  401. package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
  402. package/dist/es-legacy/components/tx-variants.js +1 -1
  403. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  404. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  405. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  406. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  407. package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
  408. package/dist/es-legacy/core/core.js +1 -1
  409. package/dist/es-legacy/core/core.js.map +1 -1
  410. package/dist/es-legacy/core/utils.js +1 -1
  411. package/dist/es-legacy/core/utils.js.map +1 -1
  412. package/dist/es-legacy/external/classnames/index.js +2 -2
  413. package/dist/es-legacy/external/classnames/index.js.map +1 -1
  414. package/dist/es-legacy/index.js +1 -1
  415. package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
  416. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  417. package/dist/es-legacy/utils/inIframe.js +2 -0
  418. package/dist/es-legacy/utils/inIframe.js.map +1 -0
  419. package/package.json +29 -23
  420. package/styles/adyen.css +21 -17
  421. package/dist/es/components/ApplePay/ApplePayService.js.map +0 -1
  422. package/dist/es/components/ApplePay/config.js +0 -2
  423. package/dist/es/components/ApplePay/config.js.map +0 -1
  424. package/dist/es/components/ApplePay/payment-request.js +0 -2
  425. package/dist/es/components/ApplePay/payment-request.js.map +0 -1
  426. package/dist/es/components/ApplePay/utils.js +0 -2
  427. package/dist/es/components/ApplePay/utils.js.map +0 -1
  428. package/dist/es/components/internal/PhoneInput/PhoneInput.js +0 -2
  429. package/dist/es/components/internal/PhoneInput/PhoneInput.js.map +0 -1
  430. package/dist/es-legacy/components/ApplePay/ApplePayService.js.map +0 -1
  431. package/dist/es-legacy/components/ApplePay/config.js +0 -2
  432. package/dist/es-legacy/components/ApplePay/config.js.map +0 -1
  433. package/dist/es-legacy/components/ApplePay/payment-request.js +0 -2
  434. package/dist/es-legacy/components/ApplePay/payment-request.js.map +0 -1
  435. package/dist/es-legacy/components/ApplePay/utils.js +0 -2
  436. package/dist/es-legacy/components/ApplePay/utils.js.map +0 -1
  437. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js +0 -2
  438. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js.map +0 -1
  439. /package/dist/es/components/ApplePay/{ApplePayService.js → services/ApplePayService.js} +0 -0
  440. /package/dist/es-legacy/components/ApplePay/{ApplePayService.js → services/ApplePayService.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"cardType.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/utils/cardType.ts"],"sourcesContent":["import { CardObject } from '../../types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\n\nlet shortestPermittedCardLength;\n\ninterface CardType {\n __NO_BRAND?: string;\n cards?: CardObject[];\n}\n\nconst CardType: CardType = {};\nCardType.__NO_BRAND = 'noBrand';\n\nCardType.cards = [];\n\nCardType.cards.push({\n cardType: 'mc',\n startingRules: [51, 52, 53, 54, 55, 22, 23, 24, 25, 26, 27],\n permittedLengths: [16],\n pattern: /^(5[1-5][0-9]{0,14}|2[2-7][0-9]{0,14})$/,\n securityCode: 'CVC'\n});\n\nCardType.cards.push({ cardType: 'visadankort', startingRules: [4571], permittedLengths: [16], pattern: /^(4571)[0-9]{0,12}$/ });\n\nCardType.cards.push({\n cardType: 'visa',\n startingRules: [4],\n permittedLengths: [13, 16, 19],\n pattern: /^4[0-9]{0,18}$/,\n securityCode: 'CVV'\n});\n\nCardType.cards.push({ cardType: 'amex', startingRules: [34, 37], permittedLengths: [15], pattern: /^3[47][0-9]{0,13}$/, securityCode: 'CID' });\n\nCardType.cards.push({ cardType: 'diners', startingRules: [36], permittedLengths: [14, 16], pattern: /^(36)[0-9]{0,12}$/ });\n\nCardType.cards.push({ cardType: 'maestrouk', startingRules: [6759], permittedLengths: [16, 18, 19], pattern: /^(6759)[0-9]{0,15}$/ });\n\nCardType.cards.push({ cardType: 'solo', startingRules: [6767], permittedLengths: [16, 18, 19], pattern: /^(6767)[0-9]{0,15}$/ });\n\nCardType.cards.push({\n cardType: 'laser',\n startingRules: [6304, 6706, 677117, 677120],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(6304|6706|6709|6771)[0-9]{0,15}$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({\n cardType: 'discover',\n startingRules: [6011, 644, 645, 646, 647, 648, 649, 65],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(6011[0-9]{0,12}|(644|645|646|647|648|649)[0-9]{0,13}|65[0-9]{0,14})$/\n});\n\nCardType.cards.push({\n cardType: 'jcb',\n startingRules: [3528, 3529, 353, 354, 355, 356, 357, 358],\n permittedLengths: [16, 19],\n pattern: /^(352[8,9]{1}[0-9]{0,15}|35[4-8]{1}[0-9]{0,16})$/,\n securityCode: 'CAV'\n});\n\nCardType.cards.push({\n cardType: 'bcmc',\n startingRules: [6703, 479658, 606005],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^((6703)[0-9]{0,15}|(479658|606005)[0-9]{0,13})$/,\n cvcPolicy: 'hidden'\n});\n\nCardType.cards.push({ cardType: 'bijcard', startingRules: [5100081], permittedLengths: [16], pattern: /^(5100081)[0-9]{0,9}$/ });\n\nCardType.cards.push({ cardType: 'dankort', startingRules: [5019], permittedLengths: [16], pattern: /^(5019)[0-9]{0,12}$/ });\n\nCardType.cards.push({ cardType: 'hipercard', startingRules: [606282], permittedLengths: [16], pattern: /^(606282)[0-9]{0,10}$/ });\n\n// Moved above maestro (from position below uatp) to stop maestro being recognised over cup\nCardType.cards.push({ cardType: 'cup', startingRules: [62, 81], permittedLengths: [14, 15, 16, 17, 18, 19], pattern: /^(62|81)[0-9]{0,17}$/ }); // orig & android v1 + modified to include our test cards (81...)\n\nCardType.cards.push({\n cardType: 'maestro',\n startingRules: [50, 56, 57, 58, 6],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(5[0|6-8][0-9]{0,17}|6[0-9]{0,18})$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({\n cardType: 'elo',\n // prettier-ignore\n startingRules: [506699, 50670, 50671, 50672, 50673, 50674, 50675, 50676, 506770, 506771, 506772, 506773, 506774, 506775, 506776, 506777, 506778, 401178, 438935, 451416, 457631, 457632, 504175, 627780, 636297, 636368],\n permittedLengths: [16],\n // prettier-ignore\n pattern:\n /^((((506699)|(506770)|(506771)|(506772)|(506773)|(506774)|(506775)|(506776)|(506777)|(506778)|(401178)|(438935)|(451416)|(457631)|(457632)|(504175)|(627780)|(636368)|(636297))[0-9]{0,10})|((50676)|(50675)|(50674)|(50673)|(50672)|(50671)|(50670))[0-9]{0,11})$/\n});\n\nCardType.cards.push({ cardType: 'uatp', startingRules: [1], permittedLengths: [15], pattern: /^1[0-9]{0,14}$/, cvcPolicy: 'optional' });\n\nCardType.cards.push({\n cardType: 'cartebancaire',\n startingRules: [4, 5, 6],\n permittedLengths: [16],\n pattern: /^[4-6][0-9]{0,15}$/\n});\n\nCardType.cards.push({ cardType: 'visaalphabankbonus', startingRules: [450903], permittedLengths: [16], pattern: /^(450903)[0-9]{0,10}$/ });\n\nCardType.cards.push({ cardType: 'mcalphabankbonus', startingRules: [510099], permittedLengths: [16], pattern: /^(510099)[0-9]{0,10}$/ });\n\nCardType.cards.push({\n cardType: 'hiper',\n startingRules: [637095, 637568, 637599, 637609, 637612],\n permittedLengths: [16],\n pattern: /^(637095|637568|637599|637609|637612)[0-9]{0,10}$/\n});\n\nCardType.cards.push({ cardType: 'oasis', startingRules: [982616], permittedLengths: [16], pattern: /^(982616)[0-9]{0,10}$/, cvcPolicy: 'optional' });\n\nCardType.cards.push({\n cardType: 'karenmillen',\n startingRules: [98261465],\n permittedLengths: [16],\n pattern: /^(98261465)[0-9]{0,8}$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({\n cardType: 'warehouse',\n startingRules: [982633],\n permittedLengths: [16],\n pattern: /^(982633)[0-9]{0,10}$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({ cardType: 'mir', startingRules: [220], permittedLengths: [16, 17, 18, 19], pattern: /^(220)[0-9]{0,16}$/ });\n\nCardType.cards.push({ cardType: 'codensa', startingRules: [590712], permittedLengths: [16], pattern: /^(590712)[0-9]{0,10}$/ });\n\nCardType.cards.push({\n cardType: 'naranja',\n startingRules: [377798, 377799, 402917, 402918, 527571, 527572, 589562],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(37|40|5[28])([279])\\d*$/\n});\n\n// TODO: 589657 clashes with naranja, rest ok\nCardType.cards.push({\n cardType: 'cabal',\n startingRules: [589657, 600691, 603522, 6042, 6043, 636908],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(58|6[03])([03469])\\d*$/\n});\n\nCardType.cards.push({\n cardType: 'shopping',\n startingRules: [2799, 589407, 603488],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(27|58|60)([39])\\d*$/\n});\n\nCardType.cards.push({ cardType: 'argencard', startingRules: [501], permittedLengths: [16, 17, 18, 19], pattern: /^(50)(1)\\d*$/ }); // NOTE: starting rule changed, from 501105, to not clash with dankort. Plus it now matches its regEx!\n\nCardType.cards.push({ cardType: 'troy', startingRules: [9792], permittedLengths: [16], pattern: /^(97)(9)\\d*$/ });\n\n// TODO: clashes with cabal\nCardType.cards.push({ cardType: 'forbrugsforeningen', startingRules: [600722], permittedLengths: [16], pattern: /^(60)(0)\\d*$/ });\n\nCardType.cards.push({\n cardType: 'vpay',\n startingRules: [401, 408, 413, 434, 435, 437, 439, 441, 442, 443, 444, 446, 447, 455, 458, 460, 461, 463, 466, 471, 479, 482, 483, 487],\n permittedLengths: [13, 14, 15, 16, 17, 18, 19],\n pattern: /^(40[1,8]|413|43[4,5]|44[1,2,3,4,6,7]|45[5,8]|46[0,1,3,6]|47[1,9]|48[2,3,7])[0-9]{0,16}$/ // ^(4[0-1|3-8][0-9]{1,17})$\n});\n\nCardType.cards.push({\n cardType: 'rupay',\n startingRules: [508528],\n permittedLengths: [16],\n // prettier-ignore\n pattern:\n /^(100003|508(2|[5-9])|60(69|[7-8])|652(1[5-9]|[2-5][0-9]|8[5-9])|65300[3-4]|8172([0-1]|[3-5]|7|9)|817(3[3-8]|40[6-9]|410)|35380([0-2]|[5-6]|9))[0-9]{0,12}$/\n});\n\nCardType.cards.push({\n cardType: 'ticket',\n expiryDatePolicy: 'hidden'\n});\n\nconst detectCard = (pCardNumber, pAvailableCards?) => {\n let matchedCards;\n let i;\n let len;\n\n if (pAvailableCards) {\n // Filter CardType.cards down to those that are found in pAvailableCards\n matchedCards = CardType.cards\n .filter(card => pAvailableCards.includes(card.cardType))\n // Further filter them to those with a regEx pattern that matches pCardNumber\n .filter(card => hasOwnProperty(card, 'pattern') && pCardNumber.match(card.pattern));\n\n // If we have matched cards: if there's only one - return it; else return the one with the longest startingRule\n if (matchedCards.length) {\n if (matchedCards.length === 1) {\n return matchedCards[0];\n }\n\n // Find longest rule for each matched card & store it as a property on the card\n for (i = 0, len = matchedCards.length; i < len; i += 1) {\n if (!matchedCards[i].longestRule) {\n const longestRule = matchedCards[i].startingRules.reduce((a, b) => (a > b ? a : b));\n // What we actually store is how many chars are in the rule\n matchedCards[i].longestRule = String(longestRule).length;\n }\n }\n\n // Based on each matched cards longest rule - find the card with the longest one!\n return matchedCards.reduce((a, b) => (a.longestRule >= b.longestRule ? a : b));\n }\n\n return { cardType: CardType.__NO_BRAND };\n }\n\n return { cardType: CardType.__NO_BRAND };\n};\n\nconst detectCardLength = (pCard, pUnformattedVal) => {\n let maxLength;\n let shortenedNewValue;\n let lengthDiff = 0;\n let reachedValidLength = false;\n let unformattedVal = pUnformattedVal;\n\n // Find the longest of the permitted card number lengths for this card brand\n const maxPermittedLength = pCard.cardType !== CardType.__NO_BRAND ? pCard.permittedLengths[pCard.permittedLengths.length - 1] : 0;\n\n // If the input value is longer than it's max permitted length then shorten it to that length\n if (maxPermittedLength && unformattedVal > maxPermittedLength) {\n lengthDiff = unformattedVal.length - maxPermittedLength;\n\n if (lengthDiff > 0) {\n unformattedVal = unformattedVal.substring(0, unformattedVal.length - lengthDiff);\n shortenedNewValue = unformattedVal;\n }\n }\n\n // If cardNumber has reached one of the cardBrand's 'permitted lengths' - mark it as 'valid'\n pCard.permittedLengths.forEach(pItem => {\n if (unformattedVal.length === pItem) {\n reachedValidLength = true;\n }\n });\n\n // If cardNumber is as long as the cardBrand's maximum permitted length then set the maxLength var\n if (unformattedVal.length === maxPermittedLength) {\n // Set maxlength to max + the right amount of spaces (one for every 4 digits, but not on the last block)\n const div = Math.floor(unformattedVal.length / 4);\n const mod = unformattedVal.length % 4;\n const numSpaces = mod > 0 ? div : div - 1;\n\n maxLength = maxPermittedLength + numSpaces;\n\n if (pCard.cardType.toLowerCase() === 'amex') {\n maxLength = maxPermittedLength + 2; // = 17 = 15 digits with space after 4th & 10th\n }\n }\n\n return {\n shortenedNewValue,\n maxLength,\n reachedValidLength\n };\n};\n\nconst getShortestPermittedCardLength = () => {\n if (!shortestPermittedCardLength) {\n let permittedLengthsArray = [];\n\n CardType.cards.forEach(pItem => {\n permittedLengthsArray = permittedLengthsArray.concat(pItem.permittedLengths ?? []);\n });\n\n shortestPermittedCardLength = Math.min.apply(null, permittedLengthsArray);\n }\n\n return shortestPermittedCardLength;\n};\n\nconst getCardByBrand = pBrand => {\n const cardType = CardType.cards.filter(card => card.cardType === pBrand);\n\n return cardType[0];\n};\n\nconst isGenericCardType = type => {\n if (!type) throw new Error('Error: isGenericCardType: type param has not been specified');\n return type === 'card' || type === 'scheme';\n};\n\nexport default {\n detectCard,\n detectCardLength,\n getShortestPermittedCardLength,\n getCardByBrand,\n isGenericCardType,\n __NO_BRAND: CardType.__NO_BRAND,\n allCards: CardType.cards\n};\n"],"names":["shortestPermittedCardLength","CardType","cards","push","cardType","startingRules","permittedLengths","pattern","securityCode","cvcPolicy","expiryDatePolicy","detectCard","pCardNumber","pAvailableCards","matchedCards","i","len","filter","card","includes","hasOwnProperty","match","length","longestRule","reduce","a","b","String","__NO_BRAND","detectCardLength","pCard","pUnformattedVal","maxLength","shortenedNewValue","lengthDiff","reachedValidLength","unformattedVal","maxPermittedLength","substring","forEach","pItem","div","Math","floor","toLowerCase","getShortestPermittedCardLength","permittedLengthsArray","concat","min","apply","getCardByBrand","pBrand","isGenericCardType","type","Error","allCards"],"mappings":"2EAGA,IAAIA,EAOJ,MAAMC,EAAqB,CAC3BA,WAAsB,UAEtBA,MAAiB,IAEjBA,EAASC,MAAMC,KAAK,CA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IAAIC,MAAM,+DAC3B,MAAgB,SAATD,GAA4B,WAATA,CAAS,EASnCzB,WAAY3B,EAAS2B,WACrB2B,SAAUtD,EAASC"}
1
+ {"version":3,"file":"cardType.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/utils/cardType.ts"],"sourcesContent":["import { CardObject } from '../../types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\n\nlet shortestPermittedCardLength;\n\ninterface CardType {\n __NO_BRAND?: string;\n cards?: CardObject[];\n}\n\nconst CardType: CardType = {};\nCardType.__NO_BRAND = 'noBrand';\n\nCardType.cards = [];\n\nCardType.cards.push({\n cardType: 'mc',\n startingRules: [51, 52, 53, 54, 55, 22, 23, 24, 25, 26, 27],\n permittedLengths: [16],\n pattern: /^(5[1-5][0-9]{0,14}|2[2-7][0-9]{0,14})$/,\n securityCode: 'CVC'\n});\n\nCardType.cards.push({ cardType: 'visadankort', startingRules: [4571], permittedLengths: [16], pattern: /^(4571)[0-9]{0,12}$/ });\n\nCardType.cards.push({\n cardType: 'visa',\n startingRules: [4],\n permittedLengths: [13, 16, 19],\n pattern: /^4[0-9]{0,18}$/,\n securityCode: 'CVV'\n});\n\nCardType.cards.push({ cardType: 'amex', startingRules: [34, 37], permittedLengths: [15], pattern: /^3[47][0-9]{0,13}$/, securityCode: 'CID' });\n\nCardType.cards.push({ cardType: 'diners', startingRules: [36], permittedLengths: [14, 15, 16, 17, 18, 19], pattern: /^(36)[0-9]{0,12}$/ });\n\nCardType.cards.push({ cardType: 'maestrouk', startingRules: [6759], permittedLengths: [16, 18, 19], pattern: /^(6759)[0-9]{0,15}$/ });\n\nCardType.cards.push({ cardType: 'solo', startingRules: [6767], permittedLengths: [16, 18, 19], pattern: /^(6767)[0-9]{0,15}$/ });\n\nCardType.cards.push({\n cardType: 'laser',\n startingRules: [6304, 6706, 677117, 677120],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(6304|6706|6709|6771)[0-9]{0,15}$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({\n cardType: 'discover',\n startingRules: [6011, 644, 645, 646, 647, 648, 649, 65],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(6011[0-9]{0,12}|(644|645|646|647|648|649)[0-9]{0,13}|65[0-9]{0,14})$/\n});\n\nCardType.cards.push({\n cardType: 'jcb',\n startingRules: [3528, 3529, 353, 354, 355, 356, 357, 358],\n permittedLengths: [16, 19],\n pattern: /^(352[8,9]{1}[0-9]{0,15}|35[4-8]{1}[0-9]{0,16})$/,\n securityCode: 'CAV'\n});\n\nCardType.cards.push({\n cardType: 'bcmc',\n startingRules: [6703, 479658, 606005],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^((6703)[0-9]{0,15}|(479658|606005)[0-9]{0,13})$/,\n cvcPolicy: 'hidden'\n});\n\nCardType.cards.push({ cardType: 'bijcard', startingRules: [5100081], permittedLengths: [16], pattern: /^(5100081)[0-9]{0,9}$/ });\n\nCardType.cards.push({ cardType: 'dankort', startingRules: [5019], permittedLengths: [16], pattern: /^(5019)[0-9]{0,12}$/ });\n\nCardType.cards.push({ cardType: 'hipercard', startingRules: [606282], permittedLengths: [16], pattern: /^(606282)[0-9]{0,10}$/ });\n\n// Moved above maestro (from position below uatp) to stop maestro being recognised over cup\nCardType.cards.push({ cardType: 'cup', startingRules: [62, 81], permittedLengths: [14, 15, 16, 17, 18, 19], pattern: /^(62|81)[0-9]{0,17}$/ }); // orig & android v1 + modified to include our test cards (81...)\n\nCardType.cards.push({\n cardType: 'maestro',\n startingRules: [50, 56, 57, 58, 6],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(5[0|6-8][0-9]{0,17}|6[0-9]{0,18})$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({\n cardType: 'elo',\n // prettier-ignore\n startingRules: [506699, 50670, 50671, 50672, 50673, 50674, 50675, 50676, 506770, 506771, 506772, 506773, 506774, 506775, 506776, 506777, 506778, 401178, 438935, 451416, 457631, 457632, 504175, 627780, 636297, 636368],\n permittedLengths: [16],\n // prettier-ignore\n pattern:\n /^((((506699)|(506770)|(506771)|(506772)|(506773)|(506774)|(506775)|(506776)|(506777)|(506778)|(401178)|(438935)|(451416)|(457631)|(457632)|(504175)|(627780)|(636368)|(636297))[0-9]{0,10})|((50676)|(50675)|(50674)|(50673)|(50672)|(50671)|(50670))[0-9]{0,11})$/\n});\n\nCardType.cards.push({ cardType: 'uatp', startingRules: [1], permittedLengths: [15], pattern: /^1[0-9]{0,14}$/, cvcPolicy: 'optional' });\n\nCardType.cards.push({\n cardType: 'cartebancaire',\n startingRules: [4, 5, 6],\n permittedLengths: [16],\n pattern: /^[4-6][0-9]{0,15}$/\n});\n\nCardType.cards.push({ cardType: 'visaalphabankbonus', startingRules: [450903], permittedLengths: [16], pattern: /^(450903)[0-9]{0,10}$/ });\n\nCardType.cards.push({ cardType: 'mcalphabankbonus', startingRules: [510099], permittedLengths: [16], pattern: /^(510099)[0-9]{0,10}$/ });\n\nCardType.cards.push({\n cardType: 'hiper',\n startingRules: [637095, 637568, 637599, 637609, 637612],\n permittedLengths: [16],\n pattern: /^(637095|637568|637599|637609|637612)[0-9]{0,10}$/\n});\n\nCardType.cards.push({ cardType: 'oasis', startingRules: [982616], permittedLengths: [16], pattern: /^(982616)[0-9]{0,10}$/, cvcPolicy: 'optional' });\n\nCardType.cards.push({\n cardType: 'karenmillen',\n startingRules: [98261465],\n permittedLengths: [16],\n pattern: /^(98261465)[0-9]{0,8}$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({\n cardType: 'warehouse',\n startingRules: [982633],\n permittedLengths: [16],\n pattern: /^(982633)[0-9]{0,10}$/,\n cvcPolicy: 'optional'\n});\n\nCardType.cards.push({ cardType: 'mir', startingRules: [220], permittedLengths: [16, 17, 18, 19], pattern: /^(220)[0-9]{0,16}$/ });\n\nCardType.cards.push({ cardType: 'codensa', startingRules: [590712], permittedLengths: [16], pattern: /^(590712)[0-9]{0,10}$/ });\n\nCardType.cards.push({\n cardType: 'naranja',\n startingRules: [377798, 377799, 402917, 402918, 527571, 527572, 589562],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(37|40|5[28])([279])\\d*$/\n});\n\n// TODO: 589657 clashes with naranja, rest ok\nCardType.cards.push({\n cardType: 'cabal',\n startingRules: [589657, 600691, 603522, 6042, 6043, 636908],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(58|6[03])([03469])\\d*$/\n});\n\nCardType.cards.push({\n cardType: 'shopping',\n startingRules: [2799, 589407, 603488],\n permittedLengths: [16, 17, 18, 19],\n pattern: /^(27|58|60)([39])\\d*$/\n});\n\nCardType.cards.push({ cardType: 'argencard', startingRules: [501], permittedLengths: [16, 17, 18, 19], pattern: /^(50)(1)\\d*$/ }); // NOTE: starting rule changed, from 501105, to not clash with dankort. Plus it now matches its regEx!\n\nCardType.cards.push({ cardType: 'troy', startingRules: [9792], permittedLengths: [16], pattern: /^(97)(9)\\d*$/ });\n\n// TODO: clashes with cabal\nCardType.cards.push({ cardType: 'forbrugsforeningen', startingRules: [600722], permittedLengths: [16], pattern: /^(60)(0)\\d*$/ });\n\nCardType.cards.push({\n cardType: 'vpay',\n startingRules: [401, 408, 413, 434, 435, 437, 439, 441, 442, 443, 444, 446, 447, 455, 458, 460, 461, 463, 466, 471, 479, 482, 483, 487],\n permittedLengths: [13, 14, 15, 16, 17, 18, 19],\n pattern: /^(40[1,8]|413|43[4,5]|44[1,2,3,4,6,7]|45[5,8]|46[0,1,3,6]|47[1,9]|48[2,3,7])[0-9]{0,16}$/ // ^(4[0-1|3-8][0-9]{1,17})$\n});\n\nCardType.cards.push({\n cardType: 'rupay',\n startingRules: [508528],\n permittedLengths: [16],\n // prettier-ignore\n pattern:\n /^(100003|508(2|[5-9])|60(69|[7-8])|652(1[5-9]|[2-5][0-9]|8[5-9])|65300[3-4]|8172([0-1]|[3-5]|7|9)|817(3[3-8]|40[6-9]|410)|35380([0-2]|[5-6]|9))[0-9]{0,12}$/\n});\n\nCardType.cards.push({\n cardType: 'ticket',\n expiryDatePolicy: 'hidden'\n});\n\nconst detectCard = (pCardNumber, pAvailableCards?) => {\n let matchedCards;\n let i;\n let len;\n\n if (pAvailableCards) {\n // Filter CardType.cards down to those that are found in pAvailableCards\n matchedCards = CardType.cards\n .filter(card => pAvailableCards.includes(card.cardType))\n // Further filter them to those with a regEx pattern that matches pCardNumber\n .filter(card => hasOwnProperty(card, 'pattern') && pCardNumber.match(card.pattern));\n\n // If we have matched cards: if there's only one - return it; else return the one with the longest startingRule\n if (matchedCards.length) {\n if (matchedCards.length === 1) {\n return matchedCards[0];\n }\n\n // Find longest rule for each matched card & store it as a property on the card\n for (i = 0, len = matchedCards.length; i < len; i += 1) {\n if (!matchedCards[i].longestRule) {\n const longestRule = matchedCards[i].startingRules.reduce((a, b) => (a > b ? a : b));\n // What we actually store is how many chars are in the rule\n matchedCards[i].longestRule = String(longestRule).length;\n }\n }\n\n // Based on each matched cards longest rule - find the card with the longest one!\n return matchedCards.reduce((a, b) => (a.longestRule >= b.longestRule ? a : b));\n }\n\n return { cardType: CardType.__NO_BRAND };\n }\n\n return { cardType: CardType.__NO_BRAND };\n};\n\nconst detectCardLength = (pCard, pUnformattedVal) => {\n let maxLength;\n let shortenedNewValue;\n let lengthDiff = 0;\n let reachedValidLength = false;\n let unformattedVal = pUnformattedVal;\n\n // Find the longest of the permitted card number lengths for this card brand\n const maxPermittedLength = pCard.cardType !== CardType.__NO_BRAND ? pCard.permittedLengths[pCard.permittedLengths.length - 1] : 0;\n\n // If the input value is longer than it's max permitted length then shorten it to that length\n if (maxPermittedLength && unformattedVal > maxPermittedLength) {\n lengthDiff = unformattedVal.length - maxPermittedLength;\n\n if (lengthDiff > 0) {\n unformattedVal = unformattedVal.substring(0, unformattedVal.length - lengthDiff);\n shortenedNewValue = unformattedVal;\n }\n }\n\n // If cardNumber has reached one of the cardBrand's 'permitted lengths' - mark it as 'valid'\n pCard.permittedLengths.forEach(pItem => {\n if (unformattedVal.length === pItem) {\n reachedValidLength = true;\n }\n });\n\n // If cardNumber is as long as the cardBrand's maximum permitted length then set the maxLength var\n if (unformattedVal.length === maxPermittedLength) {\n // Set maxlength to max + the right amount of spaces (one for every 4 digits, but not on the last block)\n const div = Math.floor(unformattedVal.length / 4);\n const mod = unformattedVal.length % 4;\n const numSpaces = mod > 0 ? div : div - 1;\n\n maxLength = maxPermittedLength + numSpaces;\n\n if (pCard.cardType.toLowerCase() === 'amex') {\n maxLength = maxPermittedLength + 2; // = 17 = 15 digits with space after 4th & 10th\n }\n }\n\n return {\n shortenedNewValue,\n maxLength,\n reachedValidLength\n };\n};\n\nconst getShortestPermittedCardLength = () => {\n if (!shortestPermittedCardLength) {\n let permittedLengthsArray = [];\n\n CardType.cards.forEach(pItem => {\n permittedLengthsArray = permittedLengthsArray.concat(pItem.permittedLengths ?? []);\n });\n\n shortestPermittedCardLength = Math.min.apply(null, permittedLengthsArray);\n }\n\n return shortestPermittedCardLength;\n};\n\nconst getCardByBrand = pBrand => {\n const cardType = CardType.cards.filter(card => card.cardType === pBrand);\n\n return cardType[0];\n};\n\nconst isGenericCardType = type => {\n if (!type) throw new Error('Error: isGenericCardType: type param has not been specified');\n return type === 'card' || type === 'scheme';\n};\n\nexport default {\n detectCard,\n detectCardLength,\n getShortestPermittedCardLength,\n getCardByBrand,\n isGenericCardType,\n __NO_BRAND: CardType.__NO_BRAND,\n allCards: CardType.cards\n};\n"],"names":["shortestPermittedCardLength","CardType","cards","push","cardType","startingRules","permittedLengths","pattern","securityCode","cvcPolicy","expiryDatePolicy","detectCard","pCardNumber","pAvailableCards","matchedCards","i","len","filter","card","includes","hasOwnProperty","match","length","longestRule","reduce","a","b","String","__NO_BRAND","detectCardLength","pCard","pUnformattedVal","maxLength","shortenedNewValue","lengthDiff","reachedValidLength","unformattedVal","maxPermittedLength","substring","forEach","pItem","div","Math","floor","toLowerCase","getShortestPermittedCardLength","permittedLengthsArray","concat","min","apply","getCardByBrand","pBrand","isGenericCardType","type","Error","allCards"],"mapp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CAAAA,EAkBPkD,eAfmBC,GACFlD,EAASC,MAAMe,QAAOC,GAAQA,EAAKd,WAAa+C,IAEjD,GAahBC,kBAVsBC,IACtB,IAAKA,EAAM,MAAM,IAAIC,MAAM,+DAC3B,MAAgB,SAATD,GAA4B,WAATA,CAAS,EASnCzB,WAAY3B,EAAS2B,WACrB2B,SAAUtD,EAASC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../external/classnames/index.js";function a({classNameModifiers:a=[],selectedValue:n,disabled:o=!1,options:s,onChange:c}){return s&&0!==s.length?e("div",{className:t("adyen-checkout__segmented-control",{"adyen-checkout__segmented-control--disabled":o},...a.map((e=>`adyen-checkout__segmented-control--${e}`))),role:"group"},s.map((({label:a,value:s,htmlProps:l})=>e("button",{disabled:o,key:s,onClick:e=>c(s,e),className:t("adyen-checkout__segmented-control-segment",{"adyen-checkout__segmented-control-segment--selected":n===s}),type:"button",...l},n===s&&e("span",{className:"adyen-checkout-checkmark"}),a)))):null}export{a as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";function a({classNameModifiers:a=[],selectedValue:n,disabled:o=!1,options:c,onChange:s}){return c&&0!==c.length?e("div",{className:t("adyen-checkout__segmented-control",{"adyen-checkout__segmented-control--disabled":o},...a.map((e=>`adyen-checkout__segmented-control--${e}`))),role:"group"},c.map((({label:a,value:c,controls:l,htmlProps:d})=>e("button",{disabled:o,key:c,onClick:e=>s(c,e),className:t("adyen-checkout__segmented-control-segment",{"adyen-checkout__segmented-control-segment--selected":n===c}),"aria-controls":l,"aria-expanded":n===c,type:"button",...d},n===c&&e("span",{className:"adyen-checkout-checkmark"}),a)))):null}export{a as default};
2
2
  //# sourceMappingURL=SegmentedControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport './SegmentedControl.scss';\n\nexport interface SegmentedControlProps<T> {\n classNameModifiers?: string[];\n selectedValue: T;\n disabled?: boolean;\n options: Array<{ label: string; value: T; htmlProps?: any }>;\n onChange(value: T, event: MouseEvent): void;\n}\n\nfunction SegmentedControl<T>({ classNameModifiers = [], selectedValue, disabled = false, options, onChange }: SegmentedControlProps<T>) {\n if (!options || options.length === 0) {\n return null;\n }\n\n return (\n <div\n className={cx(\n 'adyen-checkout__segmented-control',\n { 'adyen-checkout__segmented-control--disabled': disabled },\n ...classNameModifiers.map(modifier => `adyen-checkout__segmented-control--${modifier}`)\n )}\n role=\"group\"\n >\n {options.map(({ label, value, htmlProps }) => (\n <button\n disabled={disabled}\n key={value}\n onClick={(event: MouseEvent) => onChange(value, event)}\n className={cx('adyen-checkout__segmented-control-segment', {\n 'adyen-checkout__segmented-control-segment--selected': selectedValue === value\n })}\n type=\"button\"\n {...htmlProps}\n >\n {selectedValue === value && <span className=\"adyen-checkout-checkmark\"></span>}\n {label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default SegmentedControl;\n"],"names":["SegmentedControl","classNameModifiers","selectedValue","disabled","options","onChange","length","h","div","className","cx","map","modifier","role","label","value","htmlProps","button","key","onClick","event","type","span"],"mappings":"6HAYA,SAASA,GAAoBC,mBAAEA,EAAqB,GAAEC,cAAEA,EAAaC,SAAEA,GAAW,EAAKC,QAAEA,EAAOC,SAAEA,IAC9F,OAAKD,GAA8B,IAAnBA,EAAQE,OAKpBC,EAACC,MAAAA,CACGC,UAAWC,EACP,oCACA,CAAE,8CAA+CP,MAC9CF,EAAmBU,KAAIC,GAAY,sCAAsCA,OAEhFC,KAAK,SAEJT,EAAQO,KAAI,EAAGG,QAAOC,QAAOC,eAC1BT,EAACU,SAAAA,CACGd,SAAUA,EACVe,IAAKH,EACLI,QAAUC,GAAsBf,EAASU,EAAOK,GAChDX,UAAWC,EAAG,4CAA6C,CACvD,sDAAuDR,IAAkBa,IAE7EM,KAAK,YACDL,GAEHd,IAAkBa,GAASR,EAACe,OAAAA,CAAKb,UAAU,6BAC3CK,MAxBN,IA6Bf"}
1
+ {"version":3,"file":"SegmentedControl.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport './SegmentedControl.scss';\n\n/**\n * It makes no sense of the aria tags to be responsibility of another component\n * The new interface makes it clear that id and control are required\n * While moving the expanded logic to within the SegmentedController\n * Both interfaces are compatible\n */\nexport interface OldSegmentedControlOption<T> {\n label: string;\n value: T;\n htmlProps: {\n id: string;\n 'aria-expanded': boolean;\n 'aria-controls': string;\n };\n}\n\nexport interface NewSegmentedControlOption<T> {\n label: string;\n value: T;\n id: string;\n controls: string;\n htmlProps?: {};\n}\n\ntype SegmentedControlOption<T> = NewSegmentedControlOption<T> | OldSegmentedControlOption<T>;\n\nexport type SegmentedControlOptions<T> = Array<SegmentedControlOption<T>>;\n\nexport interface SegmentedControlProps<T> {\n classNameModifiers?: string[];\n selectedValue: T;\n disabled?: boolean;\n options: SegmentedControlOptions<T>;\n onChange(value: T, event: MouseEvent): void;\n}\n\n/**\n *\n * example:\n * <SegmentedControl\n * onChange={(value) = setMode(value)}\n * selectedValue={mode}\n * disabled={status === 'loading'}\n * classNameModifiers={['css-class']}\n * options={segmentedControlOptions}\n * />\n *\n * @param classNameModifiers\n * @param selectedValue\n * @param disabled\n * @param options\n * @param onChange\n * @constructor\n */\nfunction SegmentedControl<T>({ classNameModifiers = [], selectedValue, disabled = false, options, onChange }: SegmentedControlProps<T>) {\n if (!options || options.length === 0) {\n return null;\n }\n\n return (\n <div\n className={cx(\n 'adyen-checkout__segmented-control',\n { 'adyen-checkout__segmented-control--disabled': disabled },\n ...classNameModifiers.map(modifier => `adyen-checkout__segmented-control--${modifier}`)\n )}\n role=\"group\"\n >\n {options.map(({ label, value, controls, htmlProps }: NewSegmentedControlOption<T>) => (\n <button\n disabled={disabled}\n key={value}\n onClick={(event: MouseEvent) => onChange(value, event)}\n className={cx('adyen-checkout__segmented-control-segment', {\n 'adyen-checkout__segmented-control-segment--selected': selectedValue === value\n })}\n aria-controls={controls}\n aria-expanded={selectedValue === value}\n type=\"button\"\n {...htmlProps}\n >\n {selectedValue === value && <span className=\"adyen-checkout-checkmark\"></span>}\n {label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default SegmentedControl;\n"],"names":["SegmentedControl","classNameModifiers","selectedValue","disabled","options","onChange","length","h","div","className","cx","map","modifier","role","label","value","controls","htmlProps","button","key","onClick","event","aria-controls","aria-expanded","type","span"],"mappings":"kHA0DA,SAASA,GAAoBC,mBAAEA,EAAqB,GAAEC,cAAEA,EAAaC,SAAEA,GAAW,EAAKC,QAAEA,EAAOC,SAAEA,IAC9F,OAAKD,GAA8B,IAAnBA,EAAQE,OAKpBC,EAACC,MAAAA,CACGC,UAAWC,EACP,oCACA,CAAE,8CAA+CP,MAC9CF,EAAmBU,KAAIC,GAAY,sCAAsCA,OAEhFC,KAAK,SAEJT,EAAQO,KAAI,EAAGG,QAAOC,QAAOC,WAAUC,eACpCV,EAACW,SAAAA,CACGf,SAAUA,EACVgB,IAAKJ,EACLK,QAAUC,GAAsBhB,EAASU,EAAOM,GAChDZ,UAAWC,EAAG,4CAA6C,CACvD,sDAAuDR,IAAkBa,IAE7EO,gBAAeN,EACfO,gBAAerB,IAAkBa,EACjCS,KAAK,YACDP,GAEHf,IAAkBa,GAASR,EAACkB,OAAAA,CAAKhB,UAAU,6BAC3CK,MA1BN,IA+Bf"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import o from"../../../external/classnames/index.js";import{useState as r}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";import a from"../FormFields/Field/Field.js";import t from"../FormFields/Checkbox/Checkbox.js";import l from"../FormFields/InputEmail.js";import{getErrorMessage as m}from"../../../utils/getErrorMessage.js";function i(i){const{errors:n,value:p,onInput:c,onBlur:d}=i,{i18n:f}=s(),[h,u]=r(!1);return e("div",{className:o("adyen-checkout__fieldset","adyen-checkout__fieldset--sendCopyToEmail",i.classNames)},e(a,{classNameModifiers:["sendCopyToEmail","consentCheckbox"],name:"sendCopyToEmail",useLabelElement:!1,showErrorElement:!1},e(t,{onChange:e=>{u(e.target.checked),i.onToggle(h)},label:f.get("boleto.sendCopyToEmail"),name:"sendCopyToEmail"})),h&&e(a,{label:f.get("shopperEmail"),classNameModifiers:["shopperEmail"],errorMessage:m(f,n,f.get("shopperEmail")),name:"shopperEmail"},e(l,{name:"shopperEmail",autoCorrect:"off",spellCheck:!1,value:p,onInput:c,onBlur:d})))}export{i as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import o from"../../../_virtual/index.js";import{useState as r}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";import a from"../FormFields/Field/Field.js";import t from"../FormFields/Checkbox/Checkbox.js";import l from"../FormFields/InputEmail.js";import{getErrorMessage as m}from"../../../utils/getErrorMessage.js";function i(i){const{errors:n,value:p,onInput:c,onBlur:d}=i,{i18n:u}=s(),[f,h]=r(!1);return e("div",{className:o("adyen-checkout__fieldset","adyen-checkout__fieldset--sendCopyToEmail",i.classNames)},e(a,{classNameModifiers:["sendCopyToEmail","consentCheckbox"],name:"sendCopyToEmail",useLabelElement:!1,showErrorElement:!1},e(t,{onChange:e=>{h(e.target.checked),i.onToggle(f)},label:u.get("boleto.sendCopyToEmail"),name:"sendCopyToEmail"})),f&&e(a,{label:u.get("shopperEmail"),classNameModifiers:["shopperEmail"],errorMessage:m(u,n,u.get("shopperEmail")),name:"shopperEmail"},e(l,{name:"shopperEmail",autoCorrect:"off",spellCheck:!1,value:p,onInput:c,onBlur:d})))}export{i as default};
2
2
  //# sourceMappingURL=SendCopyToEmail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SendCopyToEmail.js","sources":["../../../../../src/components/internal/SendCopyToEmail/SendCopyToEmail.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport { useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../FormFields/Field';\nimport Checkbox from '../FormFields/Checkbox';\nimport InputEmail from '../FormFields/InputEmail';\nimport './SendCopyToEmail.scss';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\n\nexport default function SendCopyToEmail(props) {\n const { errors, value, onInput, onBlur } = props;\n const { i18n } = useCoreContext();\n const [sendCopyToEmail, setSendCopyToEmail] = useState(false);\n\n const toggleEmailField = e => {\n setSendCopyToEmail(e.target.checked);\n props.onToggle(sendCopyToEmail);\n };\n\n return (\n <div className={cx('adyen-checkout__fieldset', 'adyen-checkout__fieldset--sendCopyToEmail', props.classNames)}>\n <Field\n classNameModifiers={['sendCopyToEmail', 'consentCheckbox']}\n name={'sendCopyToEmail'}\n useLabelElement={false}\n showErrorElement={false}\n >\n <Checkbox onChange={toggleEmailField} label={i18n.get('boleto.sendCopyToEmail')} name={'sendCopyToEmail'} />\n </Field>\n\n {sendCopyToEmail && (\n <Field\n label={i18n.get('shopperEmail')}\n classNameModifiers={['shopperEmail']}\n errorMessage={getErrorMessage(i18n, errors, i18n.get('shopperEmail'))}\n name={'shopperEmail'}\n >\n <InputEmail name={'shopperEmail'} autoCorrect={'off'} spellCheck={false} value={value} onInput={onInput} onBlur={onBlur} />\n </Field>\n )}\n </div>\n );\n}\n"],"names":["SendCopyToEmail","props","errors","value","onInput","onBlur","i18n","useCoreContext","sendCopyToEmail","setSendCopyToEmail","useState","h","div","className","cx","classNames","Field","classNameModifiers","name","useLabelElement","showErrorElement","Checkbox","onChange","e","target","checked","onToggle","label","get","errorMessage","getErrorMessage","InputEmail","autoCorrect","spellCheck"],"mappings":"ydAUe,SAASA,EAAgBC,GACpC,MAAMC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,EAAOC,OAAEA,GAAWJ,GACrCK,KAAEA,GAASC,KACVC,EAAiBC,GAAsBC,GAAS,GAOvD,OACIC,EAACC,MAAAA,CAAIC,UAAWC,EAAG,2BAA4B,4CAA6Cb,EAAMc,aAC9FJ,EAACK,EAAAA,CACGC,mBAAoB,CAAC,kBAAmB,mBACxCC,KAAM,kBACNC,iBAAiB,EACjBC,kBAAkB,GAElBT,EAACU,EAAAA,CAASC,SAbGC,IACrBd,EAAmBc,EAAEC,OAAOC,SAC5BxB,EAAMyB,SAASlB,EAAAA,EAW+BmB,MAAOrB,EAAKsB,IAAI,0BAA2BV,KAAM,qBAG1FV,GACGG,EAACK,EAAAA,CACGW,MAAOrB,EAAKsB,IAAI,gBAChBX,mBAAoB,CAAC,gBACrBY,aAAcC,EAAgBxB,EAAMJ,EAAQI,EAAKsB,IAAI,iBACrDV,KAAM,gBAENP,EAACoB,EAAAA,CAAWb,KAAM,eAAgBc,YAAa,MAAOC,YAAY,EAAO9B,MAAOA,EAAOC,QAASA,EAASC,OAAQA,KAKrI"}
1
+ {"version":3,"file":"SendCopyToEmail.js","sources":["../../../../../src/components/internal/SendCopyToEmail/SendCopyToEmail.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport { useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Field from '../FormFields/Field';\nimport Checkbox from '../FormFields/Checkbox';\nimport InputEmail from '../FormFields/InputEmail';\nimport './SendCopyToEmail.scss';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\n\nexport default function SendCopyToEmail(props) {\n const { errors, value, onInput, onBlur } = props;\n const { i18n } = useCoreContext();\n const [sendCopyToEmail, setSendCopyToEmail] = useState(false);\n\n const toggleEmailField = e => {\n setSendCopyToEmail(e.target.checked);\n props.onToggle(sendCopyToEmail);\n };\n\n return (\n <div className={cx('adyen-checkout__fieldset', 'adyen-checkout__fieldset--sendCopyToEmail', props.classNames)}>\n <Field\n classNameModifiers={['sendCopyToEmail', 'consentCheckbox']}\n name={'sendCopyToEmail'}\n useLabelElement={false}\n showErrorElement={false}\n >\n <Checkbox onChange={toggleEmailField} label={i18n.get('boleto.sendCopyToEmail')} name={'sendCopyToEmail'} />\n </Field>\n\n {sendCopyToEmail && (\n <Field\n label={i18n.get('shopperEmail')}\n classNameModifiers={['shopperEmail']}\n errorMessage={getErrorMessage(i18n, errors, i18n.get('shopperEmail'))}\n name={'shopperEmail'}\n >\n <InputEmail name={'shopperEmail'} autoCorrect={'off'} spellCheck={false} value={value} onInput={onInput} onBlur={onBlur} />\n </Field>\n )}\n </div>\n );\n}\n"],"names":["SendCopyToEmail","props","errors","value","onInput","onBlur","i18n","useCoreContext","sendCopyToEmail","setSendCopyToEmail","useState","h","div","className","cx","classNames","Field","classNameModifiers","name","useLabelElement","showErrorElement","Checkbox","onChange","e","target","checked","onToggle","label","get","errorMessage","getErrorMessage","InputEmail","autoCorrect","spellCheck"],"mappings":"8cAUe,SAASA,EAAgBC,GACpC,MAAMC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,EAAOC,OAAEA,GAAWJ,GACrCK,KAAEA,GAASC,KACVC,EAAiBC,GAAsBC,GAAS,GAOvD,OACIC,EAACC,MAAAA,CAAIC,UAAWC,EAAG,2BAA4B,4CAA6Cb,EAAMc,aAC9FJ,EAACK,EAAAA,CACGC,mBAAoB,CAAC,kBAAmB,mBACxCC,KAAM,kBACNC,iBAAiB,EACjBC,kBAAkB,GAElBT,EAACU,EAAAA,CAASC,SAbGC,IACrBd,EAAmBc,EAAEC,OAAOC,SAC5BxB,EAAMyB,SAASlB,EAAAA,EAW+BmB,MAAOrB,EAAKsB,IAAI,0BAA2BV,KAAM,qBAG1FV,GACGG,EAACK,EAAAA,CACGW,MAAOrB,EAAKsB,IAAI,gBAChBX,mBAAoB,CAAC,gBACrBY,aAAcC,EAAgBxB,EAAMJ,EAAQI,EAAKsB,IAAI,iBACrDV,KAAM,gBAENP,EAACoB,EAAAA,CAAWb,KAAM,eAAgBc,YAAa,MAAOC,YAAY,EAAO9B,MAAOA,EAAOC,QAASA,EAASC,OAAQA,KAKrI"}
@@ -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, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_ERROR_TYPE, ANALYTICS_EVENT, 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 ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\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 this.onActionHandled = this.onActionHandled.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 this.props.modules.analytics.sendAnalytics(this.getComponent(analyticsObj), analyticsObj, uiElementProps);\n } catch (error) {\n console.warn('Failed to submit the analytics event. Error:', error);\n }\n }\n\n private getComponent({ component }: SendAnalyticsObject): string {\n if (component) {\n return component;\n }\n if (this.constructor['analyticsType']) {\n return this.constructor['analyticsType'];\n }\n if (this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc') {\n return this.constructor['type'];\n }\n return this.type;\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\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: () => reject(new CancelError('beforeSubmitRejected'))\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) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\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+nFJxBiC3o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TX4h9d+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 (error.name === NETWORK_ERROR && error.options.code) {\n this.submitAnalytics({ type: ANALYTICS_EVENT.error, errorType: ANALYTICS_ERROR_TYPE.apiError, code: error.options.code });\n }\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 onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\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 /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\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","buildElementProps","componentProps","finalProps","showPayButton","this","core","getCorePropsForComponent","isStoredPaymentMethod","paymentMethodsResponse","find","type","constructor","isDropin","assertIsDropin","props","formatProps","getRegulatoryDefaults","options","countryCode","storeElementRefOnCore","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","setUpAnalytics","setUpAnalyticsObj","sessionId","session","id","modules","analytics","setUp","submitAnalytics","analyticsObj","uiElementProps","sendAnalytics","getComponent","error","console","warn","component","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","ANALYTICS_SUBMIT_STR","submitPayment","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","originalAction","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","update","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","amount","onPaymentMethodsRequest","orderData","pspReference","locale","checkout","super","_define_property","NETWORK_ERROR","ANALYTICS_EVENT","errorType","ANALYTICS_ERROR_TYPE","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","h","PayButton","secondaryAmount","onClick","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AKiE,wBAAwBgF,KAAKjJ,MAEjEA,KAAK4B,WAAclB,GAASA,EAAMkB,YAAe5B,KACjDA,KAAK2G,UAAY3G,KAAKU,MAAM6B,QAAUvC,KAAKU,MAAM6B,QAAQoE,eAAYuC,EAErElJ,KAAKe,sBAAsBf,KAAKU,OAEhCV,KAAKmG,kBAAoBnG,KAAKmG,kBAAkB8C,KAAKjJ,MACrDA,KAAKsF,gBAAkBtF,KAAKsF,gBAAgB2D,KAAKjJ,KACrD,EAhCA4H,EAPkBlI,EAOJY,YAAO4I,GAKrBtB,EAZkBlI,EAYJyJ,aAAuB"}
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, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport { Resources } from '../../../core/Context/Resources';\nimport { ANALYTICS_ERROR_TYPE, ANALYTICS_EVENT, 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 ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData\n} from '../../../types/global-types';\nimport type { IDropin } from '../../Dropin/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\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 this.onActionHandled = this.onActionHandled.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 /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx\n */\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n /**\n * componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx\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 this.props.modules.analytics.sendAnalytics(this.getComponent(analyticsObj), analyticsObj, uiElementProps);\n } catch (error) {\n console.warn('Failed to submit the analytics event. Error:', error);\n }\n }\n\n private getComponent({ component }: SendAnalyticsObject): string {\n if (component) {\n return component;\n }\n if (this.constructor['analyticsType']) {\n return this.constructor['analyticsType'];\n }\n if (this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc') {\n return this.constructor['type'];\n }\n return this.type;\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.makePaymentsCall()\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch((e: PaymentResponseData | Error) => {\n if (e instanceof CancelError) {\n this.setElementStatus('ready');\n return;\n }\n this.handleFailedResult(e as PaymentResponseData);\n });\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: () => reject(new CancelError('beforeSubmitRejected'))\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) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', 'Error when making /payments call', { cause: error }));\n }\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+1IJkCSalhwi5D7fSrpjbQTmAsOpJT1N8lC1MSNmAvAwG1kWL4JxYwXDKYyYASnsia2V5IjoiQUYwQUFBMTAzQ0E1MzdFQUVEODdDMjRERDUzOTA5QjgwQTc4QTkyM0UzODIzRDY4REFDQzk0QjlGRjgzMDVEQyJ98uZI4thGveOByYbomCeeP2Gy2rzs99FOBoDYVeWIUjyM+gfnW89DdJZAhxe74Tv0TnL5DRQYPCTRQPOoLbQ21NaeSho70FNE+n8XYKlVK5Ore6BoB6IVCaal5MkM27VmZPMmGflgcPx+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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 (error.name === NETWORK_ERROR && error.options.code) {\n this.submitAnalytics({ type: ANALYTICS_EVENT.error, errorType: ANALYTICS_ERROR_TYPE.apiError, code: error.options.code });\n }\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 onActionHandled(actionHandledObj: ActionHandledReturnObject) {\n this.props?.onActionHandled?.({ originalAction: this.props.originalAction, ...actionHandledObj });\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 /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n *\n * Expected to be called after sanitizeResponse has been run on the raw payment response\n *\n * @param response -\n */\n protected handleResponse(response: PaymentResponseData): void {\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","buildElementProps","componentProps","finalProps","showPayButton","this","core","getCorePropsForComponent","isStoredPaymentMethod","paymentMethodsResponse","find","type","constructor","isDropin","assertIsDropin","props","formatProps","getRegulatoryDefaults","options","countryCode","storeElementRefOnCore","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","setElementStatus","status","elementRef","setStatus","data","isValid","errors","valid","setUpAnalytics","setUpAnalyticsObj","sessionId","session","id","modules","analytics","setUp","submitAnalytics","analyticsObj","uiElementProps","sendAnalytics","getComponent","error","console","warn","component","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","ANALYTICS_SUBMIT_STR","submitPayment","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","originalAction","response","order","remainingAmount","value","handleOrder","handleSuccessResult","handleKeyPress","key","code","preventDefault","onEnterKeyPressed","document","activeElement","blur","updateParent","update","icon","paymentMethodType","resources","getImage","displayName","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","amount","onPaymentMethodsRequest","orderData","pspReference","locale","checkout","super","_define_property","NETWORK_ERROR","ANALYTICS_EVENT","errorType","ANALYTICS_ERROR_TYPE","apiError","onError","onOrderUpdated","result","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","onPaymentCompleted","setComponentRef","ref","payButton","h","PayButton","secondaryAmount","onClick","register","bind","undefined","txVariants"],"mappings":"suBA6BO,MAAeA,UAA6DC,EAyC5DC,iBAAAA,CAAkBC,GACjC,MAMMC,EAAa,CACfC,eAAe,KAPKC,KAAKC,KAAKC,gCACFL,GAAgBM,sBAE1C,GACAH,KAAKC,KAAKG,uBAAuBC,KAAKR,GAAgBS,MAAQN,KAAKO,YAAmB,SAMrFV,GAGDW,EAAWC,EAAeT,MAEhCA,KAAKU,MAAQV,KAAKW,YAAY,IACvBX,KAAKO,YAA2B,gBAChCK,EAAsBZ,KAAKC,KAAKY,QAAQC,YAAaN,MACrDV,GAEX,CAEUiB,qBAAAA,CAAsBL,GACvBA,GAAOF,UACRR,KAAKC,KAAKe,sBAAsBhB,KAExC,CAEOiB,WAAAA,GACH,OAAOC,QAAQC,SACnB,CAEOC,QAAAA,CAASC,GACZrB,KAAKsB,MAAQ,IAAKtB,KAAKsB,SAAUD,GACjCrB,KAAKuB,UACT,CAEOC,cAAAA,GAEH,OADIxB,KAAKyB,cAAgBzB,KAAKyB,aAAaD,gBAAgBxB,KAAKyB,aAAaD,iBACtExB,IACX,CAKA,gBAAA0B,CAAwBC,EAAyBjB,GAE7C,OADAV,KAAK4B,YAAYC,UAAUF,EAAQjB,GAC5BV,IACX,CAKA,SAAA6B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AAK6E,aAAe7E,KAAK6E,aAAaoE,KAAKjJ,MAC3CA,KAAK6F,YAAc7F,KAAK6F,YAAYoD,KAAKjJ,MACzCA,KAAKwE,wBAA0BxE,KAAKwE,wBAAwByE,KAAKjJ,MACjEA,KAAKwD,eAAiBxD,KAAKwD,eAAeyF,KAAKjJ,MAC/CA,KAAK0B,iBAAmB1B,KAAK0B,iBAAiBuH,KAAKjJ,MACnDA,KAAK0C,gBAAkB1C,KAAK0C,gBAAgBuG,KAAKjJ,MACjDA,KAAKoD,iBAAmBpD,KAAKoD,iBAAiB6F,KAAKjJ,MACnDA,KAAKyE,0BAA4BzE,KAAKyE,0BAA0BwE,KAAKjJ,MACrEA,KAAKiE,wBAA0BjE,KAAKiE,wBAAwBgF,KAAKjJ,MAEjEA,KAAK4B,WAAclB,GAASA,EAAMkB,YAAe5B,KACjDA,KAAK2G,UAAY3G,KAAKU,MAAM6B,QAAUvC,KAAKU,MAAM6B,QAAQoE,eAAYuC,EAErElJ,KAAKe,sBAAsBf,KAAKU,OAEhCV,KAAKmG,kBAAoBnG,KAAKmG,kBAAkB8C,KAAKjJ,MACrDA,KAAKsF,gBAAkBtF,KAAKsF,gBAAgB2D,KAAKjJ,KACrD,EAhCA4H,EAPkBlI,EAOJY,YAAO4I,GAKrBtB,EAZkBlI,EAYJyJ,aAAuB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import a from"../../../external/classnames/index.js";import c from"../Button/Button.js";import{copyToClipboard as r}from"../../../utils/clipboard.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import o from"../../../core/Context/useImage.js";import{PREFIX as s}from"../Icon/constants.js";function n({voucherDetails:n=[],className:_="",...l}){const{i18n:u}=t(),i=o();return l.onActionHandled?.({componentType:l.paymentMethodType,actionDescription:"voucher-presented"}),e("div",{className:a("adyen-checkout__voucher-result",`adyen-checkout__voucher-result--${l.paymentMethodType}`,_)},e("div",{className:"adyen-checkout__voucher-result__top"},e("div",{className:"adyen-checkout__voucher-result__image"},!!l.imageUrl&&e("span",{className:"adyen-checkout__voucher-result__image__wrapper"},e("img",{alt:l.paymentMethodType,className:"adyen-checkout__voucher-result__image__brand",src:l.imageUrl})),!!l.issuerImageUrl&&e("span",{className:"adyen-checkout__voucher-result__image__wrapper"},e("img",{alt:l.paymentMethodType,className:"adyen-checkout__voucher-result__image__issuer",src:l.issuerImageUrl}))),e("div",{className:"adyen-checkout__voucher-result__introduction"},l.introduction," ",l.instructionsUrl&&e("a",{className:"adyen-checkout-link adyen-checkout-link--voucher-result-instructions",href:l.instructionsUrl,target:"_blank",rel:"noopener noreferrer"},u.get("voucher.readInstructions")," ›")),l.amount&&e("div",{className:"adyen-checkout__voucher-result__amount"},l.amount,l.surcharge&&e("span",{className:"adyen-checkout__voucher-result__surcharge"},"(",u.get("voucher.surcharge").replace("%@",l.surcharge),")"))),l.reference&&e("div",{className:"adyen-checkout__voucher-result__separator"},e("div",{className:"adyen-checkout__voucher-result__separator__inner"}),e("div",{className:"adyen-checkout__voucher-result__code__label"},e("span",{className:"adyen-checkout__voucher-result__code__label__text"},u.get("voucher.paymentReferenceLabel")))),e("div",{className:"adyen-checkout__voucher-result__bottom"},l.reference&&e("div",{className:"adyen-checkout__voucher-result__code"},l.barcode&&e("img",{alt:u.get("voucher.paymentReferenceLabel"),className:"adyen-checkout__voucher-result__code__barcode",src:l.barcode}),e("span",null,l.reference)),(!!l.downloadUrl||!!l.copyBtn)&&e("ul",{className:"adyen-checkout__voucher-result__actions"},!!l.copyBtn&&e("li",{className:"adyen-checkout__voucher-result__actions__item"},e(c,{inline:!0,variant:"action",onClick:(e,{complete:a})=>{r(l.reference),a()},icon:i({imageFolder:"components/"})(`${s}copy`),label:u.get("button.copy")})),!!l.downloadUrl&&e("li",{className:"adyen-checkout__voucher-result__actions__item"},e(c,{inline:!0,variant:"action",href:l.downloadUrl,icon:i({imageFolder:"components/"})(`${s}download`),label:l.downloadButtonText||u.get("button.download"),target:"_blank",rel:"noopener noreferrer"}))),e("ul",{className:"adyen-checkout__voucher-result__details"},n.filter((({label:e,value:a})=>!!e&&!!a)).map((({label:a,value:c},r)=>e("li",{key:r,className:"adyen-checkout__voucher-result__details__item"},e("span",{className:"adyen-checkout__voucher-result__details__label"},a),e("span",{className:"adyen-checkout__voucher-result__details__value"},c)))))))}export{n as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import a from"../../../_virtual/index.js";import r from"../Button/Button.js";import{copyToClipboard as o}from"../../../utils/clipboard.js";import{useCoreContext as c}from"../../../core/Context/CoreProvider.js";import t from"../../../core/Context/useImage.js";import{PREFIX as n}from"../Icon/constants.js";import s from"../DetailsTable/DetailsTable.js";function _({voucherDetails:_=[],className:l="",...u}){const{i18n:i}=c(),d=t();return u.onActionHandled?.({componentType:u.paymentMethodType,actionDescription:"voucher-presented"}),e("div",{className:a("adyen-checkout__voucher-result",`adyen-checkout__voucher-result--${u.paymentMethodType}`,l)},e("div",{className:"adyen-checkout__voucher-result__top"},e("div",{className:"adyen-checkout__voucher-result__image"},!!u.imageUrl&&e("span",{className:"adyen-checkout__voucher-result__image__wrapper"},e("img",{alt:u.paymentMethodType,className:"adyen-checkout__voucher-result__image__brand",src:u.imageUrl})),!!u.issuerImageUrl&&e("span",{className:"adyen-checkout__voucher-result__image__wrapper"},e("img",{alt:u.paymentMethodType,className:"adyen-checkout__voucher-result__image__issuer",src:u.issuerImageUrl}))),e("div",{className:"adyen-checkout__voucher-result__introduction"},u.introduction," ",u.instructionsUrl&&e("a",{className:"adyen-checkout-link adyen-checkout-link--voucher-result-instructions",href:u.instructionsUrl,target:"_blank",rel:"noopener noreferrer"},i.get("voucher.readInstructions")," ›")),u.amount&&e("div",{className:"adyen-checkout__voucher-result__amount"},u.amount,u.surcharge&&e("span",{className:"adyen-checkout__voucher-result__surcharge"},"(",i.get("voucher.surcharge").replace("%@",u.surcharge),")"))),u.reference&&e("div",{className:"adyen-checkout__voucher-result__separator"},e("div",{className:"adyen-checkout__voucher-result__separator__inner"}),e("div",{className:"adyen-checkout__voucher-result__code__label"},e("span",{className:"adyen-checkout__voucher-result__code__label__text"},i.get("voucher.paymentReferenceLabel")))),e("div",{className:"adyen-checkout__voucher-result__bottom"},u.reference&&e("div",{className:"adyen-checkout__voucher-result__code"},u.barcode&&e("img",{alt:i.get("voucher.paymentReferenceLabel"),className:"adyen-checkout__voucher-result__code__barcode",src:u.barcode}),e("span",null,u.reference)),(!!u.downloadUrl||!!u.copyBtn)&&e("ul",{className:"adyen-checkout__voucher-result__actions"},!!u.copyBtn&&e("li",{className:"adyen-checkout__voucher-result__actions__item"},e(r,{inline:!0,variant:"action",onClick:(e,{complete:a})=>{o(u.reference),a()},icon:d({imageFolder:"components/"})(`${n}copy`),label:i.get("button.copy")})),!!u.downloadUrl&&e("li",{className:"adyen-checkout__voucher-result__actions__item"},e(r,{inline:!0,variant:"action",href:u.downloadUrl,icon:d({imageFolder:"components/"})(`${n}download`),label:u.downloadButtonText||i.get("button.download"),target:"_blank",rel:"noopener noreferrer"}))),e(s,{tableFields:_})))}export{_ as default};
2
2
  //# sourceMappingURL=Voucher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Voucher.js","sources":["../../../../../src/components/internal/Voucher/Voucher.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Button from '../Button';\nimport { copyToClipboard } from '../../../utils/clipboard';\n\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Voucher.scss';\nimport { VoucherProps } from './types';\nimport useImage from '../../../core/Context/useImage';\nimport { PREFIX } from '../Icon/constants';\n\nexport default function Voucher({ voucherDetails = [], className = '', ...props }: VoucherProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n props.onActionHandled?.({ componentType: props.paymentMethodType, actionDescription: 'voucher-presented' });\n\n return (\n <div className={classNames('adyen-checkout__voucher-result', `adyen-checkout__voucher-result--${props.paymentMethodType}`, className)}>\n <div className=\"adyen-checkout__voucher-result__top\">\n <div className=\"adyen-checkout__voucher-result__image\">\n {!!props.imageUrl && (\n <span className=\"adyen-checkout__voucher-result__image__wrapper\">\n <img alt={props.paymentMethodType} className=\"adyen-checkout__voucher-result__image__brand\" src={props.imageUrl} />\n </span>\n )}\n\n {!!props.issuerImageUrl && (\n <span className=\"adyen-checkout__voucher-result__image__wrapper\">\n <img alt={props.paymentMethodType} className=\"adyen-checkout__voucher-result__image__issuer\" src={props.issuerImageUrl} />\n </span>\n )}\n </div>\n\n <div className=\"adyen-checkout__voucher-result__introduction\">\n {props.introduction}{' '}\n {props.instructionsUrl && (\n <a\n className=\"adyen-checkout-link adyen-checkout-link--voucher-result-instructions\"\n href={props.instructionsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {i18n.get('voucher.readInstructions')} ›\n </a>\n )}\n </div>\n\n {props.amount && (\n <div className=\"adyen-checkout__voucher-result__amount\">\n {props.amount}\n\n {props.surcharge && (\n <span className=\"adyen-checkout__voucher-result__surcharge\">\n ({i18n.get('voucher.surcharge').replace('%@', props.surcharge)})\n </span>\n )}\n </div>\n )}\n </div>\n\n {props.reference && (\n <div className=\"adyen-checkout__voucher-result__separator\">\n <div className=\"adyen-checkout__voucher-result__separator__inner\" />\n <div className=\"adyen-checkout__voucher-result__code__label\">\n <span className=\"adyen-checkout__voucher-result__code__label__text\">{i18n.get('voucher.paymentReferenceLabel')}</span>\n </div>\n </div>\n )}\n\n <div className=\"adyen-checkout__voucher-result__bottom\">\n {props.reference && (\n <div className=\"adyen-checkout__voucher-result__code\">\n {props.barcode && (\n <img\n alt={i18n.get('voucher.paymentReferenceLabel')}\n className=\"adyen-checkout__voucher-result__code__barcode\"\n src={props.barcode}\n />\n )}\n <span>{props.reference}</span>\n </div>\n )}\n\n {(!!props.downloadUrl || !!props.copyBtn) && (\n <ul className=\"adyen-checkout__voucher-result__actions\">\n {!!props.copyBtn && (\n <li className=\"adyen-checkout__voucher-result__actions__item\">\n <Button\n inline\n variant=\"action\"\n onClick={(e, { complete }) => {\n copyToClipboard(props.reference);\n complete();\n }}\n icon={getImage({ imageFolder: 'components/' })(`${PREFIX}copy`)}\n label={i18n.get('button.copy')}\n />\n </li>\n )}\n\n {!!props.downloadUrl && (\n <li className=\"adyen-checkout__voucher-result__actions__item\">\n <Button\n inline\n variant=\"action\"\n href={props.downloadUrl}\n icon={getImage({ imageFolder: 'components/' })(`${PREFIX}download`)}\n label={props.downloadButtonText || i18n.get('button.download')}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n </li>\n )}\n </ul>\n )}\n\n <ul className=\"adyen-checkout__voucher-result__details\">\n {voucherDetails\n .filter(({ label, value }) => !!label && !!value)\n .map(({ label, value }, index) => (\n <li key={index} className=\"adyen-checkout__voucher-result__details__item\">\n <span className=\"adyen-checkout__voucher-result__details__label\">{label}</span>\n <span className=\"adyen-checkout__voucher-result__details__value\">{value}</span>\n </li>\n ))}\n </ul>\n </div>\n </div>\n );\n}\n"],"names":["Voucher","voucherDetails","className","props","i18n","useCoreContext","getImage","useImage","onActionHandled","componentType","paymentMethodType","actionDescription","h","div","classNames","imageUrl","span","img","alt","src","issuerImageUrl","introduction","instructionsUrl","a","href","target","rel","get","amount","surcharge","replace","reference","barcode","downloadUrl","copyBtn","ul","li","Button","inline","variant","onClick","e","complete","copyToClipboard","icon","imageFolder","PREFIX","label","downloadButtonText","filter","value","map","index","key"],"mappings":"oYAWe,SAASA,GAAQC,eAAEA,EAAiB,GAAEC,UAAEA,EAAY,MAAOC,IACtE,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAIjB,OAFAJ,EAAMK,kBAAkB,CAAEC,cAAeN,EAAMO,kBAAmBC,kBAAmB,sBAGjFC,EAACC,MAAAA,CAAIX,UAAWY,EAAW,iCAAkC,mCAAmCX,EAAMO,oBAAqBR,IACvHU,EAACC,MAAAA,CAAIX,UAAU,uCACXU,EAACC,MAAAA,CAAIX,UAAU,2CACRC,EAAMY,UACLH,EAACI,OAAAA,CAAKd,UAAU,kDACZU,EA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KAAMtC,EAAS,CAAEuC,YAAa,eAAxBvC,CAAyC,GAAGwC,SAClDC,MAAO3C,EAAKuB,IAAI,oBAKzBxB,EAAM8B,aACLrB,EAACwB,KAAAA,CAAGlC,UAAU,iDACVU,EAACyB,EAAAA,CACGC,QAAAA,EACAC,QAAQ,SACRf,KAAMrB,EAAM8B,YACZW,KAAMtC,EAAS,CAAEuC,YAAa,eAAxBvC,CAAyC,GAAGwC,aAClDC,MAAO5C,EAAM6C,oBAAsB5C,EAAKuB,IAAI,mBAC5CF,OAAO,SACPC,IAAI,0BAOxBd,EAACuB,KAAAA,CAAGjC,UAAU,2CACTD,EACIgD,QAAO,EAAGF,QAAOG,aAAcH,KAAWG,IAC1CC,KAAI,EAAGJ,QAAOG,SAASE,IACpBxC,EAACwB,KAAAA,CAAGiB,IAAKD,EAAOlD,UAAU,iDACtBU,EAACI,OAAAA,CAAKd,UAAU,kDAAkD6C,GAClEnC,EAACI,OAAAA,CAAKd,UAAU,kDAAkDgD,QAOlG"}
1
+ {"version":3,"file":"Voucher.js","sources":["../../../../../src/components/internal/Voucher/Voucher.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Button from '../Button';\nimport { copyToClipboard } from '../../../utils/clipboard';\n\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Voucher.scss';\nimport { VoucherProps } from './types';\nimport useImage from '../../../core/Context/useImage';\nimport { PREFIX } from '../Icon/constants';\nimport DetailsTable from '../DetailsTable';\n\nexport default function Voucher({ voucherDetails = [], className = '', ...props }: VoucherProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n props.onActionHandled?.({ componentType: props.paymentMethodType, actionDescription: 'voucher-presented' });\n\n return (\n <div className={classNames('adyen-checkout__voucher-result', `adyen-checkout__voucher-result--${props.paymentMethodType}`, className)}>\n <div className=\"adyen-checkout__voucher-result__top\">\n <div className=\"adyen-checkout__voucher-result__image\">\n {!!props.imageUrl && (\n <span className=\"adyen-checkout__voucher-result__image__wrapper\">\n <img alt={props.paymentMethodType} className=\"adyen-checkout__voucher-result__image__brand\" src={props.imageUrl} />\n </span>\n )}\n\n {!!props.issuerImageUrl && (\n <span className=\"adyen-checkout__voucher-result__image__wrapper\">\n <img alt={props.paymentMethodType} className=\"adyen-checkout__voucher-result__image__issuer\" src={props.issuerImageUrl} />\n </span>\n )}\n </div>\n\n <div className=\"adyen-checkout__voucher-result__introduction\">\n {props.introduction}{' '}\n {props.instructionsUrl && (\n <a\n className=\"adyen-checkout-link adyen-checkout-link--voucher-result-instructions\"\n href={props.instructionsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {i18n.get('voucher.readInstructions')} ›\n </a>\n )}\n </div>\n\n {props.amount && (\n <div className=\"adyen-checkout__voucher-result__amount\">\n {props.amount}\n\n {props.surcharge && (\n <span className=\"adyen-checkout__voucher-result__surcharge\">\n ({i18n.get('voucher.surcharge').replace('%@', props.surcharge)})\n </span>\n )}\n </div>\n )}\n </div>\n\n {props.reference && (\n <div className=\"adyen-checkout__voucher-result__separator\">\n <div className=\"adyen-checkout__voucher-result__separator__inner\" />\n <div className=\"adyen-checkout__voucher-result__code__label\">\n <span className=\"adyen-checkout__voucher-result__code__label__text\">{i18n.get('voucher.paymentReferenceLabel')}</span>\n </div>\n </div>\n )}\n\n <div className=\"adyen-checkout__voucher-result__bottom\">\n {props.reference && (\n <div className=\"adyen-checkout__voucher-result__code\">\n {props.barcode && (\n <img\n alt={i18n.get('voucher.paymentReferenceLabel')}\n className=\"adyen-checkout__voucher-result__code__barcode\"\n src={props.barcode}\n />\n )}\n <span>{props.reference}</span>\n </div>\n )}\n\n {(!!props.downloadUrl || !!props.copyBtn) && (\n <ul className=\"adyen-checkout__voucher-result__actions\">\n {!!props.copyBtn && (\n <li className=\"adyen-checkout__voucher-result__actions__item\">\n <Button\n inline\n variant=\"action\"\n onClick={(e, { complete }) => {\n copyToClipboard(props.reference);\n complete();\n }}\n icon={getImage({ imageFolder: 'components/' })(`${PREFIX}copy`)}\n label={i18n.get('button.copy')}\n />\n </li>\n )}\n\n {!!props.downloadUrl && (\n <li className=\"adyen-checkout__voucher-result__actions__item\">\n <Button\n inline\n variant=\"action\"\n href={props.downloadUrl}\n icon={getImage({ imageFolder: 'components/' })(`${PREFIX}download`)}\n label={props.downloadButtonText || i18n.get('button.download')}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n </li>\n )}\n </ul>\n )}\n\n <DetailsTable tableFields={voucherDetails} />\n </div>\n </div>\n );\n}\n"],"names":["Voucher","voucherDetails","className","props","i18n","useCoreContext","getImage","useImage","onActionHandled","componentType","paymentMethodType","actionDescription","h","div","classNames","imageUrl","span","img","alt","src","issuerImageUrl","introduction","instructionsUrl","a","href","target","rel","get","amount","surcharge","replace","reference","barcode","downloadUrl","copyBtn","ul","li","Button","inline","variant","onClick","e","complete","copyToClipboard","icon","imageFolder","PREFIX","label","downloadButtonText","DetailsTable","tableFields"],"mappings":"waAYe,SAASA,GAAQC,eAAEA,EAAiB,GAAEC,UAAEA,EAAY,MAAOC,IACtE,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAIjB,OAFAJ,EAAMK,kBAAkB,CAAEC,cAAeN,EAAMO,kBAAmBC,kBAAmB,sBAGjFC,EAACC,MAAAA,CAAIX,UAAWY,EAAW,iCAAkC,mCAAmCX,EAAMO,oBAAqBR,IACvHU,EAACC,MAAAA,CAAIX,UAAU,uCACXU,EAACC,MAAAA,CAAIX,UAAU,2CACRC,EAAMY,UACLH,EAACI,OAAAA,CAAKd,UAAU,kDACZU,EAACK,MAAAA,CAAIC,IAAKf,EAAMO,kBAAmBR,UAAU,+CAA+CiB,IAAKhB,EAAMY,cAI5GZ,EAAMiB,gBACLR,EAACI,OAAAA,CAAKd,UAAU,kDACZU,EAACK,MAAAA,CAAIC,IAAKf,EAAMO,kBAAmBR,UAAU,gDAAgDiB,IAAKhB,EAAMiB,mBAKpHR,EAACC,MAAAA,CAAIX,UAAU,gDACVC,EAAMk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,GAAGwC,aAClDC,MAAO5C,EAAM6C,oBAAsB5C,EAAKuB,IAAI,mBAC5CF,OAAO,SACPC,IAAI,0BAOxBd,EAACqC,EAAAA,CAAaC,YAAajD,KAI3C"}
@@ -1,2 +1,2 @@
1
- var a=function(a){return 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.paybybank_AIS_DD="paybybank_AIS_DD",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.upi_intent="upi_intent",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}({});export{a as TxVariants};
1
+ var a=function(a){return 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.paybybank_AIS_DD="paybybank_AIS_DD",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.payto="payto",a.upi="upi",a.upi_qr="upi_qr",a.upi_collect="upi_collect",a.upi_intent="upi_intent",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}({});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 paybybank_AIS_DD = 'paybybank_AIS_DD',\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 upi_intent = 'upi_intent', // 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":"AAAO,IAAAA,EAAKA,SAAAA,GAAAA,OACKA,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,oJAUFA,EAAA,OAAA,qGAOEA,EAAA,YAAA,8LAYHA,EAAA,KAAA,yHAUGA,EAAA,SAAA,mMArJLA,CA4JX,CA5JWA,CA4JX,CAAA"}
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 paybybank_AIS_DD = 'paybybank_AIS_DD',\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 payto = 'payto',\n upi = 'upi', // also QR\n upi_qr = 'upi_qr', // also QR\n upi_collect = 'upi_collect', // also QR\n upi_intent = 'upi_intent', // 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":"AAAO,IAAAA,EAAKA,SAAAA,GAAAA,OACKA,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,oJAUFA,EAAA,OAAA,qGAOEA,EAAA,YAAA,8LAYHA,EAAA,KAAA,yIAWGA,EAAA,SAAA,mMAtJLA,CA6JX,CA7JWA,CA6JX,CAAA"}
@@ -1,2 +1,2 @@
1
- function t(t){return!this.length||this.indexOf(t.type)>-1}function e(t){return!this.length||this.indexOf(t.type)<0}function n(t){return!!t&&!!t.supportedShopperInteractions&&t.supportedShopperInteractions.includes("Ecommerce")}const i=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD"];function p(t){return!!t&&!!t.type&&i.includes(t.type)}export{t as filterAllowedPaymentMethods,n as filterEcomStoredPaymentMethods,e as filterRemovedPaymentMethods,p as filterSupportedStoredPaymentMethods};
1
+ function t(t){return!this.length||this.indexOf(t.type)>-1}function e(t){return!this.length||this.indexOf(t.type)<0}function n(t){return!!t&&!!t.supportedShopperInteractions&&t.supportedShopperInteractions.includes("Ecommerce")}const p=["scheme","blik","twint","ach","cashapp","paybybank_AIS_DD","payto"];function i(t){return!!t&&!!t.type&&p.includes(t.type)}export{t as filterAllowedPaymentMethods,n as filterEcomStoredPaymentMethods,e as filterRemovedPaymentMethods,i as filterSupportedStoredPaymentMethods};
2
2
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sources":["../../../../../src/core/ProcessResponse/PaymentMethods/filters.ts"],"sourcesContent":["export function filterAllowedPaymentMethods(pm) {\n return !this.length || this.indexOf(pm.type) > -1;\n}\n\nexport function filterRemovedPaymentMethods(pm) {\n return !this.length || this.indexOf(pm.type) < 0;\n}\n\nexport function filterEcomStoredPaymentMethods(pm) {\n return !!pm && !!pm.supportedShopperInteractions && pm.supportedShopperInteractions.includes('Ecommerce');\n}\n\nconst supportedStoredPaymentMethods = ['scheme', 'blik', 'twint', 'ach', 'cashapp', 'paybybank_AIS_DD'];\n\nexport function filterSupportedStoredPaymentMethods(pm) {\n return !!pm && !!pm.type && supportedStoredPaymentMethods.includes(pm.type);\n}\n"],"names":["filterAllowedPaymentMethods","pm","this","length","indexOf","type","filterRemovedPaymentMethods","filterEcomStoredPaymentMethods","supportedShopperInteractions","includes","supportedStoredPaymentMethods","filterSupportedStoredPaymentMethods"],"mappings":"AAAO,SAASA,EAA4BC,GACxC,OAAQC,KAAKC,QAAUD,KAAKE,QAAQH,EAAGI,OAAS,CACpD,CAEO,SAASC,EAA4BL,GACxC,OAAQC,KAAKC,QAAUD,KAAKE,QAAQH,EAAGI,MAAQ,CACnD,CAEO,SAASE,EAA+BN,GAC3C,QAASA,KAAQA,EAAGO,8BAAgCP,EAAGO,6BAA6BC,SAAS,YACjG,CAEA,MAAMC,EAAgC,CAAC,SAAU,OAAQ,QAAS,MAAO,UAAW,oBAE7E,SAASC,EAAoCV,GAChD,QAASA,KAAQA,EAAGI,MAAQK,EAA8BD,SAASR,EAAGI,KAC1E"}
1
+ {"version":3,"file":"filters.js","sources":["../../../../../src/core/ProcessResponse/PaymentMethods/filters.ts"],"sourcesContent":["export function filterAllowedPaymentMethods(pm) {\n return !this.length || this.indexOf(pm.type) > -1;\n}\n\nexport function filterRemovedPaymentMethods(pm) {\n return !this.length || this.indexOf(pm.type) < 0;\n}\n\nexport function filterEcomStoredPaymentMethods(pm) {\n return !!pm && !!pm.supportedShopperInteractions && pm.supportedShopperInteractions.includes('Ecommerce');\n}\n\nconst supportedStoredPaymentMethods = ['scheme', 'blik', 'twint', 'ach', 'cashapp', 'paybybank_AIS_DD', 'payto'];\n\nexport function filterSupportedStoredPaymentMethods(pm) {\n return !!pm && !!pm.type && supportedStoredPaymentMethods.includes(pm.type);\n}\n"],"names":["filterAllowedPaymentMethods","pm","this","length","indexOf","type","filterRemovedPaymentMethods","filterEcomStoredPaymentMethods","supportedShopperInteractions","includes","supportedStoredPaymentMethods","filterSupportedStoredPaymentMethods"],"mappings":"AAAO,SAASA,EAA4BC,GACxC,OAAQC,KAAKC,QAAUD,KAAKE,QAAQH,EAAGI,OAAS,CACpD,CAEO,SAASC,EAA4BL,GACxC,OAAQC,KAAKC,QAAUD,KAAKE,QAAQH,EAAGI,MAAQ,CACnD,CAEO,SAASE,EAA+BN,GAC3C,QAASA,KAAQA,EAAGO,8BAAgCP,EAAGO,6BAA6BC,SAAS,YACjG,CAEA,MAAMC,EAAgC,CAAC,SAAU,OAAQ,QAAS,MAAO,UAAW,mBAAoB,SAEjG,SAASC,EAAoCV,GAChD,QAASA,KAAQA,EAAGI,MAAQK,EAA8BD,SAASR,EAAGI,KAC1E"}
@@ -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.8.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.10.0",channel:"Web",platform:"Web",buildType:a,locale:i,referrer:window.location.href,screenWidth:window.screen.width,...n};if(l)return l;if(!r)return Promise.reject("no-client-key");const m=new t("checkout-attempt-id","sessionStorage"),d=m.get();return function(e){if(!e?.id)return!1;const t=Date.now()-9e5;return e.timestamp>t}(d)?Promise.resolve(d.id):(l=e(s,c).then((e=>{if(e?.checkoutAttemptId)return m.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(o))),l)}};export{o as FAILURE_MSG,n as default};
2
2
  //# sourceMappingURL=collect-id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collect-id.js","sources":["../../../../../src/core/Services/analytics/collect-id.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Storage from '../../../utils/Storage';\nimport { CheckoutAttemptIdSession, CollectIdEvent, CollectIdProps, TelemetryEvent } from './types';\n\nexport const FAILURE_MSG =\n 'WARNING: Failed to retrieve \"checkoutAttemptId\". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession: CheckoutAttemptIdSession): boolean {\n if (!checkoutAttemptIdSession?.id) return false;\n\n const fifteenMinInMs = 1000 * 60 * 15;\n const fifteenMinAgoTimestamp = Date.now() - fifteenMinInMs;\n return checkoutAttemptIdSession.timestamp > fifteenMinAgoTimestamp;\n}\n\n/**\n * Send an event to Adyen with some basic telemetry info and receive a checkoutAttemptId in response\n * @param config - object containing values needed to calculate the url for the request; and also some that need to be serialized and included in the body of request\n * @returns a function returning a promise containing the response of the call (an object containing a checkoutAttemptId property)\n */\n// const collectId = ({ analyticsContext, clientKey, locale, amount }: CollectIdProps) => { // TODO - amount will be supported in the future\nconst collectId = ({ analyticsContext, clientKey, locale, analyticsPath, bundleType }: CollectIdProps) => {\n let promise;\n\n const options = {\n errorLevel: 'fatal' as const, // ensure our catch block is called\n loadingContext: analyticsContext,\n path: `${analyticsPath}?clientKey=${clientKey}`\n };\n\n return (event: CollectIdEvent): Promise<string> => {\n const telemetryEvent: TelemetryEvent = {\n // amount, // TODO will be supported in the future\n version: process.env.VERSION,\n // The data team want both platform & channel properties:\n channel: 'Web',\n platform: 'Web',\n buildType: bundleType,\n locale,\n referrer: window.location.href,\n screenWidth: window.screen.width,\n ...event\n };\n\n if (promise) return promise; // Prevents multiple standalone components on the same page from making multiple calls to collect a checkoutAttemptId\n if (!clientKey) return Promise.reject('no-client-key');\n\n const storage = new Storage<CheckoutAttemptIdSession>('checkout-attempt-id', 'sessionStorage');\n const checkoutAttemptIdSession = storage.get();\n\n // In some cases, e.g. where the merchant has redirected the shopper and then returned them to checkout, we still have a valid checkoutAttemptId\n // so there is no need for the re-initialised Checkout to generate another one\n if (confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession)) {\n return Promise.resolve(checkoutAttemptIdSession.id);\n }\n\n promise = httpPost(options, telemetryEvent)\n .then(conversion => {\n if (conversion?.checkoutAttemptId) {\n storage.set({ id: conversion.checkoutAttemptId, timestamp: Date.now() });\n return conversion.checkoutAttemptId;\n }\n return undefined;\n })\n .catch(() => {\n return Promise.reject(FAILURE_MSG);\n });\n\n return promise;\n };\n};\n\nexport default collectId;\n"],"names":["FAILURE_MSG","collectId","analyticsContext","clientKey","locale","analyticsPath","bundleType","promise","options","errorLevel","loadingContext","path","event","telemetryEvent","version","channel","platform","buildType","referrer","window","location","href","screenWidth","screen","width","Promise","reject","storage","Storage","checkoutAttemptIdSession","get","id","fifteenMinAgoTimestamp","Date","now","timestamp","confirmSessionDurationIsMaxFifteenMinutes","resolve","httpPost","then","conversion","checkoutAttemptId","set","undefined","catch"],"mappings":"+EAIO,MAAMA,EACT,uKAoBJ,MAAMC,EAAY,EAAGC,mBAAkBC,YAAWC,SAAQC,gBAAeC,iBACrE,IAAIC,EAEJ,MAAMC,EAAU,CACZC,WAAY,QACZC,eAAgBR,EAChBS,KAAM,GAAGN,eAA2BF,KAGxC,OAAQS,IACJ,MAAMC,EAAiC,CAEnCC,QAAS,QAETC,QAAS,MACTC,SAAU,MACVC,UAAWX,EACXF,SACAc,SAAUC,OAAOC,SAASC,KAC1BC,YAAaH,OAAOI,OAAOC,SACxBZ,GAGP,GAAIL,EAAS,OAAOA,EACpB,IAAKJ,EAAW,OAAOsB,QAAQC,OAAO,iBAEtC,MAAMC,EAAU,IAAIC,EAAkC,sBAAuB,kBACvEC,EAA2BF,EAAQG,MAIzC,OA7CR,SAAmDD,GAC/C,IAAKA,GAA0BE,GAAI,OAAO,EAE1C,MACMC,EAAyBC,KAAKC,MADb,IAEvB,OAAOL,EAAyBM,UAAYH,CAChD,CAuCYI,CAA0CP,GACnCJ,QAAQY,QAAQR,EAAyBE,KAGpDxB,EAAU+B,EAAS9B,EAASK,GACvB0B,MAAKC,IACF,GAAIA,GAAYC,kBAEZ,OADAd,EAAQe,IAAI,CAAEX,GAAIS,EAAWC,kBAAmBN,UAAWF,KAAKC,QACzDM,EAAWC,iBAEfE,IAEVC,OAAM,IACInB,QAAQC,OAAO1B,KAGvBO,EAAAA,CACX"}
1
+ {"version":3,"file":"collect-id.js","sources":["../../../../../src/core/Services/analytics/collect-id.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Storage from '../../../utils/Storage';\nimport { CheckoutAttemptIdSession, CollectIdEvent, CollectIdProps, TelemetryEvent } from './types';\n\nexport const FAILURE_MSG =\n 'WARNING: Failed to retrieve \"checkoutAttemptId\". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession: CheckoutAttemptIdSession): boolean {\n if (!checkoutAttemptIdSession?.id) return false;\n\n const fifteenMinInMs = 1000 * 60 * 15;\n const fifteenMinAgoTimestamp = Date.now() - fifteenMinInMs;\n return checkoutAttemptIdSession.timestamp > fifteenMinAgoTimestamp;\n}\n\n/**\n * Send an event to Adyen with some basic telemetry info and receive a checkoutAttemptId in response\n * @param config - object containing values needed to calculate the url for the request; and also some that need to be serialized and included in the body of request\n * @returns a function returning a promise containing the response of the call (an object containing a checkoutAttemptId property)\n */\n// const collectId = ({ analyticsContext, clientKey, locale, amount }: CollectIdProps) => { // TODO - amount will be supported in the future\nconst collectId = ({ analyticsContext, clientKey, locale, analyticsPath, bundleType }: CollectIdProps) => {\n let promise;\n\n const options = {\n errorLevel: 'fatal' as const, // ensure our catch block is called\n loadingContext: analyticsContext,\n path: `${analyticsPath}?clientKey=${clientKey}`\n };\n\n return (event: CollectIdEvent): Promise<string> => {\n const telemetryEvent: TelemetryEvent = {\n // amount, // TODO will be supported in the future\n version: process.env.VERSION,\n // The data team want both platform & channel properties:\n channel: 'Web',\n platform: 'Web',\n buildType: bundleType,\n locale,\n referrer: window.location.href,\n screenWidth: window.screen.width,\n ...event\n };\n\n if (promise) return promise; // Prevents multiple standalone components on the same page from making multiple calls to collect a checkoutAttemptId\n if (!clientKey) return Promise.reject('no-client-key');\n\n const storage = new Storage<CheckoutAttemptIdSession>('checkout-attempt-id', 'sessionStorage');\n const checkoutAttemptIdSession = storage.get();\n\n // In some cases, e.g. where the merchant has redirected the shopper and then returned them to checkout, we still have a valid checkoutAttemptId\n // so there is no need for the re-initialised Checkout to generate another one\n if (confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession)) {\n return Promise.resolve(checkoutAttemptIdSession.id);\n }\n\n promise = httpPost(options, telemetryEvent)\n .then(conversion => {\n if (conversion?.checkoutAttemptId) {\n storage.set({ id: conversion.checkoutAttemptId, timestamp: Date.now() });\n return conversion.checkoutAttemptId;\n }\n return undefined;\n })\n .catch(() => {\n return Promise.reject(FAILURE_MSG);\n });\n\n return promise;\n };\n};\n\nexport default collectId;\n"],"names":["FAILURE_MSG","collectId","analyticsContext","clientKey","locale","analyticsPath","bundleType","promise","options","errorLevel","loadingContext","path","event","telemetryEvent","version","channel","platform","buildType","referrer","window","location","href","screenWidth","screen","width","Promise","reject","storage","Storage","checkoutAttemptIdSession","get","id","fifteenMinAgoTimestamp","Date","now","timestamp","confirmSessionDurationIsMaxFifteenMinutes","resolve","httpPost","then","conversion","checkoutAttemptId","set","undefined","catch"],"mappings":"+EAIO,MAAMA,EACT,uKAoBJ,MAAMC,EAAY,EAAGC,mBAAkBC,YAAWC,SAAQC,gBAAeC,iBACrE,IAAIC,EAEJ,MAAMC,EAAU,CACZC,WAAY,QACZC,eAAgBR,EAChBS,KAAM,GAAGN,eAA2BF,KAGxC,OAAQS,IACJ,MAAMC,EAAiC,CAEnCC,QAAS,SAETC,QAAS,MACTC,SAAU,MACVC,UAAWX,EACXF,SACAc,SAAUC,OAAOC,SAASC,KAC1BC,YAAaH,OAAOI,OAAOC,SACxBZ,GAGP,GAAIL,EAAS,OAAOA,EACpB,IAAKJ,EAAW,OAAOsB,QAAQC,OAAO,iBAEtC,MAAMC,EAAU,IAAIC,EAAkC,sBAAuB,kBACvEC,EAA2BF,EAAQG,MAIzC,OA7CR,SAAmDD,GAC/C,IAAKA,GAA0BE,GAAI,OAAO,EAE1C,MACMC,EAAyBC,KAAKC,MADb,IAEvB,OAAOL,EAAyBM,UAAYH,CAChD,CAuCYI,CAA0CP,GACnCJ,QAAQY,QAAQR,EAAyBE,KAGpDxB,EAAU+B,EAAS9B,EAASK,GACvB0B,MAAKC,IACF,GAAIA,GAAYC,kBAEZ,OADAd,EAAQe,IAAI,CAAEX,GAAIS,EAAWC,kBAAmBN,UAAWF,KAAKC,QACzDM,EAAWC,iBAEfE,IAEVC,OAAM,IACInB,QAAQC,OAAO1B,KAGvBO,EAAAA,CACX"}
@@ -1,2 +1,2 @@
1
- import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as f}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import v from"./Services/get-translations.js";import{defaultProps as b}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as E}from"../language/utils.js";import{resolveEnvironments as A}from"./Environment/Environment.js";function P(t,o,s){return o in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}class M{static setBundleType(t){M.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await v(this.cdnTranslationsUrl,M.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=j(this.options.locale),this.options.translations=E(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:f,subtype:t.type,message:`${s} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return e(this,p,t,i)}return this.handleCreateError()}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:M.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}constructor(t){P(this,"session",void 0),P(this,"paymentMethodsResponse",void 0),P(this,"modules",void 0),P(this,"options",void 0),P(this,"analyticsContext",void 0),P(this,"loadingContext",void 0),P(this,"cdnImagesUrl",void 0),P(this,"cdnTranslationsUrl",void 0),P(this,"components",[]),P(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this)))))),P(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),P(this,"setOptions",(t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}})),a(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...b,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=A(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=M.metadata)}}P(M,"metadata",{version:"6.8.0",bundleType:"esm"}),P(M,"registry",p);export{M as default};
1
+ import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as f}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import v from"./Services/get-translations.js";import{defaultProps as b}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as E}from"../language/utils.js";import{resolveEnvironments as A}from"./Environment/Environment.js";function P(t,o,s){return o in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}class M{static setBundleType(t){M.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await v(this.cdnTranslationsUrl,M.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=j(this.options.locale),this.options.translations=E(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:f,subtype:t.type,message:`${s} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return e(this,p,t,i)}return this.handleCreateError()}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:M.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}constructor(t){P(this,"session",void 0),P(this,"paymentMethodsResponse",void 0),P(this,"modules",void 0),P(this,"options",void 0),P(this,"analyticsContext",void 0),P(this,"loadingContext",void 0),P(this,"cdnImagesUrl",void 0),P(this,"cdnTranslationsUrl",void 0),P(this,"components",[]),P(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this)))))),P(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),P(this,"setOptions",(t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}})),a(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...b,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=A(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=M.metadata)}}P(M,"metadata",{version:"6.10.0",bundleType:"esm"}),P(M,"registry",p);export{M as default};
2
2
  //# sourceMappingURL=core.js.map