@adyen/adyen-web 6.43.0 → 6.45.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 (305) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/adyen.css +8 -8
  3. package/dist/cjs/adyen.css.map +1 -1
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/index.d.cts +99 -37
  7. package/dist/es/adyen.css +8 -8
  8. package/dist/es/adyen.css.map +1 -1
  9. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  10. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  11. package/dist/es/components/Card/Card.js +1 -1
  12. package/dist/es/components/Card/Card.js.map +1 -1
  13. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  14. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  18. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  19. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js +1 -1
  20. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -1
  21. package/dist/es/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  22. package/dist/es/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  23. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  24. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  25. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  26. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  27. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  28. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  29. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  30. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  31. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  32. package/dist/es/components/Donation/DonationCampaignService.js +1 -1
  33. package/dist/es/components/Donation/DonationCampaignService.js.map +1 -1
  34. package/dist/es/components/Dropin/Dropin.js +1 -1
  35. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  36. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  37. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  38. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  39. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  40. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js +1 -1
  41. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js.map +1 -1
  42. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  43. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  44. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  45. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  46. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  47. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  48. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  49. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  50. package/dist/es/components/GooglePay/GooglePayService.js +1 -1
  51. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  52. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  53. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  54. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  55. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  56. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  57. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  58. package/dist/es/components/PayTo/PayTo.js +1 -1
  59. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  60. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  61. package/dist/es/components/Twint/Twint.js +1 -1
  62. package/dist/es/components/Twint/Twint.js.map +1 -1
  63. package/dist/es/components/internal/Address/Address.js +1 -1
  64. package/dist/es/components/internal/Address/Address.js.map +1 -1
  65. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  66. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  67. package/dist/es/components/internal/Address/validate.js +1 -1
  68. package/dist/es/components/internal/Address/validate.js.map +1 -1
  69. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  70. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  71. package/dist/es/components/internal/Button/Button.js +1 -1
  72. package/dist/es/components/internal/Button/Button.js.map +1 -1
  73. package/dist/es/components/internal/Button/CopyButton.js +1 -1
  74. package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
  75. package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
  76. package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
  77. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  78. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  79. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  80. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  81. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  82. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  83. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  84. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  85. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  86. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  87. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  88. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  89. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  90. package/dist/es/components/internal/Modal/Modal.js +1 -1
  91. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  92. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  93. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  94. package/dist/es/components/internal/PayButton/utils.js +1 -1
  95. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  96. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  97. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  98. package/dist/es/components/internal/QRLoader/components/QRFinalState.js +1 -1
  99. package/dist/es/components/internal/QRLoader/components/QRFinalState.js.map +1 -1
  100. package/dist/es/components/internal/QRLoader/components/QRLoaderPendingState.js +2 -0
  101. package/dist/es/components/internal/QRLoader/components/QRLoaderPendingState.js.map +1 -0
  102. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  103. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  104. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  105. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  106. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  107. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  108. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  109. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  110. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  111. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  112. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  113. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  114. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  115. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  116. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  117. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  118. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  119. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  120. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  121. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  122. package/dist/es/core/Analytics/constants.js +1 -1
  123. package/dist/es/core/Analytics/constants.js.map +1 -1
  124. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  125. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  126. package/dist/es/core/Errors/SRMessages.js +1 -1
  127. package/dist/es/core/Errors/SRMessages.js.map +1 -1
  128. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  129. package/dist/es/core/Errors/SRPanelProvider.js.map +1 -1
  130. package/dist/es/core/Errors/constants.js +1 -1
  131. package/dist/es/core/Errors/constants.js.map +1 -1
  132. package/dist/es/core/Errors/useA11yReporter.js +1 -1
  133. package/dist/es/core/Errors/useA11yReporter.js.map +1 -1
  134. package/dist/es/core/Errors/useLoadingA11yReporter.js +2 -0
  135. package/dist/es/core/Errors/useLoadingA11yReporter.js.map +1 -0
  136. package/dist/es/core/Errors/utils.js +1 -1
  137. package/dist/es/core/Errors/utils.js.map +1 -1
  138. package/dist/es/core/config.js +1 -1
  139. package/dist/es/core/config.js.map +1 -1
  140. package/dist/es/core/core.js +1 -1
  141. package/dist/es/core/core.js.map +1 -1
  142. package/dist/es/core/utils.js +1 -1
  143. package/dist/es/core/utils.js.map +1 -1
  144. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  145. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  146. package/dist/es/external/preact/dist/preact.js +1 -1
  147. package/dist/es/external/preact/dist/preact.js.map +1 -1
  148. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  149. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  150. package/dist/es/index.d.ts +99 -37
  151. package/dist/es/packages/server/translations/en-US.json.js +1 -1
  152. package/dist/es/utils/useForm/useForm.js +1 -1
  153. package/dist/es/utils/useForm/useForm.js.map +1 -1
  154. package/dist/es/utils/validator-utils.js +1 -1
  155. package/dist/es/utils/validator-utils.js.map +1 -1
  156. package/dist/es-legacy/adyen.css +8 -8
  157. package/dist/es-legacy/adyen.css.map +1 -1
  158. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  159. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  160. package/dist/es-legacy/components/Card/Card.js +1 -1
  161. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  162. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  163. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  164. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  165. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  166. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  167. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  168. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js +1 -1
  169. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -1
  170. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  171. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  172. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  173. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  174. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  175. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  176. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  177. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  178. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  179. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  180. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  181. package/dist/es-legacy/components/Donation/DonationCampaignService.js +1 -1
  182. package/dist/es-legacy/components/Donation/DonationCampaignService.js.map +1 -1
  183. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  184. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  185. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  186. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  187. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  188. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  189. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js +1 -1
  190. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js.map +1 -1
  191. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  192. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  193. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  194. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  195. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  196. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  197. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  198. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  199. package/dist/es-legacy/components/GooglePay/GooglePayService.js +1 -1
  200. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  201. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  202. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  203. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  204. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  205. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  206. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  207. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  208. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  209. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  210. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  211. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  212. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  213. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  214. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  215. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  216. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  217. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  218. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  219. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  220. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  221. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  222. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  223. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  224. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  225. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  226. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  227. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  228. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  229. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  230. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  231. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  232. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  233. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  234. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  235. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  236. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  237. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  238. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  239. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  240. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  241. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  242. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  243. package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
  244. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  245. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  246. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  247. package/dist/es-legacy/components/internal/QRLoader/components/QRFinalState.js +1 -1
  248. package/dist/es-legacy/components/internal/QRLoader/components/QRFinalState.js.map +1 -1
  249. package/dist/es-legacy/components/internal/QRLoader/components/QRLoaderPendingState.js +2 -0
  250. package/dist/es-legacy/components/internal/QRLoader/components/QRLoaderPendingState.js.map +1 -0
  251. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  252. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  253. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  254. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  255. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  256. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  257. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  258. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  259. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  260. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  261. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  262. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  263. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  264. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  265. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  266. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  267. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  268. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  269. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  270. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  271. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  272. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  273. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  274. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  275. package/dist/es-legacy/core/Errors/SRMessages.js +1 -1
  276. package/dist/es-legacy/core/Errors/SRMessages.js.map +1 -1
  277. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  278. package/dist/es-legacy/core/Errors/SRPanelProvider.js.map +1 -1
  279. package/dist/es-legacy/core/Errors/constants.js +1 -1
  280. package/dist/es-legacy/core/Errors/constants.js.map +1 -1
  281. package/dist/es-legacy/core/Errors/useA11yReporter.js +1 -1
  282. package/dist/es-legacy/core/Errors/useA11yReporter.js.map +1 -1
  283. package/dist/es-legacy/core/Errors/useLoadingA11yReporter.js +2 -0
  284. package/dist/es-legacy/core/Errors/useLoadingA11yReporter.js.map +1 -0
  285. package/dist/es-legacy/core/Errors/utils.js +1 -1
  286. package/dist/es-legacy/core/Errors/utils.js.map +1 -1
  287. package/dist/es-legacy/core/config.js +1 -1
  288. package/dist/es-legacy/core/config.js.map +1 -1
  289. package/dist/es-legacy/core/core.js +1 -1
  290. package/dist/es-legacy/core/core.js.map +1 -1
  291. package/dist/es-legacy/core/utils.js +1 -1
  292. package/dist/es-legacy/core/utils.js.map +1 -1
  293. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  294. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  295. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  296. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  297. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  298. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  299. package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
  300. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  301. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  302. package/dist/es-legacy/utils/validator-utils.js +1 -1
  303. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  304. package/package.json +27 -27
  305. package/styles/adyen.css +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import {\n CVCPolicyType,\n DatePolicyType,\n RtnType_callbackFn,\n RtnType_noParamVoidFn,\n RtnType_postMessageListener,\n SecuredFieldCommonProps,\n SecuredFieldSetupObject\n} from '../types';\n\nabstract class AbstractSecuredField {\n public sfConfig: Partial<SecuredFieldCommonProps>; // could be protected but needs to be public for tests to run\n protected componentType: string;\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n protected submitAnalytics: SecuredFieldSetupObject['submitAnalytics'];\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n protected onKeyPressedCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {};\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","this","sfConfig","componentType","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","submitAnalytics","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyPressedCallback"],"mappings":"wHAUA,MAAeA,EA+BX,WAAAC,GA9BAC,EAAAC,KAAOC,gBAAP,GACAF,EAAAC,KAAUE,wBACVH,EAAAC,KAAUG,yBACVJ,EAAAC,KAAUI,mBACVL,EAAAC,KAAUK,oBACVN,EAAAC,KAAOM,8BAEPP,EAAAC,KAAUO,mBACVR,EAAAC,KAAUQ,+BACVT,EAAAC,KAAUS,kBACVV,EAAAC,KAAUU,uBACVX,EAAAC,KAAUW,oBACVZ,EAAAC,KAAUY,qBACVb,EAAAC,KAAUa,qBACVd,EAAAC,KAAUc,4BACVf,EAAAC,KAAUe,gCACVhB,EAAAC,KAAUgB,+BACVjB,EAAAC,KAAUiB,0BAEVlB,EAAAC,KAAUkB,iCACVnB,EAAAC,KAAUmB,2BACVpB,EAAAC,KAAUoB,+BACVrB,EAAAC,KAAUqB,+BACVtB,EAAAC,KAAUsB,0BACVvB,EAAAC,KAAUuB,6BACVxB,EAAAC,KAAUwB,+BACVzB,EAAAC,KAAUyB,6BACV1B,EAAAC,KAAU0B,iCACV3B,EAAAC,KAAU2B,+BAGN3B,KAAKC,SAAW,CAAA,CACpB"}
1
+ {"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import {\n CVCPolicyType,\n DatePolicyType,\n RtnType_callbackFn,\n RtnType_noParamVoidFn,\n RtnType_postMessageListener,\n SecuredFieldCommonProps,\n SecuredFieldSetupObject\n} from '../types';\n\nabstract class AbstractSecuredField {\n public sfConfig: Partial<SecuredFieldCommonProps>; // could be protected but needs to be public for tests to run\n protected componentType: string;\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n protected submitAnalytics: SecuredFieldSetupObject['submitAnalytics'];\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n protected onKeyDownCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {};\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","this","sfConfig","componentType","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","submitAnalytics","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyDownCallback"],"mappings":"wHAUA,MAAeA,EA+BX,WAAAC,GA9BAC,EAAAC,KAAOC,gBAAP,GACAF,EAAAC,KAAUE,wBACVH,EAAAC,KAAUG,yBACVJ,EAAAC,KAAUI,mBACVL,EAAAC,KAAUK,oBACVN,EAAAC,KAAOM,8BAEPP,EAAAC,KAAUO,mBACVR,EAAAC,KAAUQ,+BACVT,EAAAC,KAAUS,kBACVV,EAAAC,KAAUU,uBACVX,EAAAC,KAAUW,oBACVZ,EAAAC,KAAUY,qBACVb,EAAAC,KAAUa,qBACVd,EAAAC,KAAUc,4BACVf,EAAAC,KAAUe,gCACVhB,EAAAC,KAAUgB,+BACVjB,EAAAC,KAAUiB,0BAEVlB,EAAAC,KAAUkB,iCACVnB,EAAAC,KAAUmB,2BACVpB,EAAAC,KAAUoB,+BACVrB,EAAAC,KAAUqB,+BACVtB,EAAAC,KAAUsB,0BACVvB,EAAAC,KAAUuB,6BACVxB,EAAAC,KAAUwB,+BACVzB,EAAAC,KAAUyB,6BACV1B,EAAAC,KAAU0B,iCACV3B,EAAAC,KAAU2B,4BAGN3B,KAAKC,SAAW,CAAA,CACpB"}
@@ -1,2 +1,2 @@
1
- import{log as e,warn as i}from"../utilities/logger.js";import t from"./utils/createIframe.js";import{selectOne as s,removeAllChildren as r}from"../utilities/dom.js";import{on as n,off as o}from"../../../../../utils/listenerUtils.js";import a from"../CSF/utils/iframes/postMessageToIframe.js";import{originCheckPassed as l,isWebpackPostMsg as c,isChromeVoxPostMsg as h}from"../CSF/utils/iframes/postMessageValidation.js";import{ENCRYPTED_EXPIRY_DATE as f,ENCRYPTED_EXPIRY_MONTH as d,ENCRYPTED_EXPIRY_YEAR as u,DATE_POLICY_OPTIONAL as p,DATE_POLICY_HIDDEN as m,ENCRYPTED_SECURITY_CODE as y,CVC_POLICY_OPTIONAL as g,CVC_POLICY_HIDDEN as C}from"../constants.js";import{generateRandomNumber as b}from"../utilities/commonUtils.js";import w from"./AbstractSecuredField.js";import{reject as E}from"../../../../../utils/commonUtils.js";import{processAriaConfig as O}from"./utils/processAriaConfig.js";import{processPlaceholders as T}from"./utils/processPlaceholders.js";import{hasOwnProperty as P}from"../../../../../utils/hasOwnProperty.js";import{AnalyticsErrorEvent as L,ErrorEventType as k,ErrorEventCode as j}from"../../../../../core/Analytics/events/AnalyticsErrorEvent.js";function F(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function _(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{},s=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.forEach(function(i){F(e,i,t[i])})}return e}function S(e,i){return i=null!=i?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):function(e){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);i.push.apply(i,t)}return i}(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}),e}class v extends w{init(e,i,r,o){const a=O(this.sfConfig.txVariant,this.sfConfig.fieldType,e,o);this.sfConfig.iframeUIConfig.ariaConfig=a,this.sfConfig.iframeUIConfig.placeholders=T(this.sfConfig.txVariant,this.sfConfig.fieldType,r);const l={src:i,title:a[this.sfConfig.fieldType].iframeTitle,policy:"origin"},c=t(l);this.holderEl.appendChild(c);const h=s(this.holderEl,".js-iframe");if(h){if(!h.contentWindow){var f;console.error("ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?");const e=new L({component:this.componentType,code:j.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:k.implementation,message:`Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`});null===(f=this.submitAnalytics)||void 0===f||f.call(this,e)}this.iframeContentWindow=h.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,n(h,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=h,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,n(window,"message",this.postMessageListener,!1);const e=S(_({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),a(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(t){if(!l(t,this.loadingContext,this.sfConfig.showWarnings))return;let s;try{s=JSON.parse(t.data)}catch(i){return c(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):h(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",t.data))}if(P(s,"action")&&P(s,"numKey"))if(this.numKey===s.numKey)switch(s.action){case"encryption":this.isValid=!0,this.onEncryptionCallback(s);break;case"config":window._b$dl&&console.log("### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback",s.fieldType),this.onConfigCallback(s);break;case"focus":this.onFocusCallback(s);break;case"binValue":this.onBinValueCallback(s);break;case"touch":this.onTouchstartCallback(s);break;case"shifttab":this.onShiftTabCallback(s);break;case"autoComplete":this.onAutoCompleteCallback(s);break;case"enterKeyPressed":this.onKeyPressedCallback(s);break;case"encryptionError":{var r;const e=new L({component:this.componentType,code:s.code,errorType:k.internal,message:`${s.error}. Field= ${this.sfConfig.fieldType}`});null===(r=this.submitAnalytics)||void 0===r||r.call(this,e);break}default:this.isValid=!1,this.onValidationCallback(s)}else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){o(window,"message",this.postMessageListener,!1),o(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,r(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return!1}return!1}onIframeLoaded(e){return this.onIframeLoadedCallback=e,this}onEncryption(e){return this.onEncryptionCallback=e,this}onValidation(e){return this.onValidationCallback=e,this}onConfig(e){return this.onConfigCallback=e,this}onFocus(e){return this.onFocusCallback=e,this}onBinValue(e){return this.onBinValueCallback=e,this}onTouchstart(e){return this.onTouchstartCallback=e,this}onShiftTab(e){return this.onShiftTabCallback=e,this}onAutoComplete(e){return this.onAutoCompleteCallback=e,this}onKeyPressed(e){return this.onKeyPressedCallback=e,this}get errorType(){return this._errorType}set errorType(e){this._errorType=e}get hasError(){return this._hasError}set hasError(e){this._hasError=e}get isValid(){if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return this._isValid}return this._isValid}set isValid(e){this._isValid=e}get cvcPolicy(){return this._cvcPolicy}set cvcPolicy(e){this.sfConfig.fieldType===y&&e!==this.cvcPolicy&&(this._cvcPolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get expiryDatePolicy(){return this._expiryDatePolicy}set expiryDatePolicy(e){this.sfConfig.fieldType!==f&&this.sfConfig.fieldType!==d&&this.sfConfig.fieldType!==u||e!==this.expiryDatePolicy&&(this._expiryDatePolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get iframeContentWindow(){return this._iframeContentWindow}set iframeContentWindow(e){this._iframeContentWindow=e}get isEncrypted(){return this._isEncrypted}set isEncrypted(e){this._isEncrypted=e}get numKey(){return this._numKey}set numKey(e){this._numKey=e}get iframeOnLoadListener(){return this._iframeOnLoadListener}set iframeOnLoadListener(e){this._iframeOnLoadListener=e.bind(this)}get postMessageListener(){return this._postMessageListener}set postMessageListener(e){this._postMessageListener=e.bind(this)}constructor(e,i){super(),F(this,"sfConfig",void 0);const t=E(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=S(_({},t),{iframeUIConfig:_({},t.iframeUIConfig)});const{iframeSrc:s,placeholders:r,showContextualElement:n}=e;return this.loadingContext=e.loadingContext,this.holderEl=e.holderEl,this.submitAnalytics=e.submitAnalytics,this.componentType=e.componentType,this.isValid=!1,this.iframeContentWindow=null,this.numKey=b(),this.isEncrypted=!1,this.hasError=!1,this.errorType="",this.cvcPolicy=e.cvcPolicy,this.expiryDatePolicy=e.expiryDatePolicy,this.init(i,s,r,n)}}export{v as default};
1
+ import{log as e,warn as i}from"../utilities/logger.js";import t from"./utils/createIframe.js";import{selectOne as s,removeAllChildren as r}from"../utilities/dom.js";import{on as n,off as o}from"../../../../../utils/listenerUtils.js";import a from"../CSF/utils/iframes/postMessageToIframe.js";import{originCheckPassed as l,isWebpackPostMsg as c,isChromeVoxPostMsg as h}from"../CSF/utils/iframes/postMessageValidation.js";import{ENCRYPTED_EXPIRY_DATE as f,ENCRYPTED_EXPIRY_MONTH as d,ENCRYPTED_EXPIRY_YEAR as u,DATE_POLICY_OPTIONAL as p,DATE_POLICY_HIDDEN as m,ENCRYPTED_SECURITY_CODE as y,CVC_POLICY_OPTIONAL as g,CVC_POLICY_HIDDEN as C}from"../constants.js";import{generateRandomNumber as b}from"../utilities/commonUtils.js";import w from"./AbstractSecuredField.js";import{reject as E}from"../../../../../utils/commonUtils.js";import{processAriaConfig as O}from"./utils/processAriaConfig.js";import{processPlaceholders as T}from"./utils/processPlaceholders.js";import{hasOwnProperty as L}from"../../../../../utils/hasOwnProperty.js";import{AnalyticsErrorEvent as P,ErrorEventType as k,ErrorEventCode as j}from"../../../../../core/Analytics/events/AnalyticsErrorEvent.js";function F(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function _(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{},s=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.forEach(function(i){F(e,i,t[i])})}return e}function S(e,i){return i=null!=i?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):function(e){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);i.push.apply(i,t)}return i}(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}),e}class v extends w{init(e,i,r,o){const a=O(this.sfConfig.txVariant,this.sfConfig.fieldType,e,o);this.sfConfig.iframeUIConfig.ariaConfig=a,this.sfConfig.iframeUIConfig.placeholders=T(this.sfConfig.txVariant,this.sfConfig.fieldType,r);const l={src:i,title:a[this.sfConfig.fieldType].iframeTitle,policy:"origin"},c=t(l);this.holderEl.appendChild(c);const h=s(this.holderEl,".js-iframe");if(h){if(!h.contentWindow){var f;console.error("ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?");const e=new P({component:this.componentType,code:j.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:k.implementation,message:`Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`});null===(f=this.submitAnalytics)||void 0===f||f.call(this,e)}this.iframeContentWindow=h.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,n(h,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=h,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,n(window,"message",this.postMessageListener,!1);const e=S(_({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),a(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(t){if(!l(t,this.loadingContext,this.sfConfig.showWarnings))return;let s;try{s=JSON.parse(t.data)}catch(i){return c(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):h(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",t.data))}if(L(s,"action")&&L(s,"numKey"))if(this.numKey===s.numKey)switch(s.action){case"encryption":this.isValid=!0,this.onEncryptionCallback(s);break;case"config":window._b$dl&&console.log("### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback",s.fieldType),this.onConfigCallback(s);break;case"focus":this.onFocusCallback(s);break;case"binValue":this.onBinValueCallback(s);break;case"touch":this.onTouchstartCallback(s);break;case"shifttab":this.onShiftTabCallback(s);break;case"autoComplete":this.onAutoCompleteCallback(s);break;case"enterKeyPressed":this.onKeyDownCallback(s);break;case"encryptionError":{var r;const e=new P({component:this.componentType,code:s.code,errorType:k.internal,message:`${s.error}. Field= ${this.sfConfig.fieldType}`});null===(r=this.submitAnalytics)||void 0===r||r.call(this,e);break}default:this.isValid=!1,this.onValidationCallback(s)}else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){o(window,"message",this.postMessageListener,!1),o(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,r(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return!1}return!1}onIframeLoaded(e){return this.onIframeLoadedCallback=e,this}onEncryption(e){return this.onEncryptionCallback=e,this}onValidation(e){return this.onValidationCallback=e,this}onConfig(e){return this.onConfigCallback=e,this}onFocus(e){return this.onFocusCallback=e,this}onBinValue(e){return this.onBinValueCallback=e,this}onTouchstart(e){return this.onTouchstartCallback=e,this}onShiftTab(e){return this.onShiftTabCallback=e,this}onAutoComplete(e){return this.onAutoCompleteCallback=e,this}onKeyDown(e){return this.onKeyDownCallback=e,this}get errorType(){return this._errorType}set errorType(e){this._errorType=e}get hasError(){return this._hasError}set hasError(e){this._hasError=e}get isValid(){if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return this._isValid}return this._isValid}set isValid(e){this._isValid=e}get cvcPolicy(){return this._cvcPolicy}set cvcPolicy(e){this.sfConfig.fieldType===y&&e!==this.cvcPolicy&&(this._cvcPolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get expiryDatePolicy(){return this._expiryDatePolicy}set expiryDatePolicy(e){this.sfConfig.fieldType!==f&&this.sfConfig.fieldType!==d&&this.sfConfig.fieldType!==u||e!==this.expiryDatePolicy&&(this._expiryDatePolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get iframeContentWindow(){return this._iframeContentWindow}set iframeContentWindow(e){this._iframeContentWindow=e}get isEncrypted(){return this._isEncrypted}set isEncrypted(e){this._isEncrypted=e}get numKey(){return this._numKey}set numKey(e){this._numKey=e}get iframeOnLoadListener(){return this._iframeOnLoadListener}set iframeOnLoadListener(e){this._iframeOnLoadListener=e.bind(this)}get postMessageListener(){return this._postMessageListener}set postMessageListener(e){this._postMessageListener=e.bind(this)}constructor(e,i){super(),F(this,"sfConfig",void 0);const t=E(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=S(_({},t),{iframeUIConfig:_({},t.iframeUIConfig)});const{iframeSrc:s,placeholders:r,showContextualElement:n}=e;return this.loadingContext=e.loadingContext,this.holderEl=e.holderEl,this.submitAnalytics=e.submitAnalytics,this.componentType=e.componentType,this.isValid=!1,this.iframeContentWindow=null,this.numKey=b(),this.isEncrypted=!1,this.hasError=!1,this.errorType="",this.cvcPolicy=e.cvcPolicy,this.expiryDatePolicy=e.expiryDatePolicy,this.init(i,s,r,n)}}export{v as default};
2
2
  //# sourceMappingURL=SecuredField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/SecuredField.ts"],"sourcesContent":["import * as logger from '../utilities/logger';\nimport createIframe from './utils/createIframe';\nimport { removeAllChildren, selectOne } from '../utilities/dom';\nimport { off, on } from '../../../../../utils/listenerUtils';\nimport postMessageToIframe from '../CSF/utils/iframes/postMessageToIframe';\nimport { isChromeVoxPostMsg, isWebpackPostMsg, originCheckPassed } from '../CSF/utils/iframes/postMessageValidation';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE\n} from '../constants';\nimport { generateRandomNumber } from '../utilities/commonUtils';\nimport { CVCPolicyType, DatePolicyType, RtnType_callbackFn, RtnType_noParamVoidFn, RtnType_postMessageListener, SFFeedbackObj } from '../types';\nimport AbstractSecuredField from './AbstractSecuredField';\nimport { AriaConfig, IframeConfigObject, SecuredFieldSetupObject, SecuredFieldCommonProps } from '../types';\nimport { reject } from '../../../../../utils/commonUtils';\nimport { processAriaConfig } from './utils/processAriaConfig';\nimport { processPlaceholders } from './utils/processPlaceholders';\nimport Language from '../../../../../language/Language';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport { Placeholders } from '../../SFP/types';\nimport './SecuredField.scss';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../../core/Analytics/events/AnalyticsErrorEvent';\n\nconst logPostMsg = false;\nconst doLog = false;\n\nclass SecuredField extends AbstractSecuredField {\n public override sfConfig: SecuredFieldCommonProps;\n\n constructor(pSetupObj: SecuredFieldSetupObject, i18n: Language) {\n super();\n\n /**\n * List of props to exclude from being set on this.sfConfig.\n * These props are only required for internal purposes. They do not get sent to the iframe\n */\n const deltaPropsArr: string[] = ['loadingContext', 'holderEl', 'iframeSrc', 'showContextualElement', 'placeholders'];\n\n /**\n * List of props from setup object that will be set on this.sfConfig\n * These props will all end up being sent to the iframe\n */\n const configVarsFromSetUpObj = reject(deltaPropsArr).from(pSetupObj);\n\n // Copy passed setup object values to this.sfConfig\n this.sfConfig = {\n // ...this.sfConfig, // Do we need to do this? Pretty sure we don't\n ...configVarsFromSetUpObj,\n // Break references on iframeUIConfig object so we can overwrite its properties in each securedField instance\n iframeUIConfig: { ...configVarsFromSetUpObj.iframeUIConfig }\n } as SecuredFieldCommonProps;\n\n /**\n * Extract values only needed for init\n */\n const { iframeSrc, placeholders, showContextualElement } = pSetupObj;\n\n /**\n * Store those passed setup object values that are needed in multiple functions\n */\n this.loadingContext = pSetupObj.loadingContext;\n this.holderEl = pSetupObj.holderEl;\n this.submitAnalytics = pSetupObj.submitAnalytics;\n this.componentType = pSetupObj.componentType;\n\n /**\n * Initiate other values on 'this' through setters\n */\n this.isValid = false;\n this.iframeContentWindow = null;\n this.numKey = generateRandomNumber();\n this.isEncrypted = false;\n this.hasError = false;\n this.errorType = '';\n this.cvcPolicy = pSetupObj.cvcPolicy;\n this.expiryDatePolicy = pSetupObj.expiryDatePolicy;\n\n if (process.env.NODE_ENV === 'development' && doLog) {\n logger.log(\n '### SecuredField::constructor:: this.sfConfig.fieldType=',\n this.sfConfig.fieldType,\n 'isValid=',\n this._isValid,\n 'numKey=',\n this.numKey\n );\n logger.log('\\n');\n }\n\n return this.init(i18n, iframeSrc, placeholders, showContextualElement);\n }\n\n init(i18n: Language, iframeSrc: string, placeholders: Placeholders, showContextualElement: boolean): SecuredField {\n /**\n * Ensure all fields have a related ariaConfig object containing, at minimum, an iframeTitle property and a (translated) errors object\n */\n const processedAriaConfig: AriaConfig = processAriaConfig(this.sfConfig.txVariant, this.sfConfig.fieldType, i18n, showContextualElement);\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.ariaConfig = processedAriaConfig;\n\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.placeholders = processPlaceholders(this.sfConfig.txVariant, this.sfConfig.fieldType, placeholders);\n\n /**\n * Configure, create & reference iframe and add load listener\n */\n const iframeConfig = {\n src: iframeSrc,\n title: processedAriaConfig[this.sfConfig.fieldType].iframeTitle,\n policy: 'origin'\n };\n\n const iframeEl: HTMLIFrameElement = createIframe(iframeConfig);\n\n // Place the iframe into the holder\n this.holderEl.appendChild(iframeEl);\n\n // Now examine the holder to get an actual DOM node\n const iframe: HTMLIFrameElement = selectOne(this.holderEl, '.js-iframe');\n\n if (iframe) {\n if (!iframe.contentWindow) {\n // Warn the dev\n console.error(\n 'ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?'\n );\n // Log the error\n const event = new AnalyticsErrorEvent({\n component: this.componentType,\n code: ErrorEventCode.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,\n errorType: ErrorEventType.implementation,\n message: `Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`\n });\n\n this.submitAnalytics?.(event);\n }\n\n this.iframeContentWindow = iframe.contentWindow;\n\n // Create reference to bound fn (see getters/setters for binding)\n this.iframeOnLoadListener = this.iframeOnLoadListenerFn;\n\n on(iframe, 'load', this.iframeOnLoadListener, false);\n }\n\n this.iframeRef = iframe;\n\n return this;\n }\n\n iframeOnLoadListenerFn(): void {\n // Create reference to bound fn (see getters/setters for binding)\n this.postMessageListener = this.postMessageListenerFn;\n\n // Add general listener for 'message' EVENT - the event that 'powers' postMessage\n on(window, 'message', this.postMessageListener, false);\n\n // Create and send config object to iframe\n const configObj: IframeConfigObject = {\n ...this.sfConfig,\n numKey: this.numKey\n };\n\n if (window._b$dl) console.log('### SecuredField:::: onIframeLoaded:: created configObj=', configObj);\n\n postMessageToIframe(configObj, this.iframeContentWindow, this.loadingContext);\n //--\n\n // Callback to say iframe loaded\n this.onIframeLoadedCallback();\n }\n\n postMessageListenerFn(event: MessageEvent): void {\n // Check message is from expected domain\n if (!originCheckPassed(event, this.loadingContext, this.sfConfig.showWarnings)) {\n return;\n }\n\n // TODO - for debugging purposes this would always be useful to see\n // logger.log('\\n',this.sfConfig.fieldType,'### CSF SecuredField::postMessageListener:: event.data=',event.data);\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '\\n###CSF SecuredField::postMessageListener:: DOMAIN & ORIGIN MATCH, NO WEBPACK WEIRDNESS fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant,\n 'this.numKey=',\n this.numKey\n );\n }\n\n // PARSE DATA OBJECT (thus testing if it is a JSON string) - OR TRY & WORK OUT WHY THE PARSING FAILED\n let feedbackObj: SFFeedbackObj;\n\n try {\n feedbackObj = JSON.parse(event.data);\n } catch (e) {\n // Was the message generated by webpack?\n if (isWebpackPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK');\n return;\n }\n\n // Was the message generated by ChromeVox?\n if (isChromeVoxPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX');\n return;\n }\n\n if (this.sfConfig.showWarnings)\n logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=', event.data);\n return;\n }\n\n // CHECK FOR EXPECTED PROPS\n const hasMainProps: boolean = hasOwnProperty(feedbackObj, 'action') && hasOwnProperty(feedbackObj, 'numKey');\n\n if (!hasMainProps) {\n if (this.sfConfig.showWarnings) logger.warn('WARNING SecuredField :: postMessage listener for iframe :: data mismatch!');\n return;\n }\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log('### SecuredField::postMessageListener:: feedbackObj.numKey=', feedbackObj.numKey);\n }\n\n if (this.numKey !== feedbackObj.numKey) {\n if (this.sfConfig.showWarnings) {\n logger.warn(\n 'WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)'\n );\n }\n return;\n }\n\n // VALIDATION CHECKS PASSED - DECIDE ON COURSE OF ACTION\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '### SecuredField::postMessageListener:: numkeys match PROCEED WITH POST MESSAGE PROCESSING fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant\n );\n }\n\n switch (feedbackObj.action) {\n case 'encryption':\n this.isValid = true;\n this.onEncryptionCallback(feedbackObj);\n break;\n\n case 'config':\n if (window._b$dl)\n console.log('### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback', feedbackObj.fieldType);\n this.onConfigCallback(feedbackObj);\n break;\n\n case 'focus':\n this.onFocusCallback(feedbackObj);\n break;\n\n case 'binValue':\n this.onBinValueCallback(feedbackObj);\n break;\n\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n case 'touch':\n this.onTouchstartCallback(feedbackObj);\n break;\n\n // Only happens for Firefox & IE <= 11\n case 'shifttab':\n this.onShiftTabCallback(feedbackObj);\n break;\n\n case 'autoComplete':\n this.onAutoCompleteCallback(feedbackObj);\n break;\n\n case 'enterKeyPressed':\n this.onKeyPressedCallback(feedbackObj);\n break;\n\n case 'encryptionError': {\n const event = new AnalyticsErrorEvent({\n component: this.componentType,\n code: feedbackObj.code,\n errorType: ErrorEventType.internal,\n message: `${feedbackObj.error}. Field= ${this.sfConfig.fieldType}`\n });\n\n this.submitAnalytics?.(event);\n break;\n }\n\n /**\n * Validate, because action =\n *\n * 'brand'\n * 'delete'\n * 'luhnCheck'\n * 'incomplete field' (an error that follows from a focus (blur) event)\n * 'incorrectly filled field' (an error that follows from a focus (blur) event)\n * 'numberKeyPressed' (or date-, month-, year-, cvc-, pin-, or iban- KeyPressed)\n * - since we have no \"error\" action \"...KeyPressed\" is the action type on most error events (other than \"incomplete field, 'incorrectly filled field' or \"luhnCheck\")\n * and often these error events representing the clearing of an existing error\n */\n default:\n // If we're validation handling (& not encryption handling) field must be invalid\n this.isValid = false;\n this.onValidationCallback(feedbackObj);\n }\n }\n\n destroy(): void {\n off(window, 'message', this.postMessageListener, false);\n off(this.iframeRef, 'load', this.iframeOnLoadListener, false);\n this.iframeContentWindow = null;\n removeAllChildren(this.holderEl);\n }\n\n /**\n * Returns whether the securedField is hidden OR whether it is optional and not in error\n */\n isOptionalOrHidden(): boolean {\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n return true;\n case DATE_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n return true;\n case CVC_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n // Any other type of securedField is not optional & can't be hidden\n return false;\n }\n\n // /////// ALLOCATE CALLBACKS /////////\n onIframeLoaded(callbackFn: RtnType_noParamVoidFn): SecuredField {\n this.onIframeLoadedCallback = callbackFn;\n return this;\n }\n\n onEncryption(callbackFn: RtnType_callbackFn): SecuredField {\n this.onEncryptionCallback = callbackFn;\n return this;\n }\n\n onValidation(callbackFn: RtnType_callbackFn): SecuredField {\n this.onValidationCallback = callbackFn;\n return this;\n }\n\n onConfig(callbackFn: RtnType_callbackFn): SecuredField {\n this.onConfigCallback = callbackFn;\n return this;\n }\n\n onFocus(callbackFn: RtnType_callbackFn): SecuredField {\n this.onFocusCallback = callbackFn;\n return this;\n }\n\n onBinValue(callbackFn: RtnType_callbackFn): SecuredField {\n this.onBinValueCallback = callbackFn;\n return this;\n }\n\n onTouchstart(callbackFn: RtnType_callbackFn): SecuredField {\n this.onTouchstartCallback = callbackFn;\n return this;\n }\n\n onShiftTab(callbackFn: RtnType_callbackFn): SecuredField {\n this.onShiftTabCallback = callbackFn;\n return this;\n }\n\n onAutoComplete(callbackFn: RtnType_callbackFn): SecuredField {\n this.onAutoCompleteCallback = callbackFn;\n return this;\n }\n\n onKeyPressed(callbackFn: RtnType_callbackFn): SecuredField {\n this.onKeyPressedCallback = callbackFn;\n return this;\n }\n //------------------------------------\n\n // ///////////// GETTERS/SETTERS //////////////\n\n get errorType(): string {\n return this._errorType;\n }\n set errorType(value: string) {\n this._errorType = value;\n }\n\n get hasError(): boolean {\n return this._hasError;\n }\n set hasError(value: boolean) {\n this._hasError = value;\n }\n\n get isValid(): boolean {\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n // If cvc is hidden then the field is always valid\n return true;\n case CVC_POLICY_OPTIONAL:\n // If cvc is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n // If date is hidden then the field is always valid\n return true;\n case DATE_POLICY_OPTIONAL:\n // If date is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n return this._isValid;\n }\n set isValid(value: boolean) {\n this._isValid = value;\n }\n\n get cvcPolicy(): CVCPolicyType {\n return this._cvcPolicy;\n }\n\n set cvcPolicy(value: CVCPolicyType) {\n // Only set if this is a CVC field\n if (this.sfConfig.fieldType !== ENCRYPTED_SECURITY_CODE) return;\n\n // Only set if value has changed\n if (value === this.cvcPolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField::cvcPolicy:: value=', value);\n\n this._cvcPolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the fix in CSF the maestro PM will never register as valid\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get expiryDatePolicy(): DatePolicyType {\n return this._expiryDatePolicy;\n }\n\n set expiryDatePolicy(value: DatePolicyType) {\n // Only set if this is a date field type of securedField\n if (\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_DATE &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_MONTH &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_YEAR\n )\n return;\n\n // Only set if value has changed\n if (value === this.expiryDatePolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField:expiryDatePolicy:: value=', value);\n\n this._expiryDatePolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get iframeContentWindow(): Window {\n return this._iframeContentWindow;\n }\n set iframeContentWindow(value: Window) {\n this._iframeContentWindow = value;\n }\n\n get isEncrypted(): boolean {\n return this._isEncrypted;\n }\n set isEncrypted(value: boolean) {\n this._isEncrypted = value;\n }\n\n get numKey(): number {\n return this._numKey;\n }\n set numKey(value: number) {\n this._numKey = value;\n }\n\n // Internal use - way to create listener refs that we can add/remove\n get iframeOnLoadListener(): RtnType_noParamVoidFn {\n return this._iframeOnLoadListener;\n }\n set iframeOnLoadListener(value: RtnType_noParamVoidFn) {\n this._iframeOnLoadListener = value.bind(this);\n }\n\n get postMessageListener(): RtnType_postMessageListener {\n return this._postMessageListener;\n }\n set postMessageListener(value: RtnType_postMessageListener) {\n this._postMessageListener = value.bind(this);\n }\n}\n\nexport default SecuredField;\n"],"names":["SecuredField","AbstractSecuredField","init","i18n","iframeSrc","placeholders","showContextualElement","processedAriaConfig","processAriaConfig","this","sfConfig","txVariant","fieldType","iframeUIConfig","ariaConfig","processPlaceholders","iframeConfig","src","title","iframeTitle","policy","iframeEl","createIframe","holderEl","appendChild","iframe","selectOne","contentWindow","_this_submitAnalytics","console","error","event","AnalyticsErrorEvent","component","componentType","code","ErrorEventCode","SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND","errorType","ErrorEventType","implementation","message","submitAnalytics","iframeContentWindow","iframeOnLoadListener","iframeOnLoadListenerFn","on","iframeRef","postMessageListener","postMessageListenerFn","window","configObj","_object_spread_props","_object_spread","numKey","_b$dl","log","postMessageToIframe","loadingContext","onIframeLoadedCallback","originCheckPassed","showWarnings","feedbackObj","JSON","parse","data","e","isWebpackPostMsg","logger","isChromeVoxPostMsg","hasOwnProperty","action","isValid","onEncryptionCallback","onConfigCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyPressedCallback","internal","onValidationCallback","destroy","off","removeAllChildren","isOptionalOrHidden","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","expiryDatePolicy","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","hasError","ENCRYPTED_SECURITY_CODE","cvcPolicy","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","onIframeLoaded","callbackFn","onEncryption","onValidation","onConfig","onFocus","onBinValue","onTouchstart","onShiftTab","onAutoComplete","onKeyPressed","_errorType","value","_hasError","_isValid","_cvcPolicy","_expiryDatePolicy","_iframeContentWindow","isEncrypted","_isEncrypted","_numKey","_iframeOnLoadListener","bind","_postMessageListener","constructor","pSetupObj","super","_define_property","configVarsFromSetUpObj","reject","from","generateRandomNumber"],"mappings":"47DAgCA,MAAMA,UAAqBC,EAkEvBC,IAAAA,CAAKC,EAAgBC,EAAmBC,EAA4BC,GAIhE,MAAMC,EAAkCC,EAAkBC,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWT,EAAMG,GAElHG,KAAKC,SAASG,eAAeC,WAAaP,EAG1CE,KAAKC,SAASG,eAAeR,aAAeU,EAAoBN,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWP,GAKlH,MAAMW,EAAe,CACjBC,IAAKb,EACLc,MAAOX,EAAoBE,KAAKC,SAASE,WAAWO,YACpDC,OAAQ,UAGNC,EAA8BC,EAAaN,GAGjDP,KAAKc,SAASC,YAAYH,GAG1B,MAAMI,EAA4BC,EAAUjB,KAAKc,SAAU,cAE3D,GAAIE,EAAQ,CACR,IAAKA,EAAOE,cAAe,KAavBC,EAXAC,QAAQC,MACJ,2OAGJ,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWxB,KAAKyB,cAChBC,KAAMC,EAAeC,+CACrBC,UAAWC,EAAeC,eAC1BC,QAAS,sCAAsChC,KAAKC,SAASE,yDAG7C,QAApBgB,EAAAnB,KAAKiC,uBAAL,IAAAd,GAAAA,OAAAnB,KAAuBsB,EAC3B,CAEAtB,KAAKkC,oBAAsBlB,EAAOE,cAGlClB,KAAKmC,qBAAuBnC,KAAKoC,uBAEjCC,EAAGrB,EAAQ,OAAQhB,KAAKmC,sBAAsB,EAClD,CAIA,OAF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oG,EAAUpG,SAC1Bd,KAAKiC,gBAAkBiF,EAAUjF,gBACjCjC,KAAKyB,cAAgByF,EAAUzF,cAK/BzB,KAAK+D,SAAU,EACf/D,KAAKkC,oBAAsB,KAC3BlC,KAAK6C,OAAS2E,IACdxH,KAAK2G,aAAc,EACnB3G,KAAKoF,UAAW,EAChBpF,KAAK6B,UAAY,GACjB7B,KAAKsF,UAAY4B,EAAU5B,UAC3BtF,KAAKiF,iBAAmBiC,EAAUjC,iBAc3BjF,KAAKP,KAAKC,EAAMC,EAAWC,EAAcC,EACpD"}
1
+ {"version":3,"file":"SecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/SecuredField.ts"],"sourcesContent":["import * as logger from '../utilities/logger';\nimport createIframe from './utils/createIframe';\nimport { removeAllChildren, selectOne } from '../utilities/dom';\nimport { off, on } from '../../../../../utils/listenerUtils';\nimport postMessageToIframe from '../CSF/utils/iframes/postMessageToIframe';\nimport { isChromeVoxPostMsg, isWebpackPostMsg, originCheckPassed } from '../CSF/utils/iframes/postMessageValidation';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE\n} from '../constants';\nimport { generateRandomNumber } from '../utilities/commonUtils';\nimport { CVCPolicyType, DatePolicyType, RtnType_callbackFn, RtnType_noParamVoidFn, RtnType_postMessageListener, SFFeedbackObj } from '../types';\nimport AbstractSecuredField from './AbstractSecuredField';\nimport { AriaConfig, IframeConfigObject, SecuredFieldSetupObject, SecuredFieldCommonProps } from '../types';\nimport { reject } from '../../../../../utils/commonUtils';\nimport { processAriaConfig } from './utils/processAriaConfig';\nimport { processPlaceholders } from './utils/processPlaceholders';\nimport Language from '../../../../../language/Language';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport { Placeholders } from '../../SFP/types';\nimport './SecuredField.scss';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../../core/Analytics/events/AnalyticsErrorEvent';\n\nconst logPostMsg = false;\nconst doLog = false;\n\nclass SecuredField extends AbstractSecuredField {\n public override sfConfig: SecuredFieldCommonProps;\n\n constructor(pSetupObj: SecuredFieldSetupObject, i18n: Language) {\n super();\n\n /**\n * List of props to exclude from being set on this.sfConfig.\n * These props are only required for internal purposes. They do not get sent to the iframe\n */\n const deltaPropsArr: string[] = ['loadingContext', 'holderEl', 'iframeSrc', 'showContextualElement', 'placeholders'];\n\n /**\n * List of props from setup object that will be set on this.sfConfig\n * These props will all end up being sent to the iframe\n */\n const configVarsFromSetUpObj = reject(deltaPropsArr).from(pSetupObj);\n\n // Copy passed setup object values to this.sfConfig\n this.sfConfig = {\n // ...this.sfConfig, // Do we need to do this? Pretty sure we don't\n ...configVarsFromSetUpObj,\n // Break references on iframeUIConfig object so we can overwrite its properties in each securedField instance\n iframeUIConfig: { ...configVarsFromSetUpObj.iframeUIConfig }\n } as SecuredFieldCommonProps;\n\n /**\n * Extract values only needed for init\n */\n const { iframeSrc, placeholders, showContextualElement } = pSetupObj;\n\n /**\n * Store those passed setup object values that are needed in multiple functions\n */\n this.loadingContext = pSetupObj.loadingContext;\n this.holderEl = pSetupObj.holderEl;\n this.submitAnalytics = pSetupObj.submitAnalytics;\n this.componentType = pSetupObj.componentType;\n\n /**\n * Initiate other values on 'this' through setters\n */\n this.isValid = false;\n this.iframeContentWindow = null;\n this.numKey = generateRandomNumber();\n this.isEncrypted = false;\n this.hasError = false;\n this.errorType = '';\n this.cvcPolicy = pSetupObj.cvcPolicy;\n this.expiryDatePolicy = pSetupObj.expiryDatePolicy;\n\n if (process.env.NODE_ENV === 'development' && doLog) {\n logger.log(\n '### SecuredField::constructor:: this.sfConfig.fieldType=',\n this.sfConfig.fieldType,\n 'isValid=',\n this._isValid,\n 'numKey=',\n this.numKey\n );\n logger.log('\\n');\n }\n\n return this.init(i18n, iframeSrc, placeholders, showContextualElement);\n }\n\n init(i18n: Language, iframeSrc: string, placeholders: Placeholders, showContextualElement: boolean): SecuredField {\n /**\n * Ensure all fields have a related ariaConfig object containing, at minimum, an iframeTitle property and a (translated) errors object\n */\n const processedAriaConfig: AriaConfig = processAriaConfig(this.sfConfig.txVariant, this.sfConfig.fieldType, i18n, showContextualElement);\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.ariaConfig = processedAriaConfig;\n\n // Set result back onto config object\n this.sfConfig.iframeUIConfig.placeholders = processPlaceholders(this.sfConfig.txVariant, this.sfConfig.fieldType, placeholders);\n\n /**\n * Configure, create & reference iframe and add load listener\n */\n const iframeConfig = {\n src: iframeSrc,\n title: processedAriaConfig[this.sfConfig.fieldType].iframeTitle,\n policy: 'origin'\n };\n\n const iframeEl: HTMLIFrameElement = createIframe(iframeConfig);\n\n // Place the iframe into the holder\n this.holderEl.appendChild(iframeEl);\n\n // Now examine the holder to get an actual DOM node\n const iframe: HTMLIFrameElement = selectOne(this.holderEl, '.js-iframe');\n\n if (iframe) {\n if (!iframe.contentWindow) {\n // Warn the dev\n console.error(\n 'ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?'\n );\n // Log the error\n const event = new AnalyticsErrorEvent({\n component: this.componentType,\n code: ErrorEventCode.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,\n errorType: ErrorEventType.implementation,\n message: `Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`\n });\n\n this.submitAnalytics?.(event);\n }\n\n this.iframeContentWindow = iframe.contentWindow;\n\n // Create reference to bound fn (see getters/setters for binding)\n this.iframeOnLoadListener = this.iframeOnLoadListenerFn;\n\n on(iframe, 'load', this.iframeOnLoadListener, false);\n }\n\n this.iframeRef = iframe;\n\n return this;\n }\n\n iframeOnLoadListenerFn(): void {\n // Create reference to bound fn (see getters/setters for binding)\n this.postMessageListener = this.postMessageListenerFn;\n\n // Add general listener for 'message' EVENT - the event that 'powers' postMessage\n on(window, 'message', this.postMessageListener, false);\n\n // Create and send config object to iframe\n const configObj: IframeConfigObject = {\n ...this.sfConfig,\n numKey: this.numKey\n };\n\n if (window._b$dl) console.log('### SecuredField:::: onIframeLoaded:: created configObj=', configObj);\n\n postMessageToIframe(configObj, this.iframeContentWindow, this.loadingContext);\n //--\n\n // Callback to say iframe loaded\n this.onIframeLoadedCallback();\n }\n\n postMessageListenerFn(event: MessageEvent): void {\n // Check message is from expected domain\n if (!originCheckPassed(event, this.loadingContext, this.sfConfig.showWarnings)) {\n return;\n }\n\n // TODO - for debugging purposes this would always be useful to see\n // logger.log('\\n',this.sfConfig.fieldType,'### CSF SecuredField::postMessageListener:: event.data=',event.data);\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '\\n###CSF SecuredField::postMessageListener:: DOMAIN & ORIGIN MATCH, NO WEBPACK WEIRDNESS fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant,\n 'this.numKey=',\n this.numKey\n );\n }\n\n // PARSE DATA OBJECT (thus testing if it is a JSON string) - OR TRY & WORK OUT WHY THE PARSING FAILED\n let feedbackObj: SFFeedbackObj;\n\n try {\n feedbackObj = JSON.parse(event.data);\n } catch (e) {\n // Was the message generated by webpack?\n if (isWebpackPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK');\n return;\n }\n\n // Was the message generated by ChromeVox?\n if (isChromeVoxPostMsg(event)) {\n if (this.sfConfig.showWarnings) logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX');\n return;\n }\n\n if (this.sfConfig.showWarnings)\n logger.log('### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=', event.data);\n return;\n }\n\n // CHECK FOR EXPECTED PROPS\n const hasMainProps: boolean = hasOwnProperty(feedbackObj, 'action') && hasOwnProperty(feedbackObj, 'numKey');\n\n if (!hasMainProps) {\n if (this.sfConfig.showWarnings) logger.warn('WARNING SecuredField :: postMessage listener for iframe :: data mismatch!');\n return;\n }\n\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log('### SecuredField::postMessageListener:: feedbackObj.numKey=', feedbackObj.numKey);\n }\n\n if (this.numKey !== feedbackObj.numKey) {\n if (this.sfConfig.showWarnings) {\n logger.warn(\n 'WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)'\n );\n }\n return;\n }\n\n // VALIDATION CHECKS PASSED - DECIDE ON COURSE OF ACTION\n if (process.env.NODE_ENV === 'development' && logPostMsg) {\n logger.log(\n '### SecuredField::postMessageListener:: numkeys match PROCEED WITH POST MESSAGE PROCESSING fieldType=',\n this.sfConfig.fieldType,\n 'txVariant=',\n this.sfConfig.txVariant\n );\n }\n\n switch (feedbackObj.action) {\n case 'encryption':\n this.isValid = true;\n this.onEncryptionCallback(feedbackObj);\n break;\n\n case 'config':\n if (window._b$dl)\n console.log('### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback', feedbackObj.fieldType);\n this.onConfigCallback(feedbackObj);\n break;\n\n case 'focus':\n this.onFocusCallback(feedbackObj);\n break;\n\n case 'binValue':\n this.onBinValueCallback(feedbackObj);\n break;\n\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n case 'touch':\n this.onTouchstartCallback(feedbackObj);\n break;\n\n // Only happens for Firefox & IE <= 11\n case 'shifttab':\n this.onShiftTabCallback(feedbackObj);\n break;\n\n case 'autoComplete':\n this.onAutoCompleteCallback(feedbackObj);\n break;\n\n case 'enterKeyPressed':\n this.onKeyDownCallback(feedbackObj);\n break;\n\n case 'encryptionError': {\n const event = new AnalyticsErrorEvent({\n component: this.componentType,\n code: feedbackObj.code,\n errorType: ErrorEventType.internal,\n message: `${feedbackObj.error}. Field= ${this.sfConfig.fieldType}`\n });\n\n this.submitAnalytics?.(event);\n break;\n }\n\n /**\n * Validate, because action =\n *\n * 'brand'\n * 'delete'\n * 'luhnCheck'\n * 'incomplete field' (an error that follows from a focus (blur) event)\n * 'incorrectly filled field' (an error that follows from a focus (blur) event)\n * 'numberKeyPressed' (or date-, month-, year-, cvc-, pin-, or iban- KeyPressed)\n * - since we have no \"error\" action \"...KeyPressed\" is the action type on most error events (other than \"incomplete field, 'incorrectly filled field' or \"luhnCheck\")\n * and often these error events representing the clearing of an existing error\n */\n default:\n // If we're validation handling (& not encryption handling) field must be invalid\n this.isValid = false;\n this.onValidationCallback(feedbackObj);\n }\n }\n\n destroy(): void {\n off(window, 'message', this.postMessageListener, false);\n off(this.iframeRef, 'load', this.iframeOnLoadListener, false);\n this.iframeContentWindow = null;\n removeAllChildren(this.holderEl);\n }\n\n /**\n * Returns whether the securedField is hidden OR whether it is optional and not in error\n */\n isOptionalOrHidden(): boolean {\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n return true;\n case DATE_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n return true;\n case CVC_POLICY_OPTIONAL:\n return !this.hasError;\n default:\n return false;\n }\n }\n\n // Any other type of securedField is not optional & can't be hidden\n return false;\n }\n\n // /////// ALLOCATE CALLBACKS /////////\n onIframeLoaded(callbackFn: RtnType_noParamVoidFn): SecuredField {\n this.onIframeLoadedCallback = callbackFn;\n return this;\n }\n\n onEncryption(callbackFn: RtnType_callbackFn): SecuredField {\n this.onEncryptionCallback = callbackFn;\n return this;\n }\n\n onValidation(callbackFn: RtnType_callbackFn): SecuredField {\n this.onValidationCallback = callbackFn;\n return this;\n }\n\n onConfig(callbackFn: RtnType_callbackFn): SecuredField {\n this.onConfigCallback = callbackFn;\n return this;\n }\n\n onFocus(callbackFn: RtnType_callbackFn): SecuredField {\n this.onFocusCallback = callbackFn;\n return this;\n }\n\n onBinValue(callbackFn: RtnType_callbackFn): SecuredField {\n this.onBinValueCallback = callbackFn;\n return this;\n }\n\n onTouchstart(callbackFn: RtnType_callbackFn): SecuredField {\n this.onTouchstartCallback = callbackFn;\n return this;\n }\n\n onShiftTab(callbackFn: RtnType_callbackFn): SecuredField {\n this.onShiftTabCallback = callbackFn;\n return this;\n }\n\n onAutoComplete(callbackFn: RtnType_callbackFn): SecuredField {\n this.onAutoCompleteCallback = callbackFn;\n return this;\n }\n\n onKeyDown(callbackFn: RtnType_callbackFn): SecuredField {\n this.onKeyDownCallback = callbackFn;\n return this;\n }\n //------------------------------------\n\n // ///////////// GETTERS/SETTERS //////////////\n\n get errorType(): string {\n return this._errorType;\n }\n set errorType(value: string) {\n this._errorType = value;\n }\n\n get hasError(): boolean {\n return this._hasError;\n }\n set hasError(value: boolean) {\n this._hasError = value;\n }\n\n get isValid(): boolean {\n if (this.sfConfig.fieldType === ENCRYPTED_SECURITY_CODE) {\n switch (this.cvcPolicy) {\n case CVC_POLICY_HIDDEN:\n // If cvc is hidden then the field is always valid\n return true;\n case CVC_POLICY_OPTIONAL:\n // If cvc is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n if (\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_DATE ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_MONTH ||\n this.sfConfig.fieldType === ENCRYPTED_EXPIRY_YEAR\n ) {\n switch (this.expiryDatePolicy) {\n case DATE_POLICY_HIDDEN:\n // If date is hidden then the field is always valid\n return true;\n case DATE_POLICY_OPTIONAL:\n // If date is optional then the field is always valid UNLESS it has an error\n return !this.hasError;\n default:\n return this._isValid;\n }\n }\n\n return this._isValid;\n }\n set isValid(value: boolean) {\n this._isValid = value;\n }\n\n get cvcPolicy(): CVCPolicyType {\n return this._cvcPolicy;\n }\n\n set cvcPolicy(value: CVCPolicyType) {\n // Only set if this is a CVC field\n if (this.sfConfig.fieldType !== ENCRYPTED_SECURITY_CODE) return;\n\n // Only set if value has changed\n if (value === this.cvcPolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField::cvcPolicy:: value=', value);\n\n this._cvcPolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the fix in CSF the maestro PM will never register as valid\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get expiryDatePolicy(): DatePolicyType {\n return this._expiryDatePolicy;\n }\n\n set expiryDatePolicy(value: DatePolicyType) {\n // Only set if this is a date field type of securedField\n if (\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_DATE &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_MONTH &&\n this.sfConfig.fieldType !== ENCRYPTED_EXPIRY_YEAR\n )\n return;\n\n // Only set if value has changed\n if (value === this.expiryDatePolicy) return;\n\n if (process.env.NODE_ENV === 'development' && doLog) logger.log(this.sfConfig.fieldType, '### SecuredField:expiryDatePolicy:: value=', value);\n\n this._expiryDatePolicy = value;\n\n // If the field has changed status (required <--> not required) AND it's error state was due to an isValidated call\n if (this.hasError && this.errorType === 'isValidated') {\n this.hasError = false;\n }\n }\n\n get iframeContentWindow(): Window {\n return this._iframeContentWindow;\n }\n set iframeContentWindow(value: Window) {\n this._iframeContentWindow = value;\n }\n\n get isEncrypted(): boolean {\n return this._isEncrypted;\n }\n set isEncrypted(value: boolean) {\n this._isEncrypted = value;\n }\n\n get numKey(): number {\n return this._numKey;\n }\n set numKey(value: number) {\n this._numKey = value;\n }\n\n // Internal use - way to create listener refs that we can add/remove\n get iframeOnLoadListener(): RtnType_noParamVoidFn {\n return this._iframeOnLoadListener;\n }\n set iframeOnLoadListener(value: RtnType_noParamVoidFn) {\n this._iframeOnLoadListener = value.bind(this);\n }\n\n get postMessageListener(): RtnType_postMessageListener {\n return this._postMessageListener;\n }\n set postMessageListener(value: RtnType_postMessageListener) {\n this._postMessageListener = value.bind(this);\n }\n}\n\nexport default SecuredField;\n"],"names":["SecuredField","AbstractSecuredField","init","i18n","iframeSrc","placeholders","showContextualElement","processedAriaConfig","processAriaConfig","this","sfConfig","txVariant","fieldType","iframeUIConfig","ariaConfig","processPlaceholders","iframeConfig","src","title","iframeTitle","policy","iframeEl","createIframe","holderEl","appendChild","iframe","selectOne","contentWindow","_this_submitAnalytics","console","error","event","AnalyticsErrorEvent","component","componentType","code","ErrorEventCode","SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND","errorType","ErrorEventType","implementation","message","submitAnalytics","iframeContentWindow","iframeOnLoadListener","iframeOnLoadListenerFn","on","iframeRef","postMessageListener","postMessageListenerFn","window","configObj","_object_spread_props","_object_spread","numKey","_b$dl","log","postMessageToIframe","loadingContext","onIframeLoadedCallback","originCheckPassed","showWarnings","feedbackObj","JSON","parse","data","e","isWebpackPostMsg","logger","isChromeVoxPostMsg","hasOwnProperty","action","isValid","onEncryptionCallback","onConfigCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyDownCallback","internal","onValidationCallback","destroy","off","removeAllChildren","isOptionalOrHidden","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","expiryDatePolicy","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","hasError","ENCRYPTED_SECURITY_CODE","cvcPolicy","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","onIframeLoaded","callbackFn","onEncryption","onValidation","onConfig","onFocus","onBinValue","onTouchstart","onShiftTab","onAutoComplete","onKeyDown","_errorType","value","_hasError","_isValid","_cvcPolicy","_expiryDatePolicy","_iframeContentWindow","isEncrypted","_isEncrypted","_numKey","_iframeOnLoadListener","bind","_postMessageListener","constructor","pSetupObj","super","_define_property","configVarsFromSetUpObj","reject","from","generateRandomNumber"],"mappings":"47DAgCA,MAAMA,UAAqBC,EAkEvBC,IAAAA,CAAKC,EAAgBC,EAAmBC,EAA4BC,GAIhE,MAAMC,EAAkCC,EAAkBC,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWT,EAAMG,GAElHG,KAAKC,SAASG,eAAeC,WAAaP,EAG1CE,KAAKC,SAASG,eAAeR,aAAeU,EAAoBN,KAAKC,SAASC,UAAWF,KAAKC,SAASE,UAAWP,GAKlH,MAAMW,EAAe,CACjBC,IAAKb,EACLc,MAAOX,EAAoBE,KAAKC,SAASE,WAAWO,YACpDC,OAAQ,UAGNC,EAA8BC,EAAaN,GAGjDP,KAAKc,SAASC,YAAYH,GAG1B,MAAMI,EAA4BC,EAAUjB,KAAKc,SAAU,cAE3D,GAAIE,EAAQ,CACR,IAAKA,EAAOE,cAAe,KAavBC,EAXAC,QAAQC,MACJ,2OAGJ,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWxB,KAAKyB,cAChBC,KAAMC,EAAeC,+CACrBC,UAAWC,EAAeC,eAC1BC,QAAS,sCAAsChC,KAAKC,SAASE,yDAG7C,QAApBgB,EAAAnB,KAAKiC,uBAAL,IAAAd,GAAAA,OAAAnB,KAAuBsB,EAC3B,CAEAtB,KAAKkC,oBAAsBlB,EAAOE,cAGlClB,KAAKmC,qBAAuBnC,KAAKoC,uBAEjCC,EAAGrB,EAAQ,OAAQhB,KAAKmC,sBAAsB,EAClD,CAIA,OAFAnC,KAAKsC,UAAYtB,EAEVhB,IACX,CAEAoC,sBAAAA,GAEIpC,KAAKuC,oBAAsBvC,KAAKwC,sBAGhCH,EAAGI,OAAQ,UAAWzC,KAAKuC,qBAAqB,GAGhD,MAAM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,OAAS2E,IACdxH,KAAK2G,aAAc,EACnB3G,KAAKoF,UAAW,EAChBpF,KAAK6B,UAAY,GACjB7B,KAAKsF,UAAY4B,EAAU5B,UAC3BtF,KAAKiF,iBAAmBiC,EAAUjC,iBAc3BjF,KAAKP,KAAKC,EAAMC,EAAWC,EAAcC,EACpD"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";import{stopPropagationForActionKeys as o}from"../Button/stopPropagationForActionKeys.js";function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const r=({classNameModifiers:r=[],selectedValue:c,disabled:a=!1,options:l,onChange:s})=>l&&0!==l.length?e("div",{className:t("adyen-checkout__segmented-control",{"adyen-checkout__segmented-control--disabled":a},...r.map(e=>`adyen-checkout__segmented-control--${e}`)),role:"tablist"},l.map(({label:r,value:l,id:i,controls:d,htmlProps:u})=>e("button",function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){n(e,t,o[t])})}return e}({role:"tab",id:i,disabled:a,key:l,onClick:e=>s(l,e),onKeyPress:o,onKeyDown:o,className:t("adyen-checkout__segmented-control-segment",{"adyen-checkout__segmented-control-segment--selected":c===l}),"aria-controls":d,"aria-selected":c===l,type:"button"},u),r))):null;export{r as SegmentedControl};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";import{stopPropagationForActionKeys as o}from"../Button/stopPropagationForActionKeys.js";function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const r=({classNameModifiers:r=[],selectedValue:c,disabled:a=!1,options:l,onChange:s})=>l&&0!==l.length?e("div",{className:t("adyen-checkout__segmented-control",{"adyen-checkout__segmented-control--disabled":a},...r.map(e=>`adyen-checkout__segmented-control--${e}`)),role:"tablist"},l.map(({label:r,value:l,id:i,controls:d,htmlProps:u})=>e("button",function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){n(e,t,o[t])})}return e}({role:"tab",id:i,disabled:a,key:l,onClick:e=>s(l,e),onKeyDown:o,className:t("adyen-checkout__segmented-control-segment",{"adyen-checkout__segmented-control-segment--selected":c===l}),"aria-controls":d,"aria-selected":c===l,type:"button"},u),r))):null;export{r as SegmentedControl};
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';\n\nimport './SegmentedControl.scss';\nimport { stopPropagationForActionKeys } from '../Button/stopPropagationForActionKeys';\n\nexport interface SegmentedControlOption<T> {\n readonly label: string;\n readonly value: T;\n readonly id: string;\n readonly controls: string;\n readonly htmlProps?: {};\n}\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 */\nexport const SegmentedControl = <T,>({\n classNameModifiers = [],\n selectedValue,\n disabled = false,\n options,\n onChange\n}: Readonly<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=\"tablist\"\n >\n {options.map(({ label, value, id, controls, htmlProps }: SegmentedControlOption<T>) => (\n <button\n role=\"tab\"\n id={id}\n disabled={disabled}\n key={value}\n onClick={(event: MouseEvent) => onChange(value, event)}\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n onKeyPress={stopPropagationForActionKeys}\n onKeyDown={stopPropagationForActionKeys}\n className={cx('adyen-checkout__segmented-control-segment', {\n 'adyen-checkout__segmented-control-segment--selected': selectedValue === value\n })}\n aria-controls={controls}\n aria-selected={selectedValue === value}\n type=\"button\"\n {...htmlProps}\n >\n {label}\n </button>\n ))}\n </div>\n );\n};\n"],"names":["SegmentedControl","classNameModifiers","selectedValue","disabled","options","onChange","length","h","div","className","cx","map","modifier","role","label","value","id","controls","htmlProps","button","key","onClick","event","onKeyPress","stopPropagationForActionKeys","onKeyDown","aria-controls","aria-selected","type"],"mappings":"mUA0CO,MAAMA,EAAmB,EAC5BC,qBAAqB,GACrBC,gBACAC,YAAW,EACXC,UACAC,cAEKD,GAA8B,IAAnBA,EAAQE,OAKpBC,EAACC,MAAAA,CACGC,UAAWC,EACP,oCACA,CAAE,8CAA+CP,MAC9CF,EAAmBU,IAAIC,GAAY,sCAAsCA,MAEhFC,KAAK,WAEJT,EAAQO,IAAI,EAAGG,QAAOC,QAAOC,KAAIC,WAAUC,eACxCX,EAACY,2UAAAA,CAAAA,CACGN,KAAK,MACLG,GAAIA,EACJb,SAAUA,EACViB,IAAKL,EACLM,QAAUC,GAAsBjB,EAASU,EAAOO,GAEhDC,WAAYC,EACZC,UAAWD,EACXf,UAAWC,EAAG,4CAA6C,CACvD,sDAAuDR,IAAkBa,IAE7EW,gBAAeT,EACfU,gBAAezB,IAAkBa,EACjCa,KAAK,UACDV,GAEHJ,KA9BN"}
1
+ {"version":3,"file":"SegmentedControl.js","sources":["../../../../../src/components/internal/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\n\nimport './SegmentedControl.scss';\nimport { stopPropagationForActionKeys } from '../Button/stopPropagationForActionKeys';\n\nexport interface SegmentedControlOption<T> {\n readonly label: string;\n readonly value: T;\n readonly id: string;\n readonly controls: string;\n readonly htmlProps?: {};\n}\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 */\nexport const SegmentedControl = <T,>({\n classNameModifiers = [],\n selectedValue,\n disabled = false,\n options,\n onChange\n}: Readonly<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=\"tablist\"\n >\n {options.map(({ label, value, id, controls, htmlProps }: SegmentedControlOption<T>) => (\n <button\n role=\"tab\"\n id={id}\n disabled={disabled}\n key={value}\n onClick={(event: MouseEvent) => onChange(value, event)}\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n onKeyDown={stopPropagationForActionKeys}\n className={cx('adyen-checkout__segmented-control-segment', {\n 'adyen-checkout__segmented-control-segment--selected': selectedValue === value\n })}\n aria-controls={controls}\n aria-selected={selectedValue === value}\n type=\"button\"\n {...htmlProps}\n >\n {label}\n </button>\n ))}\n </div>\n );\n};\n"],"names":["SegmentedControl","classNameModifiers","selectedValue","disabled","options","onChange","length","h","div","className","cx","map","modifier","role","label","value","id","controls","htmlProps","button","key","onClick","event","onKeyDown","stopPropagationForActionKeys","aria-controls","aria-selected","type"],"mappings":"mUA0CO,MAAMA,EAAmB,EAC5BC,qBAAqB,GACrBC,gBACAC,YAAW,EACXC,UACAC,cAEKD,GAA8B,IAAnBA,EAAQE,OAKpBC,EAACC,MAAAA,CACGC,UAAWC,EACP,oCACA,CAAE,8CAA+CP,MAC9CF,EAAmBU,IAAIC,GAAY,sCAAsCA,MAEhFC,KAAK,WAEJT,EAAQO,IAAI,EAAGG,QAAOC,QAAOC,KAAIC,WAAUC,eACxCX,EAACY,2UAAAA,CAAAA,CACGN,KAAK,MACLG,GAAIA,EACJb,SAAUA,EACViB,IAAKL,EACLM,QAAUC,GAAsBjB,EAASU,EAAOO,GAEhDC,UAAWC,EACXf,UAAWC,EAAG,4CAA6C,CACvD,sDAAuDR,IAAkBa,IAE7EU,gBAAeR,EACfS,gBAAexB,IAAkBa,EACjCY,KAAK,UACDT,GAEHJ,KA7BN"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,createRef as t}from"../../../external/preact/dist/preact.js";import s,{NETWORK_ERROR as n}from"../../../core/Errors/AdyenCheckoutError.js";import{hasOwnProperty as o}from"../../../utils/hasOwnProperty.js";import i from"../BaseElement/BaseElement.js";import r from"../PayButton/PayButton.js";import{assertIsDropin as a,getRegulatoryDefaults as l,sanitizeResponse as h,verifyPaymentDidNotFail as d,cleanupFinalResult as c}from"./utils.js";import{AnalyticsErrorEvent as p,ErrorEventType as m}from"../../../core/Analytics/events/AnalyticsErrorEvent.js";import{AnalyticsInfoEvent as u,InfoEventType as y}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import{AnalyticsLogEvent as f,LogEventType as v}from"../../../core/Analytics/events/AnalyticsLogEvent.js";import b from"../../../core/Errors/CancelError.js";import{CoreProvider as R}from"../../../core/Context/CoreProvider.js";import P from"../../../core/Errors/SRPanelProvider.js";import{AmountProvider as A}from"../../../core/Context/AmountProvider.js";import{TxVariants as g}from"../../tx-variants.js";function E(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function w(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},n=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),n.forEach(function(t){E(e,t,s[t])})}return e}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t.push.apply(t,s)}return t}(Object(t)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))}),e}class C extends i{createBeforeRenderHook(e){const t=this.render;this.render=(...s)=>(this.beforeRender(e),t.apply(this,s))}beforeRender(e){if(null==e?void 0:e.originalAction)return;const t=new u(w({type:y.rendered,component:this.type,configData:S(w({},e),{showPayButton:this.props.showPayButton})},(null==e?void 0:e.oneClick)&&{isStoredPaymentMethod:!0}));this.analytics.sendAnalytics(t)}reportIntegrationFlavor(){this.analytics.sendFlavor("components")}get analytics(){return this.core.modules.analytics}get srPanel(){return this.core.modules.srPanel}getPaymentMethodConfigFromResponse(e){return(null==e?void 0:e.storedPaymentMethodId)?this.getStoredPaymentMethodDetails(e.storedPaymentMethodId):this.getPaymentMethodFromPaymentMethodsResponse(null==e?void 0:e.type,null==e?void 0:e.paymentMethodId)}buildElementProps(e){const t=w({showPayButton:!0},this.core.getCorePropsForComponent(),this.getPaymentMethodConfigFromResponse(e),e),s=a(this);this.props=this.formatProps(w({},this.constructor.defaultProps,l(this.core.options.countryCode,s),t))}getStoredPaymentMethodDetails(e){return this.core.paymentMethodsResponse.findStoredPaymentMethod(e)}getPaymentMethodFromPaymentMethodsResponse(e,t){var s;return t?this.core.paymentMethodsResponse.findById(t):null===(s=this.core.paymentMethodsResponse)||void 0===s?void 0:s.find(e||this.constructor.type)}storeElementRefOnCore(e){(null==e?void 0:e.isDropin)||this.core.storeElementReference(this)}isAvailable(){return Promise.resolve()}setState(e){this.state=w({},this.state,e),this.onChange()}showValidation(){return this.componentRef&&this.componentRef.showValidation&&this.componentRef.showValidation(),this}updateAmount(e,t){var s;this.props=w({},this.props,e&&{amount:e},t&&{secondaryAmount:t}),null===(s=this.amountProviderRef.current)||void 0===s||s.update(e,t)}setElementStatus(e,t){var s;return null===(s=this.elementRef)||void 0===s||s.setStatus(e,t),this}setStatus(e,t){var s;return(null===(s=this.componentRef)||void 0===s?void 0:s.setStatus)&&this.componentRef.setStatus(e,t),this}onChange(){var e,t;null===(e=(t=this.props).onChange)||void 0===e||e.call(t,{data:this.data,isValid:this.isValid,errors:this.state.errors,valid:this.state.valid},this.elementRef)}submitAnalytics(e){this.analytics.sendAnalytics(e)}submit(){this.isValid?this.makePaymentsCall().then(h).then(d).then(this.handleResponse).catch(e=>{e instanceof b?this.setElementStatus("ready"):this.handleFailedResult(e)}):this.showValidation()}makePaymentsCall(){if(this.setElementStatus("loading"),this.props.onSubmit)return this.submitUsingAdvancedFlow();if(this.core.session){return(this.props.beforeSubmit?new Promise((e,t)=>{this.props.beforeSubmit(this.data,this.elementRef,{resolve:e,reject:()=>t(new b("beforeSubmitRejected"))})}):Promise.resolve(this.data)).then(this.submitUsingSessionsFlow)}this.handleError(new s("IMPLEMENTATION_ERROR",'It can not perform /payments call. Callback "onSubmit" is missing or Checkout session is not available'))}async submitUsingAdvancedFlow(){const e=new f({component:this.type,type:v.submit,message:"Shopper clicked pay"});return this.submitAnalytics(e),new Promise((e,t)=>{this.props.onSubmit({data:this.data,isValid:this.isValid},this.elementRef,{resolve:e,reject:t})})}async submitUsingSessionsFlow(e){const t=new f({component:this.type,type:v.submit,message:"Shopper clicked pay"});this.submitAnalytics(t);try{return await this.core.session.submitPayment(e)}catch(e){return e instanceof s?this.handleError(e):this.handleError(new s("ERROR","Error when making /payments call",{cause:e})),Promise.reject(e)}}onComplete(e){this.handleAdditionalDetails(e)}handleAdditionalDetails(e){this.makeAdditionalDetailsCall(e).then(h).then(d).then(this.handleResponse).catch(this.handleFailedResult)}makeAdditionalDetailsCall(e){return this.props.onAdditionalDetails?new Promise((t,s)=>{this.props.onAdditionalDetails(e,this.elementRef,{resolve:t,reject:s})}):this.core.session?this.submitAdditionalDetailsUsingSessionsFlow(e.data):void this.handleError(new s("IMPLEMENTATION_ERROR",'It can not perform /payments/details call. Callback "onAdditionalDetails" is missing or Checkout session is not available'))}async submitAdditionalDetailsUsingSessionsFlow(e){try{return await this.core.session.submitDetails(e)}catch(e){return e instanceof s?this.handleError(e):this.handleError(new s("ERROR","Error when making /details call",{cause:e})),Promise.reject(e)}}handleAction(e,t={}){if(!e||!e.type){if(o(e,"action")&&o(e,"resultCode"))throw new Error('handleAction::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('handleAction::Invalid Action - the passed action object does not have a "type" property')}const s=this.core.createFromAction(e,w({},this.elementRef.props,t));return s?(this.unmount(),s.mount(this._node)):null}onActionHandled(e){var t,s;null===(s=this.props)||void 0===s||null===(t=s.onActionHandled)||void 0===t||t.call(s,w({originalAction:this.props.originalAction},e))}setupSessionsDonation(){const{amount:e,donation:t}=this.props;if(!1!==(null==t?void 0:t.autoMount)){const t=a(this.elementRef)?this.elementRef._node:this._node;new(this.core.getComponent(g.donation))(this.core,{rootNode:t,commercialTxAmount:e.value})}}handleResponse(e){var t,s;e.action?this.elementRef.handleAction(e.action):(null===(s=e.order)||void 0===s||null===(t=s.remainingAmount)||void 0===t?void 0:t.value)>0?this.handleOrder(e):this.handleSuccessResult(e)}handleKeyPress(e){var t;"Enter"!==e.key&&"Enter"!==e.code||(e.preventDefault(),this.onEnterKeyPressed(null===(t=document)||void 0===t?void 0:t.activeElement,this))}onEnterKeyPressed(e,t){this.props.onEnterKeyPressed?this.props.onEnterKeyPressed(e,t):(e.blur(),this.submit())}updateParent(e={}){return this.elementRef.core.update(e)}get isValid(){return!1}get icon(){var e;const t=this.props.paymentMethodType||this.type;return null!==(e=this.props.icon)&&void 0!==e?e:this.resources.getImage()(t)}get displayName(){var e,t;const s=null===(t=this.core.paymentMethodsResponse)||void 0===t||null===(e=t.paymentMethods)||void 0===e?void 0:e.find(e=>e.type===this.type);return this.props.name||(null==s?void 0:s.name)||this.type}get accessibleName(){return this.displayName}get additionalInfo(){return null}get type(){return this.props.type||this.constructor.type}async handleAdvanceFlowPaymentMethodsUpdate(e,t){return new Promise((t,s)=>{if(!this.props.onPaymentMethodsRequest)return t();this.props.onPaymentMethodsRequest(S(w({},e&&{order:{orderData:e.orderData,pspReference:e.pspReference}}),{locale:this.core.options.locale}),{resolve:t,reject:s})}).catch(e=>{this.handleError(new s("IMPLEMENTATION_ERROR","Something failed during payment methods update or onPaymentMethodsRequest was not implemented",{cause:e}))}).then(s=>this.core.update(S(w({},s&&{paymentMethodsResponse:s}),{order:e,amount:e?e.remainingAmount:t})))}render(){return e(R,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources,analytics:this.analytics},e(P,{srPanel:this.srPanel},e(A,{amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,providerRef:this.amountProviderRef},this.componentToRender())))}constructor(s,o){super(s,o),E(this,"componentRef",void 0),E(this,"resources",void 0),E(this,"elementRef",void 0),E(this,"amountProviderRef",t()),E(this,"handleError",e=>{if(this.setElementStatus("ready"),e.name===n&&e.options.code){const t=new p({component:this.type,errorType:m.apiError,code:e.options.code});this.submitAnalytics(t)}this.props.onError&&this.props.onError(e,this.elementRef)}),E(this,"handleOrder",e=>{const{order:t}=e;(this.core.session?this.core.update({order:t}):this.handleAdvanceFlowPaymentMethodsUpdate(t)).then(()=>{var e,s;null===(e=(s=this.props).onOrderUpdated)||void 0===e||e.call(s,{order:t})})}),E(this,"handleFailedResult",e=>{var t,s;a(this.elementRef)&&this.elementRef.displayFinalAnimation("error"),c(e),null===(t=(s=this.props).onPaymentFailed)||void 0===t||t.call(s,e,this.elementRef)}),E(this,"handleSuccessResult",e=>{var t,s;a(this.elementRef)&&this.elementRef.displayFinalAnimation("success"),c(e),this.core.session&&!0===e.askDonation&&this.setupSessionsDonation(),null===(t=(s=this.props).onPaymentCompleted)||void 0===t||t.call(s,e,this.elementRef)}),E(this,"setComponentRef",e=>{this.componentRef=e}),E(this,"payButton",t=>e(r,S(w({},t),{onClick:this.submit}))),this.core.register(this.constructor),this.submit=this.submit.bind(this),this.setState=this.setState.bind(this),this.onComplete=this.onComplete.bind(this),this.handleAction=this.handleAction.bind(this),this.handleOrder=this.handleOrder.bind(this),this.handleAdditionalDetails=this.handleAdditionalDetails.bind(this),this.handleResponse=this.handleResponse.bind(this),this.setElementStatus=this.setElementStatus.bind(this),this.submitAnalytics=this.submitAnalytics.bind(this),this.makePaymentsCall=this.makePaymentsCall.bind(this),this.makeAdditionalDetailsCall=this.makeAdditionalDetailsCall.bind(this),this.submitUsingSessionsFlow=this.submitUsingSessionsFlow.bind(this),this.updateAmount=this.updateAmount.bind(this),this.setupSessionsDonation=this.setupSessionsDonation.bind(this),this.elementRef=o&&o.elementRef||this,this.resources=this.props.modules?this.props.modules.resources:void 0,this.storeElementRefOnCore(this.props),this.onEnterKeyPressed=this.onEnterKeyPressed.bind(this),this.onActionHandled=this.onActionHandled.bind(this),this.createBeforeRenderHook(o),this.reportIntegrationFlavor()}}E(C,"type",void 0),E(C,"txVariants",[]);export{C as UIElement,C as default};
1
+ import{createElement as e,createRef as t}from"../../../external/preact/dist/preact.js";import s,{NETWORK_ERROR as o}from"../../../core/Errors/AdyenCheckoutError.js";import i from"../../../core/Services/order-status.js";import{hasOwnProperty as n}from"../../../utils/hasOwnProperty.js";import r from"../BaseElement/BaseElement.js";import a from"../PayButton/PayButton.js";import{assertIsDropin as h,getRegulatoryDefaults as l,sanitizeResponse as d,verifyPaymentDidNotFail as c,cleanupFinalResult as p}from"./utils.js";import{AnalyticsErrorEvent as m,ErrorEventType as u}from"../../../core/Analytics/events/AnalyticsErrorEvent.js";import{AnalyticsInfoEvent as y,InfoEventType as f}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";import{AnalyticsLogEvent as v,LogEventType as R}from"../../../core/Analytics/events/AnalyticsLogEvent.js";import b from"../../../core/Errors/CancelError.js";import{CoreProvider as P}from"../../../core/Context/CoreProvider.js";import A from"../../../core/Errors/SRPanelProvider.js";import{AmountProvider as g}from"../../../core/Context/AmountProvider.js";import{TxVariants as w}from"../../tx-variants.js";function E(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function S(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},o=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),o.forEach(function(t){E(e,t,s[t])})}return e}function C(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t.push.apply(t,s)}return t}(Object(t)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))}),e}class j extends r{createBeforeRenderHook(e){const t=this.render;this.render=(...s)=>(this.beforeRender(e),t.apply(this,s))}beforeRender(e){if(null==e?void 0:e.originalAction)return;const t=new y(S({type:f.rendered,component:this.type,configData:C(S({},e),{showPayButton:this.props.showPayButton})},(null==e?void 0:e.oneClick)&&{isStoredPaymentMethod:!0}));this.analytics.sendAnalytics(t)}reportIntegrationFlavor(){this.analytics.sendFlavor("components")}get analytics(){return this.core.modules.analytics}get srPanel(){return this.core.modules.srPanel}getPaymentMethodConfigFromResponse(e){return(null==e?void 0:e.storedPaymentMethodId)?this.getStoredPaymentMethodDetails(e.storedPaymentMethodId):this.getPaymentMethodFromPaymentMethodsResponse(null==e?void 0:e.type,null==e?void 0:e.paymentMethodId)}buildElementProps(e){const t=S({showPayButton:!0},this.core.getCorePropsForComponent(),this.getPaymentMethodConfigFromResponse(e),e),s=h(this);this.props=this.formatProps(S({},this.constructor.defaultProps,l(this.core.options.countryCode,s),t))}getStoredPaymentMethodDetails(e){return this.core.paymentMethodsResponse.findStoredPaymentMethod(e)}getPaymentMethodFromPaymentMethodsResponse(e,t){var s;return t?this.core.paymentMethodsResponse.findById(t):null===(s=this.core.paymentMethodsResponse)||void 0===s?void 0:s.find(e||this.constructor.type)}storeElementRefOnCore(e){(null==e?void 0:e.isDropin)||this.core.storeElementReference(this)}isAvailable(){return Promise.resolve()}setState(e){this.state=S({},this.state,e),this.onChange()}showValidation(){return this.componentRef&&this.componentRef.showValidation&&this.componentRef.showValidation(),this}updateAmount(e,t){var s;this.props=S({},this.props,e&&{amount:e},t&&{secondaryAmount:t}),null===(s=this.amountProviderRef.current)||void 0===s||s.update(e,t)}setElementStatus(e,t){var s;return null===(s=this.elementRef)||void 0===s||s.setStatus(e,t),this}setStatus(e,t){var s;return(null===(s=this.componentRef)||void 0===s?void 0:s.setStatus)&&this.componentRef.setStatus(e,t),this}onChange(){var e,t;null===(e=(t=this.props).onChange)||void 0===e||e.call(t,{data:this.data,isValid:this.isValid,errors:this.state.errors,valid:this.state.valid},this.elementRef)}submitAnalytics(e){this.analytics.sendAnalytics(e)}submit(){if(this.isValid){if(this.props.onReview){var e;const t=null!==(e=this.state.order)&&void 0!==e?e:this.props.order,s=(e={})=>{this.submitAnalytics(new v({component:this.type,type:R.review,message:"Review flow triggered"})),this.props.onReview(this.data,this.elementRef,e)};return t?void i({clientKey:this.props.clientKey,loadingContext:this.props.loadingContext},t).then(e=>s({orderStatus:e})).catch(()=>s()):void s()}this.executePaymentsCall()}else this.showValidation()}executePaymentsCall(){this.makePaymentsCall().then(d).then(c).then(this.handleResponse).catch(e=>{e instanceof b?this.setElementStatus("ready"):this.handleFailedResult(e)})}makePaymentsCall(){if(this.setElementStatus("loading"),this.props.onSubmit)return this.submitUsingAdvancedFlow();if(this.core.session){return(this.props.beforeSubmit?new Promise((e,t)=>{this.props.beforeSubmit(this.data,this.elementRef,{resolve:e,reject:()=>t(new b("beforeSubmitRejected"))})}):Promise.resolve(this.data)).then(this.submitUsingSessionsFlow)}this.handleError(new s("IMPLEMENTATION_ERROR",'It can not perform /payments call. Callback "onSubmit" is missing or Checkout session is not available'))}async submitUsingAdvancedFlow(){const e=new v({component:this.type,type:R.submit,message:"Shopper clicked pay"});return this.submitAnalytics(e),new Promise((e,t)=>{this.props.onSubmit({data:this.data,isValid:this.isValid},this.elementRef,{resolve:e,reject:t})})}async submitUsingSessionsFlow(e){const t=new v({component:this.type,type:R.submit,message:"Shopper clicked pay"});this.submitAnalytics(t);try{return await this.core.session.submitPayment(e)}catch(e){return e instanceof s?this.handleError(e):this.handleError(new s("ERROR","Error when making /payments call",{cause:e})),Promise.reject(e)}}onComplete(e){this.handleAdditionalDetails(e)}handleAdditionalDetails(e){this.makeAdditionalDetailsCall(e).then(d).then(c).then(this.handleResponse).catch(this.handleFailedResult)}makeAdditionalDetailsCall(e){return this.props.onAdditionalDetails?new Promise((t,s)=>{this.props.onAdditionalDetails(e,this.elementRef,{resolve:t,reject:s})}):this.core.session?this.submitAdditionalDetailsUsingSessionsFlow(e.data):void this.handleError(new s("IMPLEMENTATION_ERROR",'It can not perform /payments/details call. Callback "onAdditionalDetails" is missing or Checkout session is not available'))}async submitAdditionalDetailsUsingSessionsFlow(e){try{return await this.core.session.submitDetails(e)}catch(e){return e instanceof s?this.handleError(e):this.handleError(new s("ERROR","Error when making /details call",{cause:e})),Promise.reject(e)}}handleAction(e,t={}){if(!e||!e.type){if(n(e,"action")&&n(e,"resultCode"))throw new Error('handleAction::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('handleAction::Invalid Action - the passed action object does not have a "type" property')}const s=this.core.createFromAction(e,S({},this.elementRef.props,t));return s?(this.unmount(),s.mount(this._node)):null}onActionHandled(e){var t,s;null===(s=this.props)||void 0===s||null===(t=s.onActionHandled)||void 0===t||t.call(s,S({originalAction:this.props.originalAction},e))}setupSessionsDonation(){const{amount:e,donation:t}=this.props;if(!1!==(null==t?void 0:t.autoMount)){const t=h(this.elementRef)?this.elementRef._node:this._node;new(this.core.getComponent(w.donation))(this.core,{rootNode:t,commercialTxAmount:e.value})}}handleResponse(e){var t,s,o;e.action?(null===(o=this.core.options)||void 0===o?void 0:o.onAction)?this.core.options.onAction(this.core.createFromAction(e.action,S({},this.elementRef.props))):this.elementRef.handleAction(e.action):(null===(s=e.order)||void 0===s||null===(t=s.remainingAmount)||void 0===t?void 0:t.value)>0?this.handleOrder(e):this.handleSuccessResult(e)}handleKeyDown(e){var t;"Enter"!==e.key&&"Enter"!==e.code||(e.preventDefault(),this.onEnterKeyPressed(null===(t=document)||void 0===t?void 0:t.activeElement,this))}onEnterKeyPressed(e,t){this.props.onEnterKeyPressed?this.props.onEnterKeyPressed(e,t):(e.blur(),this.submit())}updateParent(e={}){return this.elementRef.core.update(e)}get isValid(){return!1}get icon(){var e;const t=this.props.paymentMethodType||this.type;return null!==(e=this.props.icon)&&void 0!==e?e:this.resources.getImage()(t)}get displayName(){var e,t;const s=null===(t=this.core.paymentMethodsResponse)||void 0===t||null===(e=t.paymentMethods)||void 0===e?void 0:e.find(e=>e.type===this.type);return this.props.name||(null==s?void 0:s.name)||this.type}get accessibleName(){return this.displayName}get additionalInfo(){return null}get type(){return this.props.type||this.constructor.type}async handleAdvanceFlowPaymentMethodsUpdate(e,t){return new Promise((t,s)=>{if(!this.props.onPaymentMethodsRequest)return t();this.props.onPaymentMethodsRequest(C(S({},e&&{order:{orderData:e.orderData,pspReference:e.pspReference}}),{locale:this.core.options.locale}),{resolve:t,reject:s})}).catch(e=>{this.handleError(new s("IMPLEMENTATION_ERROR","Something failed during payment methods update or onPaymentMethodsRequest was not implemented",{cause:e}))}).then(s=>this.core.update(C(S({},s&&{paymentMethodsResponse:s}),{order:e,amount:e?e.remainingAmount:t})))}render(){return e(P,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources,analytics:this.analytics},e(A,{srPanel:this.srPanel},e(g,{amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,providerRef:this.amountProviderRef},this.componentToRender())))}constructor(s,i){super(s,i),E(this,"componentRef",void 0),E(this,"resources",void 0),E(this,"elementRef",void 0),E(this,"amountProviderRef",t()),E(this,"handleError",e=>{if(this.setElementStatus("ready"),e.name===o&&e.options.code){const t=new m({component:this.type,errorType:u.apiError,code:e.options.code});this.submitAnalytics(t)}this.props.onError&&this.props.onError(e,this.elementRef)}),E(this,"handleOrder",e=>{const{order:t}=e;(this.core.session?this.core.update({order:t}):this.handleAdvanceFlowPaymentMethodsUpdate(t)).then(()=>{var e,s;null===(e=(s=this.props).onOrderUpdated)||void 0===e||e.call(s,{order:t})})}),E(this,"handleFailedResult",e=>{var t,s;h(this.elementRef)&&this.elementRef.displayFinalAnimation("error"),p(e),null===(t=(s=this.props).onPaymentFailed)||void 0===t||t.call(s,e,this.elementRef)}),E(this,"handleSuccessResult",e=>{var t,s;h(this.elementRef)&&this.elementRef.displayFinalAnimation("success"),p(e),this.core.session&&!0===e.askDonation&&this.setupSessionsDonation(),null===(t=(s=this.props).onPaymentCompleted)||void 0===t||t.call(s,e,this.elementRef)}),E(this,"setComponentRef",e=>{this.componentRef=e}),E(this,"payButton",t=>e(a,C(S({},t),{onClick:this.submit,showReview:!!this.props.onReview}))),this.core.register(this.constructor),this.submit=this.submit.bind(this),this.setState=this.setState.bind(this),this.onComplete=this.onComplete.bind(this),this.handleAction=this.handleAction.bind(this),this.handleOrder=this.handleOrder.bind(this),this.handleAdditionalDetails=this.handleAdditionalDetails.bind(this),this.handleResponse=this.handleResponse.bind(this),this.setElementStatus=this.setElementStatus.bind(this),this.submitAnalytics=this.submitAnalytics.bind(this),this.makePaymentsCall=this.makePaymentsCall.bind(this),this.makeAdditionalDetailsCall=this.makeAdditionalDetailsCall.bind(this),this.submitUsingSessionsFlow=this.submitUsingSessionsFlow.bind(this),this.updateAmount=this.updateAmount.bind(this),this.setupSessionsDonation=this.setupSessionsDonation.bind(this),this.elementRef=i&&i.elementRef||this,this.resources=this.props.modules?this.props.modules.resources:void 0,this.storeElementRefOnCore(this.props),this.onEnterKeyPressed=this.onEnterKeyPressed.bind(this),this.onActionHandled=this.onActionHandled.bind(this),this.createBeforeRenderHook(i),this.reportIntegrationFlavor()}}E(j,"type",void 0),E(j,"txVariants",[]);export{j as UIElement,j as default};
2
2
  //# sourceMappingURL=UIElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\nimport { TxVariants } from '../../tx-variants';\nimport Donation from '../../Donation/Donation';\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n /**\n * componentRef is a ref to the primary component inside the subclass that extends UIElement e.g. CardInput.tsx (which sits inside Card.tsx)\n */\n protected componentRef: any;\n\n protected resources: Resources;\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx or Dropin.tsx\n */\n public elementRef: UIElement;\n\n public static readonly type: string | undefined = undefined;\n\n /**\n * Reference to the methods exposed by the AmountProvider context\n */\n protected amountProviderRef: RefObject<AmountProviderRef> = createRef();\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static readonly 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 this.updateAmount = this.updateAmount.bind(this);\n this.setupSessionsDonation = this.setupSessionsDonation.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 this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n protected getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\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 * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\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 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 protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\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 void 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 const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\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 const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\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+mWteUnBENZu7KqO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JgK62ltN2idqKxLC7WtivCUgejuQUvNreCYBQCaKwTwP02lZsJpGF9yw8gbyuoB+2aB7IZmgIB8GP4qVQ/ht5B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\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 const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\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 });\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\n ? this.core.update({\n order\n })\n : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n protected setupSessionsDonation() {\n const { amount, donation } = this.props;\n\n // If merchant hasn't explicitly disabled autoMount by setting it to false\n if (donation?.autoMount !== false) {\n const rootNode: HTMLElement = assertIsDropin(this.elementRef) ? this.elementRef._node : this._node;\n\n const DonationComponentRef = this.core.getComponent(TxVariants.donation) as typeof Donation;\n new DonationComponentRef(this.core, { rootNode, commercialTxAmount: amount.value }); // NOSONAR: Instantiation triggers internal async initialization (fire-and-forget pattern)\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\n /** If we are using sessions and the response mandates it - create a Donation instance */\n if (this.core.session && result.askDonation === true) {\n this.setupSessionsDonation();\n }\n\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 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: PayButtonProps) => {\n return <PayButton {...props} 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 protected abstract componentToRender(): h.JSX.Element | null;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","_object_spread","type","InfoEventType","rendered","component","configData","_object_spread_props","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","_this_core_paymentMethodsResponse","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","_this_amountProviderRef_current","amountProviderRef","current","update","setElementStatus","status","_this_elementRef","elementRef","setStatus","_this_componentRef","_this_props_onChange","_this_props","call","data","isValid","errors","valid","submitAnalytics","submit","makePaymentsCall","then","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","AnalyticsLogEvent","LogEventType","message","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","_this_props_onActionHandled","setupSessionsDonation","donation","autoMount","rootNode","getComponent","TxVariants","commercialTxAmount","value","response","order","remainingAmount","handleOrder","handleSuccessResult","handleKeyPress","document","key","code","preventDefault","onEnterKeyPressed","activeElement","blur","updateParent","icon","_this_props_icon","paymentMethodType","resources","getImage","displayName","_this_core_paymentMethodsResponse_paymentMethods","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","loadingContext","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","_this_props_onOrderUpdated","onOrderUpdated","result","_this_props_onPaymentFailed","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","_this_props_onPaymentCompleted","askDonation","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","register","bind","undefined","txVariants"],"mappings":"y2DAsCO,MAAeA,UAA6DC,EAgEvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,aAAAA,EAAAA,EAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmBC,EAAA,CACjCC,KAAMC,EAAcC,SACpBC,UAAWZ,KAAKS,KAChBI,WAAYC,EAAAN,EAAA,CAAA,EAAKV,GAAAA,CAAqBiB,cAAef,KAAKgB,MAAMD,kBAC5DjB,aAAAA,EAAAA,EAAqBmB,WAAY,CAAEC,uBAAuB,KAGlElB,KAAKmB,UAAUC,cAAcd,EACjC,CAEUe,uBAAAA,GACDrB,KAAKmB,UAAUG,WAA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ACT,EA1CAuJ,EAbkBjL,EAaKc,YAA2B4L,GAUlDzB,EAvBkBjL,EAuBK2M,aAAuB"}
1
+ {"version":3,"file":"UIElement.js","sources":["../../../../../src/components/internal/UIElement/UIElement.tsx"],"sourcesContent":["import { createRef, h, RefObject, TargetedKeyboardEvent } from 'preact';\nimport { Resources } from '../../../core/Context/Resources';\nimport AdyenCheckoutError, { NETWORK_ERROR } from '../../../core/Errors/AdyenCheckoutError';\nimport getOrderStatus from '../../../core/Services/order-status';\nimport { hasOwnProperty } from '../../../utils/hasOwnProperty';\nimport BaseElement from '../BaseElement/BaseElement';\nimport PayButton from '../PayButton';\nimport { assertIsDropin, cleanupFinalResult, getRegulatoryDefaults, sanitizeResponse, verifyPaymentDidNotFail } from './utils';\n\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventType } from '../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AnalyticsInfoEvent, InfoEventType } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AnalyticsLogEvent, LogEventType } from '../../../core/Analytics/events/AnalyticsLogEvent';\nimport type { CheckoutSessionDetailsResponse, CheckoutSessionPaymentResponse } from '../../../core/CheckoutSession/types';\nimport type { NewableComponent } from '../../../core/core.registry';\nimport CancelError from '../../../core/Errors/CancelError';\nimport type { AdditionalDetailsData, CoreConfiguration, ICore, ReviewDetails } from '../../../core/types';\nimport type {\n ActionHandledReturnObject,\n CheckoutAdvancedFlowResponse,\n Order,\n PaymentAction,\n PaymentAmount,\n PaymentData,\n PaymentMethodsResponse,\n PaymentResponseData,\n RawPaymentMethod\n} from '../../../types/global-types';\nimport type { ComponentMethodsRef, UIElementProps, UIElementStatus } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\nimport { CoreProvider } from '../../../core/Context/CoreProvider';\nimport { SRPanel } from '../../../core/Errors/SRPanel';\nimport SRPanelProvider from '../../../core/Errors/SRPanelProvider';\nimport { AmountProvider, AmountProviderRef } from '../../../core/Context/AmountProvider';\nimport { PayButtonProps } from '../PayButton/PayButton';\nimport { TxVariants } from '../../tx-variants';\nimport Donation from '../../Donation/Donation';\nimport './UIElement.scss';\n\nexport abstract class UIElement<P extends UIElementProps = UIElementProps> extends BaseElement<P> {\n /**\n * componentRef is a ref to the primary component inside the subclass that extends UIElement e.g. CardInput.tsx (which sits inside Card.tsx)\n */\n protected componentRef: any;\n\n protected resources: Resources;\n\n /**\n * elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx or Dropin.tsx\n */\n public elementRef: UIElement;\n\n public static readonly type: string | undefined = undefined;\n\n /**\n * Reference to the methods exposed by the AmountProvider context\n */\n protected amountProviderRef: RefObject<AmountProviderRef> = createRef();\n\n /**\n * Defines all txVariants that the Component supports (in case it support multiple ones besides the 'type' one)\n */\n public static readonly 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 this.updateAmount = this.updateAmount.bind(this);\n this.setupSessionsDonation = this.setupSessionsDonation.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 this.createBeforeRenderHook(props);\n this.reportIntegrationFlavor();\n }\n\n /**\n * Creates a hook tied to render() method. This hook is called every time render() is invoked.\n * Currently useful for Analytics\n *\n * @param configSetByMerchant\n * @private\n */\n private createBeforeRenderHook(configSetByMerchant: P): void {\n const originalRender = this.render;\n\n this.render = (...args: any[]) => {\n this.beforeRender(configSetByMerchant);\n return originalRender.apply(this, args);\n };\n }\n\n protected beforeRender(configSetByMerchant?: P): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && { isStoredPaymentMethod: true })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n protected reportIntegrationFlavor(): void {\n void this.analytics.sendFlavor('components');\n }\n\n get analytics(): IAnalytics {\n return this.core.modules.analytics;\n }\n\n get srPanel(): SRPanel {\n return this.core.modules.srPanel;\n }\n\n protected getPaymentMethodConfigFromResponse(componentProps: P) {\n if (componentProps?.storedPaymentMethodId) return this.getStoredPaymentMethodDetails(componentProps.storedPaymentMethodId);\n return this.getPaymentMethodFromPaymentMethodsResponse(componentProps?.type, componentProps?.paymentMethodId);\n }\n\n protected override buildElementProps(componentProps?: P) {\n const globalCoreProps = this.core.getCorePropsForComponent();\n\n const paymentMethodFromResponse = this.getPaymentMethodConfigFromResponse(componentProps);\n\n const finalProps = {\n showPayButton: true,\n ...globalCoreProps,\n ...paymentMethodFromResponse,\n ...componentProps\n };\n\n const isDropinInstance = assertIsDropin(this);\n\n this.props = this.formatProps({\n ...this.constructor['defaultProps'], // component defaults\n ...getRegulatoryDefaults(this.core.options.countryCode, isDropinInstance), // regulatory defaults\n ...finalProps // the rest (inc. merchant defined config)\n });\n }\n\n protected getStoredPaymentMethodDetails(storedPaymentMethodId: string) {\n return this.core.paymentMethodsResponse.findStoredPaymentMethod(storedPaymentMethodId);\n }\n\n /**\n * Get the payment method from the paymentMethodsResponse\n *\n * @param type - The type of the payment method to get. (This prop is passed by Drop-in OR Standalone components containing the property 'type' as part of their configuration)\n * @param paymentMethodId - Unique internal payment method ID\n */\n protected getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n return this.core.paymentMethodsResponse?.find(type || this.constructor['type']);\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 * Updates the amount in the props and propagates it to the AmountProvider.\n * This allows children components to access the updated amount via context.\n *\n * @param amount - Primary payment amount object\n * @param secondaryAmount - Optional secondary amount for display purposes (e.g., converted currency)\n * @internal\n */\n public updateAmount(amount: PaymentAmount, secondaryAmount?: PaymentAmount): void {\n this.props = {\n ...this.props,\n ...(amount && { amount }),\n ...(secondaryAmount && { secondaryAmount })\n };\n this.amountProviderRef.current?.update(amount, secondaryAmount);\n }\n\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 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 protected override submitAnalytics(event: AbstractAnalyticsEvent) {\n this.analytics.sendAnalytics(event);\n }\n\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n if (this.props.onReview) {\n const order = this.state.order ?? this.props.order;\n const onReview = (reviewDetails: ReviewDetails = {}) => {\n this.submitAnalytics(new AnalyticsLogEvent({ component: this.type, type: LogEventType.review, message: 'Review flow triggered' }));\n this.props.onReview(this.data, this.elementRef, reviewDetails);\n };\n if (order) {\n void getOrderStatus({ clientKey: this.props.clientKey, loadingContext: this.props.loadingContext }, order)\n .then(orderStatus => onReview({ orderStatus }))\n .catch(() => onReview());\n return;\n }\n onReview();\n return;\n }\n\n this.executePaymentsCall();\n }\n\n public executePaymentsCall(): void {\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 void 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 const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\n\n return new Promise<CheckoutAdvancedFlowResponse>((resolve, reject) => {\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 const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.submit,\n message: 'Shopper clicked pay'\n });\n this.submitAnalytics(event);\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+1IJkCSalhwi5D7fSrpjbQTmAsOpJT1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B9z/FLohK/8cSPV/4i32SNNdcwhV',\n // sessionResult:\n // 'X3XtfGC7!H4sIAAAAAAAA/6tWykxRslJyDjaxNDMyM3E2MXIyNDUys3RU0lHKTS1KzkjMK3FMTs4vzSsBKgtJLS7xhYo6Z6QmZ+eXlgAVFpcklpQWA+WLUtNKi1NTlGoBMEEbz1cAAAA=iMsCaEJ5LcnsqIUtmNxjm8HtfQ8gZW8JewEU3wHz4qg='\n // };\n }\n\n protected onComplete(state): void {\n this.handleAdditionalDetails(state);\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 const event = new AnalyticsErrorEvent({\n component: this.type,\n errorType: ErrorEventType.apiError,\n code: error.options.code\n });\n\n this.submitAnalytics(event);\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 });\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\n ? this.core.update({\n order\n })\n : this.handleAdvanceFlowPaymentMethodsUpdate(order);\n\n void updateCorePromise.then(() => {\n this.props.onOrderUpdated?.({ order });\n });\n };\n\n protected setupSessionsDonation() {\n const { amount, donation } = this.props;\n\n // If merchant hasn't explicitly disabled autoMount by setting it to false\n if (donation?.autoMount !== false) {\n const rootNode: HTMLElement = assertIsDropin(this.elementRef) ? this.elementRef._node : this._node;\n\n const DonationComponentRef = this.core.getComponent(TxVariants.donation) as typeof Donation;\n new DonationComponentRef(this.core, { rootNode, commercialTxAmount: amount.value }); // NOSONAR: Instantiation triggers internal async initialization (fire-and-forget pattern)\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\n /** If we are using sessions and the response mandates it - create a Donation instance */\n if (this.core.session && result.askDonation === true) {\n this.setupSessionsDonation();\n }\n\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 if (this.core.options?.onAction) {\n this.core.options.onAction(this.core.createFromAction(response.action, { ...this.elementRef.props }));\n } else {\n this.elementRef.handleAction(response.action);\n }\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 handleKeyDown(e: 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 handleKeyDown)\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 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: PayButtonProps) => {\n return <PayButton {...props} onClick={this.submit} showReview={!!this.props.onReview} />;\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 protected abstract componentToRender(): h.JSX.Element | null;\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources} analytics={this.analytics}>\n <SRPanelProvider srPanel={this.srPanel}>\n <AmountProvider amount={this.props.amount} secondaryAmount={this.props.secondaryAmount} providerRef={this.amountProviderRef}>\n {this.componentToRender()}\n </AmountProvider>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default UIElement;\n"],"names":["UIElement","BaseElement","createBeforeRenderHook","configSetByMerchant","originalRender","this","render","args","beforeRender","apply","originalAction","event","AnalyticsInfoEvent","_object_spread","type","InfoEventType","rendered","component","configData","_object_spread_props","showPayButton","props","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","reportIntegrationFlavor","sendFlavor","core","modules","srPanel","getPaymentMethodConfigFromResponse","componentProps","storedPaymentMethodId","getStoredPaymentMethodDetails","getPaymentMethodFromPaymentMethodsResponse","paymentMethodId","buildElementProps","finalProps","getCorePropsForComponent","isDropinInstance","assertIsDropin","formatProps","constructor","getRegulatoryDefaults","options","countryCode","paymentMethodsResponse","findStoredPaymentMethod","_this_core_paymentMethodsResponse","findById","find","storeElementRefOnCore","isDropin","storeElementReference","isAvailable","Promise","resolve","setState","newState","state","onChange","showValidation","componentRef","updateAmount","amount","secondaryAmount","_this_amountProviderRef_current","amountProviderRef","current","update","setElementStatus","status","_this_elementRef","elementRef","setStatus","_this_componentRef","_this_props_onChange","_this_props","call","data","isValid","errors","valid","submitAnalytics","submit","onReview","_this_state_order","order","reviewDetails","AnalyticsLogEvent","LogEventType","review","message","getOrderStatus","clientKey","loadingContext","then","orderStatus","catch","executePaymentsCall","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","e","CancelError","handleFailedResult","onSubmit","submitUsingAdvancedFlow","session","beforeSubmit","reject","submitUsingSessionsFlow","handleError","AdyenCheckoutError","submitPayment","error","cause","onComplete","handleAdditionalDetails","makeAdditionalDetailsCall","onAdditionalDetails","submitAdditionalDetailsUsingSessionsFlow","submitDetails","handleAction","action","hasOwnProperty","Error","paymentAction","createFromAction","unmount","mount","_node","onActionHandled","actionHandledObj","_this_props_onActionHandled","setupSessionsDonation","donation","autoMount","rootNode","getComponent","TxVariants","commercialTxAmount","value","response","_this_core_options","onAction","remainingAmount","handleOrder","handleSuccessResult","handleKeyDown","document","key","code","preventDefault","onEnterKeyPressed","activeElement","blur","updateParent","icon","_this_props_icon","paymentMethodType","resources","getImage","displayName","_this_core_paymentMethodsResponse_paymentMethods","paymentMethodFromResponse","paymentMethods","pm","name","accessibleName","additionalInfo","handleAdvanceFlowPaymentMethodsUpdate","onPaymentMethodsRequest","orderData","pspReference","locale","h","CoreProvider","i18n","SRPanelProvider","AmountProvider","providerRef","componentToRender","checkout","super","_define_property","createRef","NETWORK_ERROR","AnalyticsErrorEvent","errorType","ErrorEventType","apiError","onError","_this_props_onOrderUpdated","onOrderUpdated","result","_this_props_onPaymentFailed","displayFinalAnimation","cleanupFinalResult","onPaymentFailed","_this_props_onPaymentCompleted","askDonation","onPaymentCompleted","setComponentRef","ref","payButton","PayButton","onClick","showReview","register","bind","undefined","txVariants"],"mappings":"+5DAuCO,MAAeA,UAA6DC,EAgEvEC,sBAAAA,CAAuBC,GAC3B,MAAMC,EAAiBC,KAAKC,OAE5BD,KAAKC,OAAS,IAAIC,KACdF,KAAKG,aAAaL,GACXC,EAAeK,MAAMJ,KAAME,GAE1C,CAEUC,YAAAA,CAAaL,GAEnB,GAAIA,aAAAA,EAAAA,EAAqBO,eACrB,OAGJ,MAAMC,EAAQ,IAAIC,EAAmBC,EAAA,CACjCC,KAAMC,EAAcC,SACpBC,UAAWZ,KAAKS,KAChBI,WAAYC,EAAAN,EAAA,CAAA,EAAKV,GAAAA,CAAqBiB,cAAef,KAAKgB,MAAMD,kBAC5DjB,aAAAA,EAAAA,EAAqBmB,WAAY,CAAEC,uBAAuB,KAGlElB,KAAKm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,KAAK/M,MAC3CA,KAAKgJ,YAAchJ,KAAKgJ,YAAY+D,KAAK/M,MACzCA,KAAKmH,wBAA0BnH,KAAKmH,wBAAwB4F,KAAK/M,MACjEA,KAAKmG,eAAiBnG,KAAKmG,eAAe4G,KAAK/M,MAC/CA,KAAKkE,iBAAmBlE,KAAKkE,iBAAiB6I,KAAK/M,MACnDA,KAAK+E,gBAAkB/E,KAAK+E,gBAAgBgI,KAAK/M,MACjDA,KAAKgG,iBAAmBhG,KAAKgG,iBAAiB+G,KAAK/M,MACnDA,KAAKoH,0BAA4BpH,KAAKoH,0BAA0B2F,KAAK/M,MACrEA,KAAK4G,wBAA0B5G,KAAK4G,wBAAwBmG,KAAK/M,MACjEA,KAAK2D,aAAe3D,KAAK2D,aAAaoJ,KAAK/M,MAC3CA,KAAKoI,sBAAwBpI,KAAKoI,sBAAsB2E,KAAK/M,MAE7DA,KAAKqE,WAAcrD,GAASA,EAAMqD,YAAerE,KACjDA,KAAK8J,UAAY9J,KAAKgB,MAAMQ,QAAUxB,KAAKgB,MAAMQ,QAAQsI,eAAYkD,EAErEhN,KAAK+C,sBAAsB/C,KAAKgB,OAEhChB,KAAKuJ,kBAAoBvJ,KAAKuJ,kBAAkBwD,KAAK/M,MACrDA,KAAKiI,gBAAkBjI,KAAKiI,gBAAgB8E,KAAK/M,MAEjDA,KAAKH,uBAAuBmB,GAC5BhB,KAAKqB,yBACT,EA1CAiK,EAbkB3L,EAaKc,YAA2BuM,GAUlD1B,EAvBkB3L,EAuBKsN,aAAuB"}
@@ -1,2 +1,2 @@
1
- import{ERROR_INVALID_FORMAT_EXPECTS as t,ERROR_FIELD_REQUIRED as o,BOLETO_SOCIAL_SECURITY_NUMBER_INVALID as e,CREDITCARD_TAX_NUMBER_INVALID as r,CREDITCARD_HOLDER_NAME_INVALID as c}from"../Errors/constants.js";const s=3e3,n={[c]:"925",[r]:"942",[e]:"926",[`${o}.country`]:"930",[`${o}.street`]:"931",[`${o}.house_number_or_name`]:"932",[`${o}.postal_code`]:"933",[`${o}.city`]:"935",[`${o}.state_or_province`]:"936",[`${t}.postal_code`]:"934"},$="fetch-checkoutAttemptId-failed";export{s as ANALYTICS_SEARCH_DEBOUNCE_TIME,$ as NO_CHECKOUT_ATTEMPT_ID,n as errorCodeMapping};
1
+ import{ERROR_INVALID_CHARACTERS as t,ERROR_INVALID_FORMAT_EXPECTS as o,ERROR_FIELD_REQUIRED as e,BOLETO_SOCIAL_SECURITY_NUMBER_INVALID as r,CREDITCARD_TAX_NUMBER_INVALID as c,CREDITCARD_HOLDER_NAME_INVALID as s}from"../Errors/constants.js";const n=3e3,$={[s]:"925",[c]:"942",[r]:"926",[`${e}.country`]:"930",[`${e}.street`]:"931",[`${e}.house_number_or_name`]:"932",[`${e}.postal_code`]:"933",[`${e}.city`]:"935",[`${e}.state_or_province`]:"936",[`${o}.postal_code`]:"934",[t]:"937"},_="fetch-checkoutAttemptId-failed";export{n as ANALYTICS_SEARCH_DEBOUNCE_TIME,_ as NO_CHECKOUT_ATTEMPT_ID,$ as errorCodeMapping};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/core/Analytics/constants.ts"],"sourcesContent":["import {\n BOLETO_SOCIAL_SECURITY_NUMBER_INVALID,\n CREDITCARD_HOLDER_NAME_INVALID,\n CREDITCARD_TAX_NUMBER_INVALID,\n ERROR_FIELD_REQUIRED,\n ERROR_INVALID_FORMAT_EXPECTS\n} from '../Errors/constants';\n\nexport const ANALYTICS_PATH = 'v3/analytics';\n\nexport const ANALYTICS_SEARCH_DEBOUNCE_TIME = 3000;\n\n/**\n * Function to map errorCodes based on translation keys to the codes expected by the analytics endpoint\n */\nexport const errorCodeMapping: Record<string, string> = {\n [CREDITCARD_HOLDER_NAME_INVALID]: '925',\n [CREDITCARD_TAX_NUMBER_INVALID]: '942',\n //\n [BOLETO_SOCIAL_SECURITY_NUMBER_INVALID]: '926',\n //\n [`${ERROR_FIELD_REQUIRED}.country`]: '930',\n [`${ERROR_FIELD_REQUIRED}.street`]: '931',\n [`${ERROR_FIELD_REQUIRED}.house_number_or_name`]: '932',\n [`${ERROR_FIELD_REQUIRED}.postal_code`]: '933',\n [`${ERROR_FIELD_REQUIRED}.city`]: '935',\n [`${ERROR_FIELD_REQUIRED}.state_or_province`]: '936',\n //\n [`${ERROR_INVALID_FORMAT_EXPECTS}.postal_code`]: '934'\n //\n};\n\nexport const NO_CHECKOUT_ATTEMPT_ID = 'fetch-checkoutAttemptId-failed';\n"],"names":["ANALYTICS_SEARCH_DEBOUNCE_TIME","errorCodeMapping","CREDITCARD_HOLDER_NAME_INVALID","CREDITCARD_TAX_NUMBER_INVALID","BOLETO_SOCIAL_SECURITY_NUMBER_INVALID","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS","NO_CHECKOUT_ATTEMPT_ID"],"mappings":"kNAUO,MAAMA,EAAiC,IAKjCC,EAA2C,CACpDC,CAACA,GAAiC,MAClCC,CAACA,GAAgC,MAEjCC,CAACA,GAAwC,MAEzC,CAAC,GAAGC,aAAiC,MACrC,CAAC,GAAGA,YAAgC,MACpC,CAAC,GAAGA,0BAA8C,MAClD,CAAC,GAAGA,iBAAqC,MACzC,CAAC,GAAGA,UAA8B,MAClC,CAAC,GAAGA,uBAA2C,MAE/C,CAAC,GAAGC,iBAA6C,OAIxCC,EAAyB"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/core/Analytics/constants.ts"],"sourcesContent":["import {\n BOLETO_SOCIAL_SECURITY_NUMBER_INVALID,\n CREDITCARD_HOLDER_NAME_INVALID,\n CREDITCARD_TAX_NUMBER_INVALID,\n ERROR_FIELD_REQUIRED,\n ERROR_INVALID_CHARACTERS,\n ERROR_INVALID_FORMAT_EXPECTS\n} from '../Errors/constants';\n\nexport const ANALYTICS_PATH = 'v3/analytics';\n\nexport const ANALYTICS_SEARCH_DEBOUNCE_TIME = 3000;\n\n/**\n * Function to map errorCodes based on translation keys to the codes expected by the analytics endpoint\n */\nexport const errorCodeMapping: Record<string, string> = {\n [CREDITCARD_HOLDER_NAME_INVALID]: '925',\n [CREDITCARD_TAX_NUMBER_INVALID]: '942',\n //\n [BOLETO_SOCIAL_SECURITY_NUMBER_INVALID]: '926',\n //\n [`${ERROR_FIELD_REQUIRED}.country`]: '930',\n [`${ERROR_FIELD_REQUIRED}.street`]: '931',\n [`${ERROR_FIELD_REQUIRED}.house_number_or_name`]: '932',\n [`${ERROR_FIELD_REQUIRED}.postal_code`]: '933',\n [`${ERROR_FIELD_REQUIRED}.city`]: '935',\n [`${ERROR_FIELD_REQUIRED}.state_or_province`]: '936',\n //\n [`${ERROR_INVALID_FORMAT_EXPECTS}.postal_code`]: '934',\n [ERROR_INVALID_CHARACTERS]: '937'\n //\n};\n\nexport const NO_CHECKOUT_ATTEMPT_ID = 'fetch-checkoutAttemptId-failed';\n"],"names":["ANALYTICS_SEARCH_DEBOUNCE_TIME","errorCodeMapping","CREDITCARD_HOLDER_NAME_INVALID","CREDITCARD_TAX_NUMBER_INVALID","BOLETO_SOCIAL_SECURITY_NUMBER_INVALID","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS","ERROR_INVALID_CHARACTERS","NO_CHECKOUT_ATTEMPT_ID"],"mappings":"gPAWO,MAAMA,EAAiC,IAKjCC,EAA2C,CACpDC,CAACA,GAAiC,MAClCC,CAACA,GAAgC,MAEjCC,CAACA,GAAwC,MAEzC,CAAC,GAAGC,aAAiC,MACrC,CAAC,GAAGA,YAAgC,MACpC,CAAC,GAAGA,0BAA8C,MAClD,CAAC,GAAGA,iBAAqC,MACzC,CAAC,GAAGA,UAA8B,MAClC,CAAC,GAAGA,uBAA2C,MAE/C,CAAC,GAAGC,iBAA6C,MACjDC,CAACA,GAA2B,OAInBC,EAAyB"}
@@ -1,2 +1,2 @@
1
- import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n=function(e){return e.action="action",e.submit="submit",e.redirect="redirect",e.threeDS2="threeDS2",e.closed="closed",e.apiRequest="apiRequest",e}({}),a=function(e){return e.challengeIframeLoaded="challengeIframeLoaded",e.challengeDataSentWeb="challengeDataSentWeb",e.challengeCompleted="challengeCompleted",e.fingerprintDataSentWeb="fingerprintDataSentWeb",e.fingerprintCompleted="fingerprintCompleted",e.fingerprintIframeLoaded="fingerprintIframeLoaded",e.threeDS2="threeDS2",e.redirect="redirect",e.voucher="voucher",e.await="awat",e.qrCode="qrCode",e.bankTransfer="bankTransfer",e.sdk="sdk",e.donation="donation",e.donationCampaigns="donationCampaigns",e}({});class i extends e{getEventCategory(){return t.log}static getSubtypeFromActionType(e){return a[e]}constructor(e){super(e.component),r(this,"type",void 0),r(this,"subType",void 0),r(this,"message",void 0),r(this,"result",void 0),this.type=e.type,this.message=e.message,e.subType&&(this.subType=e.subType),e.result&&(this.result=e.result)}}export{i as AnalyticsLogEvent,a as LogEventSubtype,n as LogEventType};
1
+ import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n=function(e){return e.action="action",e.submit="submit",e.redirect="redirect",e.threeDS2="threeDS2",e.closed="closed",e.apiRequest="apiRequest",e.review="review",e}({}),i=function(e){return e.challengeIframeLoaded="challengeIframeLoaded",e.challengeDataSentWeb="challengeDataSentWeb",e.challengeCompleted="challengeCompleted",e.fingerprintDataSentWeb="fingerprintDataSentWeb",e.fingerprintCompleted="fingerprintCompleted",e.fingerprintIframeLoaded="fingerprintIframeLoaded",e.threeDS2="threeDS2",e.redirect="redirect",e.voucher="voucher",e.await="awat",e.qrCode="qrCode",e.bankTransfer="bankTransfer",e.sdk="sdk",e.donation="donation",e.donationCampaigns="donationCampaigns",e.review="review",e}({});class a extends e{getEventCategory(){return t.log}static getSubtypeFromActionType(e){return i[e]}constructor(e){super(e.component),r(this,"type",void 0),r(this,"subType",void 0),r(this,"message",void 0),r(this,"result",void 0),this.type=e.type,this.message=e.message,e.subType&&(this.subType=e.subType),e.result&&(this.result=e.result)}}export{a as AnalyticsLogEvent,i as LogEventSubtype,n as LogEventType};
2
2
  //# sourceMappingURL=AnalyticsLogEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsLogEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsLogEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport type { PaymentAction } from '../../../types/global-types';\n\ntype AnalyticsLogEventProps = {\n type: LogEventType;\n subType?: LogEventSubtype;\n component: string;\n message: string;\n result?: string;\n};\n\nexport enum LogEventType {\n action = 'action',\n submit = 'submit',\n redirect = 'redirect',\n threeDS2 = 'threeDS2',\n closed = 'closed',\n apiRequest = 'apiRequest'\n}\n\nexport enum LogEventSubtype {\n challengeIframeLoaded = 'challengeIframeLoaded',\n challengeDataSentWeb = 'challengeDataSentWeb',\n challengeCompleted = 'challengeCompleted',\n fingerprintDataSentWeb = 'fingerprintDataSentWeb',\n fingerprintCompleted = 'fingerprintCompleted',\n fingerprintIframeLoaded = 'fingerprintIframeLoaded',\n threeDS2 = 'threeDS2',\n redirect = 'redirect',\n voucher = 'voucher',\n await = 'awat',\n qrCode = 'qrCode',\n bankTransfer = 'bankTransfer',\n sdk = 'sdk',\n donation = 'donation',\n donationCampaigns = 'donationCampaigns'\n}\n\nexport class AnalyticsLogEvent extends AbstractAnalyticsEvent {\n private readonly type: LogEventType;\n private readonly subType: LogEventSubtype;\n\n private readonly message?: string;\n private readonly result?: string;\n\n constructor(props: AnalyticsLogEventProps) {\n super(props.component);\n\n this.type = props.type;\n this.message = props.message;\n\n if (props.subType) this.subType = props.subType;\n if (props.result) this.result = props.result;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.log;\n }\n\n public static getSubtypeFromActionType(type: PaymentAction['type']): LogEventSubtype {\n return LogEventSubtype[type];\n }\n}\n"],"names":["LogEventType","LogEventSubtype","AnalyticsLogEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","log","getSubtypeFromActionType","type","constructor","props","super","component","_define_property","this","subType","message","result"],"mappings":"yNAWO,IAAAA,EAAKA,SAAAA,GAAAA,mIAAAA,CAOX,CAPWA,CAOX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,4eAAAA,CAgBX,CAhBWA,CAgBX,CAAA,GAEM,MAAMC,UAA0BC,EAiB5BC,gBAAAA,GACH,OAAOC,EAAuBC,GAClC,CAEA,+BAAcC,CAAyBC,GACnC,OAAOP,EAAgBO,EAC3B,CAhBA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WAPhBC,EAAAC,KAAiBN,YAAjB,GACAK,EAAAC,KAAiBC,kBAEjBF,EAAAC,KAAiBE,kBACjBH,EAAAC,KAAiBG,iBAKbH,KAAKN,KAAOE,EAAMF,KAClBM,KAAKE,QAAUN,EAAMM,QAEjBN,EAAMK,UAASD,KAAKC,QAAUL,EAAMK,SACpCL,EAAMO,SAAQH,KAAKG,OAASP,EAAMO,OAC1C"}
1
+ {"version":3,"file":"AnalyticsLogEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsLogEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport type { PaymentAction } from '../../../types/global-types';\n\ntype AnalyticsLogEventProps = {\n type: LogEventType;\n subType?: LogEventSubtype;\n component: string;\n message: string;\n result?: string;\n};\n\nexport enum LogEventType {\n action = 'action',\n submit = 'submit',\n redirect = 'redirect',\n threeDS2 = 'threeDS2',\n closed = 'closed',\n apiRequest = 'apiRequest',\n review = 'review'\n}\n\nexport enum LogEventSubtype {\n challengeIframeLoaded = 'challengeIframeLoaded',\n challengeDataSentWeb = 'challengeDataSentWeb',\n challengeCompleted = 'challengeCompleted',\n fingerprintDataSentWeb = 'fingerprintDataSentWeb',\n fingerprintCompleted = 'fingerprintCompleted',\n fingerprintIframeLoaded = 'fingerprintIframeLoaded',\n threeDS2 = 'threeDS2',\n redirect = 'redirect',\n voucher = 'voucher',\n await = 'awat',\n qrCode = 'qrCode',\n bankTransfer = 'bankTransfer',\n sdk = 'sdk',\n donation = 'donation',\n donationCampaigns = 'donationCampaigns',\n review = 'review'\n}\n\nexport class AnalyticsLogEvent extends AbstractAnalyticsEvent {\n private readonly type: LogEventType;\n private readonly subType: LogEventSubtype;\n\n private readonly message?: string;\n private readonly result?: string;\n\n constructor(props: AnalyticsLogEventProps) {\n super(props.component);\n\n this.type = props.type;\n this.message = props.message;\n\n if (props.subType) this.subType = props.subType;\n if (props.result) this.result = props.result;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.log;\n }\n\n public static getSubtypeFromActionType(type: PaymentAction['type']): LogEventSubtype {\n return LogEventSubtype[type];\n }\n}\n"],"names":["LogEventType","LogEventSubtype","AnalyticsLogEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","log","getSubtypeFromActionType","type","constructor","props","super","component","_define_property","this","subType","message","result"],"mappings":"yNAWO,IAAAA,EAAKA,SAAAA,GAAAA,qJAAAA,CAQX,CARWA,CAQX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,8fAAAA,CAiBX,CAjBWA,CAiBX,CAAA,GAEM,MAAMC,UAA0BC,EAiB5BC,gBAAAA,GACH,OAAOC,EAAuBC,GAClC,CAEA,+BAAcC,CAAyBC,GACnC,OAAOP,EAAgBO,EAC3B,CAhBA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WAPhBC,EAAAC,KAAiBN,YAAjB,GACAK,EAAAC,KAAiBC,kBAEjBF,EAAAC,KAAiBE,kBACjBH,EAAAC,KAAiBG,iBAKbH,KAAKN,KAAOE,EAAMF,KAClBM,KAAKE,QAAUN,EAAMM,QAEjBN,EAAMK,UAASD,KAAKC,QAAUL,EAAMK,SACpCL,EAAMO,SAAQH,KAAKG,OAASP,EAAMO,OAC1C"}