@adyen/adyen-web 6.33.0 → 6.34.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 (346) hide show
  1. package/dist/cjs/adyen.css +5 -4
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +172 -96
  6. package/dist/es/adyen.css +5 -4
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Ach/Ach.js.map +1 -1
  9. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  10. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  11. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  12. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  13. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  14. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  15. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  16. package/dist/es/components/AmazonPay/components/ChangePaymentDetailsButton.js +1 -1
  17. package/dist/es/components/AmazonPay/components/ChangePaymentDetailsButton.js.map +1 -1
  18. package/dist/es/components/AmazonPay/components/SignOutButton.js +1 -1
  19. package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
  20. package/dist/es/components/AmazonPay/defaultProps.js +1 -1
  21. package/dist/es/components/AmazonPay/defaultProps.js.map +1 -1
  22. package/dist/es/components/AmazonPay/services.js.map +1 -1
  23. package/dist/es/components/Boleto/Boleto.js +1 -1
  24. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  25. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  26. package/dist/es/components/Card/Card.js +1 -1
  27. package/dist/es/components/Card/Card.js.map +1 -1
  28. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  29. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  30. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  31. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  32. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  33. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  34. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  35. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  36. package/dist/es/components/Card/components/CardInput/defaultProps.js +1 -1
  37. package/dist/es/components/Card/components/CardInput/defaultProps.js.map +1 -1
  38. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  39. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  40. package/dist/es/components/Card/components/CardInput/validate.js +1 -1
  41. package/dist/es/components/Card/components/CardInput/validate.js.map +1 -1
  42. package/dist/es/components/Card/components/Fastlane/FastlaneSignup.js.map +1 -1
  43. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  44. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  45. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  46. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  47. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  48. package/dist/es/components/Doku/Doku.js +1 -1
  49. package/dist/es/components/Doku/Doku.js.map +1 -1
  50. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  51. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  52. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  53. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  54. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js +2 -0
  55. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js.map +1 -0
  56. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  57. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  58. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  59. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  60. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  61. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  62. package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  63. package/dist/es/components/Iris/Iris.js +1 -1
  64. package/dist/es/components/Iris/Iris.js.map +1 -1
  65. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  66. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  67. package/dist/es/components/Multibanco/components/MultibancoVoucherResult/MultibancoVoucherResult.js.map +1 -1
  68. package/dist/es/components/Oxxo/Oxxo.js +1 -1
  69. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  70. package/dist/es/components/Oxxo/components/OxxoVoucherResult/OxxoVoucherResult.js.map +1 -1
  71. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  72. package/dist/es/components/PayPal/Paypal.js +1 -1
  73. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  74. package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
  75. package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
  76. package/dist/es/components/PayPal/components/PaypalComponent.js +1 -1
  77. package/dist/es/components/PayPal/components/PaypalComponent.js.map +1 -1
  78. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  79. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  80. package/dist/es/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  81. package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
  82. package/dist/es/components/Pix/Pix.js +1 -1
  83. package/dist/es/components/Pix/Pix.js.map +1 -1
  84. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  85. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  86. package/dist/es/components/UPI/UPI.js +1 -1
  87. package/dist/es/components/UPI/UPI.js.map +1 -1
  88. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  89. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  90. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  91. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  92. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  93. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  94. package/dist/es/components/UPI/constants.js +1 -1
  95. package/dist/es/components/UPI/constants.js.map +1 -1
  96. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  97. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  98. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  99. package/dist/es/components/internal/BrandIcons/BrandIcons.js +2 -0
  100. package/dist/es/components/internal/BrandIcons/BrandIcons.js.map +1 -0
  101. package/dist/es/components/internal/BrandIcons/BrandIcons.module.scss.js +2 -0
  102. package/dist/es/components/internal/BrandIcons/BrandIcons.module.scss.js.map +1 -0
  103. package/dist/es/components/internal/{Brand/Brand.js → BrandImage/BrandImage.js} +2 -2
  104. package/dist/es/components/internal/BrandImage/BrandImage.js.map +1 -0
  105. package/dist/es/components/internal/Button/Button.js +1 -1
  106. package/dist/es/components/internal/Button/Button.js.map +1 -1
  107. package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
  108. package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  109. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  110. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  111. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  112. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  113. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  114. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  115. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  116. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  117. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  118. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  119. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  120. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  121. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  122. package/dist/es/components/internal/Tooltip/Tooltip.js.map +1 -1
  123. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  124. package/dist/es/core/Analytics/Analytics.js +1 -1
  125. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  126. package/dist/es/core/Analytics/AnalyticsEventQueue.js +1 -1
  127. package/dist/es/core/Analytics/AnalyticsEventQueue.js.map +1 -1
  128. package/dist/es/core/config.js +1 -1
  129. package/dist/es/core/config.js.map +1 -1
  130. package/dist/es/core/core.js +1 -1
  131. package/dist/es/core/core.js.map +1 -1
  132. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  133. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  134. package/dist/es/external/preact/dist/preact.js +1 -1
  135. package/dist/es/external/preact/dist/preact.js.map +1 -1
  136. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  137. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  138. package/dist/es/index.d.ts +172 -96
  139. package/dist/es/language/Language.js +1 -1
  140. package/dist/es/language/Language.js.map +1 -1
  141. package/dist/es/language/LanguageService.js +2 -0
  142. package/dist/es/language/LanguageService.js.map +1 -0
  143. package/dist/es/language/constants.js +1 -1
  144. package/dist/es/language/constants.js.map +1 -1
  145. package/dist/es/language/utils.js +1 -1
  146. package/dist/es/language/utils.js.map +1 -1
  147. package/dist/es/packages/server/translations/en-US.json.js +2 -0
  148. package/dist/es/packages/server/translations/en-US.json.js.map +1 -0
  149. package/dist/es-legacy/adyen.css +5 -4
  150. package/dist/es-legacy/adyen.css.map +1 -1
  151. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  152. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  153. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  154. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  155. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  156. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  157. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  158. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  159. package/dist/es-legacy/components/AmazonPay/components/ChangePaymentDetailsButton.js +1 -1
  160. package/dist/es-legacy/components/AmazonPay/components/ChangePaymentDetailsButton.js.map +1 -1
  161. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js +1 -1
  162. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
  163. package/dist/es-legacy/components/AmazonPay/defaultProps.js +1 -1
  164. package/dist/es-legacy/components/AmazonPay/defaultProps.js.map +1 -1
  165. package/dist/es-legacy/components/AmazonPay/services.js.map +1 -1
  166. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
  167. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  168. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
  169. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
  170. package/dist/es-legacy/components/Boleto/Boleto.js +1 -1
  171. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  172. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  173. package/dist/es-legacy/components/Card/Card.js +1 -1
  174. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  175. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  176. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  177. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  178. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  179. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  180. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  181. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  182. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  183. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js +1 -1
  184. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js.map +1 -1
  185. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  186. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  187. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  188. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  189. package/dist/es-legacy/components/Card/components/CardInput/validate.js +1 -1
  190. package/dist/es-legacy/components/Card/components/CardInput/validate.js.map +1 -1
  191. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  192. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  193. package/dist/es-legacy/components/Card/components/Fastlane/FastlaneSignup.js.map +1 -1
  194. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  195. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  196. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  197. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  198. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  199. package/dist/es-legacy/components/Doku/Doku.js +1 -1
  200. package/dist/es-legacy/components/Doku/Doku.js.map +1 -1
  201. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  202. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  203. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  204. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  205. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js +2 -0
  206. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js.map +1 -0
  207. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  208. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  209. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  210. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  211. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  212. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  213. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  214. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  215. package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  216. package/dist/es-legacy/components/GooglePay/requests.js +1 -1
  217. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  218. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  219. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  220. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  221. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  222. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
  223. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  224. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  225. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  226. package/dist/es-legacy/components/Multibanco/components/MultibancoVoucherResult/MultibancoVoucherResult.js.map +1 -1
  227. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  228. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  229. package/dist/es-legacy/components/Oxxo/components/OxxoVoucherResult/OxxoVoucherResult.js.map +1 -1
  230. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  231. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  232. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  233. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  234. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  235. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  236. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  237. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  238. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  239. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  240. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  241. package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  242. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
  243. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  244. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  245. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  246. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  247. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  248. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  249. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  250. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  251. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  252. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  253. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  254. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  255. package/dist/es-legacy/components/UPI/constants.js +1 -1
  256. package/dist/es-legacy/components/UPI/constants.js.map +1 -1
  257. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  258. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  259. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  260. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js +2 -0
  261. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js.map +1 -0
  262. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.module.scss.js +2 -0
  263. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.module.scss.js.map +1 -0
  264. package/dist/es-legacy/components/internal/{Brand/Brand.js → BrandImage/BrandImage.js} +2 -2
  265. package/dist/es-legacy/components/internal/BrandImage/BrandImage.js.map +1 -0
  266. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  267. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  268. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
  269. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  270. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  271. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  272. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
  273. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
  274. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  275. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  276. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  277. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  278. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
  279. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  280. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  281. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  282. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  283. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  284. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  285. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  286. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  287. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  288. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  289. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  290. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  291. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  292. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
  293. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  294. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  295. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  296. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  297. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  298. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  299. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  300. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  301. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  302. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  303. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  304. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  305. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  306. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  307. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  308. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  309. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
  310. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
  311. package/dist/es-legacy/components/internal/Tooltip/Tooltip.js.map +1 -1
  312. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  313. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  314. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  315. package/dist/es-legacy/core/Analytics/AnalyticsEventQueue.js +1 -1
  316. package/dist/es-legacy/core/Analytics/AnalyticsEventQueue.js.map +1 -1
  317. package/dist/es-legacy/core/Context/Resources.js +1 -1
  318. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  319. package/dist/es-legacy/core/config.js +1 -1
  320. package/dist/es-legacy/core/config.js.map +1 -1
  321. package/dist/es-legacy/core/core.js +1 -1
  322. package/dist/es-legacy/core/core.js.map +1 -1
  323. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  324. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  325. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  326. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  327. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  328. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  329. package/dist/es-legacy/language/Language.js +1 -1
  330. package/dist/es-legacy/language/Language.js.map +1 -1
  331. package/dist/es-legacy/language/LanguageService.js +2 -0
  332. package/dist/es-legacy/language/LanguageService.js.map +1 -0
  333. package/dist/es-legacy/language/constants.js +1 -1
  334. package/dist/es-legacy/language/constants.js.map +1 -1
  335. package/dist/es-legacy/language/utils.js +1 -1
  336. package/dist/es-legacy/language/utils.js.map +1 -1
  337. package/dist/es-legacy/packages/server/translations/en-US.json.js +2 -0
  338. package/dist/es-legacy/packages/server/translations/en-US.json.js.map +1 -0
  339. package/package.json +8 -7
  340. package/styles/adyen.css +5 -4
  341. package/dist/es/components/internal/Brand/Brand.js.map +0 -1
  342. package/dist/es/core/Services/get-translations.js +0 -2
  343. package/dist/es/core/Services/get-translations.js.map +0 -1
  344. package/dist/es-legacy/components/internal/Brand/Brand.js.map +0 -1
  345. package/dist/es-legacy/core/Services/get-translations.js +0 -2
  346. package/dist/es-legacy/core/Services/get-translations.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({\n getError,\n showNumber,\n showPrefix,\n form,\n canSelectPrefix = true,\n ...props\n}: Readonly<PhoneInputFieldProps>) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","_0","getError","showNumber","showPrefix","form","canSelectPrefix","props","data","i18n","useCoreContext","handleChangeFor","valid","useEffect","phoneNumber","phonePrefix","h","Fragment","Field","className","label","get","errorMessage","showValidIcon","isValid","dir","name","Select","readonly","items","onChange","placeholder","placeholders","selectedValue","phoneNumberKey","filled","length","InputText","type","value","onInput","onBlur","autoCorrect","required"],"mappings":"29BA6Be,SAASA,EAAiBC,OAAAC,SACrCA,EAAQC,WACRA,EAAUC,WACVA,EAAUC,KACVA,EAAIC,gBACJA,GAAkB,GAEWL,EAD1BM,EAAAA,EAAAA,EAAAA,iEAgC8BA,IAAAA,EAYTC,EAYSD,EAtDjC,MAAME,KAAEA,GAASC,KAEXC,gBAAEA,EAAeH,KAAEA,EAAII,MAAEA,GAAUP,EASzC,OANAQ,EAAU,KACFL,EAAKM,aACLH,EAAgB,cAAe,OAA/BA,CAAuCH,EAAKM,cAEjD,CAACN,EAAKO,cAGLC,EAACC,EAAAA,KACIb,GACGY,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOX,EAAKY,IAAI,mBAChBC,aAAcpB,EAAS,eACvBqB,eAAe,EACfC,QAASZ,EAAMG,YACfU,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACW,EAAAA,CACGC,UAAWtB,EACXa,UAAW,wEACXO,KAAM,cACNG,MAAOtB,EAAMsB,MACbC,SAAUnB,EAAgB,eAC1BoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBQ,YAClCkB,cAAezB,EAAKO,eAK/BZ,GACGa,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOb,EAAM2B,eAAiBzB,EAAKY,IAAId,EAAM2B,gBAAkBzB,EAAKY,IAAI,mBACxEC,aAAcpB,EAAS,eACvBsB,QAASZ,EAAME,YACfqB,QAAQ3B,SAAiB,QAAjBA,EAAAA,EAAMM,mBAANN,IAAAA,OAAAA,EAAAA,EAAmB4B,QAAS,EACpCX,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACqB,EAAAA,CACGlB,UAAU,gFACVmB,KAAK,MACLZ,KAAK,cACLa,MAAO/B,EAAKM,YACZ0B,QAAS7B,EAAgB,cAAe,SACxC8B,OAAQ9B,EAAgB,cAAe,QACvCoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBO,YAClC4B,YAAY,MACZC,UAAU,KAMlC"}
1
+ {"version":3,"file":"PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({\n getError,\n showNumber,\n showPrefix,\n form,\n canSelectPrefix = true,\n ...props\n}: Readonly<PhoneInputFieldProps>) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","_0","getError","showNumber","showPrefix","form","canSelectPrefix","props","data","i18n","useCoreContext","handleChangeFor","valid","useEffect","phoneNumber","phonePrefix","h","Fragment","Field","className","label","get","errorMessage","showValidIcon","isValid","dir","name","Select","readonly","items","onChange","placeholder","placeholders","selectedValue","phoneNumberKey","filled","length","InputText","type","value","onInput","onBlur","autoCorrect","required"],"mappings":"m+BA6Be,SAASA,EAAiBC,OAAAC,SACrCA,EAAQC,WACRA,EAAUC,WACVA,EAAUC,KACVA,EAAIC,gBACJA,GAAkB,GAEWL,EAD1BM,EAAAA,EAAAA,EAAAA,iEAgC8BA,IAAAA,EAYTC,EAYSD,EAtDjC,MAAME,KAAEA,GAASC,KAEXC,gBAAEA,EAAeH,KAAEA,EAAII,MAAEA,GAAUP,EASzC,OANAQ,EAAU,KACFL,EAAKM,aACLH,EAAgB,cAAe,OAA/BA,CAAuCH,EAAKM,cAEjD,CAACN,EAAKO,cAGLC,EAACC,EAAAA,KACIb,GACGY,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOX,EAAKY,IAAI,mBAChBC,aAAcpB,EAAS,eACvBqB,eAAe,EACfC,QAASZ,EAAMG,YACfU,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACW,EAAAA,CACGC,UAAWtB,EACXa,UAAW,wEACXO,KAAM,cACNG,MAAOtB,EAAMsB,MACbC,SAAUnB,EAAgB,eAC1BoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBQ,YAClCkB,cAAezB,EAAKO,eAK/BZ,GACGa,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOb,EAAM2B,eAAiBzB,EAAKY,IAAId,EAAM2B,gBAAkBzB,EAAKY,IAAI,mBACxEC,aAAcpB,EAAS,eACvBsB,QAASZ,EAAME,YACfqB,QAAQ3B,SAAiB,QAAjBA,EAAAA,EAAMM,mBAANN,IAAAA,OAAAA,EAAAA,EAAmB4B,QAAS,EACpCX,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACqB,EAAAA,CACGlB,UAAU,gFACVmB,KAAK,MACLZ,KAAK,cACLa,MAAO/B,EAAKM,YACZ0B,QAAS7B,EAAgB,cAAe,SACxC8B,OAAQ9B,EAAgB,cAAe,QACvCoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBO,YAClC4B,YAAY,MACZC,UAAU,KAMlC"}
@@ -1,2 +1,2 @@
1
- import{createContext as e,createElement as t}from"../../../external/preact/dist/preact.js";import{useContext as r}from"../../../external/preact/hooks/dist/hooks.js";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}function l(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}const c=e(void 0),i=e=>{let{children:r}=e,n=l(e,["children"]);return t(c.Provider,{value:o({},n)},r)},a=()=>{const e=r(c);if(void 0===e)throw new Error('"useQRLoaderDetails" must be used within a QRLoaderDetailsContext');return e};export{i as QRLoaderDetailsProvider,a as useQRLoaderDetails};
1
+ import{createContext as e,createElement as t}from"../../../external/preact/dist/preact.js";import{useContext as r}from"../../../external/preact/hooks/dist/hooks.js";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}function l(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}const c=e(void 0),i=e=>{let{children:r}=e,n=l(e,["children"]);return t(c.Provider,{value:o({},n)},r)},a=()=>{const e=r(c);if(void 0===e)throw new Error('"useQRLoaderDetails" must be used within a QRLoaderDetailsContext');return e};export{i as QRLoaderDetailsProvider,a as useQRLoaderDetails};
2
2
  //# sourceMappingURL=QRLoaderDetailsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n type: string;\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: Readonly<QRLoaderDetailsProviderProps>) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","_0","children","props","h","Provider","value","_object_spread","useQRLoaderDetails","context","useContext","Error"],"mappings":"ktCAuBA,MAAMA,EAAyBC,OAAuDC,GAEhFC,EAA0BC,QAACC,SAAEA,GAA4DD,EAA/CE,EAAAA,EAAAA,EAAAA,cAC5C,OAAOC,EAACP,EAAuBQ,SAAQ,CAACC,MAAOC,EAAA,CAAA,EAAKJ,IAAUD,IAG5DM,EAAqB,KACvB,MAAMC,EAAUC,EAAWb,GAE3B,QAAgBE,IAAZU,EACA,MAAM,IAAIE,MAAM,qEAGpB,OAAOF"}
1
+ {"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n type: string;\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: Readonly<QRLoaderDetailsProviderProps>) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","_0","children","props","h","Provider","value","_object_spread","useQRLoaderDetails","context","useContext","Error"],"mappings":"0tCAuBA,MAAMA,EAAyBC,OAAuDC,GAEhFC,EAA0BC,QAACC,SAAEA,GAA4DD,EAA/CE,EAAAA,EAAAA,EAAAA,cAC5C,OAAOC,EAACP,EAAuBQ,SAAQ,CAACC,MAAOC,EAAA,CAAA,EAAKJ,IAAUD,IAG5DM,EAAqB,KACvB,MAAMC,EAAUC,EAAWb,GAE3B,QAAgBE,IAAZU,EACA,MAAM,IAAIE,MAAM,qEAGpB,OAAOF"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{useState as n}from"../../../external/preact/hooks/dist/hooks.js";import{useAmount as o}from"../../../core/Context/AmountProvider.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,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 r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function a(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function i(i){let{label:u=null,icon:s=null,payButton:p,onSubmit:f,name:b,showPayButton:y}=i,O=a(i,["label","icon","payButton","onSubmit","name","showPayButton"]);const{i18n:m}=r(),[j,g]=n("ready"),{amount:P}=o();this.setStatus=e=>{g(e)};if(y)return e(t,null,p(c(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({},O),{status:j,icon:s,classNameModifiers:["standalone"],label:u||(P&&{}.hasOwnProperty.call(P,"value")&&0===P.value?`${m.get("preauthorizeWith")} ${b}`:`${m.get("continueTo")} ${b}`),onClick:f})))}export{i as default};
1
+ import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{useState as n}from"../../../external/preact/hooks/dist/hooks.js";import{useAmount as o}from"../../../core/Context/AmountProvider.js";function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(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 r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function a(e,t){if(null==e)return{};var r,n,o,c={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n]);return c}if(c=function(e,t){if(null==e)return{};var r,n,o={},c=Object.getOwnPropertyNames(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n]);return c}function i(i){let{label:u=null,icon:s=null,payButton:p,onSubmit:f,name:b,showPayButton:y}=i,O=a(i,["label","icon","payButton","onSubmit","name","showPayButton"]);const{i18n:m}=r(),[j,g]=n("ready"),{amount:P}=o();this.setStatus=e=>{g(e)};if(y)return e(t,null,p(l(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){c(e,t,r[t])})}return e}({},O),{status:j,icon:s,classNameModifiers:["standalone"],label:u||(P&&{}.hasOwnProperty.call(P,"value")&&0===P.value?`${m.get("preauthorizeWith")} ${b}`:`${m.get("continueTo")} ${b}`),onClick:f})))}export{i as default};
2
2
  //# sourceMappingURL=RedirectButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n name: string;\n showPayButton: boolean;\n ref?: any;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, name, showPayButton, ...props }: Readonly<RedirectButtonProps>) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { amount } = useAmount();\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","_0","label","icon","payButton","onSubmit","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","amount","useAmount","this","newStatus","h","Fragment","_object_spread_props","_object_spread","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"+3CAiBA,SAASA,EAAeC,GAAA,IAAAC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,KAAEA,EAAIC,cAAEA,GAAwDN,EAAtCO,EAAAA,EAAAA,EAAAA,gEAC9F,MAAMC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,OAAEA,GAAWC,IAEnBC,KAAKJ,UAAYK,IACbL,EAAUK,IASd,GAAKV,EAIL,OACIW,EAACC,EAAAA,KACIf,EAAUgB,oUAAAC,CAAA,GACJb,GAAAA,CACHG,SACAR,OACAmB,mBAAoB,CAAC,cACrBpB,MAAOA,IAhBIY,GAAU,CAAC,EAAES,eAAeC,KAAKV,EAAQ,UAA6B,IAAjBA,EAAOW,MACxD,GAAGhB,EAAKiB,IAAI,uBAAuBpB,IACnD,GAAGG,EAAKiB,IAAI,iBAAiBpB,KAe5BqB,QAAStB,KAIzB"}
1
+ {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment, Ref } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n name: string;\n showPayButton: boolean;\n ref?: Ref<typeof RedirectButton>;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, name, showPayButton, ...props }: Readonly<RedirectButtonProps>) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { amount } = useAmount();\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","_0","label","icon","payButton","onSubmit","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","amount","useAmount","this","newStatus","h","Fragment","_object_spread_props","_object_spread","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"u4CAiBA,SAASA,EAAeC,GAAA,IAAAC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,KAAEA,EAAIC,cAAEA,GAAwDN,EAAtCO,EAAAA,EAAAA,EAAAA,gEAC9F,MAAMC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,OAAEA,GAAWC,IAEnBC,KAAKJ,UAAYK,IACbL,EAAUK,IASd,GAAKV,EAIL,OACIW,EAACC,EAAAA,KACIf,EAAUgB,oUAAAC,CAAA,GACJb,GAAAA,CACHG,SACAR,OACAmB,mBAAoB,CAAC,cACrBpB,MAAOA,IAhBIY,GAAU,CAAC,EAAES,eAAeC,KAAKV,EAAQ,UAA6B,IAAjBA,EAAOW,MACxD,GAAGhB,EAAKiB,IAAI,uBAAuBpB,IACnD,GAAGG,EAAKiB,IAAI,iBAAiBpB,KAe5BqB,QAAStB,KAIzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { TxVariants } from '../../../tx-variants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static readonly defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy();\n this.initializeCSF(this.rootNode);\n } else {\n if (this.props.componentType === TxVariants.customCard) {\n console.debug(\n 'You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a \"data-cse\" attribute e.g. <div data-cse=\"encryptedCardNumber\"></div>'\n );\n }\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n componentType: this.props.componentType,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n onSubmitAnalytics: this.props.onSubmitAnalytics,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: null },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: string): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public getRootNode(): HTMLElement {\n return this.rootNode;\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: null },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","componentType","TxVariants","customCard","console","debug","handleOnNoDataRequired","componentDidUpdate","_this_props_onStateUpdate","_this_props","checkForKCPFields","onStateUpdate","call","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","_this_props_placeholders","loadingContext","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","onSubmitAnalytics","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","_object_spread_props","_object_spread","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","getRootNode","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","mustResetDedicatedBrand","brand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","handlers","bind","defaultProps"],"mappings":"4/CA+BA,MAAMA,UAA8BC,EAyEzBC,iBAAAA,GAECC,KAAKC,MAAMC,UACXF,KAAKG,YAAYH,KAAKC,MAAMC,UAIhC,MAAME,EAASC,EAAUL,KAAKE,UACxBI,EAAQF,EAAOG,OAAOC,EAAoB,CAAA,GAEhDR,KAAKS,SAAS,CAAEH,UAGhBF,EAAOM,QAAQC,IACXX,KAAKY,gBAAgBD,GAAS,IAIlCX,KAAKa,cAAgBT,EAAOU,OAAOC,GAAKA,EAAEC,MAAM,WAAWC,OAEvDb,EAAOa,QACPjB,KAAKkB,UACLlB,KAAKmB,cAAcnB,KAAKE,YAEpBF,KAAKC,MAAMmB,gBAAkBC,EAAWC,YACxCC,QAAQC,MACJ,yOAGRxB,KAAKyB,yBAEb,CAEOC,kBAAAA,OAGHC,EAAAC,EAFA5B,KAAK6B,oBAEmB,QAAxBF,GAAAC,EAAA5B,KAAKC,OAAM6B,qBAAX,IAAAH,GAAAA,EAAAI,KAAAH,EAA2B5B,KAAKgC,MACpC,CAEOC,oBAAAA,GACHjC,KAAKkC,IAAM,KACXC,aAAanC,KAAKoC,oBAClBD,aAAanC,KAAKqC,qBACtB,CAEQlB,aAAAA,CAAcmB,GA+CA,IAAAC,EA9ClB,IAAIC,EAAiBxC,KAAKC,MAAMuC,eAOhC,MAAMC,EAA8B,CAChCvC,SAAUoC,EACVI,KAAM1C,KAAKC,MAAMyC,KACjBtB,cAAepB,KAAKC,MAAMmB,cAC1BuB,UAAW3C,KAAKC,MAAM0C,UACtBC,eAAgB5C,KAAKC,MAAM4C,OAC3BC,UAAW9C,KAAKC,MAAM6C,UACtBC,sBAAuB/C,KAAKC,MAAM8C,sBAClCP,iBACAQ,UAAWhD,KAAKC,MAAM+C,UACtBC,a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AAKkI,eAAiBlI,KAAKkI,eAAesC,KAAKxK,MAC/CA,KAAKkB,QAAUlB,KAAKkB,QAAQsJ,KAAKxK,KACrC,EAEA+J,EAvEElK,EAuEqB4K,eAAeA"}
1
+ {"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj,\n SFFieldType\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { TxVariants } from '../../../tx-variants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static readonly defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy();\n this.initializeCSF(this.rootNode);\n } else {\n if (this.props.componentType === TxVariants.customCard) {\n console.debug(\n 'You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a \"data-cse\" attribute e.g. <div data-cse=\"encryptedCardNumber\"></div>'\n );\n }\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n componentType: this.props.componentType,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n onSubmitAnalytics: this.props.onSubmitAnalytics,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: null },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: SFFieldType): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType as SFFieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public getRootNode(): HTMLElement {\n return this.rootNode;\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: null },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","componentType","TxVariants","customCard","console","debug","handleOnNoDataRequired","componentDidUpdate","_this_props_onStateUpdate","_this_props","checkForKCPFields","onStateUpdate","call","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","_this_props_placeholders","loadingContext","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","onSubmitAnalytics","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","_object_spread_props","_object_spread","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","getRootNode","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","mustResetDedicatedBrand","brand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIR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AeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractCSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/AbstractCSF.ts"],"sourcesContent":["import { CSFSetupObject, CSFConfigObject, CSFCallbacksConfig, CSFStateObject } from './types';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject, CVCPolicyType, DatePolicyType, SFFieldType } from '../types';\nimport { createSecuredFields } from './extensions/createSecuredFields';\nimport processBrand from './partials/processBrand';\nimport handleBrandFromBinLookup from './extensions/handleBrandFromBinLookup';\n\nabstract class AbstractCSF {\n // Set in CSF\n protected callbacks: CSFCallbacksConfig;\n protected config: CSFConfigObject;\n protected props: CSFSetupObject;\n protected state: CSFStateObject;\n protected validateForm: () => void;\n protected handleBrandFromBinLookup: typeof handleBrandFromBinLookup;\n protected callbacksHandler: (callbacksObj: object) => void;\n protected configHandler: (props: CSFSetupObject) => void;\n protected createCardSecuredFields: (securedFields: HTMLElement[], cvcPolicy: CVCPolicyType, expiryDatePolicy: DatePolicyType) => Promise<any>;\n protected createNonCardSecuredFields: (securedFields: HTMLElement[]) => Promise<any>;\n protected createSecuredFields: typeof createSecuredFields;\n protected destroySecuredFields: () => void;\n protected handleIOSTouchEvents: () => void;\n protected destroyTouchendListener: () => void;\n protected destroyTouchstartListener: () => void;\n protected handleBinValue: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleEncryption: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleFocus: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleIframeConfigFeedback: (pFeedbackObj) => boolean;\n protected handleValidation: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleSFShiftTab: (fieldType: string) => void;\n protected handleShiftTab: (fieldType: string) => void;\n protected isConfigured: () => void;\n protected postMessageToAllIframes: (pDataObj: object) => void;\n protected processAutoComplete: (pFeedbackObj: SFFeedbackObj) => void;\n protected processBrand: typeof processBrand;\n protected sendBrandToCardSF: (brandObj: SendBrandObject) => void;\n protected sendExpiryDatePolicyToSF: (dateObj: SendExpiryDateObject) => void;\n protected setFocusOnFrame: (pFieldType: SFFieldType, doLog?: boolean) => void;\n protected setupSecuredField: (pItem: HTMLElement) => void;\n protected touchendListener: (e: Event) => void;\n protected touchstartListener: () => void;\n protected hasGenuineTouchEvents: boolean;\n // Set in createSecuredFields\n protected encryptedAttrName: string;\n protected hasRedundantCVCField: boolean;\n protected isSingleBrandedCard: boolean;\n protected securityCode: string;\n // --\n protected constructor(setupObj: CSFSetupObject) {\n this.props = setupObj;\n this.state = {} as any as CSFStateObject;\n\n // Initialise storage objects\n this.config = {} as any as CSFConfigObject; // {} as ConfigObject fails in linting\n this.callbacks = {} as any as CSFCallbacksConfig;\n }\n}\nexport default AbstractCSF;\n"],"names":["AbstractCSF","constructor","setupObj","_define_property","this","callbacks","config","props","state","validateForm","handleBrandFromBinLookup","callbacksHandler","configHandler","createCardSecuredFields","createNonCardSecuredFields","createSecuredFields","destroySecuredFields","handleIOSTouchEvents","destroyTouchendListener","destroyTouchstartListener","handleBinValue","handleEncryption","handleFocus","handleIframeConfigFeedback","handleValidation","handleSFShiftTab","handleShiftTab","isConfigured","postMessageToAllIframes","processAutoComplete","processBrand","sendBrandToCardSF","sendExpiryDatePolicyToSF","setFocusOnFrame","setupSecuredField","touchendListener","touchstartListener","hasGenuineTouchEvents","encryptedAttrName","hasRedundantCVCField","isSingleBrandedCard","securityCode"],"mappings":"wHAMA,MAAeA,EAyCX,WAAAC,CAAsBC,GAvCtBC,EAAAC,KAAUC,oBACVF,EAAAC,KAAUE,iBACVH,EAAAC,KAAUG,gBACVJ,EAAAC,KAAUI,gBACVL,EAAAC,KAAUK,uBACVN,EAAAC,KAAUM,mCACVP,EAAAC,KAAUO,2BACVR,EAAAC,KAAUQ,wBACVT,EAAAC,KAAUS,kCACVV,EAAAC,KAAUU,qCACVX,EAAAC,KAAUW,8BACVZ,EAAAC,KAAUY,+BACVb,EAAAC,KAAUa,+BACVd,EAAAC,KAAUc,kCACVf,EAAAC,KAAUe,oCACVhB,EAAAC,KAAUgB,yBACVjB,EAAAC,KAAUiB,2BACVlB,EAAAC,KAAUkB,sBACVnB,EAAAC,KAAUmB,qCACVpB,EAAAC,KAAUoB,2BACVrB,EAAAC,KAAUqB,2BACVtB,EAAAC,KAAUsB,yBACVvB,EAAAC,KAAUuB,uBACVxB,EAAAC,KAAUwB,kCACVzB,EAAAC,KAAUyB,8BACV1B,EAAAC,KAAU0B,uBACV3B,EAAAC,KAAU2B,4BACV5B,EAAAC,KAAU4B,mCACV7B,EAAAC,KAAU6B,0BACV9B,EAAAC,KAAU8B,4BACV/B,EAAAC,KAAU+B,2BACVhC,EAAAC,KAAUgC,6BACVjC,EAAAC,KAAUiC,gCAEVlC,EAAAC,KAAUkC,4BACVnC,EAAAC,KAAUmC,+BACVpC,EAAAC,KAAUoC,8BACVrC,EAAAC,KAAUqC,uBAGNrC,KAAKG,MAAQL,EACbE,KAAKI,MAAQ,CAAA,EAGbJ,KAAKE,OAAS,GACdF,KAAKC,UAAY,CAAA,CACrB"}
1
+ {"version":3,"file":"AbstractCSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/AbstractCSF.ts"],"sourcesContent":["import { CSFSetupObject, CSFConfigObject, CSFCallbacksConfig, CSFStateObject } from './types';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject, CVCPolicyType, DatePolicyType, SFFieldType } from '../types';\nimport { createSecuredFields } from './extensions/createSecuredFields';\nimport processBrand from './partials/processBrand';\nimport handleBrandFromBinLookup from './extensions/handleBrandFromBinLookup';\n\nabstract class AbstractCSF {\n // Set in CSF\n protected callbacks: Partial<CSFCallbacksConfig>;\n protected config: Partial<CSFConfigObject>;\n protected props: CSFSetupObject;\n protected state: Partial<CSFStateObject>;\n protected validateForm: () => void;\n protected handleBrandFromBinLookup: typeof handleBrandFromBinLookup;\n protected callbacksHandler: (callbacksObj: object) => void;\n protected configHandler: (props: CSFSetupObject) => void;\n protected createCardSecuredFields: (securedFields: HTMLElement[], cvcPolicy: CVCPolicyType, expiryDatePolicy: DatePolicyType) => Promise<void>;\n protected createNonCardSecuredFields: (securedFields: HTMLElement[]) => Promise<void>;\n protected createSecuredFields: typeof createSecuredFields;\n protected destroySecuredFields: () => void;\n protected handleIOSTouchEvents: () => void;\n protected destroyTouchendListener: () => void;\n protected destroyTouchstartListener: () => void;\n protected handleBinValue: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleEncryption: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleFocus: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleIframeConfigFeedback: (pFeedbackObj) => boolean;\n protected handleValidation: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleSFShiftTab: (fieldType: string) => void;\n protected handleShiftTab: (fieldType: string) => void;\n protected isConfigured: () => void;\n protected postMessageToAllIframes: (pDataObj: object) => void;\n protected processAutoComplete: (pFeedbackObj: SFFeedbackObj) => void;\n protected processBrand: typeof processBrand;\n protected sendBrandToCardSF: (brandObj: SendBrandObject) => void;\n protected sendExpiryDatePolicyToSF: (dateObj: SendExpiryDateObject) => void;\n protected setFocusOnFrame: (pFieldType: SFFieldType, doLog?: boolean) => void;\n protected setupSecuredField: (pItem: HTMLElement) => void;\n protected touchendListener: (e: Event) => void;\n protected touchstartListener: () => void;\n protected hasGenuineTouchEvents: boolean;\n // Set in createSecuredFields\n protected encryptedAttrName: string;\n protected hasRedundantCVCField: boolean;\n protected isSingleBrandedCard: boolean;\n protected securityCode: string;\n // --\n protected constructor(setupObj: CSFSetupObject) {\n this.props = setupObj;\n this.state = {};\n\n // Initialise storage objects\n this.config = {};\n this.callbacks = {};\n }\n}\nexport default AbstractCSF;\n"],"names":["AbstractCSF","constructor","setupObj","_define_property","this","callbacks","config","props","state","validateForm","handleBrandFromBinLookup","callbacksHandler","configHandler","createCardSecuredFields","createNonCardSecuredFields","createSecuredFields","destroySecuredFields","handleIOSTouchEvents","destroyTouchendListener","destroyTouchstartListener","handleBinValue","handleEncryption","handleFocus","handleIframeConfigFeedback","handleValidation","handleSFShiftTab","handleShiftTab","isConfigured","postMessageToAllIframes","processAutoComplete","processBrand","sendBrandToCardSF","sendExpiryDatePolicyToSF","setFocusOnFrame","setupSecuredField","touchendListener","touchstartListener","hasGenuineTouchEvents","encryptedAttrName","hasRedundantCVCField","isSingleBrandedCard","securityCode"],"mappings":"wHAMA,MAAeA,EAyCX,WAAAC,CAAsBC,GAvCtBC,EAAAC,KAAUC,oBACVF,EAAAC,KAAUE,iBACVH,EAAAC,KAAUG,gBACVJ,EAAAC,KAAUI,gBACVL,EAAAC,KAAUK,uBACVN,EAAAC,KAAUM,mCACVP,EAAAC,KAAUO,2BACVR,EAAAC,KAAUQ,wBACVT,EAAAC,KAAUS,kCACVV,EAAAC,KAAUU,qCACVX,EAAAC,KAAUW,8BACVZ,EAAAC,KAAUY,+BACVb,EAAAC,KAAUa,+BACVd,EAAAC,KAAUc,kCACVf,EAAAC,KAAUe,oCACVhB,EAAAC,KAAUgB,yBACVjB,EAAAC,KAAUiB,2BACVlB,EAAAC,KAAUkB,sBACVnB,EAAAC,KAAUmB,qCACVpB,EAAAC,KAAUoB,2BACVrB,EAAAC,KAAUqB,2BACVtB,EAAAC,KAAUsB,yBACVvB,EAAAC,KAAUuB,uBACVxB,EAAAC,KAAUwB,kCACVzB,EAAAC,KAAUyB,8BACV1B,EAAAC,KAAU0B,uBACV3B,EAAAC,KAAU2B,4BACV5B,EAAAC,KAAU4B,mCACV7B,EAAAC,KAAU6B,0BACV9B,EAAAC,KAAU8B,4BACV/B,EAAAC,KAAU+B,2BACVhC,EAAAC,KAAUgC,6BACVjC,EAAAC,KAAUiC,gCAEVlC,EAAAC,KAAUkC,4BACVnC,EAAAC,KAAUmC,+BACVpC,EAAAC,KAAUoC,8BACVrC,EAAAC,KAAUqC,uBAGNrC,KAAKG,MAAQL,EACbE,KAAKI,MAAQ,CAAA,EAGbJ,KAAKE,OAAS,CAAA,EACdF,KAAKC,UAAY,CAAA,CACrB"}
@@ -1,2 +1,2 @@
1
- import e from"./AbstractCSF.js";import{handleConfig as s}from"./extensions/handleConfig.js";import{configureCallbacks as t}from"./extensions/configureCallbacks.js";import{handleValidation as i}from"./extensions/handleValidation.js";import{handleEncryption as r}from"./extensions/handleEncryption.js";import{createSecuredFields as o,createNonCardSecuredFields as a,createCardSecuredFields as n,setupSecuredField as d}from"./extensions/createSecuredFields.js";import h from"./extensions/handleIOSTouchEvents.js";import l from"./extensions/handleTab.js";import c,{sendBrandToCardSF as u,sendExpiryDatePolicyToSF as p}from"./extensions/handleBrandFromBinLookup.js";import{setFocusOnFrame as m}from"./partials/setFocusOnFrame.js";import{postMessageToAllIframes as f}from"./partials/postMessageToAllIframes.js";import F from"./partials/processBrand.js";import{processAutoComplete as y}from"./partials/processAutoComplete.js";import{handleFocus as C}from"./partials/handleFocus.js";import{handleIframeConfigFeedback as g}from"./partials/handleIframeConfigFeedback.js";import{isConfigured as S}from"./partials/isConfigured.js";import b from"./partials/validateForm.js";import{handleBinValue as j}from"./partials/handleBinValue.js";import{destroySecuredFields as T}from"./utils/destroySecuredFields.js";import I from"./utils/iframes/postMessageToIframe.js";import k from"./utils/iframes/getIframeContentWin.js";import{warn as O}from"../utilities/logger.js";import{selectOne as x}from"../utilities/dom.js";import{on as v}from"../../../../../utils/listenerUtils.js";import{partial as L}from"../utilities/commonUtils.js";import{hasOwnProperty as B}from"../../../../../utils/hasOwnProperty.js";import K from"./utils/userAgent.js";const P=(e="You cannot use secured fields")=>{O(`${e} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`)};class V extends e{init(){this.configHandler(this.props),this.callbacksHandler(this.props.callbacks);const e=this.createSecuredFields();this.state.numIframes=this.state.originalNumIframes=e,this.state.isKCP=!!this.props.isKCP,K.__IS_IOS&&this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents=!1,v(document,"touchstart",this.touchstartListener))}createReturnObject(){return{updateStyles:e=>{this.state.isConfigured?this.postMessageToAllIframes({styleObject:e}):O("You cannot update the secured fields styling - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.")},setFocusOnFrame:e=>{this.state.isConfigured?this.setFocusOnFrame(e):P("You cannot set focus on any secured field")},isValidated:(e,s)=>{if(this.state.isConfigured){if(B(this.state.securedFields,e)){this.state.securedFields[e].hasError=!0,""===this.state.securedFields[e].errorType&&(this.state.securedFields[e].errorType="isValidated");const t={txVariant:this.state.type,fieldType:e,externalValidation:!0,code:s,numKey:this.state.securedFields[e].numKey};I(t,k(this.state,e),this.config.loadingContext)}}else P("You cannot set validated on any secured field")},hasUnsupportedCard:(e,s)=>{if(this.state.isConfigured){if(B(this.state.securedFields,e)){this.state.securedFields[e].hasError=!!s,this.state.securedFields[e].errorType=s;const t={txVariant:this.state.type,fieldType:e,unsupportedCard:!!s,code:s,numKey:this.state.securedFields[e].numKey};I(t,k(this.state,e),this.config.loadingContext)}}else P("You cannot set hasUnsupportedCard on any secured field")},destroy:()=>{this.state.isConfigured?this.destroySecuredFields():P("You cannot destroy secured fields")},brandsFromBinLookup:(e,s)=>{if(!this.config.isCreditCardType)return null;this.state.isConfigured?this.handleBrandFromBinLookup(e,s):P("You cannot set pass brands to secured fields")},addSecuredField:e=>{const s=x(this.props.rootNode,`[data-cse="${e}"]`);s&&(this.state.numIframes+=1,this.setupSecuredField(s))},removeSecuredField:e=>{if(this.state.securedFields[e]){this.state.securedFields[e].destroy(),delete this.state.securedFields[e],this.state.numIframes-=1,this.state.iframeCount-=1;const s={additionalIframeRemoved:!0,fieldType:e,type:this.state.type};this.callbacks.onAdditionalSFRemoved(s)}},setKCPStatus:e=>{this.state.isKCP=e},sfIsOptionalOrHidden:e=>this.state.securedFields[e].isOptionalOrHidden()}}constructor(e){super(e),this.state={type:this.props.type,brand:"card"!==this.props.type?{brand:this.props.type,cvcPolicy:"required"}:{brand:null,cvcPolicy:"required"},allValid:void 0,numIframes:0,originalNumIframes:0,iframeCount:0,iframeConfigCount:0,isConfigured:!1,hasSeparateDateFields:!1,currentFocusObject:null,registerFieldForIos:!1,securedFields:{},isKCP:!1};const I={csfState:this.state,csfConfig:this.config,csfProps:this.props,csfCallbacks:this.callbacks};this.configHandler=s,this.callbacksHandler=t,this.validateForm=L(b,I),this.isConfigured=L(S,I,this.validateForm),this.handleIframeConfigFeedback=L(g,I,this.isConfigured),this.processBrand=L(F,I),this.handleValidation=i,this.handleEncryption=r,this.createSecuredFields=o,this.createNonCardSecuredFields=a,this.createCardSecuredFields=n,this.setupSecuredField=d,this.postMessageToAllIframes=L(f,I),this.handleIOSTouchEvents=h.handleTouchend.bind(this),this.touchendListener=h.touchendListener.bind(this),this.destroyTouchendListener=h.destroyTouchendListener.bind(this),this.touchstartListener=h.touchstartListener.bind(this),this.destroyTouchstartListener=h.destroyTouchstartListener.bind(this),this.setFocusOnFrame=L(m,I),this.handleFocus=L(C,I,this.handleIOSTouchEvents),this.handleSFShiftTab=l.handleSFShiftTab,this.handleShiftTab=l.handleShiftTab,this.destroySecuredFields=T,this.processAutoComplete=L(y,I),this.handleBinValue=L(j,I),this.handleBrandFromBinLookup=c,this.sendBrandToCardSF=u,this.sendExpiryDatePolicyToSF=p,this.init()}}export{V as default};
1
+ import s from"./AbstractCSF.js";import{handleConfig as e}from"./extensions/handleConfig.js";import{configureCallbacks as t}from"./extensions/configureCallbacks.js";import{handleValidation as i}from"./extensions/handleValidation.js";import{handleEncryption as r}from"./extensions/handleEncryption.js";import{createSecuredFields as o,createNonCardSecuredFields as a,createCardSecuredFields as n,setupSecuredField as d}from"./extensions/createSecuredFields.js";import h from"./extensions/handleIOSTouchEvents.js";import l from"./extensions/handleTab.js";import c,{sendBrandToCardSF as u,sendExpiryDatePolicyToSF as p}from"./extensions/handleBrandFromBinLookup.js";import{setFocusOnFrame as m}from"./partials/setFocusOnFrame.js";import{postMessageToAllIframes as f}from"./partials/postMessageToAllIframes.js";import F from"./partials/processBrand.js";import{processAutoComplete as y}from"./partials/processAutoComplete.js";import{handleFocus as b}from"./partials/handleFocus.js";import{handleIframeConfigFeedback as C}from"./partials/handleIframeConfigFeedback.js";import{isConfigured as g}from"./partials/isConfigured.js";import S from"./partials/validateForm.js";import{handleBinValue as j}from"./partials/handleBinValue.js";import{destroySecuredFields as T}from"./utils/destroySecuredFields.js";import I from"./utils/iframes/postMessageToIframe.js";import k from"./utils/iframes/getIframeContentWin.js";import{warn as O}from"../utilities/logger.js";import{selectOne as x}from"../utilities/dom.js";import{on as v}from"../../../../../utils/listenerUtils.js";import{partial as L}from"../utilities/commonUtils.js";import{hasOwnProperty as B}from"../../../../../utils/hasOwnProperty.js";import K from"./utils/userAgent.js";const P=(s="You cannot use secured fields")=>{O(`${s} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`)};class V extends s{init(){this.configHandler(this.props),this.callbacksHandler(this.props.callbacks);const s=this.createSecuredFields();this.state.numIframes=this.state.originalNumIframes=s,this.state.isKCP=!!this.props.isKCP,K.__IS_IOS&&this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents=!1,v(document,"touchstart",this.touchstartListener))}createReturnObject(){return{updateStyles:s=>{this.state.isConfigured?this.postMessageToAllIframes({styleObject:s}):O("You cannot update the secured fields styling - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.")},setFocusOnFrame:s=>{this.state.isConfigured?this.setFocusOnFrame(s):P("You cannot set focus on any secured field")},isValidated:(s,e)=>{if(this.state.isConfigured){if(B(this.state.securedFields,s)){this.state.securedFields[s].hasError=!0,""===this.state.securedFields[s].errorType&&(this.state.securedFields[s].errorType="isValidated");const t={txVariant:this.state.type,fieldType:s,externalValidation:!0,code:e,numKey:this.state.securedFields[s].numKey};I(t,k(this.state,s),this.config.loadingContext)}}else P("You cannot set validated on any secured field")},hasUnsupportedCard:(s,e)=>{if(this.state.isConfigured){if(B(this.state.securedFields,s)){this.state.securedFields[s].hasError=!!e,this.state.securedFields[s].errorType=e;const t={txVariant:this.state.type,fieldType:s,unsupportedCard:!!e,code:e,numKey:this.state.securedFields[s].numKey};I(t,k(this.state,s),this.config.loadingContext)}}else P("You cannot set hasUnsupportedCard on any secured field")},destroy:()=>{this.state.isConfigured?this.destroySecuredFields():P("You cannot destroy secured fields")},brandsFromBinLookup:(s,e)=>{if(!this.config.isCreditCardType)return null;this.state.isConfigured?this.handleBrandFromBinLookup(s,e):P("You cannot set pass brands to secured fields")},addSecuredField:s=>{const e=x(this.props.rootNode,`[data-cse="${s}"]`);e&&(this.state.numIframes+=1,this.setupSecuredField(e))},removeSecuredField:s=>{if(this.state.securedFields[s]){this.state.securedFields[s].destroy(),delete this.state.securedFields[s],this.state.numIframes-=1,this.state.iframeCount-=1;const e={additionalIframeRemoved:!0,fieldType:s,type:this.state.type};this.callbacks.onAdditionalSFRemoved(e)}},setKCPStatus:s=>{this.state.isKCP=s},sfIsOptionalOrHidden:s=>this.state.securedFields[s].isOptionalOrHidden()}}constructor(s){super(s),this.state={type:this.props.type,brand:"card"!==this.props.type?{brand:this.props.type,cvcPolicy:"required"}:{brand:null,cvcPolicy:"required"},allValid:void 0,numIframes:0,originalNumIframes:0,iframeCount:0,iframeConfigCount:0,isConfigured:!1,hasSeparateDateFields:!1,currentFocusObject:null,registerFieldForIos:!1,securedFields:{},isKCP:!1};const I={csfState:this.state,csfConfig:this.config,csfProps:this.props,csfCallbacks:this.callbacks};this.configHandler=e.bind(this),this.callbacksHandler=t.bind(this),this.validateForm=L(S,I),this.isConfigured=L(g,I,this.validateForm),this.handleIframeConfigFeedback=L(C,I,this.isConfigured),this.processBrand=L(F,I),this.handleValidation=i.bind(this),this.handleEncryption=r.bind(this),this.createSecuredFields=o.bind(this),this.createNonCardSecuredFields=a.bind(this),this.createCardSecuredFields=n.bind(this),this.setupSecuredField=d.bind(this),this.postMessageToAllIframes=L(f,I),this.handleIOSTouchEvents=h.handleTouchend.bind(this),this.touchendListener=h.touchendListener.bind(this),this.destroyTouchendListener=h.destroyTouchendListener.bind(this),this.touchstartListener=h.touchstartListener.bind(this),this.destroyTouchstartListener=h.destroyTouchstartListener.bind(this),this.setFocusOnFrame=L(m,I),this.handleFocus=L(b,I,this.handleIOSTouchEvents),this.handleSFShiftTab=l.handleSFShiftTab.bind(this),this.handleShiftTab=l.handleShiftTab.bind(this),this.destroySecuredFields=T.bind(this),this.processAutoComplete=L(y,I),this.handleBinValue=L(j,I),this.handleBrandFromBinLookup=c.bind(this),this.sendBrandToCardSF=u.bind(this),this.sendExpiryDatePolicyToSF=p.bind(this),this.init()}}export{V as default};
2
2
  //# sourceMappingURL=CSF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/CSF.ts"],"sourcesContent":["import AbstractCSF from './AbstractCSF';\nimport { CSFReturnObject, CSFSetupObject, CSFStateObject, CSFThisObject } from './types';\nimport { StylesObject, CardAdditionalSFData, SFFieldType } from '../types';\nimport { BinLookupResponse } from '../../../../Card/types';\nimport { handleConfig } from './extensions/handleConfig';\nimport { configureCallbacks } from './extensions/configureCallbacks';\nimport { handleValidation } from './extensions/handleValidation';\nimport { handleEncryption } from './extensions/handleEncryption';\nimport { createSecuredFields, createNonCardSecuredFields, createCardSecuredFields, setupSecuredField } from './extensions/createSecuredFields';\nimport handleIOSTouchEvents from './extensions/handleIOSTouchEvents';\nimport handleTab from './extensions/handleTab';\nimport handleBrandFromBinLookup, { sendBrandToCardSF, sendExpiryDatePolicyToSF } from './extensions/handleBrandFromBinLookup';\nimport { setFocusOnFrame } from './partials/setFocusOnFrame';\nimport { postMessageToAllIframes } from './partials/postMessageToAllIframes';\nimport processBrand from './partials/processBrand';\nimport { processAutoComplete } from './partials/processAutoComplete';\nimport { handleFocus } from './partials/handleFocus';\nimport { handleIframeConfigFeedback } from './partials/handleIframeConfigFeedback';\nimport { isConfigured } from './partials/isConfigured';\nimport validateForm from './partials/validateForm';\nimport { handleBinValue } from './partials/handleBinValue';\nimport { destroySecuredFields } from './utils/destroySecuredFields';\nimport postMessageToIframe from './utils/iframes/postMessageToIframe';\nimport getIframeContentWin from './utils/iframes/getIframeContentWin';\nimport * as logger from '../utilities/logger';\nimport { selectOne } from '../utilities/dom';\nimport { on } from '../../../../../utils/listenerUtils';\nimport { partial } from '../utilities/commonUtils';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport ua from './utils/userAgent';\nimport { SingleBrandResetObject } from '../../SFP/types';\n\nconst notConfiguredWarning = (str = 'You cannot use secured fields') => {\n logger.warn(`${str} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`);\n};\n\nclass CSF extends AbstractCSF {\n // --\n constructor(setupObj: CSFSetupObject) {\n /**\n * Initialises:\n * - this.props = setupObj: CSFSetupObject\n *\n * and empty objects for:\n * - this.config: CSFConfigObject (populated in handleConfig.ts)\n * - this.callbacks: CSFCallbacksConfig (populated in configureCallbacks.ts\n * - this.state: CSFStateObject (populated below)\n */\n super(setupObj);\n\n this.state = {\n /**\n * For generic card will always be 'card'.\n * For non-generic card will be hardcoded to a particular txVariant e.g. 'mc' or 'visa'\n * For other types of SecuredField will be the passed type e.g. 'ach' or 'giftcard'\n */\n type: this.props.type,\n /**\n * For generic card will change as shopper types\n * For non-generic card will be fixed\n */\n brand: this.props.type !== 'card' ? { brand: this.props.type, cvcPolicy: 'required' } : { brand: null, cvcPolicy: 'required' },\n allValid: undefined,\n numIframes: 0,\n originalNumIframes: 0,\n iframeCount: 0,\n iframeConfigCount: 0,\n isConfigured: false,\n hasSeparateDateFields: false,\n currentFocusObject: null,\n registerFieldForIos: false,\n securedFields: {},\n isKCP: false\n } as CSFStateObject;\n\n // Create object of references to properties on 'this', that can be used to set up the partials\n const thisObj: CSFThisObject = { csfState: this.state, csfConfig: this.config, csfProps: this.props, csfCallbacks: this.callbacks };\n\n // Setup 'this' references\n this.configHandler = handleConfig;\n\n this.callbacksHandler = configureCallbacks;\n\n this.validateForm = partial(validateForm, thisObj);\n\n this.isConfigured = partial(isConfigured, thisObj, this.validateForm);\n this.handleIframeConfigFeedback = partial(handleIframeConfigFeedback, thisObj, this.isConfigured);\n\n this.processBrand = partial(processBrand, thisObj);\n\n this.handleValidation = handleValidation;\n this.handleEncryption = handleEncryption;\n\n this.createSecuredFields = createSecuredFields;\n this.createNonCardSecuredFields = createNonCardSecuredFields;\n this.createCardSecuredFields = createCardSecuredFields;\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.setupSecuredField = setupSecuredField;\n\n this.postMessageToAllIframes = partial(postMessageToAllIframes, thisObj);\n\n this.handleIOSTouchEvents = handleIOSTouchEvents.handleTouchend.bind(this);\n this.touchendListener = handleIOSTouchEvents.touchendListener.bind(this);\n this.destroyTouchendListener = handleIOSTouchEvents.destroyTouchendListener.bind(this);\n this.touchstartListener = handleIOSTouchEvents.touchstartListener.bind(this);\n this.destroyTouchstartListener = handleIOSTouchEvents.destroyTouchstartListener.bind(this);\n\n this.setFocusOnFrame = partial(setFocusOnFrame, thisObj);\n this.handleFocus = partial(handleFocus, thisObj, this.handleIOSTouchEvents);\n\n this.handleSFShiftTab = handleTab.handleSFShiftTab;\n this.handleShiftTab = handleTab.handleShiftTab;\n\n this.destroySecuredFields = destroySecuredFields;\n\n this.processAutoComplete = partial(processAutoComplete, thisObj);\n\n this.handleBinValue = partial(handleBinValue, thisObj);\n\n this.handleBrandFromBinLookup = handleBrandFromBinLookup;\n this.sendBrandToCardSF = sendBrandToCardSF;\n this.sendExpiryDatePolicyToSF = sendExpiryDatePolicyToSF;\n\n // Populate config & callbacks objects & create securedFields\n this.init();\n }\n\n private init(): void {\n this.configHandler(this.props);\n this.callbacksHandler(this.props.callbacks);\n\n /**\n * Create all the securedFields\n */\n const numIframes: number = this.createSecuredFields();\n\n this.state.numIframes = this.state.originalNumIframes = numIframes;\n\n this.state.isKCP = !!this.props.isKCP;\n\n /**\n * Add touchstart listener\n * re. Disabling arrow keys in iOS\n */\n if (ua.__IS_IOS && this.props.shouldDisableIOSArrowKeys) {\n this.hasGenuineTouchEvents = false;\n on(document, 'touchstart', this.touchstartListener);\n }\n }\n\n // Expose functions that can be called on the CSF instance\n public createReturnObject(): CSFReturnObject {\n // --\n const returnObj: CSFReturnObject = {\n // --\n updateStyles: (pStyleObject: StylesObject): void => {\n if (this.state.isConfigured) {\n this.postMessageToAllIframes({ styleObject: pStyleObject });\n } else {\n logger.warn(\n 'You cannot update the secured fields styling ' +\n \"- they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.\"\n );\n }\n },\n setFocusOnFrame: (pFieldType: SFFieldType): void => {\n if (this.state.isConfigured) {\n this.setFocusOnFrame(pFieldType);\n // Comment in a quick way to test destroying secured fields (also see comment in destroySecuredFields)\n // this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot set focus on any secured field');\n }\n },\n // For component based implementation - if showValidation function is called on the component use this\n // function as a way to notify the CSF that a field is in error\n isValidated: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n this.state.securedFields[pFieldType].hasError = true;\n\n // If there's not already an errorType, set one\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the corresponding fix in the SecuredField class the maestro PM will never register as valid\n if (this.state.securedFields[pFieldType].errorType === '') {\n this.state.securedFields[pFieldType].errorType = 'isValidated';\n }\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n externalValidation: true,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set validated on any secured field');\n }\n },\n hasUnsupportedCard: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n //\n this.state.securedFields[pFieldType].hasError = !!code;\n this.state.securedFields[pFieldType].errorType = code;\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n unsupportedCard: !!code,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set hasUnsupportedCard on any secured field');\n }\n },\n destroy: (): void => {\n if (this.state.isConfigured) {\n this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot destroy secured fields');\n }\n },\n brandsFromBinLookup: (binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void => {\n if (!this.config.isCreditCardType) return null;\n\n if (this.state.isConfigured) {\n this.handleBrandFromBinLookup(binLookupResponse, resetObj);\n } else {\n notConfiguredWarning('You cannot set pass brands to secured fields');\n }\n },\n addSecuredField: (pFieldType: SFFieldType): void => {\n const securedField: HTMLElement = selectOne(this.props.rootNode, `[data-cse=\"${pFieldType}\"]`);\n if (securedField) {\n this.state.numIframes += 1;\n this.setupSecuredField(securedField);\n }\n },\n removeSecuredField: (pFieldType: SFFieldType): void => {\n if (this.state.securedFields[pFieldType]) {\n this.state.securedFields[pFieldType].destroy();\n delete this.state.securedFields[pFieldType];\n this.state.numIframes -= 1;\n this.state.iframeCount -= 1;\n\n const callbackObj: CardAdditionalSFData = { additionalIframeRemoved: true, fieldType: pFieldType, type: this.state.type };\n this.callbacks.onAdditionalSFRemoved(callbackObj);\n }\n },\n setKCPStatus: (isKCP: boolean): void => {\n this.state.isKCP = isKCP;\n },\n sfIsOptionalOrHidden: (fieldType: string): boolean => {\n return this.state.securedFields[fieldType].isOptionalOrHidden();\n }\n };\n\n return returnObj;\n }\n}\n\nexport default CSF;\n"],"names":["notConfiguredWarning","str","logger","CSF","AbstractCSF","init","this","configHandler","props","callbacksHandler","callbacks","numIframes","createSecuredFields","state","originalNumIframes","isKCP","ua","__IS_IOS","shouldDisableIOSArrowKeys","hasGenuineTouchEvents","on","document","touchstartListener","createReturnObject","updateStyles","pStyleObject","isConfigured","postMessageToAllIframes","styleObject","setFocusOnFrame","pFieldType","isValidated","code","hasOwnProperty","securedFields","hasError","errorType","dataObj","txVariant","type","fieldType","externalValidation","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","hasUnsupportedCard","unsupportedCard","destroy","destroySecuredFields","brandsFromBinLookup","binLookupResponse","resetObj","isCreditCardType","handleBrandFromBinLookup","addSecuredField","securedField","selectOne","rootNode","setupSecuredField","removeSecuredField","iframeCount","callbackObj","additionalIframeRemoved","onAdditionalSFRemoved","setKCPStatus","sfIsOptionalOrHidden","isOptionalOrHidden","constructor","setupObj","super","brand","cvcPolicy","allValid","undefined","iframeConfigCount","hasSeparateDateFields","currentFocusObject","registerFieldForIos","thisObj","csfState","csfConfig","csfProps","csfCallbacks","handleConfig","configureCallbacks","validateForm","partial","handleIframeConfigFeedback","processBrand","handleValidation","handleEncryption","createNonCardSecuredFields","createCardSecuredFields","handleIOSTouchEvents","handleTouchend","bind","touchendListener","destroyTouchendListener","destroyTouchstartListener","handleFocus","handleSFShiftTab","handleTab","handleShiftTab","processAutoComplete","handleBinValue","sendBrandToCardSF","sendExpiryDatePolicyToSF"],"mappings":"qrDAgCA,MAAMA,EAAuB,CAACC,EAAM,mCAChCC,EAAY,GAAGD,wGAGnB,MAAME,UAAYC,EA2FNC,IAAAA,GACJC,KAAKC,cAAcD,KAAKE,OACxBF,KAAKG,iBAAiBH,KAAKE,MAAME,WAKjC,MAAMC,EAAqBL,KAAKM,sBAEhCN,KAAKO,MAAMF,WAAaL,KAAKO,MAAMC,mBAAqBH,EAExDL,KAAKO,MAAME,QAAUT,KAAKE,MAAMO,MAM5BC,EAAGC,UAAYX,KAAKE,MAAMU,4BAC1BZ,KAAKa,uBAAwB,EAC7BC,EAAGC,SAAU,aAAcf,KAAKgB,oBAExC,CAGOC,kBAAAA,GAkHH,MAhHmC,CAE/BC,aAAeC,IACPnB,KAAKO,MAAMa,aACXpB,KAAKqB,wBAAwB,CAAEC,YAAaH,IAE5CvB,EACI,mJAKZ2B,gBAAkBC,IACVxB,KAAKO,MAAMa,aACXpB,KAAKuB,gBAAgBC,GAIrB9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EAAQE,EAAcV,GAE1C1E,KAAKqF,iBAAmBA,EACxBrF,KAAKsF,iBAAmBA,EAExBtF,KAAKM,oBAAsBA,EAC3BN,KAAKuF,2BAA6BA,EAClCvF,KAAKwF,wBAA0BA,EAE/BxF,KAAKsD,kBAAoBA,EAEzBtD,KAAKqB,wBAA0B6D,EAAQ7D,EAAyBqD,GAEhE1E,KAAKyF,qBAAuBA,EAAqBC,eAAeC,KAAK3F,MACrEA,KAAK4F,iBAAmBH,EAAqBG,iBAAiBD,KAAK3F,MACnEA,KAAK6F,wBAA0BJ,EAAqBI,wBAAwBF,KAAK3F,MACjFA,KAAKgB,mBAAqByE,EAAqBzE,mBAAmB2E,KAAK3F,MACvEA,KAAK8F,0BAA4BL,EAAqBK,0BAA0BH,KAAK3F,MAErFA,KAAKuB,gBAAkB2D,EAAQ3D,EAAiBmD,GAChD1E,KAAK+F,YAAcb,EAAQa,EAAarB,EAAS1E,KAAKyF,sBAEtDzF,KAAKgG,iBAAmBC,EAAUD,iBAClChG,KAAKkG,eAAiBD,EAAUC,eAEhClG,KAAK4C,qBAAuBA,EAE5B5C,KAAKmG,oBAAsBjB,EAAQiB,EAAqBzB,GAExD1E,KAAKoG,eAAiBlB,EAAQkB,EAAgB1B,GAE9C1E,KAAKiD,yBAA2BA,EAChCjD,KAAKqG,kBAAoBA,EACzBrG,KAAKsG,yBAA2BA,EAGhCtG,KAAKD,MACT"}
1
+ {"version":3,"file":"CSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/CSF.ts"],"sourcesContent":["import AbstractCSF from './AbstractCSF';\nimport { CSFReturnObject, CSFSetupObject, CSFStateObject, CSFThisObject, CSFCallbacksConfig, CSFConfigObject } from './types';\nimport { StylesObject, CardAdditionalSFData, SFFieldType } from '../types';\nimport { BinLookupResponse } from '../../../../Card/types';\nimport { handleConfig } from './extensions/handleConfig';\nimport { configureCallbacks } from './extensions/configureCallbacks';\nimport { handleValidation } from './extensions/handleValidation';\nimport { handleEncryption } from './extensions/handleEncryption';\nimport { createSecuredFields, createNonCardSecuredFields, createCardSecuredFields, setupSecuredField } from './extensions/createSecuredFields';\nimport handleIOSTouchEvents from './extensions/handleIOSTouchEvents';\nimport handleTab from './extensions/handleTab';\nimport handleBrandFromBinLookup, { sendBrandToCardSF, sendExpiryDatePolicyToSF } from './extensions/handleBrandFromBinLookup';\nimport { setFocusOnFrame } from './partials/setFocusOnFrame';\nimport { postMessageToAllIframes } from './partials/postMessageToAllIframes';\nimport processBrand from './partials/processBrand';\nimport { processAutoComplete } from './partials/processAutoComplete';\nimport { handleFocus } from './partials/handleFocus';\nimport { handleIframeConfigFeedback } from './partials/handleIframeConfigFeedback';\nimport { isConfigured } from './partials/isConfigured';\nimport validateForm from './partials/validateForm';\nimport { handleBinValue } from './partials/handleBinValue';\nimport { destroySecuredFields } from './utils/destroySecuredFields';\nimport postMessageToIframe from './utils/iframes/postMessageToIframe';\nimport getIframeContentWin from './utils/iframes/getIframeContentWin';\nimport * as logger from '../utilities/logger';\nimport { selectOne } from '../utilities/dom';\nimport { on } from '../../../../../utils/listenerUtils';\nimport { partial } from '../utilities/commonUtils';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport ua from './utils/userAgent';\nimport { SingleBrandResetObject } from '../../SFP/types';\n\nconst notConfiguredWarning = (str = 'You cannot use secured fields') => {\n logger.warn(`${str} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`);\n};\n\nclass CSF extends AbstractCSF {\n declare protected callbacks: CSFCallbacksConfig;\n declare protected config: CSFConfigObject;\n declare protected state: CSFStateObject;\n\n constructor(setupObj: CSFSetupObject) {\n /**\n * Initialises:\n * - this.props = setupObj: CSFSetupObject\n *\n * and empty objects for:\n * - this.config: CSFConfigObject (populated in handleConfig.ts)\n * - this.callbacks: CSFCallbacksConfig (populated in configureCallbacks.ts\n * - this.state: CSFStateObject (populated below)\n */\n super(setupObj);\n\n this.state = {\n /**\n * For generic card will always be 'card'.\n * For non-generic card will be hardcoded to a particular txVariant e.g. 'mc' or 'visa'\n * For other types of SecuredField will be the passed type e.g. 'ach' or 'giftcard'\n */\n type: this.props.type,\n /**\n * For generic card will change as shopper types\n * For non-generic card will be fixed\n */\n brand: this.props.type !== 'card' ? { brand: this.props.type, cvcPolicy: 'required' } : { brand: null, cvcPolicy: 'required' },\n allValid: undefined,\n numIframes: 0,\n originalNumIframes: 0,\n iframeCount: 0,\n iframeConfigCount: 0,\n isConfigured: false,\n hasSeparateDateFields: false,\n currentFocusObject: null,\n registerFieldForIos: false,\n securedFields: {},\n isKCP: false\n } as CSFStateObject;\n\n // Create object of references to properties on 'this', that can be used to set up the partials\n const thisObj: CSFThisObject = { csfState: this.state, csfConfig: this.config, csfProps: this.props, csfCallbacks: this.callbacks };\n\n // Setup 'this' references\n this.configHandler = handleConfig.bind(this);\n\n this.callbacksHandler = configureCallbacks.bind(this);\n\n this.validateForm = partial(validateForm, thisObj);\n\n this.isConfigured = partial(isConfigured, thisObj, this.validateForm);\n this.handleIframeConfigFeedback = partial(handleIframeConfigFeedback, thisObj, this.isConfigured);\n\n this.processBrand = partial(processBrand, thisObj);\n\n this.handleValidation = handleValidation.bind(this);\n this.handleEncryption = handleEncryption.bind(this);\n\n this.createSecuredFields = createSecuredFields.bind(this);\n this.createNonCardSecuredFields = createNonCardSecuredFields.bind(this);\n this.createCardSecuredFields = createCardSecuredFields.bind(this);\n \n this.setupSecuredField = setupSecuredField.bind(this);\n\n this.postMessageToAllIframes = partial(postMessageToAllIframes, thisObj);\n\n this.handleIOSTouchEvents = handleIOSTouchEvents.handleTouchend.bind(this);\n this.touchendListener = handleIOSTouchEvents.touchendListener.bind(this);\n this.destroyTouchendListener = handleIOSTouchEvents.destroyTouchendListener.bind(this);\n this.touchstartListener = handleIOSTouchEvents.touchstartListener.bind(this);\n this.destroyTouchstartListener = handleIOSTouchEvents.destroyTouchstartListener.bind(this);\n\n this.setFocusOnFrame = partial(setFocusOnFrame, thisObj);\n this.handleFocus = partial(handleFocus, thisObj, this.handleIOSTouchEvents);\n\n this.handleSFShiftTab = handleTab.handleSFShiftTab.bind(this);\n this.handleShiftTab = handleTab.handleShiftTab.bind(this);\n\n this.destroySecuredFields = destroySecuredFields.bind(this);\n\n this.processAutoComplete = partial(processAutoComplete, thisObj);\n\n this.handleBinValue = partial(handleBinValue, thisObj);\n\n this.handleBrandFromBinLookup = handleBrandFromBinLookup.bind(this);\n this.sendBrandToCardSF = sendBrandToCardSF.bind(this);\n this.sendExpiryDatePolicyToSF = sendExpiryDatePolicyToSF.bind(this);\n\n // Populate config & callbacks objects & create securedFields\n this.init();\n }\n\n private init(): void {\n this.configHandler(this.props);\n this.callbacksHandler(this.props.callbacks);\n\n /**\n * Create all the securedFields\n */\n const numIframes: number = this.createSecuredFields();\n\n this.state.numIframes = this.state.originalNumIframes = numIframes;\n\n this.state.isKCP = !!this.props.isKCP;\n\n /**\n * Add touchstart listener\n * re. Disabling arrow keys in iOS\n */\n if (ua.__IS_IOS && this.props.shouldDisableIOSArrowKeys) {\n this.hasGenuineTouchEvents = false;\n on(document, 'touchstart', this.touchstartListener);\n }\n }\n\n // Expose functions that can be called on the CSF instance\n public createReturnObject(): CSFReturnObject {\n // --\n const returnObj: CSFReturnObject = {\n // --\n updateStyles: (pStyleObject: StylesObject): void => {\n if (this.state.isConfigured) {\n this.postMessageToAllIframes({ styleObject: pStyleObject });\n } else {\n logger.warn(\n 'You cannot update the secured fields styling ' +\n \"- they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.\"\n );\n }\n },\n setFocusOnFrame: (pFieldType: SFFieldType): void => {\n if (this.state.isConfigured) {\n this.setFocusOnFrame(pFieldType);\n // Comment in a quick way to test destroying secured fields (also see comment in destroySecuredFields)\n // this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot set focus on any secured field');\n }\n },\n // For component based implementation - if showValidation function is called on the component use this\n // function as a way to notify the CSF that a field is in error\n isValidated: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n this.state.securedFields[pFieldType].hasError = true;\n\n // If there's not already an errorType, set one\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the corresponding fix in the SecuredField class the maestro PM will never register as valid\n if (this.state.securedFields[pFieldType].errorType === '') {\n this.state.securedFields[pFieldType].errorType = 'isValidated';\n }\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n externalValidation: true,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set validated on any secured field');\n }\n },\n hasUnsupportedCard: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n //\n this.state.securedFields[pFieldType].hasError = !!code;\n this.state.securedFields[pFieldType].errorType = code;\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n unsupportedCard: !!code,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set hasUnsupportedCard on any secured field');\n }\n },\n destroy: (): void => {\n if (this.state.isConfigured) {\n this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot destroy secured fields');\n }\n },\n brandsFromBinLookup: (binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void => {\n if (!this.config.isCreditCardType) return null;\n\n if (this.state.isConfigured) {\n this.handleBrandFromBinLookup(binLookupResponse, resetObj);\n } else {\n notConfiguredWarning('You cannot set pass brands to secured fields');\n }\n },\n addSecuredField: (pFieldType: SFFieldType): void => {\n const securedField: HTMLElement = selectOne(this.props.rootNode, `[data-cse=\"${pFieldType}\"]`);\n if (securedField) {\n this.state.numIframes += 1;\n this.setupSecuredField(securedField);\n }\n },\n removeSecuredField: (pFieldType: SFFieldType): void => {\n if (this.state.securedFields[pFieldType]) {\n this.state.securedFields[pFieldType].destroy();\n delete this.state.securedFields[pFieldType];\n this.state.numIframes -= 1;\n this.state.iframeCount -= 1;\n\n const callbackObj: CardAdditionalSFData = { additionalIframeRemoved: true, fieldType: pFieldType, type: this.state.type };\n this.callbacks.onAdditionalSFRemoved(callbackObj);\n }\n },\n setKCPStatus: (isKCP: boolean): void => {\n this.state.isKCP = isKCP;\n },\n sfIsOptionalOrHidden: (fieldType: string): boolean => {\n return this.state.securedFields[fieldType].isOptionalOrHidden();\n }\n };\n\n return returnObj;\n }\n}\n\nexport default CSF;\n"],"names":["notConfiguredWarning","str","logger","CSF","AbstractCSF","init","this","configHandler","props","callbacksHandler","callbacks","numIframes","createSecuredFields","state","originalNumIframes","isKCP","ua","__IS_IOS","shouldDisableIOSArrowKeys","hasGenuineTouchEvents","on","document","touchstartListener","createReturnObject","updateStyles","pStyleObject","isConfigured","postMessageToAllIframes","styleObject","setFocusOnFrame","pFieldType","isValidated","code","hasOwnProperty","securedFields","hasError","errorType","dataObj","txVariant","type","fieldType","externalValidation","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","hasUnsupportedCard","unsupportedCard","destroy","destroySecuredFields","brandsFromBinLookup","binLookupResponse","resetObj","isCreditCardType","handleBrandFromBinLookup","addSecuredField","securedField","selectOne","rootNode","setupSecuredField","removeSecuredField","iframeCount","callbackObj","additionalIframeRemoved","onAdditionalSFRemoved","setKCPStatus","sfIsOptionalOrHidden","isOptionalOrHidden","constructor","setupObj","super","brand","cvcPolicy","allValid","undefined","iframeConfigCount","hasSeparateDateFields","currentFocusObject","registerFieldForIos","thisObj","csfState","csfConfig","csfProps","csfCallbacks","handleConfig","bind","configureCallbacks","validateForm","partial","handleIframeConfigFeedback","processBrand","handleValidation","handleEncryption","createNonCardSecuredFields","createCardSecuredFields","handleIOSTouchEvents","handleTouchend","touchendListener","destroyTouchendListener","destroyTouchstartListener","handleFocus","handleSFShiftTab","handleTab","handleShiftTab","processAutoComplete","handleBinValue","sendBrandToCardSF","sendExpiryDatePolicyToSF"],"mappings":"qrDAgCA,MAAMA,EAAuB,CAACC,EAAM,mCAChCC,EAAY,GAAGD,wGAGnB,MAAME,UAAYC,EA8FNC,IAAAA,GACJC,KAAKC,cAAcD,KAAKE,OACxBF,KAAKG,iBAAiBH,KAAKE,MAAME,WAKjC,MAAMC,EAAqBL,KAAKM,sBAEhCN,KAAKO,MAAMF,WAAaL,KAAKO,MAAMC,mBAAqBH,EAExDL,KAAKO,MAAME,QAAUT,KAAKE,MAAMO,MAM5BC,EAAGC,UAAYX,KAAKE,MAAMU,4BAC1BZ,KAAKa,uBAAwB,EAC7BC,EAAGC,SAAU,aAAcf,KAAKgB,oBAExC,CAGOC,kBAAAA,GAkHH,MAhHmC,CAE/BC,aAAeC,IACPnB,KAAKO,MAAMa,aACXpB,KAAKqB,wBAAwB,CAAEC,YAAaH,IAE5CvB,EACI,mJAKZ2B,gBAAkBC,IACVxB,KAAKO,MAAMa,aACXpB,KAAKuB,gBAAgBC,GAIrB9B,EAAqB,8CAK7B+B,YAAa,CAACD,EAAyBE,KACnC,GAAI1B,KAAKO,MAAMa,cACX,GAAIO,EAAe3B,KAAKO,MAAMqB,cAAeJ,GAAa,CACtDxB,KAAKO,MAAMqB,cAAcJ,GAAYK,UAAW,EAKO,KAAnD7B,KAAKO,MAAMqB,cAAcJ,GAAYM,YACrC9B,KAAKO,MAAMqB,cAAcJ,GAAYM,UAAY,eAIrD,MAAMC,EAAkB,CACpBC,UAAWhC,KAAKO,MAAM0B,KACtBC,UAAWV,EACXW,oBAAoB,EACpBT,OACAU,OAAQpC,KAAKO,MAAMqB,cAAcJ,GAAYY,QAEjDC,EAAoBN,EAASO,EAAoBtC,KAAKO,MAAOiB,GAAaxB,KAAKuC,OAAOC,eAC1F,OAEA9C,EAAqB,kDAG7B+C,mBAAoB,CAACjB,EAAyBE,KAC1C,GAAI1B,KAA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1E,mBAAmBgE,KAAKhF,MACvEA,KAAK8F,0BAA4BJ,EAAqBI,0BAA0Bd,KAAKhF,MAErFA,KAAKuB,gBAAkB4D,EAAQ5D,EAAiBmD,GAChD1E,KAAK+F,YAAcZ,EAAQY,EAAarB,EAAS1E,KAAK0F,sBAEtD1F,KAAKgG,iBAAmBC,EAAUD,iBAAiBhB,KAAKhF,MACxDA,KAAKkG,eAAiBD,EAAUC,eAAelB,KAAKhF,MAEpDA,KAAK4C,qBAAuBA,EAAqBoC,KAAKhF,MAEtDA,KAAKmG,oBAAsBhB,EAAQgB,EAAqBzB,GAExD1E,KAAKoG,eAAiBjB,EAAQiB,EAAgB1B,GAE9C1E,KAAKiD,yBAA2BA,EAAyB+B,KAAKhF,MAC9DA,KAAKqG,kBAAoBA,EAAkBrB,KAAKhF,MAChDA,KAAKsG,yBAA2BA,EAAyBtB,KAAKhF,MAG9DA,KAAKD,MACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"configureCallbacks.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.ts"],"sourcesContent":["import { CSFCallbacksConfig } from '../types';\n\nconst noop = () => {};\n\nexport function configureCallbacks(callbacksObj: CSFCallbacksConfig = {} as any as CSFCallbacksConfig): void {\n // --\n this.callbacks.onLoad = callbacksObj.onLoad ? callbacksObj.onLoad : noop;\n\n this.callbacks.onConfigSuccess = callbacksObj.onConfigSuccess ? callbacksObj.onConfigSuccess : noop;\n\n this.callbacks.onFieldValid = callbacksObj.onFieldValid ? callbacksObj.onFieldValid : noop;\n\n this.callbacks.onAllValid = callbacksObj.onAllValid ? callbacksObj.onAllValid : noop;\n\n this.callbacks.onBrand = callbacksObj.onBrand ? callbacksObj.onBrand : noop;\n\n this.callbacks.onError = callbacksObj.onError ? callbacksObj.onError : noop;\n\n this.callbacks.onFocus = callbacksObj.onFocus ? callbacksObj.onFocus : noop;\n\n this.callbacks.onBinValue = callbacksObj.onBinValue ? callbacksObj.onBinValue : noop;\n\n this.callbacks.onAutoComplete = callbacksObj.onAutoComplete ? callbacksObj.onAutoComplete : noop;\n\n this.callbacks.onAdditionalSFConfig = callbacksObj.onAdditionalSFConfig ? callbacksObj.onAdditionalSFConfig : noop;\n\n this.callbacks.onAdditionalSFRemoved = callbacksObj.onAdditionalSFRemoved ? callbacksObj.onAdditionalSFRemoved : noop;\n\n this.callbacks.onTouchstartIOS = callbacksObj.onTouchstartIOS ? callbacksObj.onTouchstartIOS : noop;\n\n this.callbacks.onKeyPressed = callbacksObj.onKeyPressed ? callbacksObj.onKeyPressed : noop;\n}\n"],"names":["noop","configureCallbacks","callbacksObj","this","callbacks","onLoad","onConfigSuccess","onFieldValid","onAllValid","onBrand","onError","onFocus","onBinValue","onAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","onKeyPressed"],"mappings":"AAEA,MAAMA,EAAO,OAEN,SAASC,EAAmBC,EAAmC,IAElEC,KAAKC,UAAUC,OAASH,EAAaG,OAASH,EAAaG,OAASL,EAEpEG,KAAKC,UAAUE,gBAAkBJ,EAAaI,gBAAkBJ,EAAaI,gBAAkBN,EAE/FG,KAAKC,UAAUG,aAAeL,EAAaK,aAAeL,EAAaK,aAAeP,EAEtFG,KAAKC,UAAUI,WAAaN,EAAaM,WAAaN,EAAaM,WAAaR,EAEhFG,KAAKC,UAAUK,QAAUP,EAAaO,QAAUP,EAAaO,QAAUT,EAEvEG,KAAKC,UAAUM,QAAUR,EAAaQ,QAAUR,EAAaQ,QAAUV,EAEvEG,KAAKC,UAAUO,QAAUT,EAAaS,QAAUT,EAAaS,QAAUX,EAEvEG,KAAKC,UAAUQ,WAAaV,EAAaU,WAAaV,EAAaU,WAAaZ,EAEhFG,KAAKC,UAAUS,eAAiBX,EAAaW,eAAiBX,EAAaW,eAAiBb,EAE5FG,KAAKC,UAAUU,qBAAuBZ,EAAaY,qBAAuBZ,EAAaY,qBAAuBd,EAE9GG,KAAKC,UAAUW,sBAAwBb,EAAaa,sBAAwBb,EAAaa,sBAAwBf,EAEjHG,KAAKC,UAAUY,gBAAkBd,EAAac,gBAAkBd,EAAac,gBAAkBhB,EAE/FG,KAAKC,UAAUa,aAAef,EAAae,aAAef,EAAae,aAAejB,CAC1F"}
1
+ {"version":3,"file":"configureCallbacks.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.ts"],"sourcesContent":["import { CSFCallbacksConfig } from '../types';\n\nconst noop = () => {};\n\nexport function configureCallbacks(callbacksObj: Partial<CSFCallbacksConfig> = {}): void {\n // --\n this.callbacks.onLoad = callbacksObj.onLoad ? callbacksObj.onLoad : noop;\n\n this.callbacks.onConfigSuccess = callbacksObj.onConfigSuccess ? callbacksObj.onConfigSuccess : noop;\n\n this.callbacks.onFieldValid = callbacksObj.onFieldValid ? callbacksObj.onFieldValid : noop;\n\n this.callbacks.onAllValid = callbacksObj.onAllValid ? callbacksObj.onAllValid : noop;\n\n this.callbacks.onBrand = callbacksObj.onBrand ? callbacksObj.onBrand : noop;\n\n this.callbacks.onError = callbacksObj.onError ? callbacksObj.onError : noop;\n\n this.callbacks.onFocus = callbacksObj.onFocus ? callbacksObj.onFocus : noop;\n\n this.callbacks.onBinValue = callbacksObj.onBinValue ? callbacksObj.onBinValue : noop;\n\n this.callbacks.onAutoComplete = callbacksObj.onAutoComplete ? callbacksObj.onAutoComplete : noop;\n\n this.callbacks.onAdditionalSFConfig = callbacksObj.onAdditionalSFConfig ? callbacksObj.onAdditionalSFConfig : noop;\n\n this.callbacks.onAdditionalSFRemoved = callbacksObj.onAdditionalSFRemoved ? callbacksObj.onAdditionalSFRemoved : noop;\n\n this.callbacks.onTouchstartIOS = callbacksObj.onTouchstartIOS ? callbacksObj.onTouchstartIOS : noop;\n\n this.callbacks.onKeyPressed = callbacksObj.onKeyPressed ? callbacksObj.onKeyPressed : noop;\n}\n"],"names":["noop","configureCallbacks","callbacksObj","this","callbacks","onLoad","onConfigSuccess","onFieldValid","onAllValid","onBrand","onError","onFocus","onBinValue","onAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","onKeyPressed"],"mappings":"AAEA,MAAMA,EAAO,OAEN,SAASC,EAAmBC,EAA4C,IAE3EC,KAAKC,UAAUC,OAASH,EAAaG,OAASH,EAAaG,OAASL,EAEpEG,KAAKC,UAAUE,gBAAkBJ,EAAaI,gBAAkBJ,EAAaI,gBAAkBN,EAE/FG,KAAKC,UAAUG,aAAeL,EAAaK,aAAeL,EAAaK,aAAeP,EAEtFG,KAAKC,UAAUI,WAAaN,EAAaM,WAAaN,EAAaM,WAAaR,EAEhFG,KAAKC,UAAUK,QAAUP,EAAaO,QAAUP,EAAaO,QAAUT,EAEvEG,KAAKC,UAAUM,QAAUR,EAAaQ,QAAUR,EAAaQ,QAAUV,EAEvEG,KAAKC,UAAUO,QAAUT,EAAaS,QAAUT,EAAaS,QAAUX,EAEvEG,KAAKC,UAAUQ,WAAaV,EAAaU,WAAaV,EAAaU,WAAaZ,EAEhFG,KAAKC,UAAUS,eAAiBX,EAAaW,eAAiBX,EAAaW,eAAiBb,EAE5FG,KAAKC,UAAUU,qBAAuBZ,EAAaY,qBAAuBZ,EAAaY,qBAAuBd,EAE9GG,KAAKC,UAAUW,sBAAwBb,EAAaa,sBAAwBb,EAAaa,sBAAwBf,EAEjHG,KAAKC,UAAUY,gBAAkBd,EAAac,gBAAkBd,EAAac,gBAAkBhB,EAE/FG,KAAKC,UAAUa,aAAef,EAAae,aAAef,EAAae,aAAejB,CAC1F"}
@@ -1,2 +1,2 @@
1
- import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,CVC_POLICY_REQUIRED as o,DATE_POLICY_REQUIRED as s,ENCRYPTED_EXPIRY_YEAR as r,SF_CONFIG_TIMEOUT as n,DATA_UID as a,DATA_INFO as l}from"../../constants.js";import{existy as d}from"../../../../../../utils/commonUtils.js";import c from"../utils/cardType.js";import h from"../../securedField/SecuredField.js";import p from"../../../../../../core/Errors/AdyenCheckoutError.js";import{isSecuredField as u}from"../../../utils.js";function f(e,t){if(null==e)return{};var i,o,s,r={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(i=Reflect.ownKeys(e),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}if(r=function(e,t){if(null==e)return{};var i,o,s={},r=Object.getOwnPropertyNames(e);for(o=0;o<r.length;o++)i=r[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}(e,t),Object.getOwnPropertySymbols)for(i=Object.getOwnPropertySymbols(e),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}function m(){this.encryptedAttrName=i;const r=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),o=u(i);return o||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),o}),n=o,a=s;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(r,n,a),r.length):(this.createNonCardSecuredFields(r),r.length)}async function y(e){for(let t=0;t<e.length;t++){const i=e[t];await this.setupSecuredField(i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})}}async function g(e,t,i){let r=this.state.type;if("card"===r&&1===this.config.cardGroupTypes.length&&(r=this.config.cardGroupTypes[0],this.state.type=r),this.isSingleBrandedCard="card"!==r,this.isSingleBrandedCard){const e=c.getCardByBrand(r);d(e)?(t=e.cvcPolicy||o,i=e.expiryDatePolicy||s,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let o=0;o<e.length;o++){const s=e[o];window._b$dl&&console.log("\nAbout to set up securedField:",s),await this.setupSecuredField(s,t,i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}),window._b$dl&&console.log("Finished setting up securedField:",s)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:r,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function T(e,i,o){return new Promise((s,d)=>{const c=t(e,this.encryptedAttrName);c===r&&(this.state.hasSeparateDateFields=!0);const u={fieldType:c,extraFieldData:t(e,l),uid:t(e,a),cvcPolicy:i,holderEl:e,expiryDatePolicy:o,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders,submitAnalytics:this.props.onSubmitAnalytics,componentType:this.props.componentType},m=new h(u,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new p("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(m.loadToConfigTimeout=setTimeout(()=>{d({type:u.fieldType,failReason:"sf took too long to config"})},n),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(m.loadToConfigTimeout),m.loadToConfigTimeout=null,s(e)}).onFocus(e=>{this.handleFocus(e)}).onBinValue(e=>{this.handleBinValue(e)}).onTouchstart(e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})}).onShiftTab(e=>{this.handleSFShiftTab(e.fieldType)}).onEncryption(e=>{this.handleEncryption(e)}).onValidation(e=>{this.handleValidation(e)}).onAutoComplete(e=>{this.processAutoComplete(e)}).onKeyPressed(e=>{const{numKey:t}=e,i=f(e,["numKey"]);this.callbacks.onKeyPressed(i)});this.state.securedFields[c]=m})}export{g as createCardSecuredFields,y as createNonCardSecuredFields,m as createSecuredFields,T as setupSecuredField};
1
+ import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,CVC_POLICY_REQUIRED as o,DATE_POLICY_REQUIRED as s,ENCRYPTED_EXPIRY_YEAR as r,SF_CONFIG_TIMEOUT as n,DATA_UID as a,DATA_INFO as l}from"../../constants.js";import{existy as d}from"../../../../../../utils/commonUtils.js";import c from"../utils/cardType.js";import h from"../../securedField/SecuredField.js";import p from"../../../../../../core/Errors/AdyenCheckoutError.js";import{isSecuredField as u}from"../../../utils.js";function f(e,t){if(null==e)return{};var i,o,s,r={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(i=Reflect.ownKeys(Object(e)),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}if(r=function(e,t){if(null==e)return{};var i,o,s={},r=Object.getOwnPropertyNames(e);for(o=0;o<r.length;o++)i=r[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}(e,t),Object.getOwnPropertySymbols)for(i=Object.getOwnPropertySymbols(e),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}function m(){this.encryptedAttrName=i;const r=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),o=u(i);return o||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),o}),n=o,a=s;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(r,n,a),r.length):(this.createNonCardSecuredFields(r),r.length)}async function y(e){for(let t=0;t<e.length;t++){const i=e[t];await this.setupSecuredField(i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})}}async function g(e,t,i){let r=this.state.type;if("card"===r&&1===this.config.cardGroupTypes.length&&(r=this.config.cardGroupTypes[0],this.state.type=r),this.isSingleBrandedCard="card"!==r,this.isSingleBrandedCard){const e=c.getCardByBrand(r);d(e)?(t=e.cvcPolicy||o,i=e.expiryDatePolicy||s,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let o=0;o<e.length;o++){const s=e[o];window._b$dl&&console.log("\nAbout to set up securedField:",s),await this.setupSecuredField(s,t,i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}),window._b$dl&&console.log("Finished setting up securedField:",s)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:r,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function T(e,i,o){return new Promise((s,d)=>{const c=t(e,this.encryptedAttrName);c===r&&(this.state.hasSeparateDateFields=!0);const u={fieldType:c,extraFieldData:t(e,l),uid:t(e,a),cvcPolicy:i,holderEl:e,expiryDatePolicy:o,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders,submitAnalytics:this.props.onSubmitAnalytics,componentType:this.props.componentType},m=new h(u,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new p("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(m.loadToConfigTimeout=setTimeout(()=>{d({type:u.fieldType,failReason:"sf took too long to config"})},n),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(m.loadToConfigTimeout),m.loadToConfigTimeout=null,s(e)}).onFocus(e=>{this.handleFocus(e)}).onBinValue(e=>{this.handleBinValue(e)}).onTouchstart(e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})}).onShiftTab(e=>{this.handleSFShiftTab(e.fieldType)}).onEncryption(e=>{this.handleEncryption(e)}).onValidation(e=>{this.handleValidation(e)}).onAutoComplete(e=>{this.processAutoComplete(e)}).onKeyPressed(e=>{const{numKey:t}=e,i=f(e,["numKey"]);this.callbacks.onKeyPressed(i)});this.state.securedFields[c]=m})}export{g as createCardSecuredFields,y as createNonCardSecuredFields,m as createSecuredFields,T as setupSecuredField};
2
2
  //# sourceMappingURL=createSecuredFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSecuredFields.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.ts"],"sourcesContent":["import { select, getAttribute } from '../../utilities/dom';\nimport {\n ENCRYPTED_EXPIRY_YEAR,\n DATE_POLICY_REQUIRED,\n CVC_POLICY_REQUIRED,\n DATA_ENCRYPTED_FIELD_ATTR,\n DATA_INFO,\n DATA_UID,\n SF_CONFIG_TIMEOUT,\n ENCRYPTED_EXPIRY_MONTH\n} from '../../constants';\nimport { existy } from '../../../../../../utils/commonUtils';\nimport cardType from '../utils/cardType';\nimport { SecuredFieldSetupObject } from '../../types';\nimport SecuredField from '../../securedField/SecuredField';\nimport { CardObject, CardBrandData, SFFeedbackObj, CardLoadData, CVCPolicyType, DatePolicyType } from '../../types';\nimport AdyenCheckoutError from '../../../../../../core/Errors/AdyenCheckoutError';\nimport type { SFKeyPressObj } from '../../types';\nimport { isSecuredField } from '../../../utils';\n\n/**\n * Bound to the instance of CSF\n * Handles specific functionality related to configuring & creating SecuredFields\n */\nexport function createSecuredFields(): number {\n this.encryptedAttrName = DATA_ENCRYPTED_FIELD_ATTR;\n\n // Detect DOM elements that qualify as securedField holders & filter them for valid types\n const securedFields: HTMLElement[] = select(this.props.rootNode, `[${this.encryptedAttrName}]`).filter(field => {\n const fieldType: string = getAttribute(field, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_MONTH) {\n // TODO send analytics about separate date fields\n }\n\n const isValidType = isSecuredField(fieldType);\n if (!isValidType) {\n console.warn(\n `WARNING: '${fieldType}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`\n );\n }\n return isValidType;\n });\n\n /**\n * cvcPolicy - 'required' | 'optional' | 'hidden'\n * - Always 'required' for GiftCards\n * - Usually 'required' for single branded Credit Cards but with exceptions e.g. maestro ('optional'), bcmc ('hidden').\n * - Always 'required' for generic Credit Cards at start up - in this case, subsequent, supporting information about whether cvc stops being required\n * comes from the SF in the brand information (as the shopper inputs the cc number)\n */\n const cvcPolicy: CVCPolicyType = CVC_POLICY_REQUIRED;\n\n /** Usually 'required' for single branded Credit Cards but with exceptions e.g. ticket ('hidden', *technically* a meal voucher) */\n const expiryDatePolicy: DatePolicyType = DATE_POLICY_REQUIRED;\n\n // CHECK IF THIS SECURED FIELD IS NOT OF A CREDIT CARD TYPE\n if (!this.config.isCreditCardType) {\n this.createNonCardSecuredFields(securedFields);\n return securedFields.length;\n }\n\n // CONTINUE AS CREDIT-CARD TYPE...\n this.isSingleBrandedCard = false;\n\n this.securityCode = '';\n\n this.createCardSecuredFields(securedFields, cvcPolicy, expiryDatePolicy);\n\n // Return the number of iframes we're going to create\n return securedFields.length;\n}\n\n/**\n * i.e. giftcard and ach fields\n *\n * Create a new SecuredField for each detected holding element\n */\nexport async function createNonCardSecuredFields(securedFields: HTMLElement[]): Promise<any> {\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n await this.setupSecuredField(securedField).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n }\n}\n\nexport async function createCardSecuredFields(\n securedFields: HTMLElement[],\n cvcPolicy: CVCPolicyType,\n expiryDatePolicy: DatePolicyType\n): Promise<any> {\n // Declared card type from the initialisation of CSF\n let type: string = this.state.type;\n\n // Maybe it's a single branded card defined by setting type: 'card' & a single item in cardGroupTypes\n // In which case update the type var both locally AND in State\n if (type === 'card' && this.config.cardGroupTypes.length === 1) {\n type = this.config.cardGroupTypes[0];\n this.state.type = type;\n }\n\n // So, is it a single branded card?\n this.isSingleBrandedCard = type !== 'card';\n\n // If single branded card field...\n if (this.isSingleBrandedCard) {\n // Check that type exists\n const card: CardObject = cardType.getCardByBrand(type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (!existy(card)) {\n this.state.type = 'unrecognised-single-brand'; // Will let CVC field accept 4 digits in the input\n } else {\n // Assess whether cvc field is required based on the card type & whether the cvc field should even be visible\n cvcPolicy = card.cvcPolicy || CVC_POLICY_REQUIRED;\n expiryDatePolicy = card.expiryDatePolicy || DATE_POLICY_REQUIRED;\n\n this.securityCode = card.securityCode;\n }\n }\n\n /**\n * Create a new SecuredField for each detected holding element\n *\n * - we do this in sequence, waiting until one has configured before creating the next.\n * We do it this way to avoid the 'bug' whereby if something interrupts the loading of an iframe the listener we have for its load event\n * never fires; which means the iframe never configures.\n * (NB - you can recreate this 'bug' by creating the securedFields in a synchronous loop:\n * securedFields.forEach(this.setupSecuredField.bind(this));\n * and putting a breakpoint on the line where we declare the setupSecuredField function)\n *\n * Also note we tried the Array.map/Promise.all way of asynchronously looping through an array - but it didn't fix the issue,\n * - so we fall back to a good old for-loop\n */\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n if (window._b$dl) console.log('\\nAbout to set up securedField:', securedField);\n await this.setupSecuredField(securedField, cvcPolicy, expiryDatePolicy).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n if (window._b$dl) console.log('Finished setting up securedField:', securedField);\n }\n if (window._b$dl) console.log('Finished setting up all securedFields');\n\n /**\n * Now the securedFields have all been created and configured...\n *\n * For a single branded card we call to onBrand callback once.\n * This allows the UI to set the correct logo if they haven't already,\n * and we also pass the cvcPolicy & expiryDatePolicy so the UI can hide the iframe holders if necessary\n */\n if (this.isSingleBrandedCard) {\n const callbackObj: CardBrandData = {\n type: this.state.type,\n rootNode: this.props.rootNode,\n brand: type,\n cvcPolicy,\n expiryDatePolicy,\n cvcText: this.securityCode\n };\n\n // Allow a tick for the securedField to finish rendering\n setTimeout(() => {\n this.callbacks.onBrand(callbackObj);\n }, 0);\n }\n}\n\n// Run for each detected holder of a securedField...\nexport function setupSecuredField(pItem: HTMLElement, cvcPolicy?: CVCPolicyType, expiryDatePolicy?: DatePolicyType): Promise<any> {\n return new Promise((resolve, reject) => {\n /**\n * possible values:\n * encryptedCardNumber\n * encryptedExpiryDate\n * encryptedExpiryMonth\n * encryptedExpiryYear\n * encryptedSecurityCode\n * encryptedPassword\n */\n const fieldType: string = getAttribute(pItem, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_YEAR) {\n this.state.hasSeparateDateFields = true;\n }\n\n const extraFieldData: string = getAttribute(pItem, DATA_INFO);\n const uid = getAttribute(pItem, DATA_UID);\n\n // CREATE SecuredField passing config object\n const sfInitObj: SecuredFieldSetupObject = {\n fieldType,\n extraFieldData,\n uid,\n cvcPolicy,\n holderEl: pItem,\n expiryDatePolicy,\n txVariant: this.state.type,\n // from this.config (calculated)\n cardGroupTypes: this.config.cardGroupTypes,\n iframeUIConfig: this.config.iframeUIConfig,\n sfLogAtStart: this.config.sfLogAtStart,\n trimTrailingSeparator: this.config.trimTrailingSeparator,\n isCreditCardType: this.config.isCreditCardType,\n iframeSrc: this.config.iframeSrc,\n loadingContext: this.config.loadingContext,\n showWarnings: this.config.showWarnings,\n legacyInputMode: this.config.legacyInputMode,\n minimumExpiryDate: this.config.minimumExpiryDate,\n // from this.props (passed straight thru)\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n disableIOSArrowKeys: this.props.shouldDisableIOSArrowKeys,\n implementationType: this.props.implementationType,\n showContextualElement: this.props.showContextualElement,\n placeholders: this.props.placeholders,\n submitAnalytics: this.props.onSubmitAnalytics,\n componentType: this.props.componentType\n };\n\n const sf: SecuredField = new SecuredField(sfInitObj, this.props.i18n)\n .onIframeLoaded((): void => {\n // Count\n this.state.iframeCount += 1;\n\n if (window._b$dl) console.log('### createSecuredFields::onIframeLoaded:: this.state.iframeCount=', this.state.iframeCount);\n\n // One of our existing securedFields has just loaded new content!\n if (this.state.iframeCount > this.state.numIframes) {\n this.destroySecuredFields();\n // TODO send analytics about this error\n throw new AdyenCheckoutError(\n 'ERROR',\n `One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`\n );\n }\n\n /** Create timeout within which time we expect the securedField to configure */\n // @ts-ignore - timeout 'type' *is* a number\n sf.loadToConfigTimeout = setTimeout(() => {\n reject({ type: sfInitObj.fieldType, failReason: 'sf took too long to config' });\n }, SF_CONFIG_TIMEOUT);\n\n // If all iframes are loaded - call onLoad callback\n if (this.state.iframeCount === this.state.originalNumIframes) {\n const callbackObj: CardLoadData = { iframesLoaded: true };\n this.callbacks.onLoad(callbackObj);\n }\n })\n .onConfig((pFeedbackObj: SFFeedbackObj): void => {\n this.handleIframeConfigFeedback(pFeedbackObj);\n\n // Clear timeout since the securedField has configured\n clearTimeout(sf.loadToConfigTimeout);\n sf.loadToConfigTimeout = null;\n\n resolve(pFeedbackObj);\n })\n .onFocus((pFeedbackObj: SFFeedbackObj): void => {\n this.handleFocus(pFeedbackObj);\n })\n .onBinValue((pFeedbackObj: SFFeedbackObj): void => {\n this.handleBinValue(pFeedbackObj);\n })\n .onTouchstart((pFeedbackObj: SFFeedbackObj): void => {\n // re. Disabling arrow keys in iOS - need to disable all other fields in the form\n if (this.props.shouldDisableIOSArrowKeys) {\n /**\n * re. this.hasGenuineTouchEvents...\n * There seems to be an issue with Responsive Design mode in Safari that means it allows setting focus on cross-origin iframes,\n * without enabling the touch events that allow the \"disableIOSArrowKeys\" workaround to fully function.\n * This results in a click on an securedFields *label* leading to, for example, the holderName field being disabled, but w/o access\n * to the touch events that would let it re-enable itself.\n *\n * So we prevent the \"disableIOSArrowKeys\" workaround unless we genuinely have touch events available.\n */\n if (this.hasGenuineTouchEvents || pFeedbackObj.hasGenuineTouchEvents) {\n this.callbacks.onTouchstartIOS({ fieldType: pFeedbackObj.fieldType });\n }\n }\n\n // Only perform this step if we genuinely have touch events available\n if (pFeedbackObj.hasGenuineTouchEvents || this.hasGenuineTouchEvents) {\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n // - pass information about which field has just been clicked (gained focus) to the other iframes\n this.postMessageToAllIframes({ fieldType: pFeedbackObj.fieldType, fieldClick: true });\n }\n })\n .onShiftTab((pFeedbackObj: SFFeedbackObj): void => {\n // Only happens for Firefox & IE <= 11\n this.handleSFShiftTab(pFeedbackObj.fieldType);\n })\n .onEncryption((pFeedbackObj: SFFeedbackObj): void => {\n this.handleEncryption(pFeedbackObj);\n })\n .onValidation((pFeedbackObj: SFFeedbackObj): void => {\n this.handleValidation(pFeedbackObj);\n })\n .onAutoComplete((pFeedbackObj: SFFeedbackObj): void => {\n this.processAutoComplete(pFeedbackObj);\n })\n .onKeyPressed((pFeedbackObj: SFFeedbackObj): void => {\n const { numKey, ...rest } = pFeedbackObj;\n this.callbacks.onKeyPressed(rest as SFKeyPressObj);\n });\n\n // Store reference to securedField in this.state (under fieldType)\n this.state.securedFields[fieldType] = sf;\n });\n}\n"],"names":["createSecuredFields","this","encryptedAttrName","DATA_ENCRYPTED_FIELD_ATTR","securedFields","select","props","rootNode","filter","field","fieldType","getAttribute","isValidType","isSecuredField","console","warn","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","config","isCreditCardType","isSingleBrandedCard","securityCode","createCardSecuredFields","length","createNonCardSecuredFields","async","i","securedField","setupSecuredField","catch","e","window","_b$dl","log","type","state","cardGroupTypes","card","cardType","getCardByBrand","existy","callbackObj","brand","cvcText","setTimeout","callbacks","onBrand","pItem","Promise","resolve","reject","ENCRYPTED_EXPIRY_YEAR","hasSeparateDateFields","sfInitObj","extraFieldData","DATA_INFO","uid","DATA_UID","holderEl","txVariant","iframeUIConfig","sfLogAtStart","trimTrailingSeparator","iframeSrc","loadingContext","showWarnings","legacyInputMode","minimumExpiryDate","maskSecurityCode","exposeExpiryDate","disableIOSArrowKeys","shouldDisableIOSArrowKeys","implementationType","showContextualElement","placeholders","submitAnalytics","onSubmitAnalytics","componentType","sf","SecuredField","i18n","onIframeLoaded","iframeCount","numIframes","destroySecuredFields","AdyenCheckoutError","loadToConfigTimeout","failReason","SF_CONFIG_TIMEOUT","originalNumIframes","iframesLoaded","onLoad","onConfig","pFeedbackObj","handleIframeConfigFeedback","clearTimeout","onFocus","handleFocus","onBinValue","handleBinValue","onTouchstart","hasGenuineTouchEvents","onTouchstartIOS","postMessageToAllIframes","fieldClick","onShiftTab","handleSFShiftTab","onEncryption","handleEncryption","onValidation","handleValidation","onAutoComplete","processAutoComplete","onKeyPressed","numKey","rest"],"mappings":"goCAwBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAeH,GAMnC,OALKE,GACDE,QAAQC,KACJ,aAAaL,mCAA2CT,KAAKC,sFAG9DU,IAULI,EAA2BC,EAG3BC,EAAmCC,EAGzC,OAAKlB,KAAKmB,OAAOC,kBAMjBpB,KAAKqB,qBAAsB,EAE3BrB,KAAKsB,aAAe,GAEpBtB,KAAKuB,wBAAwBpB,EAAeY,EAAWE,GAGhDd,EAAcqB,SAZjBxB,KAAKyB,2BAA2BtB,GACzBA,EAAcqB,OAY7B,CAOOE,eAAeD,EAA2BtB,GAC7C,IAAK,IAAIwB,EAAI,EAAGA,EAAIxB,EAAcqB,OAAQG,IAAK,CAC3C,MAAMC,EAAezB,EAAcwB,SAC7B3B,KAAK6B,kBAAkBD,GAAcE,MAAMC,IACzCC,OAAOC,OAAOpB,QAAQqB,IAAI,mCAAoCH,IAE1E,CACJ,CAEOL,eAAeH,EAClBpB,EACAY,EACAE,GAGA,IAAIkB,EAAenC,KAAKoC,MAAMD,KAa9B,GATa,SAATA,GAAyD,IAAtCnC,KAAKmB,OAAOkB,eAAeb,SAC9CW,EA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aAAajB,EAAGQ,qBAChBR,EAAGQ,oBAAsB,KAEzBrC,EAAQ4C,KAEXG,QAASH,IACN9F,KAAKkG,YAAYJ,KAEpBK,WAAYL,IACT9F,KAAKoG,eAAeN,KAEvBO,aAAcP,IAEP9F,KAAKK,MAAMmE,4BAUPxE,KAAKsG,uBAAyBR,EAAaQ,wBAC3CtG,KAAK8C,UAAUyD,gBAAgB,CAAE9F,UAAWqF,EAAarF,aAK7DqF,EAAaQ,uBAAyBtG,KAAKsG,wBAG3CtG,KAAKwG,wBAAwB,CAAE/F,UAAWqF,EAAarF,UAAWgG,YAAY,MAGrFC,WAAYZ,IAET9F,KAAK2G,iBAAiBb,EAAarF,aAEtCmG,aAAcd,IACX9F,KAAK6G,iBAAiBf,KAEzBgB,aAAchB,IACX9F,KAAK+G,iBAAiBjB,KAEzBkB,eAAgBlB,IACb9F,KAAKiH,oBAAoBnB,KAE5BoB,aAAcpB,IACX,MAAMqB,OAAEA,GAAoBrB,EAATsB,EAAAA,EAAStB,EAAAA,YAC5B9F,KAAK8C,UAAUoE,aAAaE,KAIpCpH,KAAKoC,MAAMjC,cAAcM,GAAasE,GAE9C"}
1
+ {"version":3,"file":"createSecuredFields.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.ts"],"sourcesContent":["import { select, getAttribute } from '../../utilities/dom';\nimport {\n ENCRYPTED_EXPIRY_YEAR,\n DATE_POLICY_REQUIRED,\n CVC_POLICY_REQUIRED,\n DATA_ENCRYPTED_FIELD_ATTR,\n DATA_INFO,\n DATA_UID,\n SF_CONFIG_TIMEOUT,\n ENCRYPTED_EXPIRY_MONTH\n} from '../../constants';\nimport { existy } from '../../../../../../utils/commonUtils';\nimport cardType from '../utils/cardType';\nimport { SecuredFieldSetupObject } from '../../types';\nimport SecuredField from '../../securedField/SecuredField';\nimport { CardObject, CardBrandData, SFFeedbackObj, CardLoadData, CVCPolicyType, DatePolicyType } from '../../types';\nimport AdyenCheckoutError from '../../../../../../core/Errors/AdyenCheckoutError';\nimport type { SFKeyPressObj } from '../../types';\nimport { isSecuredField } from '../../../utils';\n\n/**\n * Bound to the instance of CSF\n * Handles specific functionality related to configuring & creating SecuredFields\n */\nexport function createSecuredFields(): number {\n this.encryptedAttrName = DATA_ENCRYPTED_FIELD_ATTR;\n\n // Detect DOM elements that qualify as securedField holders & filter them for valid types\n const securedFields: HTMLElement[] = select(this.props.rootNode, `[${this.encryptedAttrName}]`).filter(field => {\n const fieldType: string = getAttribute(field, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_MONTH) {\n // TODO send analytics about separate date fields\n }\n\n const isValidType = isSecuredField(fieldType);\n if (!isValidType) {\n console.warn(\n `WARNING: '${fieldType}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`\n );\n }\n return isValidType;\n });\n\n /**\n * cvcPolicy - 'required' | 'optional' | 'hidden'\n * - Always 'required' for GiftCards\n * - Usually 'required' for single branded Credit Cards but with exceptions e.g. maestro ('optional'), bcmc ('hidden').\n * - Always 'required' for generic Credit Cards at start up - in this case, subsequent, supporting information about whether cvc stops being required\n * comes from the SF in the brand information (as the shopper inputs the cc number)\n */\n const cvcPolicy: CVCPolicyType = CVC_POLICY_REQUIRED;\n\n /** Usually 'required' for single branded Credit Cards but with exceptions e.g. ticket ('hidden', *technically* a meal voucher) */\n const expiryDatePolicy: DatePolicyType = DATE_POLICY_REQUIRED;\n\n // CHECK IF THIS SECURED FIELD IS NOT OF A CREDIT CARD TYPE\n if (!this.config.isCreditCardType) {\n this.createNonCardSecuredFields(securedFields);\n return securedFields.length;\n }\n\n // CONTINUE AS CREDIT-CARD TYPE...\n this.isSingleBrandedCard = false;\n\n this.securityCode = '';\n\n this.createCardSecuredFields(securedFields, cvcPolicy, expiryDatePolicy);\n\n // Return the number of iframes we're going to create\n return securedFields.length;\n}\n\n/**\n * i.e. giftcard and ach fields\n *\n * Create a new SecuredField for each detected holding element\n */\nexport async function createNonCardSecuredFields(securedFields: HTMLElement[]): Promise<void> {\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n await this.setupSecuredField(securedField).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n }\n}\n\nexport async function createCardSecuredFields(\n securedFields: HTMLElement[],\n cvcPolicy: CVCPolicyType,\n expiryDatePolicy: DatePolicyType\n): Promise<void> {\n // Declared card type from the initialisation of CSF\n let type: string = this.state.type;\n\n // Maybe it's a single branded card defined by setting type: 'card' & a single item in cardGroupTypes\n // In which case update the type var both locally AND in State\n if (type === 'card' && this.config.cardGroupTypes.length === 1) {\n type = this.config.cardGroupTypes[0];\n this.state.type = type;\n }\n\n // So, is it a single branded card?\n this.isSingleBrandedCard = type !== 'card';\n\n // If single branded card field...\n if (this.isSingleBrandedCard) {\n // Check that type exists\n const card: CardObject = cardType.getCardByBrand(type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (!existy(card)) {\n this.state.type = 'unrecognised-single-brand'; // Will let CVC field accept 4 digits in the input\n } else {\n // Assess whether cvc field is required based on the card type & whether the cvc field should even be visible\n cvcPolicy = card.cvcPolicy || CVC_POLICY_REQUIRED;\n expiryDatePolicy = card.expiryDatePolicy || DATE_POLICY_REQUIRED;\n\n this.securityCode = card.securityCode;\n }\n }\n\n /**\n * Create a new SecuredField for each detected holding element\n *\n * - we do this in sequence, waiting until one has configured before creating the next.\n * We do it this way to avoid the 'bug' whereby if something interrupts the loading of an iframe the listener we have for its load event\n * never fires; which means the iframe never configures.\n * (NB - you can recreate this 'bug' by creating the securedFields in a synchronous loop:\n * securedFields.forEach(this.setupSecuredField.bind(this));\n * and putting a breakpoint on the line where we declare the setupSecuredField function)\n *\n * Also note we tried the Array.map/Promise.all way of asynchronously looping through an array - but it didn't fix the issue,\n * - so we fall back to a good old for-loop\n */\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n if (window._b$dl) console.log('\\nAbout to set up securedField:', securedField);\n await this.setupSecuredField(securedField, cvcPolicy, expiryDatePolicy).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n if (window._b$dl) console.log('Finished setting up securedField:', securedField);\n }\n if (window._b$dl) console.log('Finished setting up all securedFields');\n\n /**\n * Now the securedFields have all been created and configured...\n *\n * For a single branded card we call to onBrand callback once.\n * This allows the UI to set the correct logo if they haven't already,\n * and we also pass the cvcPolicy & expiryDatePolicy so the UI can hide the iframe holders if necessary\n */\n if (this.isSingleBrandedCard) {\n const callbackObj: CardBrandData = {\n type: this.state.type,\n rootNode: this.props.rootNode,\n brand: type,\n cvcPolicy,\n expiryDatePolicy,\n cvcText: this.securityCode\n };\n\n // Allow a tick for the securedField to finish rendering\n setTimeout(() => {\n this.callbacks.onBrand(callbackObj);\n }, 0);\n }\n}\n\n// Run for each detected holder of a securedField...\nexport function setupSecuredField(pItem: HTMLElement, cvcPolicy?: CVCPolicyType, expiryDatePolicy?: DatePolicyType): Promise<SFFeedbackObj> {\n return new Promise((resolve, reject) => {\n /**\n * possible values:\n * encryptedCardNumber\n * encryptedExpiryDate\n * encryptedExpiryMonth\n * encryptedExpiryYear\n * encryptedSecurityCode\n * encryptedPassword\n */\n const fieldType: string = getAttribute(pItem, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_YEAR) {\n this.state.hasSeparateDateFields = true;\n }\n\n const extraFieldData: string = getAttribute(pItem, DATA_INFO);\n const uid = getAttribute(pItem, DATA_UID);\n\n // CREATE SecuredField passing config object\n const sfInitObj: SecuredFieldSetupObject = {\n fieldType,\n extraFieldData,\n uid,\n cvcPolicy,\n holderEl: pItem,\n expiryDatePolicy,\n txVariant: this.state.type,\n // from this.config (calculated)\n cardGroupTypes: this.config.cardGroupTypes,\n iframeUIConfig: this.config.iframeUIConfig,\n sfLogAtStart: this.config.sfLogAtStart,\n trimTrailingSeparator: this.config.trimTrailingSeparator,\n isCreditCardType: this.config.isCreditCardType,\n iframeSrc: this.config.iframeSrc,\n loadingContext: this.config.loadingContext,\n showWarnings: this.config.showWarnings,\n legacyInputMode: this.config.legacyInputMode,\n minimumExpiryDate: this.config.minimumExpiryDate,\n // from this.props (passed straight thru)\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n disableIOSArrowKeys: this.props.shouldDisableIOSArrowKeys,\n implementationType: this.props.implementationType,\n showContextualElement: this.props.showContextualElement,\n placeholders: this.props.placeholders,\n submitAnalytics: this.props.onSubmitAnalytics,\n componentType: this.props.componentType\n };\n\n const sf: SecuredField = new SecuredField(sfInitObj, this.props.i18n)\n .onIframeLoaded((): void => {\n // Count\n this.state.iframeCount += 1;\n\n if (window._b$dl) console.log('### createSecuredFields::onIframeLoaded:: this.state.iframeCount=', this.state.iframeCount);\n\n // One of our existing securedFields has just loaded new content!\n if (this.state.iframeCount > this.state.numIframes) {\n this.destroySecuredFields();\n // TODO send analytics about this error\n throw new AdyenCheckoutError(\n 'ERROR',\n `One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`\n );\n }\n\n /** Create timeout within which time we expect the securedField to configure */\n // @ts-ignore - timeout 'type' *is* a number\n sf.loadToConfigTimeout = setTimeout(() => {\n reject({ type: sfInitObj.fieldType, failReason: 'sf took too long to config' });\n }, SF_CONFIG_TIMEOUT);\n\n // If all iframes are loaded - call onLoad callback\n if (this.state.iframeCount === this.state.originalNumIframes) {\n const callbackObj: CardLoadData = { iframesLoaded: true };\n this.callbacks.onLoad(callbackObj);\n }\n })\n .onConfig((pFeedbackObj: SFFeedbackObj): void => {\n this.handleIframeConfigFeedback(pFeedbackObj);\n\n // Clear timeout since the securedField has configured\n clearTimeout(sf.loadToConfigTimeout);\n sf.loadToConfigTimeout = null;\n\n resolve(pFeedbackObj);\n })\n .onFocus((pFeedbackObj: SFFeedbackObj): void => {\n this.handleFocus(pFeedbackObj);\n })\n .onBinValue((pFeedbackObj: SFFeedbackObj): void => {\n this.handleBinValue(pFeedbackObj);\n })\n .onTouchstart((pFeedbackObj: SFFeedbackObj): void => {\n // re. Disabling arrow keys in iOS - need to disable all other fields in the form\n if (this.props.shouldDisableIOSArrowKeys) {\n /**\n * re. this.hasGenuineTouchEvents...\n * There seems to be an issue with Responsive Design mode in Safari that means it allows setting focus on cross-origin iframes,\n * without enabling the touch events that allow the \"disableIOSArrowKeys\" workaround to fully function.\n * This results in a click on an securedFields *label* leading to, for example, the holderName field being disabled, but w/o access\n * to the touch events that would let it re-enable itself.\n *\n * So we prevent the \"disableIOSArrowKeys\" workaround unless we genuinely have touch events available.\n */\n if (this.hasGenuineTouchEvents || pFeedbackObj.hasGenuineTouchEvents) {\n this.callbacks.onTouchstartIOS({ fieldType: pFeedbackObj.fieldType });\n }\n }\n\n // Only perform this step if we genuinely have touch events available\n if (pFeedbackObj.hasGenuineTouchEvents || this.hasGenuineTouchEvents) {\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n // - pass information about which field has just been clicked (gained focus) to the other iframes\n this.postMessageToAllIframes({ fieldType: pFeedbackObj.fieldType, fieldClick: true });\n }\n })\n .onShiftTab((pFeedbackObj: SFFeedbackObj): void => {\n // Only happens for Firefox & IE <= 11\n this.handleSFShiftTab(pFeedbackObj.fieldType);\n })\n .onEncryption((pFeedbackObj: SFFeedbackObj): void => {\n this.handleEncryption(pFeedbackObj);\n })\n .onValidation((pFeedbackObj: SFFeedbackObj): void => {\n this.handleValidation(pFeedbackObj);\n })\n .onAutoComplete((pFeedbackObj: SFFeedbackObj): void => {\n this.processAutoComplete(pFeedbackObj);\n })\n .onKeyPressed((pFeedbackObj: SFFeedbackObj): void => {\n const { numKey, ...rest } = pFeedbackObj;\n this.callbacks.onKeyPressed(rest as SFKeyPressObj);\n });\n\n // Store reference to securedField in this.state (under fieldType)\n this.state.securedFields[fieldType] = sf;\n });\n}\n"],"names":["createSecuredFields","this","encryptedAttrName","DATA_ENCRYPTED_FIELD_ATTR","securedFields","select","props","rootNode","filter","field","fieldType","getAttribute","isValidType","isSecuredField","console","warn","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","config","isCreditCardType","isSingleBrandedCard","securityCode","createCardSecuredFields","length","createNonCardSecuredFields","async","i","securedField","setupSecuredField","catch","e","window","_b$dl","log","type","state","cardGroupTypes","card","cardType","getCardByBrand","existy","callbackObj","brand","cvcText","setTimeout","callbacks","onBrand","pItem","Promise","resolve","reject","ENCRYPTED_EXPIRY_YEAR","hasSeparateDateFields","sfInitObj","extraFieldData","DATA_INFO","uid","DATA_UID","holderEl","txVariant","iframeUIConfig","sfLogAtStart","trimTrailingSeparator","iframeSrc","loadingContext","showWarnings","legacyInputMode","minimumExpiryDate","maskSecurityCode","exposeExpiryDate","disableIOSArrowKeys","shouldDisableIOSArrowKeys","implementationType","showContextualElement","placeholders","submitAnalytics","onSubmitAnalytics","componentType","sf","SecuredField","i18n","onIframeLoaded","iframeCount","numIframes","destroySecuredFields","AdyenCheckoutError","loadToConfigTimeout","failReason","SF_CONFIG_TIMEOUT","originalNumIframes","iframesLoaded","onLoad","onConfig","pFeedbackObj","handleIframeConfigFeedback","clearTimeout","onFocus","handleFocus","onBinValue","handleBinValue","onTouchstart","hasGenuineTouchEvents","onTouchstartIOS","postMessageToAllIframes","fieldClick","onShiftTab","handleSFShiftTab","onEncryption","handleEncryption","onValidation","handleValidation","onAutoComplete","processAutoComplete","onKeyPressed","numKey","rest"],"mappings":"woCAwBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAeH,GAMnC,OALKE,GACDE,QAAQC,KACJ,aAAaL,mCAA2CT,KAAKC,sFAG9DU,IAULI,EA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UAAUoE,aAAaE,KAIpCpH,KAAKoC,MAAMjC,cAAcM,GAAasE,GAE9C"}
@@ -1,2 +1,2 @@
1
- import{makeCallbackObjectsEncryption as t}from"../utils/callbackUtils.js";import{ENCRYPTED_EXPIRY_YEAR as s,ENCRYPTED_SECURITY_CODE as e,ENCRYPTED_EXPIRY_MONTH as i,ENCRYPTED_CARD_NUMBER as o,ENCRYPTED_EXPIRY_DATE as r}from"../../constants.js";import{processErrors as a}from"../utils/processErrors.js";import{truthy as n}from"../../../../../../utils/commonUtils.js";import l from"../utils/iframes/postMessageToIframe.js";import{hasOwnProperty as p}from"../../../../../../utils/hasOwnProperty.js";import c from"../utils/iframes/getIframeContentWin.js";function d(d){const m=d.fieldType;let f,u;this.config.autoFocus&&("year"!==d.type&&m!==s||this.setFocusOnFrame(e),m===i&&this.setFocusOnFrame(s));const h=d[m];this.state.securedFields[m].isEncrypted=!0,a({error:"",fieldType:m},this.state.securedFields[m],this.state.type,this.props.rootNode,this.callbacks.onError);const y=t({fieldType:m,txVariant:this.state.type,rootNode:this.props.rootNode,encryptedObjArr:h});if(m===i&&p(this.state.securedFields,s)){const t={txVariant:this.state.type,code:d.code,blob:h[0].blob,fieldType:s,numKey:this.state.securedFields[s].numKey};l(t,c(this.state,s),this.config.loadingContext)}for(m===o&&n(d.endDigits)&&(y[0].endDigits=d.endDigits),m===o&&n(d.issuerBin)&&(y[0].issuerBin=+d.issuerBin),m===r&&n(d.expiryDate)&&(y[1].expiryDate=d.expiryDate),f=0,u=y.length;f<u;f+=1)this.callbacks.onFieldValid(y[f]);this.validateForm()}export{d as handleEncryption};
1
+ import{makeCallbackObjectsEncryption as t}from"../utils/callbackUtils.js";import{ENCRYPTED_EXPIRY_YEAR as s,ENCRYPTED_SECURITY_CODE as e,ENCRYPTED_EXPIRY_MONTH as i,ENCRYPTED_CARD_NUMBER as o,ENCRYPTED_EXPIRY_DATE as r}from"../../constants.js";import{processErrors as a}from"../utils/processErrors.js";import{truthy as n}from"../../../../../../utils/commonUtils.js";import l from"../utils/iframes/postMessageToIframe.js";import{hasOwnProperty as p}from"../../../../../../utils/hasOwnProperty.js";import c from"../utils/iframes/getIframeContentWin.js";function d(d){const m=d.fieldType;let f,u;this.config.autoFocus&&("year"!==d.type&&m!==s||this.setFocusOnFrame(e),m===i&&this.setFocusOnFrame(s));const h=d[m];this.state.securedFields[m].isEncrypted=!0,a({error:"",fieldType:d.fieldType},this.state.securedFields[m],this.state.type,this.props.rootNode,this.callbacks.onError);const y=t({fieldType:m,txVariant:this.state.type,rootNode:this.props.rootNode,encryptedObjArr:h});if(m===i&&p(this.state.securedFields,s)){const t={txVariant:this.state.type,code:d.code,blob:h[0].blob,fieldType:s,numKey:this.state.securedFields[s].numKey};l(t,c(this.state,s),this.config.loadingContext)}for(m===o&&n(d.endDigits)&&(y[0].endDigits=d.endDigits),m===o&&n(d.issuerBin)&&(y[0].issuerBin=+d.issuerBin),m===r&&n(d.expiryDate)&&(y[1].expiryDate=d.expiryDate),f=0,u=y.length;f<u;f+=1)this.callbacks.onFieldValid(y[f]);this.validateForm()}export{d as handleEncryption};
2
2
  //# sourceMappingURL=handleEncryption.js.map