@adyen/adyen-web 6.29.0 → 6.31.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 (515) hide show
  1. package/dist/cjs/adyen.css +8 -9
  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 +705 -641
  6. package/dist/es/adyen.css +8 -9
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  9. package/dist/es/components/Ach/Ach.js +1 -1
  10. package/dist/es/components/Ach/Ach.js.map +1 -1
  11. package/dist/es/components/Ach/components/AccountTypeSelector.js.map +1 -1
  12. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  13. package/dist/es/components/Affirm/Affirm.js.map +1 -1
  14. package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
  15. package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
  16. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  17. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  18. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  19. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  20. package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
  21. package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
  22. package/dist/es/components/AmazonPay/utils.js +1 -1
  23. package/dist/es/components/AmazonPay/utils.js.map +1 -1
  24. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  25. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  26. package/dist/es/components/ApplePay/services/ApplePayService.js +1 -1
  27. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  28. package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
  29. package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -1
  30. package/dist/es/components/Atome/Atome.js.map +1 -1
  31. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  32. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  33. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  34. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  35. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  36. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  37. package/dist/es/components/Blik/Blik.js +1 -1
  38. package/dist/es/components/Blik/Blik.js.map +1 -1
  39. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  40. package/dist/es/components/Card/Card.js +1 -1
  41. package/dist/es/components/Card/Card.js.map +1 -1
  42. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  43. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  44. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  45. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  46. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  47. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  48. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  49. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  50. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  51. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  52. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  53. package/dist/es/components/Card/components/ClickToPayWrapper.js +1 -1
  54. package/dist/es/components/Card/components/ClickToPayWrapper.js.map +1 -1
  55. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  56. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  57. package/dist/es/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
  58. package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
  59. package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
  60. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  61. package/dist/es/components/ClickToPay/ClickToPay.js +1 -1
  62. package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
  63. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  64. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  65. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  66. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  67. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  68. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  69. package/dist/es/components/Dropin/Dropin.js +1 -1
  70. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  71. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  72. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  73. package/dist/es/components/Dropin/components/DropinSuccessState.js +2 -0
  74. package/dist/es/components/Dropin/components/DropinSuccessState.js.map +1 -0
  75. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  76. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  77. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  78. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  79. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  80. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  81. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  82. package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
  83. package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
  84. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  85. package/dist/es/components/Iris/Iris.js +1 -1
  86. package/dist/es/components/Iris/Iris.js.map +1 -1
  87. package/dist/es/components/Iris/components/IrisGenerateQRCode.js +1 -1
  88. package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  89. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  90. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  91. package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  92. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  93. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  94. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  95. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  96. package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
  97. package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
  98. package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  99. package/dist/es/components/PayByBankPix/services/PasskeyService.js.map +1 -1
  100. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  101. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  102. package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  103. package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  104. package/dist/es/components/PayTo/PayTo.js +1 -1
  105. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  106. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  107. package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
  108. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  109. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  110. package/dist/es/components/Pix/components/PixQRDetails.js +1 -1
  111. package/dist/es/components/Pix/components/PixQRDetails.js.map +1 -1
  112. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  113. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  114. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  115. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  116. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  117. package/dist/es/components/Twint/Twint.js +1 -1
  118. package/dist/es/components/Twint/Twint.js.map +1 -1
  119. package/dist/es/components/UPI/UPI.js +1 -1
  120. package/dist/es/components/UPI/UPI.js.map +1 -1
  121. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  122. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  123. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  124. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  125. package/dist/es/components/UPI/constants.js +1 -1
  126. package/dist/es/components/UPI/constants.js.map +1 -1
  127. package/dist/es/components/components-name-map.js +1 -1
  128. package/dist/es/components/components-name-map.js.map +1 -1
  129. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  130. package/dist/es/components/internal/Await/Await.js +1 -1
  131. package/dist/es/components/internal/Await/Await.js.map +1 -1
  132. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  133. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  134. package/dist/es/components/internal/Button/Button.js +1 -1
  135. package/dist/es/components/internal/Button/Button.js.map +1 -1
  136. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  137. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  138. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  139. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  140. package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
  141. package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
  142. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  143. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  144. package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  145. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  146. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  147. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  148. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  149. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  150. package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  151. package/dist/es/components/internal/Countdown/index.js +1 -1
  152. package/dist/es/components/internal/Countdown/index.js.map +1 -1
  153. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  154. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  155. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  156. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  157. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  158. package/dist/es/components/internal/PayButton/utils.js +1 -1
  159. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  160. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  161. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  162. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  163. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  164. package/dist/es/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  165. package/dist/es/components/internal/QRLoader/components/QRDetails.js +1 -1
  166. package/dist/es/components/internal/QRLoader/components/QRDetails.js.map +1 -1
  167. package/dist/es/components/internal/QRLoader/components/QRImage.js +1 -1
  168. package/dist/es/components/internal/QRLoader/components/QRImage.js.map +1 -1
  169. package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
  170. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  171. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  172. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  173. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  174. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  175. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  176. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  177. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  178. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  179. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  180. package/dist/es/components/internal/SecuredFields/utils.js.map +1 -1
  181. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  182. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  183. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  184. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  185. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  186. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  187. package/dist/es/components/tx-variants.js +1 -1
  188. package/dist/es/components/tx-variants.js.map +1 -1
  189. package/dist/es/core/Analytics/Analytics.js +1 -1
  190. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  191. package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
  192. package/dist/es/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
  193. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  194. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  195. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  196. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  197. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  198. package/dist/es/core/Analytics/utils.js +1 -1
  199. package/dist/es/core/Analytics/utils.js.map +1 -1
  200. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  201. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  202. package/dist/es/core/Context/AmountProvider.js +2 -0
  203. package/dist/es/core/Context/AmountProvider.js.map +1 -0
  204. package/dist/es/core/Context/Resources.js.map +1 -1
  205. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  206. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  207. package/dist/es/core/config.js +1 -1
  208. package/dist/es/core/core.js +1 -1
  209. package/dist/es/core/core.js.map +1 -1
  210. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  211. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  212. package/dist/es/external/preact/dist/preact.js +1 -1
  213. package/dist/es/external/preact/dist/preact.js.map +1 -1
  214. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  215. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  216. package/dist/es/index.d.ts +705 -641
  217. package/dist/es/language/Language.js.map +1 -1
  218. package/dist/es/utils/Script.js.map +1 -1
  219. package/dist/es/utils/Storage.js +1 -1
  220. package/dist/es/utils/Storage.js.map +1 -1
  221. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  222. package/dist/es/utils/Validator/Validator.js.map +1 -1
  223. package/dist/es/utils/amount-util.js +1 -1
  224. package/dist/es/utils/amount-util.js.map +1 -1
  225. package/dist/es/utils/browserInfo.js +1 -1
  226. package/dist/es/utils/browserInfo.js.map +1 -1
  227. package/dist/es/utils/constants/currency-minor-units.js.map +1 -1
  228. package/dist/es/utils/createSdkData.js.map +1 -1
  229. package/dist/es/utils/getErrorMessage.js.map +1 -1
  230. package/dist/es/utils/getProp.js +1 -1
  231. package/dist/es/utils/getProp.js.map +1 -1
  232. package/dist/es/utils/hasOwnProperty.js.map +1 -1
  233. package/dist/es/utils/isValidURL.js.map +1 -1
  234. package/dist/es/utils/listenerUtils.js.map +1 -1
  235. package/dist/es/utils/promiseTimeout.js.map +1 -1
  236. package/dist/es/utils/textUtils.js.map +1 -1
  237. package/dist/es/utils/validator-utils.js.map +1 -1
  238. package/dist/es-legacy/adyen.css +8 -9
  239. package/dist/es-legacy/adyen.css.map +1 -1
  240. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  241. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  242. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  243. package/dist/es-legacy/components/Ach/components/AccountTypeSelector.js.map +1 -1
  244. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  245. package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
  246. package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
  247. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
  248. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  249. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  250. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  251. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  252. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
  253. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
  254. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  255. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  256. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  257. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  258. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js +1 -1
  259. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  260. package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
  261. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  262. package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
  263. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  264. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  265. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  266. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  267. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  268. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  269. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  270. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  271. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  272. package/dist/es-legacy/components/Card/Card.js +1 -1
  273. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  274. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  275. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  276. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  277. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  278. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  279. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  280. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  281. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  282. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  283. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  284. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  285. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  286. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  287. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  288. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  289. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  290. package/dist/es-legacy/components/Card/components/Fastlane/USOnlyPhoneInput.js.map +1 -1
  291. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  292. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  293. package/dist/es-legacy/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
  294. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
  295. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
  296. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  297. package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
  298. package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
  299. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  300. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  301. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  302. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  303. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  304. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  305. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  306. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  307. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  308. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  309. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  310. package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js +2 -0
  311. package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js.map +1 -0
  312. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  313. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  314. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  315. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  316. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  317. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  318. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  319. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
  320. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
  321. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  322. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  323. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  324. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  325. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +1 -1
  326. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  327. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  328. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  329. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  330. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  331. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  332. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  333. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  334. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  335. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  336. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
  337. package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
  338. package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
  339. package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  340. package/dist/es-legacy/components/PayByBankPix/services/PasskeyService.js.map +1 -1
  341. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  342. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  343. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  344. package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  345. package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  346. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  347. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  348. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  349. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
  350. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  351. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
  352. package/dist/es-legacy/components/Pix/components/PixQRDetails.js +1 -1
  353. package/dist/es-legacy/components/Pix/components/PixQRDetails.js.map +1 -1
  354. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  355. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  356. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  357. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  358. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  359. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  360. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  361. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  362. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  363. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  364. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  365. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  366. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  367. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  368. package/dist/es-legacy/components/UPI/constants.js +1 -1
  369. package/dist/es-legacy/components/UPI/constants.js.map +1 -1
  370. package/dist/es-legacy/components/components-name-map.js +1 -1
  371. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  372. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  373. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  374. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  375. package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
  376. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  377. package/dist/es-legacy/components/internal/Await/Await.js +1 -1
  378. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  379. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  380. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  381. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  382. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  383. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  384. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  385. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  386. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  387. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  388. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  389. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  390. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
  391. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
  392. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  393. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  394. package/dist/es-legacy/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  395. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  396. package/dist/es-legacy/components/internal/ClickToPay/services/create-clicktopay-service.js.map +1 -1
  397. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  398. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  399. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  400. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  401. package/dist/es-legacy/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  402. package/dist/es-legacy/components/internal/Countdown/index.js +1 -1
  403. package/dist/es-legacy/components/internal/Countdown/index.js.map +1 -1
  404. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  405. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  406. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  407. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +1 -1
  408. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  409. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  410. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  411. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  412. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  413. package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
  414. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  415. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  416. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  417. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  418. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  419. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  420. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  421. package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js +1 -1
  422. package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js.map +1 -1
  423. package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js +1 -1
  424. package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js.map +1 -1
  425. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  426. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  427. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  428. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  429. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  430. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  431. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  432. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  433. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  434. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
  435. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  436. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  437. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  438. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  439. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  440. package/dist/es-legacy/components/internal/SecuredFields/utils.js.map +1 -1
  441. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  442. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  443. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  444. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  445. package/dist/es-legacy/components/internal/Tooltip/Tooltip.js.map +1 -1
  446. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  447. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  448. package/dist/es-legacy/components/tx-variants.js +1 -1
  449. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  450. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  451. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  452. package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
  453. package/dist/es-legacy/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
  454. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  455. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  456. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  457. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  458. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  459. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  460. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  461. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
  462. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
  463. package/dist/es-legacy/core/Context/AmountProvider.js +2 -0
  464. package/dist/es-legacy/core/Context/AmountProvider.js.map +1 -0
  465. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  466. package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
  467. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  468. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  469. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  470. package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  471. package/dist/es-legacy/core/Services/http.js.map +1 -1
  472. package/dist/es-legacy/core/config.js +1 -1
  473. package/dist/es-legacy/core/core.js +1 -1
  474. package/dist/es-legacy/core/core.js.map +1 -1
  475. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  476. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  477. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  478. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  479. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  480. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  481. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  482. package/dist/es-legacy/language/Language.js.map +1 -1
  483. package/dist/es-legacy/utils/Script.js.map +1 -1
  484. package/dist/es-legacy/utils/Storage.js +1 -1
  485. package/dist/es-legacy/utils/Storage.js.map +1 -1
  486. package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
  487. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  488. package/dist/es-legacy/utils/amount-util.js +1 -1
  489. package/dist/es-legacy/utils/amount-util.js.map +1 -1
  490. package/dist/es-legacy/utils/browserInfo.js +1 -1
  491. package/dist/es-legacy/utils/browserInfo.js.map +1 -1
  492. package/dist/es-legacy/utils/constants/currency-minor-units.js.map +1 -1
  493. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  494. package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
  495. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  496. package/dist/es-legacy/utils/getProp.js +1 -1
  497. package/dist/es-legacy/utils/getProp.js.map +1 -1
  498. package/dist/es-legacy/utils/hasOwnProperty.js.map +1 -1
  499. package/dist/es-legacy/utils/isValidURL.js.map +1 -1
  500. package/dist/es-legacy/utils/listenerUtils.js.map +1 -1
  501. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  502. package/dist/es-legacy/utils/textUtils.js.map +1 -1
  503. package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
  504. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  505. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  506. package/package.json +11 -11
  507. package/styles/adyen.css +8 -9
  508. package/dist/es/components/UPI/components/VpaInput/VpaInput.js +0 -2
  509. package/dist/es/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
  510. package/dist/es/components/UPI/components/VpaInput/validate.js +0 -2
  511. package/dist/es/components/UPI/components/VpaInput/validate.js.map +0 -1
  512. package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js +0 -2
  513. package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
  514. package/dist/es-legacy/components/UPI/components/VpaInput/validate.js +0 -2
  515. package/dist/es-legacy/components/UPI/components/VpaInput/validate.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{Component as t}from"../../../../external/preact/dist/preact.js";import{getFields as s,validFieldsReducer as e,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import r from"../lib/CSF/initCSF.js";import n from"./SecuredFieldsProviderHandlers.js";import d from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as a,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,DATE_POLICY_REQUIRED as p,CVC_POLICY_REQUIRED as c}from"../lib/constants.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as f}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as m}from"../../../../core/Errors/constants.js";function O(t,s,e){return s in t?Object.defineProperty(t,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[s]=e,t}function y(t){for(var s=1;s<arguments.length;s++){var e=null!=arguments[s]?arguments[s]:{},i=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.forEach(function(s){O(t,s,e[s])})}return t}function F(t,s){return s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):function(t){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);s.push.apply(s,e)}return s}(Object(s)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}),t}class C extends t{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const t=s(this.rootNode),i=t.reduce(e,{});this.setState({valid:i}),t.forEach(t=>{this.numCharsInField[t]=0}),this.numDateFields=t.filter(t=>t.match(/Expiry/)).length,t.length?(this.destroy(),this.initializeCSF(this.rootNode)):this.handleOnNoDataRequired()}componentDidUpdate(){var t,s;this.checkForKCPFields(),null===(t=(s=this.props).onStateUpdate)||void 0===t||t.call(s,this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(t){var s;let e=this.props.loadingContext;const i={rootNode:t,type:this.props.type,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:e,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyPressed:this.handleKeyPressed},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:null!==(s=this.props.placeholders)&&void 0!==s?s:{},showContextualElement:this.props.showContextualElement};this.csf=r(i),this.csfLoadFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new u("ERROR","secured field iframes have failed to load")))},this.csfLoadFailTimeoutMS)}checkForKCPFields(){let t=!1;if(this.props.koreanAuthenticationRequired&&(t=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!t){const t=t=>({data:F(y({},t.data),{[a]:void 0}),valid:F(y({},t.valid),{[a]:!1}),errors:F(y({},t.errors),{[a]:!1}),hasKoreanFields:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(a),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&t){const t=t=>({valid:F(y({},t.valid),{[a]:!1}),hasKoreanFields:!0,isSfpValid:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(a),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(t){const s=!!t.error;return s&&this.setState({detectedUnsupportedBrands:t.detectedBrands}),t.rootNode=this.rootNode,this.handleOnError(t,s),this.csf&&this.csf.hasUnsupportedCard(h,t.error),s}setFocusOn(t){this.csf&&this.csf.setFocusOnFrame(t)}updateStyles(t){this.csf&&this.csf.updateStyles(t)}sfIsOptionalOrHidden(t){return this.csf.sfIsOptionalOrHidden(t)}destroy(){this.csf&&this.csf.destroy()}showValidation(){const{numDateFields:t,state:s}=this;Object.keys(s.valid).reduce(i(t,s),[]).forEach(t=>{const e=o(t,this.rootNode,s);this.handleOnError(e,!!s.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(t,e.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((t,s)=>{const e=this.state.errors[s];return t[s]=e?y({isValid:!1,errorMessage:f(e,m),errorI18n:this.props.i18n.get(e),error:e,rootNode:this.rootNode},this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}):null,t},{})}processBinLookupResponse(t,s){var e;if(this.state.detectedUnsupportedBrands&&(this.setState(t=>({errors:F(y({},t.errors),{[h]:!1}),detectedUnsupportedBrands:null})),this.csf&&t)){const t={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(t)}this.issuingCountryCode=null==t||null===(e=t.issuingCountryCode)||void 0===e?void 0:e.toLowerCase();const i=(null==s?void 0:s.brand)&&l.includes(s.brand);i&&this.setState(s,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(t,i?s:null)}render(t,s){return t.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},s)}constructor(t){super(t),O(this,"csfLoadFailTimeout",void 0),O(this,"csfLoadFailTimeoutMS",void 0),O(this,"csfConfigFailTimeout",void 0),O(this,"csfConfigFailTimeoutMS",void 0),O(this,"numCharsInField",void 0),O(this,"rootNode",void 0),O(this,"numDateFields",void 0),O(this,"csf",void 0),O(this,"handleOnLoad",void 0),O(this,"handleOnConfigSuccess",void 0),O(this,"handleOnFieldValid",void 0),O(this,"handleOnAllValid",void 0),O(this,"handleOnBrand",void 0),O(this,"handleFocus",void 0),O(this,"handleOnError",void 0),O(this,"handleOnAutoComplete",void 0),O(this,"handleOnNoDataRequired",void 0),O(this,"handleOnTouchstartIOS",void 0),O(this,"handleKeyPressed",void 0),O(this,"state",void 0),O(this,"props",void 0),O(this,"issuingCountryCode",void 0),O(this,"setRootNode",t=>{this.rootNode=t});const s={status:"loading",brand:t.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:t.hasKoreanFields};this.state=s,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=n.handleOnLoad.bind(this),this.handleOnConfigSuccess=n.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=n.handleOnFieldValid.bind(this),this.handleOnAllValid=n.handleOnAllValid.bind(this),this.handleOnBrand=n.handleOnBrand.bind(this),this.handleFocus=n.handleFocus.bind(this),this.handleOnError=n.handleOnError.bind(this),this.handleOnNoDataRequired=n.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=n.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=n.handleOnTouchstartIOS.bind(this),this.handleKeyPressed=n.handleKeyPressed.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}O(C,"defaultProps",d);export{C as default};
1
+ import{Component as t}from"../../../../external/preact/dist/preact.js";import{getFields as e,validFieldsReducer as s,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import n from"../lib/CSF/initCSF.js";import r from"./SecuredFieldsProviderHandlers.js";import d from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as a,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,DATE_POLICY_REQUIRED as p,CVC_POLICY_REQUIRED as c}from"../lib/constants.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as m}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as f}from"../../../../core/Errors/constants.js";import{TxVariants as y}from"../../../tx-variants.js";function O(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function C(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),i.forEach(function(e){O(t,e,s[e])})}return t}function F(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e}(Object(e)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))}),t}class b extends t{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const t=e(this.rootNode),i=t.reduce(s,{});this.setState({valid:i}),t.forEach(t=>{this.numCharsInField[t]=0}),this.numDateFields=t.filter(t=>t.match(/Expiry/)).length,t.length?(this.destroy(),this.initializeCSF(this.rootNode)):(this.props.componentType===y.customCard&&console.debug('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>'),this.handleOnNoDataRequired())}componentDidUpdate(){var t,e;this.checkForKCPFields(),null===(t=(e=this.props).onStateUpdate)||void 0===t||t.call(e,this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(t){var e;let s=this.props.loadingContext;const i={rootNode:t,type:this.props.type,componentType:this.props.componentType,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:s,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,onSubmitAnalytics:this.props.onSubmitAnalytics,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyPressed:this.handleKeyPressed},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:null!==(e=this.props.placeholders)&&void 0!==e?e:{},showContextualElement:this.props.showContextualElement};this.csf=n(i),this.csfLoadFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new u("ERROR","secured field iframes have failed to load")))},this.csfLoadFailTimeoutMS)}checkForKCPFields(){let t=!1;if(this.props.koreanAuthenticationRequired&&(t=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!t){const t=t=>({data:F(C({},t.data),{[a]:void 0}),valid:F(C({},t.valid),{[a]:!1}),errors:F(C({},t.errors),{[a]:!1}),hasKoreanFields:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(a),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&t){const t=t=>({valid:F(C({},t.valid),{[a]:!1}),hasKoreanFields:!0,isSfpValid:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(a),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(t){const e=!!t.error;return e&&this.setState({detectedUnsupportedBrands:t.detectedBrands}),t.rootNode=this.rootNode,this.handleOnError(t,e),this.csf&&this.csf.hasUnsupportedCard(h,t.error),e}setFocusOn(t){this.csf&&this.csf.setFocusOnFrame(t)}updateStyles(t){this.csf&&this.csf.updateStyles(t)}sfIsOptionalOrHidden(t){return this.csf.sfIsOptionalOrHidden(t)}destroy(){this.csf&&this.csf.destroy()}showValidation(){const{numDateFields:t,state:e}=this;Object.keys(e.valid).reduce(i(t,e),[]).forEach(t=>{const s=o(t,this.rootNode,e);this.handleOnError(s,!!e.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(t,s.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((t,e)=>{const s=this.state.errors[e];return t[e]=s?C({isValid:!1,errorMessage:m(s,f),errorI18n:this.props.i18n.get(s),error:s,rootNode:this.rootNode},this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}):null,t},{})}processBinLookupResponse(t,e){var s;if(this.state.detectedUnsupportedBrands&&(this.setState(t=>({errors:F(C({},t.errors),{[h]:!1}),detectedUnsupportedBrands:null})),this.csf&&t)){const t={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(t)}this.issuingCountryCode=null==t||null===(s=t.issuingCountryCode)||void 0===s?void 0:s.toLowerCase();const i=(null==e?void 0:e.brand)&&l.includes(e.brand);i&&this.setState(e,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(t,i?e:null)}render(t,e){return t.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},e)}constructor(t){super(t),O(this,"csfLoadFailTimeout",void 0),O(this,"csfLoadFailTimeoutMS",void 0),O(this,"csfConfigFailTimeout",void 0),O(this,"csfConfigFailTimeoutMS",void 0),O(this,"numCharsInField",void 0),O(this,"rootNode",void 0),O(this,"numDateFields",void 0),O(this,"csf",void 0),O(this,"handleOnLoad",void 0),O(this,"handleOnConfigSuccess",void 0),O(this,"handleOnFieldValid",void 0),O(this,"handleOnAllValid",void 0),O(this,"handleOnBrand",void 0),O(this,"handleFocus",void 0),O(this,"handleOnError",void 0),O(this,"handleOnAutoComplete",void 0),O(this,"handleOnNoDataRequired",void 0),O(this,"handleOnTouchstartIOS",void 0),O(this,"handleKeyPressed",void 0),O(this,"state",void 0),O(this,"props",void 0),O(this,"issuingCountryCode",void 0),O(this,"setRootNode",t=>{this.rootNode=t});const e={status:"loading",brand:t.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:t.hasKoreanFields};this.state=e,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=r.handleOnLoad.bind(this),this.handleOnConfigSuccess=r.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=r.handleOnFieldValid.bind(this),this.handleOnAllValid=r.handleOnAllValid.bind(this),this.handleOnBrand=r.handleOnBrand.bind(this),this.handleFocus=r.handleFocus.bind(this),this.handleOnError=r.handleOnError.bind(this),this.handleOnNoDataRequired=r.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=r.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=r.handleOnTouchstartIOS.bind(this),this.handleKeyPressed=r.handleKeyPressed.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}O(b,"defaultProps",d);export{b as default};
2
2
  //# sourceMappingURL=SecuredFieldsProvider.js.map
@@ -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';\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 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(); // TODO test if this solves the React double render problem.\n this.initializeCSF(this.rootNode);\n } else {\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 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 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]: false },\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 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]: false },\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","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","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","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":"u8CA8BA,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,WAExBF,KAAKoB,wBAEb,CAEOC,kBAAAA,OAGHC,EAAAC,EAFAvB,KAAKwB,oBAEmB,QAAxBF,GAAAC,EAAAvB,KAAKC,OAAMwB,qBAAX,IAAAH,GAAAA,EAAAI,KAAAH,EAA2BvB,KAAK2B,MACpC,CAEOC,oBAAAA,GACH5B,KAAK6B,IAAM,KACXC,aAAa9B,KAAK+B,oBAClBD,aAAa9B,KAAKgC,qBACtB,CAEQb,aAAAA,CAAcc,GA6CA,IAAAC,EA5ClB,IAAIC,EAAiBnC,KAAKC,MAAMkC,eAOhC,MAAMC,EAA8B,CAChClC,SAAU+B,EACVI,KAAMrC,KAAKC,MAAMoC,KACjBC,UAAWtC,KAAKC,MAAMqC,UACtBC,eAAgBvC,KAAKC,MAAMuC,OAC3BC,UAAWzC,KAAKC,MAAMwC,UACtBC,sBAAuB1C,KAAKC,MAAMyC,sBAClCP,iBACAQ,UAAW3C,KAAKC,MAAM0C,UACtBC,aAAc5C,KAAKC,MAAM2C,aACzBC,eAAgB,CACZC,SAAU9C,KAAKC,MAAM8C,QAEzBC,KAAMhD,KAAKC,MAAM+C,KACjBC,UAAW,CACPC,OAAQlD,KAAKmD,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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 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]: false },\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 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]: false },\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","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,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GvBZ,KAAKyD,aAAe6G,EAAS7G,aAAa8G,KAAKvK,MAC/CA,KAAK2D,sBAAwB2G,EAAS3G,sBAAsB4G,KAAKvK,MACjEA,KAAK6D,mBAAqByG,EAASzG,mBAAmB0G,KAAKvK,MAC3DA,KAAK+D,iBAAmBuG,EAASvG,iBAAiBwG,KAAKvK,MACvDA,KAAKiE,cAAgBqG,EAASrG,cAAcsG,KAAKvK,MACjDA,KAAKqE,YAAciG,EAASjG,YAAYkG,KAAKvK,MAC7CA,KAAKmE,cAAgBmG,EAASnG,cAAcoG,KAAKvK,MACjDA,KAAKyB,uBAAyB6I,EAAS7I,uBAAuB8I,KAAKvK,MACnEA,KAAKwE,qBAAuB8F,EAAS9F,qBAAqB+F,KAAKvK,MAC/DA,KAAK4E,sBAAwB0F,EAAS1F,sBAAsB2F,KAAKvK,MACjEA,KAAK8E,iBAAmBwF,EAASxF,iBAAiByF,KAAKvK,MAEvDA,KAAKkJ,yBAA2BlJ,KAAKkJ,yBAAyBqB,KAAKvK,MAGnEA,KAAK0H,WAAa1H,KAAK0H,WAAW6C,KAAKvK,MACvCA,KAAK6H,aAAe7H,KAAK6H,aAAa0C,KAAKvK,MAC3CA,KAAKmH,sBAAwBnH,KAAKmH,sBAAsBoD,KAAKvK,MAC7DA,KAAKiI,eAAiBjI,KAAKiI,eAAesC,KAAKvK,MAC/CA,KAAKkB,QAAUlB,KAAKkB,QAAQqJ,KAAKvK,KACrC,EAEA8J,EAvEEjK,EAuEY2K,eAAeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/extensions.ts"],"sourcesContent":["import { SingleBrandResetObject } from '../SFP/types';\nimport { BrandObject } from '../../../Card/types';\nimport createCardVariantSwitcher from './createCardVariantSwitcher';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../lib/constants';\nimport { mustHandleDualBrandingAccordingToEURegulations } from '../../../Card/components/CardInput/utils';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../../Card/constants';\n\n// Externally testable utils\nexport const containsExcludedBrand = (brandsArr: BrandObject[], excludedBrands: string[]): boolean => {\n return brandsArr.reduce((acc, brandObj) => acc || excludedBrands.includes(brandObj.brand), false);\n};\n\nexport const cloneBrandsArr = (brandsArr: BrandObject[]): BrandObject[] => brandsArr.map(item => ({ ...item }));\n\nexport const removeExcludedBrand = (brandsArr: BrandObject[], mainBrand1 = 'mc', mainBrand2 = 'visa'): BrandObject[] => {\n const clonedBrands: BrandObject[] = cloneBrandsArr(brandsArr);\n\n if (clonedBrands[0].brand !== mainBrand1 && clonedBrands[0].brand !== mainBrand2) clonedBrands.reverse();\n clonedBrands.length = 1;\n return clonedBrands;\n};\n// --\n\nexport default function extensions(props, refs, states, hasPanLengthRef: Partial<{ current }> = {}) {\n // Destructure props, refs and state hooks\n const { type, cvcPolicy } = props;\n const { sfp } = refs;\n const { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode } = states;\n\n return {\n /**\n * Handle the binLookup response object generated in triggerBinLookup and process it in relation to the CardInput and it's sub-components.\n * e.g. we might need to add/remove additional markup (a selector for brands), and inform SFP of the issuingCountryCode & detected brand(s).\n *\n * @param binLookupResponse -\n * @param isReset -\n */\n processBinLookup: (binLookupResponse, isReset) => {\n const issuingCode = binLookupResponse?.issuingCountryCode ? binLookupResponse.issuingCountryCode.toLowerCase() : null;\n setIssuingCountryCode(issuingCode);\n\n // Reset UI\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // If /binLookup has 'reset' then for a generic card the internal regex will kick in to show the right brand icon - so set to null\n // However for a single-branded card we need to pass the \"base\" type so the brand logo is reset - so set to type\n const brandToReset = isReset && type !== 'card' ? type : null;\n\n sfp.current.processBinLookupResponse(binLookupResponse, {\n brand: brandToReset,\n cvcPolicy: cvcPolicy // undefined except for Bancontact\n } as SingleBrandResetObject);\n\n // Reset storage var\n hasPanLengthRef.current = 0;\n return;\n }\n\n // RESULT: binLookup has found a result so proceed accordingly\n if (binLookupResponse.supportedBrands?.length) {\n const hasExcludedBrand: boolean = containsExcludedBrand(binLookupResponse.supportedBrands, BRAND_ICON_UI_EXCLUSION_LIST);\n\n const supportedBrands: BrandObject[] = hasExcludedBrand\n ? removeExcludedBrand(binLookupResponse.supportedBrands)\n : cloneBrandsArr(binLookupResponse.supportedBrands);\n\n // 1) Multiple options found - add to the UI & inform SFP\n if (supportedBrands.length > 1) {\n // --\n\n // Only if the brands in DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM are present in the binLookup response should we handle dual branding based on EU regulations\n const preselectBrand = mustHandleDualBrandingAccordingToEURegulations(\n DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM,\n supportedBrands,\n 'brand'\n );\n\n const switcherObj = createCardVariantSwitcher(supportedBrands, preselectBrand);\n\n // Set properties on state to trigger the dual branding icons in the UI\n setDualBrandSelectElements(switcherObj.dualBrandSelectElements);\n setSelectedBrandValue(switcherObj.selectedBrandValue); // initially this value from switcherObj will be ''\n\n // Pass an object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands: [switcherObj.leadBrand]\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (switcherObj.leadBrand.panLength > 0) {\n hasPanLengthRef.current = switcherObj.leadBrand.panLength;\n }\n\n // 2) Single option found (binValueObject.supportedBrands.length === 1)\n } else {\n // Reset UI\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // Set (single) value from binLookup so it will be added to the 'brand' property in the paymentMethod object\n // EXCEPT - if we are dealing with a brand that we exclude from the UI\n if (!hasExcludedBrand) setSelectedBrandValue(supportedBrands[0].brand);\n\n // Pass object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (supportedBrands[0].panLength > 0) {\n hasPanLengthRef.current = supportedBrands[0].panLength;\n }\n }\n }\n },\n /**\n * Handler for clicks on the icons added in response to the /binLookup call\n * Inform SFP of the brand changes when these selections are made\n */\n handleDualBrandSelection: (e: Event | string): void => {\n let value: Event | string = e;\n if (e instanceof Event) {\n const target = e.target as HTMLLIElement;\n value = target.getAttribute('data-value') || target.getAttribute('value');\n }\n\n // Check if we have a value and whether that value corresponds to a brandObject we can propagate\n // If either are false then abandon the process\n let brandObjArr: BrandObject[] = [];\n if (value) {\n // Find the brandObject with the matching brand value and place into an array\n brandObjArr = dualBrandSelectElements.reduce((acc, item) => {\n if (item.brandObject.brand === value) {\n acc.push(item.brandObject);\n }\n return acc;\n }, []);\n\n if (!brandObjArr.length) {\n return; // no brand object associated with value was found\n }\n } else {\n return; // no value passed\n }\n\n setSelectedBrandValue(value);\n\n // Pass brand object into SecuredFields\n sfp.current.processBinLookupResponse({\n issuingCountryCode,\n supportedBrands: brandObjArr,\n isDualBrandSelection: true\n });\n }\n };\n}\n"],"names":["containsExcludedBrand","brandsArr","excludedBrands","reduce","acc","brandObj","includes","brand","cloneBrandsArr","map","item","_object_spread","removeExcludedBrand","mainBrand1","mainBrand2","clonedBrands","reverse","length","extensions","props","refs","states","hasPanLengthRef","type","cvcPolicy","sfp","dualBrandSelectElements","setDualBrandSelectElements","setSelectedBrandValue","issuingCountryCode","setIssuingCountryCode","processBinLookup","binLookupResponse","isReset","issuingCode","toLowerCase","Object","keys","brandToReset","current","processBinLookupResponse","supportedBrands","hasExcludedBrand","BRAND_ICON_UI_EXCLUSION_LIST","preselectBrand","mustHandleDualBrandingAccordingToEURegulations","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","switcherObj","createCardVariantSwitcher","selectedBrandValue","leadBrand","panLength","handleDualBrandSelection","e","value","Event","target","getAttribute","brandObjArr","brandObject","push","isDualBrandSelection"],"mappings":"6aAQO,MAAMA,EAAwB,CAACC,EAA0BC,IACrDD,EAAUE,OAAO,C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AYrB,yBACvCE,EAAsBmB,EAAYE,oBAGlCxB,EAAIc,QAAQC,yBAAyB,CACjCX,mBAAoBG,EAAkBH,mBACtCY,gBAAiB,CAACM,EAAYG,aAI9BH,EAAYG,UAAUC,UAAY,IAClC7B,EAAgBiB,QAAUQ,EAAYG,UAAUC,UAIxD,MAEIxB,EAA2B,IAC3BC,EAAsB,IAIjBc,GAAkBd,EAAsBa,EAAgB,GAAGlC,OAGhEkB,EAAIc,QAAQC,yBAAyB,CACjCX,mBAAoBG,EAAkBH,mBACtCY,oBAIAA,EAAgB,GAAGU,UAAY,IAC/B7B,EAAgBiB,QAAUE,EAAgB,GAAGU,UAGzD,GAMJC,yBAA2BC,IACvB,IAAIC,EAAwBD,EAC5B,GAAIA,aAAaE,MAAO,CACpB,MAAMC,EAASH,EAAEG,OACjBF,EAAQE,EAAOC,aAAa,eAAiBD,EAAOC,aAAa,QACrE,CAIA,IAAIC,EAA6B,GAC7BJ,IAEAI,EAAchC,EAAwBvB,OAAO,CAACC,EAAKM,KAC3CA,EAAKiD,YAAYpD,QAAU+C,GAC3BlD,EAAIwD,KAAKlD,EAAKiD,aAEXvD,GACR,IAEEsD,EAAYzC,SAOrBW,EAAsB0B,GAGtB7B,EAAIc,QAAQC,yBAAyB,CACjCX,qBACAY,gBAAiBiB,EACjBG,sBAAsB,OAItC"}
1
+ {"version":3,"file":"extensions.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/extensions.ts"],"sourcesContent":["import { SingleBrandResetObject } from '../SFP/types';\nimport { BrandObject } from '../../../Card/types';\nimport createCardVariantSwitcher from './createCardVariantSwitcher';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../lib/constants';\nimport { mustHandleDualBrandingAccordingToEURegulations } from '../../../Card/components/CardInput/utils';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../../Card/constants';\n\n// Externally testable utils\nexport const containsExcludedBrand = (brandsArr: BrandObject[], excludedBrands: string[]): boolean => {\n return brandsArr.reduce((acc, brandObj) => acc || excludedBrands.includes(brandObj.brand), false);\n};\n\nexport const cloneBrandsArr = (brandsArr: BrandObject[]): BrandObject[] => brandsArr.map(item => ({ ...item }));\n\nexport const removeExcludedBrand = (brandsArr: BrandObject[], mainBrand1 = 'mc', mainBrand2 = 'visa'): BrandObject[] => {\n const clonedBrands: BrandObject[] = cloneBrandsArr(brandsArr);\n\n if (clonedBrands[0].brand !== mainBrand1 && clonedBrands[0].brand !== mainBrand2) clonedBrands.reverse();\n clonedBrands.length = 1;\n return clonedBrands;\n};\n// --\n\nexport default function extensions(props, refs, states, hasPanLengthRef: Partial<{ current }> = {}) {\n // Destructure props, refs and state hooks\n const { type, cvcPolicy } = props;\n const { sfp } = refs;\n const { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode } = states;\n\n return {\n /**\n * Handle the binLookup response object generated in triggerBinLookup and process it in relation to the CardInput and it's sub-components.\n * e.g. we might need to add/remove additional markup (a selector for brands), and inform SFP of the issuingCountryCode & detected brand(s).\n *\n * @param binLookupResponse -\n * @param isReset -\n */\n processBinLookup: (binLookupResponse, isReset) => {\n const issuingCode = binLookupResponse?.issuingCountryCode ? binLookupResponse.issuingCountryCode.toLowerCase() : null;\n setIssuingCountryCode(issuingCode);\n\n // Reset UI\n if (!binLookupResponse || !Object.keys(binLookupResponse).length) {\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // If /binLookup has 'reset' then for a generic card the internal regex will kick in to show the right brand icon - so set to null\n // However for a single-branded card we need to pass the \"base\" type so the brand logo is reset - so set to type\n const brandToReset = isReset && type !== 'card' ? type : null;\n\n sfp.current.processBinLookupResponse(binLookupResponse, {\n brand: brandToReset,\n cvcPolicy: cvcPolicy // undefined except for Bancontact\n } as SingleBrandResetObject);\n\n // Reset storage var\n hasPanLengthRef.current = 0;\n return;\n }\n\n // RESULT: binLookup has found a result so proceed accordingly\n if (binLookupResponse.supportedBrands?.length) {\n const hasExcludedBrand: boolean = containsExcludedBrand(binLookupResponse.supportedBrands, BRAND_ICON_UI_EXCLUSION_LIST);\n\n const supportedBrands: BrandObject[] = hasExcludedBrand\n ? removeExcludedBrand(binLookupResponse.supportedBrands)\n : cloneBrandsArr(binLookupResponse.supportedBrands);\n\n // 1) Multiple options found - add to the UI & inform SFP\n if (supportedBrands.length > 1) {\n // --\n\n // Only if the brands in DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM are present in the binLookup response should we handle dual branding based on EU regulations\n const preselectBrand = mustHandleDualBrandingAccordingToEURegulations(\n DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM,\n supportedBrands,\n 'brand'\n );\n\n const switcherObj = createCardVariantSwitcher(supportedBrands, preselectBrand);\n\n // Set properties on state to trigger the dual branding icons in the UI\n setDualBrandSelectElements(switcherObj.dualBrandSelectElements);\n setSelectedBrandValue(switcherObj.selectedBrandValue); // initially this value from switcherObj will be ''\n\n // Pass an object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands: [switcherObj.leadBrand]\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (switcherObj.leadBrand.panLength > 0) {\n hasPanLengthRef.current = switcherObj.leadBrand.panLength;\n }\n\n // 2) Single option found (binValueObject.supportedBrands.length === 1)\n } else {\n // Reset UI\n setDualBrandSelectElements([]);\n setSelectedBrandValue('');\n\n // Set (single) value from binLookup so it will be added to the 'brand' property in the paymentMethod object\n // EXCEPT - if we are dealing with a brand that we exclude from the UI\n if (!hasExcludedBrand) setSelectedBrandValue(supportedBrands[0].brand);\n\n // Pass object through to SFP\n sfp.current.processBinLookupResponse({\n issuingCountryCode: binLookupResponse.issuingCountryCode,\n supportedBrands\n });\n\n // Store the fact the binLookup obj has a panLength prop\n if (supportedBrands[0].panLength > 0) {\n hasPanLengthRef.current = supportedBrands[0].panLength;\n }\n }\n }\n },\n /**\n * Handler for clicks on the icons added in response to the /binLookup call\n * Inform SFP of the brand changes when these selections are made\n */\n handleDualBrandSelection: (e: Event | string): void => {\n let value: Event | string = e;\n if (e instanceof Event) {\n const target = e.target as HTMLLIElement;\n value = target.getAttribute('data-value') || target.getAttribute('value');\n }\n\n // Check if we have a value and whether that value corresponds to a brandObject we can propagate\n // If either are false then abandon the process\n let brandObjArr: BrandObject[] = [];\n if (value) {\n // Find the brandObject with the matching brand value and place into an array\n brandObjArr = dualBrandSelectElements.reduce((acc, item) => {\n if (item.brandObject.brand === value) {\n acc.push(item.brandObject);\n }\n return acc;\n }, []);\n\n if (!brandObjArr.length) {\n return; // no brand object associated with value was found\n }\n } else {\n return; // no value passed\n }\n\n setSelectedBrandValue(value);\n\n // Pass brand object into SecuredFields\n sfp.current.processBinLookupResponse({\n issuingCountryCode,\n supportedBrands: brandObjArr,\n isDualBrandSelection: true\n });\n }\n };\n}\n"],"names":["containsExcludedBrand","brandsArr","excludedBrands","reduce","acc","brandObj","includes","brand","cloneBrandsArr","map","item","_object_spread","removeExcludedBrand","mainBrand1","mainBrand2","clonedBrands","reverse","length","extensions","props","refs","states","hasPanLengthRef","type","cvcPolicy","sfp","dualBrandSelectElements","setDualBrandSelectElements","setSelectedBrandValue","issuingCountryCode","setIssuingCountryCode","processBinLookup","binLookupResponse","isReset","issuingCode","toLowerCase","Object","keys","brandToReset","current","processBinLookupResponse","supportedBrands","hasExcludedBrand","BRAND_ICON_UI_EXCLUSION_LIST","preselectBrand","mustHandleDualBrandingAccordingToEURegulations","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","switcherObj","createCardVariantSwitcher","selectedBrandValue","leadBrand","panLength","handleDualBrandSelection","e","value","Event","target","getAttribute","brandObjArr","brandObject","push","isDualBrandSelection"],"mappings":"6aAQO,MAAMA,EAAwB,CAACC,EAA0BC,IACrDD,EAAUE,OAAO,CAACC,EAAKC,IAAaD,GAAOF,EAAeI,SAASD,EAASE,QAAQ,GAGlFC,EAAkBP,GAA4CA,EAAUQ,IAAIC,qUAASC,CAAA,CAAA,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,EAAYG,UAAUC,UAAY,IAClC7B,EAAgBiB,QAAUQ,EAAYG,UAAUC,UAIxD,MAEIxB,EAA2B,IAC3BC,EAAsB,IAIjBc,GAAkBd,EAAsBa,EAAgB,GAAGlC,OAGhEkB,EAAIc,QAAQC,yBAAyB,CACjCX,mBAAoBG,EAAkBH,mBACtCY,oBAIAA,EAAgB,GAAGU,UAAY,IAC/B7B,EAAgBiB,QAAUE,EAAgB,GAAGU,UAGzD,GAMJC,yBAA2BC,IACvB,IAAIC,EAAwBD,EAC5B,GAAIA,aAAaE,MAAO,CACpB,MAAMC,EAASH,EAAEG,OACjBF,EAAQE,EAAOC,aAAa,eAAiBD,EAAOC,aAAa,QACrE,CAIA,IAAIC,EAA6B,GAC7BJ,IAEAI,EAAchC,EAAwBvB,OAAO,CAACC,EAAKM,KAC3CA,EAAKiD,YAAYpD,QAAU+C,GAC3BlD,EAAIwD,KAAKlD,EAAKiD,aAEXvD,GACR,IAEEsD,EAAYzC,SAOrBW,EAAsB0B,GAGtB7B,EAAIc,QAAQC,yBAAyB,CACjCX,qBACAY,gBAAiBiB,EACjBG,sBAAsB,OAItC"}
@@ -1 +1 @@
1
- {"version":3,"file":"triggerBinLookUp.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/triggerBinLookUp.ts"],"sourcesContent":["import { httpPost } from '../../../../core/Services/http';\nimport { CardBinLookupData, CardBinValueData, CardErrorData } from '../lib/types';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../lib/constants';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BinLookupResponse, BinLookupResponseRaw } from '../../../Card/types';\n\nif (process.env.NODE_ENV === 'development') {\n window.mockBinCount = 0; // Set to 0 to turn off mocking, 1 to turn it on\n}\n\nexport default parent => {\n let currentRequestId = null;\n\n return (callbackObj: CardBinValueData) => {\n // Allow way for merchant to disallow binLookup by specifically setting the prop to false\n if (parent.props.doBinLookup === false) {\n if (parent.props.onBinValue) parent.props.onBinValue(callbackObj);\n return;\n }\n\n // Do binLookup when encryptedBin property is present (and only if the merchant is using a clientKey)\n if (callbackObj.encryptedBin && parent.props.clientKey) {\n // Store id of request we're about to make\n currentRequestId = callbackObj.uuid;\n\n void httpPost(\n {\n loadingContext: parent.props.loadingContext,\n path: `v3/bin/binLookup?token=${parent.props.clientKey}`\n },\n {\n type: parent.props.brand,\n supportedBrands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES,\n encryptedBin: callbackObj.encryptedBin,\n requestId: callbackObj.uuid // Pass id of request\n }\n ).then((data: BinLookupResponseRaw) => {\n // If response is the one we were waiting for...\n if (data?.requestId === currentRequestId) {\n if (process.env.NODE_ENV === 'development') {\n // TODO mocking\n if (window.mockBinCount >= 1) {\n switch (window.mockBinCount) {\n case 1:\n console.log('\\n### triggerBinLookUp::mock first response:: ');\n data.brands = [\n {\n brand: 'mc',\n cvcPolicy: 'optional',\n enableLuhnCheck: true,\n // showExpiryDate: true, // deprecated in /binLookup v3\n expiryDatePolicy: 'optional',\n // panLength: 16,\n supported: true\n }\n ];\n // data.issuingCountryCode = 'KR'; // needed to mock korean_local_card\n // increment to alter second response\n window.mockBinCount++;\n\n break;\n case 2:\n console.log('\\n### triggerBinLookUp::mock second response:: ');\n // data.brands = null;\n data.brands = [\n {\n brand: 'maestro',\n cvcPolicy: 'required',\n enableLuhnCheck: true,\n showExpiryDate: true,\n supported: true,\n showSocialSecurityNumber: false\n // panLength: 16\n }\n ];\n break;\n default:\n }\n }\n // TODO end\n }\n\n if (data.brands?.length) {\n const mappedResponse = data.brands.reduce(\n (acc, item) => {\n // All brand strings end up in the detectedBrands array\n acc.detectedBrands.push(item.brand);\n // Also add the paymentMethodVariants (more granular description of the txvariant)\n acc.paymentMethodVariants.push(item.paymentMethodVariant);\n\n // Add supported brand objects to the supportedBrands array\n if (item.supported === true) {\n acc.supportedBrands.push(item);\n return acc;\n }\n\n return acc;\n },\n { supportedBrands: [], detectedBrands: [], paymentMethodVariants: [] }\n );\n\n /**\n * supportedBrands = merchant supports this brand(s); we have detected the card number to be of this brand(s); carry on!\n */\n if (mappedResponse.supportedBrands.length) {\n // ...call processBinLookupResponse with, a simplified, response object if it contains at least one supported brand\n parent.processBinLookupResponse({\n issuingCountryCode: data.issuingCountryCode,\n supportedBrands: mappedResponse.supportedBrands,\n ...(data.showSocialSecurityNumber ? { showSocialSecurityNumber: data.showSocialSecurityNumber } : {})\n } as BinLookupResponse);\n\n // Inform merchant of the result\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n // supportedBrands contains the subset of this.props.brands that matches the card number that the shopper has typed\n supportedBrands: mappedResponse.supportedBrands.map(item => item.brand),\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n supportedBrandsRaw: mappedResponse.supportedBrands, // full supportedBrands data (for customCard comp)\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES,\n issuingCountryCode: data.issuingCountryCode\n } as CardBinLookupData);\n\n return;\n }\n\n /**\n * detectedBrands = no brands the merchant supports were found; what we did detect the shopper to be entering was this brand;\n * error!\n */\n if (mappedResponse.detectedBrands.length) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n detectedBrands: mappedResponse.detectedBrands\n };\n parent.handleUnsupportedCard(errObj);\n\n // Inform merchant of the result\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n supportedBrands: null,\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n } as CardBinLookupData);\n\n return;\n }\n } else {\n /**\n * BIN not in DB (a failed lookup will just contain a requestId)\n */\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: null,\n supportedBrands: null,\n paymentMethodVariants: null,\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n } as CardBinLookupData);\n\n // Reset the UI and let the native, regex branding happen (for the generic card)\n // For a single-branded card we need to pass a boolean to prompt resetting the brand logo to the 'base' type\n parent.processBinLookupResponse({}, true);\n }\n } else {\n if (!data?.requestId) {\n // Some other kind of error on the backend\n parent.props.onError(data || { errorType: 'binLookup', message: 'unknownError' });\n }\n // Else - response with wrong requestId\n }\n });\n } else if (currentRequestId) {\n /**\n * If onBinValue callback is called AND we have been doing binLookup BUT passed object doesn't have an encryptedBin property\n * - then THE NUMBER OF DIGITS IN NUMBER FIELD HAS DROPPED BELOW THRESHOLD for BIN lookup - so reset the UI\n */\n parent.processBinLookupResponse(null, true);\n\n currentRequestId = null; // Ignore any pending responses\n\n // Reset any errors\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n parent.handleUnsupportedCard(errObj);\n\n // CustomCard needs this to reset the UI\n parent.onBinLookup({\n isReset: true\n } as CardBinLookupData);\n }\n\n if (parent.props.onBinValue) parent.props.onBinValue(callbackObj);\n };\n};\n"],"names":["triggerBinLookUp","parent","currentRequestId","callbackObj","props","doBinLookup","encryptedBin","clientKey","uuid","httpPost","loadingContext","path","type","brand","supportedBrands","brands","DEFAULT_CARD_GROUP_TYPES","requestId","then","data","length","mappedResponse","reduce","acc","item","detectedBrands","push","paymentMethodVariants","paymentMethodVariant","supported","processBinLookupResponse","_object_spread","issuingCountryCode","showSocialSecurityNumber","onBinLookup","map","supportedBrandsRaw","errObj","fieldType","error","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","handleUnsupportedCard","onError","errorType","message","isReset","onBinValue"],"mappings":"yTAUA,IAAAA,EAAeC,IACX,IAAIC,EAAmB,KAEvB,OAAQC,IAEJ,IAAiC,IAA7BF,EAAOG,MAAMC,YAAjB,CAMA,GAAIF,EAAYG,cAAgBL,EAAOG,MAAMG,UAEzCL,EAAmBC,EAAYK,KAE1BC,EACD,CACIC,eAAgBT,EAAOG,MAAMM,eAC7BC,KAAM,0BAA0BV,EAAOG,MAAMG,aAEjD,CAC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,EAAOG,MAAMW,QAAUC,GAIvC,CACJ,MAIIf,EAAOiC,YAAY,CACftB,KAAMT,EAAYS,KAClBa,eAAgB,KAChBX,gBAAiB,KACjBa,sBAAuB,KACvBZ,OAAQd,EAAOG,MAAMW,QAAUC,IAKnCf,EAAO6B,yBAAyB,CAAA,GAAI,QAGnCX,aAAAA,EAAAA,EAAMF,YAEPhB,EAAOG,MAAMuC,QAAQxB,GAAQ,CAAEyB,UAAW,YAAaC,QAAS,wBAKzE,GAAI3C,EAAkB,CAKzBD,EAAO6B,yBAAyB,MAAM,GAEtC5B,EAAmB,KAGnB,MAAMmC,EAAwB,CAC1BzB,KAAM,OACN0B,UAAW,sBACXC,MAAO,IAEXtC,EAAOyC,sBAAsBL,GAG7BpC,EAAOiC,YAAY,CACfY,SAAS,GAEjB,CAEI7C,EAAOG,MAAM2C,YAAY9C,EAAOG,MAAM2C,WAAW5C,EApLrD,MAFQF,EAAOG,MAAM2C,YAAY9C,EAAOG,MAAM2C,WAAW5C,GAwLjE"}
1
+ {"version":3,"file":"triggerBinLookUp.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/triggerBinLookUp.ts"],"sourcesContent":["import { httpPost } from '../../../../core/Services/http';\nimport { CardBinLookupData, CardBinValueData, CardErrorData } from '../lib/types';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../lib/constants';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BinLookupResponse, BinLookupResponseRaw } from '../../../Card/types';\n\nif (process.env.NODE_ENV === 'development') {\n window.mockBinCount = 0; // Set to 0 to turn off mocking, 1 to turn it on\n}\n\nexport default parent => {\n let currentRequestId = null;\n\n return (callbackObj: CardBinValueData) => {\n // Allow way for merchant to disallow binLookup by specifically setting the prop to false\n if (parent.props.doBinLookup === false) {\n if (parent.props.onBinValue) parent.props.onBinValue(callbackObj);\n return;\n }\n\n // Do binLookup when encryptedBin property is present (and only if the merchant is using a clientKey)\n if (callbackObj.encryptedBin && parent.props.clientKey) {\n // Store id of request we're about to make\n currentRequestId = callbackObj.uuid;\n\n void httpPost(\n {\n loadingContext: parent.props.loadingContext,\n path: `v3/bin/binLookup?token=${parent.props.clientKey}`\n },\n {\n type: parent.props.brand,\n supportedBrands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES,\n encryptedBin: callbackObj.encryptedBin,\n requestId: callbackObj.uuid // Pass id of request\n }\n ).then((data: BinLookupResponseRaw) => {\n // If response is the one we were waiting for...\n if (data?.requestId === currentRequestId) {\n if (process.env.NODE_ENV === 'development') {\n // TODO mocking\n if (window.mockBinCount >= 1) {\n switch (window.mockBinCount) {\n case 1:\n console.log('\\n### triggerBinLookUp::mock first response:: ');\n data.brands = [\n {\n brand: 'mc',\n cvcPolicy: 'optional',\n enableLuhnCheck: true,\n // showExpiryDate: true, // deprecated in /binLookup v3\n expiryDatePolicy: 'optional',\n // panLength: 16,\n supported: true\n }\n ];\n // data.issuingCountryCode = 'KR'; // needed to mock korean_local_card\n // increment to alter second response\n window.mockBinCount++;\n\n break;\n case 2:\n console.log('\\n### triggerBinLookUp::mock second response:: ');\n // data.brands = null;\n data.brands = [\n {\n brand: 'maestro',\n cvcPolicy: 'required',\n enableLuhnCheck: true,\n showExpiryDate: true,\n supported: true,\n showSocialSecurityNumber: false\n // panLength: 16\n }\n ];\n break;\n default:\n }\n }\n // TODO end\n }\n\n if (data.brands?.length) {\n const mappedResponse = data.brands.reduce(\n (acc, item) => {\n // All brand strings end up in the detectedBrands array\n acc.detectedBrands.push(item.brand);\n // Also add the paymentMethodVariants (more granular description of the txvariant)\n acc.paymentMethodVariants.push(item.paymentMethodVariant);\n\n // Add supported brand objects to the supportedBrands array\n if (item.supported === true) {\n acc.supportedBrands.push(item);\n return acc;\n }\n\n return acc;\n },\n { supportedBrands: [], detectedBrands: [], paymentMethodVariants: [] }\n );\n\n /**\n * supportedBrands = merchant supports this brand(s); we have detected the card number to be of this brand(s); carry on!\n */\n if (mappedResponse.supportedBrands.length) {\n // ...call processBinLookupResponse with, a simplified, response object if it contains at least one supported brand\n parent.processBinLookupResponse({\n issuingCountryCode: data.issuingCountryCode,\n supportedBrands: mappedResponse.supportedBrands,\n ...(data.showSocialSecurityNumber ? { showSocialSecurityNumber: data.showSocialSecurityNumber } : {})\n } as BinLookupResponse);\n\n // Inform merchant of the result\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n // supportedBrands contains the subset of this.props.brands that matches the card number that the shopper has typed\n supportedBrands: mappedResponse.supportedBrands.map(item => item.brand),\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n supportedBrandsRaw: mappedResponse.supportedBrands, // full supportedBrands data (for customCard comp)\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES,\n issuingCountryCode: data.issuingCountryCode\n } as CardBinLookupData);\n\n return;\n }\n\n /**\n * detectedBrands = no brands the merchant supports were found; what we did detect the shopper to be entering was this brand;\n * error!\n */\n if (mappedResponse.detectedBrands.length) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n detectedBrands: mappedResponse.detectedBrands\n };\n parent.handleUnsupportedCard(errObj);\n\n // Inform merchant of the result\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n supportedBrands: null,\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n } as CardBinLookupData);\n\n return;\n }\n } else {\n /**\n * BIN not in DB (a failed lookup will just contain a requestId)\n */\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: null,\n supportedBrands: null,\n paymentMethodVariants: null,\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n } as CardBinLookupData);\n\n // Reset the UI and let the native, regex branding happen (for the generic card)\n // For a single-branded card we need to pass a boolean to prompt resetting the brand logo to the 'base' type\n parent.processBinLookupResponse({}, true);\n }\n } else {\n if (!data?.requestId) {\n // Some other kind of error on the backend\n parent.props.onError(data || { errorType: 'binLookup', message: 'unknownError' });\n }\n // Else - response with wrong requestId\n }\n });\n } else if (currentRequestId) {\n /**\n * If onBinValue callback is called AND we have been doing binLookup BUT passed object doesn't have an encryptedBin property\n * - then THE NUMBER OF DIGITS IN NUMBER FIELD HAS DROPPED BELOW THRESHOLD for BIN lookup - so reset the UI\n */\n parent.processBinLookupResponse(null, true);\n\n currentRequestId = null; // Ignore any pending responses\n\n // Reset any errors\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n parent.handleUnsupportedCard(errObj);\n\n // CustomCard needs this to reset the UI\n parent.onBinLookup({\n isReset: true\n } as CardBinLookupData);\n }\n\n if (parent.props.onBinValue) parent.props.onBinValue(callbackObj);\n };\n};\n"],"names":["triggerBinLookUp","parent","currentRequestId","callbackObj","props","doBinLookup","encryptedBin","clientKey","uuid","httpPost","loadingContext","path","type","brand","supportedBrands","brands","DEFAULT_CARD_GROUP_TYPES","requestId","then","data","length","mappedResponse","reduce","acc","item","detectedBrands","push","paymentMethodVariants","paymentMethodVariant","supported","processBinLookupResponse","_object_spread","issuingCountryCode","showSocialSecurityNumber","onBinLookup","map","supportedBrandsRaw","errObj","fieldType","error","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","handleUnsupportedCard","onError","errorType","message","isReset","onBinValue"],"mappings":"yTAUA,IAAAA,EAAeC,IACX,IAAIC,EAAmB,KAEvB,OAAQC,IAEJ,IAAiC,IAA7BF,EAAOG,MAAMC,YAAjB,CAMA,GAAIF,EAAYG,cAAgBL,EAAOG,MAAMG,UAEzCL,EAAmBC,EAAYK,KAE1BC,EACD,CACIC,eAAgBT,EAAOG,MAAMM,eAC7BC,KAAM,0BAA0BV,EAAOG,MAAMG,aAEjD,CACIK,KAAMX,EAAOG,MAAMS,MACnBC,gBAAiBb,EAAOG,MAAMW,QAAUC,EACxCV,aAAcH,EAAYG,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,gBAAiB,KACjBa,sBAAuB,KACvBZ,OAAQd,EAAOG,MAAMW,QAAUC,IAKnCf,EAAO6B,yBAAyB,CAAA,GAAI,QAGnCX,eAAAA,EAAMF,YAEPhB,EAAOG,MAAMuC,QAAQxB,GAAQ,CAAEyB,UAAW,YAAaC,QAAS,wBAKzE,GAAI3C,EAAkB,CAKzBD,EAAO6B,yBAAyB,MAAM,GAEtC5B,EAAmB,KAGnB,MAAMmC,EAAwB,CAC1BzB,KAAM,OACN0B,UAAW,sBACXC,MAAO,IAEXtC,EAAOyC,sBAAsBL,GAG7BpC,EAAOiC,YAAY,CACfY,SAAS,GAEjB,CAEI7C,EAAOG,MAAM2C,YAAY9C,EAAOG,MAAM2C,WAAW5C,EApLrD,MAFQF,EAAOG,MAAM2C,YAAY9C,EAAOG,MAAM2C,WAAW5C,GAwLjE"}
@@ -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,iBAAV,GACAF,EAAAC,KAAUE,cAAV,GACAH,EAAAC,KAAUG,aAAV,GACAJ,EAAAC,KAAUI,aAAV,GACAL,EAAAC,KAAUK,oBAAV,GACAN,EAAAC,KAAUM,gCAAV,GACAP,EAAAC,KAAUO,wBAAV,GACAR,EAAAC,KAAUQ,qBAAV,GACAT,EAAAC,KAAUS,+BAAV,GACAV,EAAAC,KAAUU,kCAAV,GACAX,EAAAC,KAAUW,2BAAV,GACAZ,EAAAC,KAAUY,4BAAV,GACAb,EAAAC,KAAUa,4BAAV,GACAd,EAAAC,KAAUc,+BAAV,GACAf,EAAAC,KAAUe,iCAAV,GACAhB,EAAAC,KAAUgB,sBAAV,GACAjB,EAAAC,KAAUiB,wBAAV,GACAlB,EAAAC,KAAUkB,mBAAV,GACAnB,EAAAC,KAAUmB,kCAAV,GACApB,EAAAC,KAAUoB,wBAAV,GACArB,EAAAC,KAAUqB,wBAAV,GACAtB,EAAAC,KAAUsB,sBAAV,GACAvB,EAAAC,KAAUuB,oBAAV,GACAxB,EAAAC,KAAUwB,+BAAV,GACAzB,EAAAC,KAAUyB,2BAAV,GACA1B,EAAAC,KAAU0B,oBAAV,GACA3B,EAAAC,KAAU2B,yBAAV,GACA5B,EAAAC,KAAU4B,gCAAV,GACA7B,EAAAC,KAAU6B,uBAAV,GACA9B,EAAAC,KAAU8B,yBAAV,GACA/B,EAAAC,KAAU+B,wBAAV,GACAhC,EAAAC,KAAUgC,0BAAV,GACAjC,EAAAC,KAAUiC,6BAAV,GAEAlC,EAAAC,KAAUkC,yBAAV,GACAnC,EAAAC,KAAUmC,4BAAV,GACApC,EAAAC,KAAUoC,2BAAV,GACArC,EAAAC,KAAUqC,oBAAV,GAGIrC,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: 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,2 +1,2 @@
1
- import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,ALL_SECURED_FIELDS as o,CVC_POLICY_REQUIRED as s,DATE_POLICY_REQUIRED as r,ENCRYPTED_EXPIRY_YEAR as n,SF_CONFIG_TIMEOUT as a,DATA_UID as l,DATA_INFO as d}from"../../constants.js";import{existy as c}from"../../../../../../utils/commonUtils.js";import h from"../utils/cardType.js";import p from"../../securedField/SecuredField.js";import u from"../../../../../../core/Errors/AdyenCheckoutError.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 y(){this.encryptedAttrName=i;const n=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),s=o.includes(i);return s||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),s}),a=s,l=r;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(n,a,l),n.length):(this.createNonCardSecuredFields(n),n.length)}async function m(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 o=this.state.type;if("card"===o&&1===this.config.cardGroupTypes.length&&(o=this.config.cardGroupTypes[0],this.state.type=o),this.isSingleBrandedCard="card"!==o,this.isSingleBrandedCard){const e=h.getCardByBrand(o);c(e)?(t=e.cvcPolicy||s,i=e.expiryDatePolicy||r,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:o,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function C(e,i,o){return new Promise((s,r)=>{const c=t(e,this.encryptedAttrName);c===n&&(this.state.hasSeparateDateFields=!0);const h={fieldType:c,extraFieldData:t(e,d),uid:t(e,l),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},y=new p(h,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 u("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(y.loadToConfigTimeout=setTimeout(()=>{r({type:h.fieldType,failReason:"sf took too long to config"})},a),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(y.loadToConfigTimeout),y.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]=y})}export{g as createCardSecuredFields,m as createNonCardSecuredFields,y as createSecuredFields,C as setupSecuredField};
1
+ import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,ALL_SECURED_FIELDS as o,CVC_POLICY_REQUIRED as s,DATE_POLICY_REQUIRED as n,ENCRYPTED_EXPIRY_YEAR as r,SF_CONFIG_TIMEOUT as a,DATA_UID as l,DATA_INFO as d}from"../../constants.js";import{existy as c}from"../../../../../../utils/commonUtils.js";import h from"../utils/cardType.js";import p from"../../securedField/SecuredField.js";import u from"../../../../../../core/Errors/AdyenCheckoutError.js";function f(e,t){if(null==e)return{};var i,o,s,n={};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)&&(n[o]=e[o]);return n}if(n=function(e,t){if(null==e)return{};var i,o,s={},n=Object.getOwnPropertyNames(e);for(o=0;o<n.length;o++)i=n[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)&&(n[o]=e[o]);return n}function y(){this.encryptedAttrName=i;const r=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),s=o.includes(i);return s||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),s}),a=s,l=n;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(r,a,l),r.length):(this.createNonCardSecuredFields(r),r.length)}async function m(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 o=this.state.type;if("card"===o&&1===this.config.cardGroupTypes.length&&(o=this.config.cardGroupTypes[0],this.state.type=o),this.isSingleBrandedCard="card"!==o,this.isSingleBrandedCard){const e=h.getCardByBrand(o);c(e)?(t=e.cvcPolicy||s,i=e.expiryDatePolicy||n,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:o,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function T(e,i,o){return new Promise((s,n)=>{const c=t(e,this.encryptedAttrName);c===r&&(this.state.hasSeparateDateFields=!0);const h={fieldType:c,extraFieldData:t(e,d),uid:t(e,l),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},y=new p(h,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 u("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(y.loadToConfigTimeout=setTimeout(()=>{n({type:h.fieldType,failReason:"sf took too long to config"})},a),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(y.loadToConfigTimeout),y.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]=y})}export{g as createCardSecuredFields,m as createNonCardSecuredFields,y 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 ALL_SECURED_FIELDS,\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';\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 = ALL_SECURED_FIELDS.includes(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 * encryptedPin???\n * encryptedBankAccountNumber\n * encryptedBankLocationId\n * encryptedIBAN\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 };\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","ALL_SECURED_FIELDS","includes","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","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":"qmCAwBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAmBC,SAASJ,GAMhD,OALKE,GACDG,QAAQC,KACJ,aAAaN,mCAA2CT,KAAKC,sFAG9DU,IAULK,EAA2BC,EAG3BC,EAAmCC,EAGzC,OAAKnB,KAAKoB,OAAOC,kBAMjBrB,KAAKsB,qBAAsB,EAE3BtB,KAAKuB,aAAe,GAEpBvB,KAAKwB,wBAAwBrB,EAAea,EAAWE,GAGhDf,EAAcsB,SAZjBzB,KAAK0B,2BAA2BvB,GACzBA,EAAcsB,OAY7B,CAOOE,eAAeD,EAA2BvB,GAC7C,IAAK,IAAIyB,EAAI,EAAGA,EAAIzB,EAAcsB,OAAQG,IAAK,CAC3C,MAAMC,EAAe1B,EAAcyB,SAC7B5B,KAAK8B,kBAAkBD,GAAcE,MAAMC,IACzCC,OAAOC,OAAOpB,QAAQqB,IAAI,mCAAoCH,IAE1E,CACJ,CAEOL,eAAeH,EAClBrB,EACAa,EACAE,GAGA,IAAIkB,EAAepC,KAAKqC,MAAMD,KAa9B,GATa,SAATA,GAAyD,IAAtCpC,KAAKoB,OAAOkB,eAAeb,SAC9CW,EAAOpC,KAAKoB,OAAOkB,eAAe,GAClCtC,KAAKqC,MAAMD,KAAOA,GAItBpC,KAAKsB,oBAA+B,SAATc,EAGvBpC,KAAKsB,oBAAqB,CAE1B,MAAMiB,EAAmBC,EAASC,eAAeL,GAI5CM,EAAOH,IAIRvB,EAAYuB,EAAKvB,WAAaC,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,aAK7DmF,EAAaQ,uBAAyBpG,KAAKoG,wBAG3CpG,KAAKsG,wBAAwB,CAAE7F,UAAWmF,EAAanF,UAAW8F,YAAY,MAGrFC,WAAYZ,IAET5F,KAAKyG,iBAAiBb,EAAanF,aAEtCiG,aAAcd,IACX5F,KAAK2G,iBAAiBf,KAEzBgB,aAAchB,IACX5F,KAAK6G,iBAAiBjB,KAEzBkB,eAAgBlB,IACb5F,KAAK+G,oBAAoBnB,KAE5BoB,aAAcpB,IACX,MAAMqB,OAAEA,GAAoBrB,EAATsB,EAAAA,EAAStB,EAAAA,YAC5B5F,KAAK+C,UAAUiE,aAAaE,KAIpClH,KAAKqC,MAAMlC,cAAcM,GAAaoE,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 ALL_SECURED_FIELDS,\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';\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 = ALL_SECURED_FIELDS.includes(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 * encryptedPin???\n * encryptedBankAccountNumber\n * encryptedBankLocationId\n * encryptedIBAN\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","ALL_SECURED_FIELDS","includes","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":"qmCAwBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAmBC,SAASJ,GAMhD,OALKE,GACDG,QAAQC,KACJ,aAAaN,mCAA2CT,KAAKC,sFAG9DU,IAULK,EAA2BC,EAG3BC,EAAmCC,EAGzC,OAAKnB,KAAKoB,OAAOC,kBAMjBrB,KAAKsB,qBAAsB,EAE3BtB,KAAKuB,aAAe,GAEpBvB,KAAKwB,wBAAwBrB,EAAea,EAAWE,GAGhDf,EAAcsB,SAZjBzB,KAAK0B,2BAA2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MgD,WAGpC,MAFArF,KAAKsF,uBAEC,IAAIC,EACN,QACA,gKACoBvF,KAAKqC,MAAM+C,+BAA+BpF,KAAKqC,MAAMgD,cAWjF,GALAL,EAAGQ,oBAAsB1C,WAAW,KAChCM,EAAO,CAAEhB,KAAMmB,EAAU9C,UAAWgF,WAAY,gCACjDC,GAGC1F,KAAKqC,MAAM+C,cAAgBpF,KAAKqC,MAAMsD,mBAAoB,CAC1D,MAAMhD,EAA4B,CAAEiD,eAAe,GACnD5F,KAAK+C,UAAU8C,OAAOlD,EAC1B,IAEHmD,SAAUC,IACP/F,KAAKgG,2BAA2BD,GAGhCE,aAAajB,EAAGQ,qBAChBR,EAAGQ,oBAAsB,KAEzBrC,EAAQ4C,KAEXG,QAASH,IACN/F,KAAKmG,YAAYJ,KAEpBK,WAAYL,IACT/F,KAAKqG,eAAeN,KAEvBO,aAAcP,IAEP/F,KAAKK,MAAMoE,4BAUPzE,KAAKuG,uBAAyBR,EAAaQ,wBAC3CvG,KAAK+C,UAAUyD,gBAAgB,CAAE/F,UAAWsF,EAAatF,aAK7DsF,EAAaQ,uBAAyBvG,KAAKuG,wBAG3CvG,KAAKyG,wBAAwB,CAAEhG,UAAWsF,EAAatF,UAAWiG,YAAY,MAGrFC,WAAYZ,IAET/F,KAAK4G,iBAAiBb,EAAatF,aAEtCoG,aAAcd,IACX/F,KAAK8G,iBAAiBf,KAEzBgB,aAAchB,IACX/F,KAAKgH,iBAAiBjB,KAEzBkB,eAAgBlB,IACb/F,KAAKkH,oBAAoBnB,KAE5BoB,aAAcpB,IACX,MAAMqB,OAAEA,GAAoBrB,EAATsB,EAAAA,EAAStB,EAAAA,YAC5B/F,KAAK+C,UAAUoE,aAAaE,KAIpCrH,KAAKqC,MAAMlC,cAAcM,GAAauE,GAE9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"processAutoComplete.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.ts"],"sourcesContent":["import postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { ENCRYPTED_EXPIRY_DATE, ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR } from '../../constants';\nimport { SFFeedbackObj, CardAutoCompleteData } from '../../types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { CSFThisObject } from '../types';\n\n/**\n *\n * @param csfState - comes from initial, partial, implementation\n * @param csfConfig - comes from initial, partial, implementation\n * @param csfCallbacks - comes from initial, partial, implementation\n *\n * @param pFeedbackObj -\n */\nexport function processAutoComplete({ csfState, csfConfig, csfCallbacks }: CSFThisObject, pFeedbackObj: SFFeedbackObj): boolean {\n /**\n * NOTE: It seems Chrome has started autofilling across cross-origin iframes. Have tested as far back as v104 but have no resources to test further back\n * So, in theory for Chrome \\>= v104 we don't need to do any of this, including having special listeners in the securedFields\n */\n\n // Specifically for cc-name (but no reason not to propagate all AC objects to the merchant)\n if (pFeedbackObj.name === 'cc-name') {\n const feedbackObj: SFFeedbackObj = { ...pFeedbackObj };\n delete feedbackObj.numKey;\n const ACFeedbackObj: CardAutoCompleteData = feedbackObj as CardAutoCompleteData;\n csfCallbacks.onAutoComplete(ACFeedbackObj);\n return true;\n }\n\n // Send date info to relevant secured fields (needed for Safari whose Security model won't allow direct population of fields in 3rd party iframes)\n if (pFeedbackObj.name === 'cc-exp') {\n const splittableDateVal = pFeedbackObj.value.replace(/[^0-9]/gi, '/'); // Replace any non-digits with a fwd-slash so we can always split it\n\n const dateValArr: string[] = splittableDateVal.split('/');\n\n if (dateValArr.length !== 2) {\n // To avoid bug in some versions of Safari where date doesn't come through as expected\n return false;\n }\n\n if (dateValArr[0].length === 1) dateValArr[0] = `0${dateValArr[0]}`; // pad, if required\n\n const acMonthVal: string = dateValArr[0];\n\n // Extra checks that passed year is a valid value\n const year = dateValArr[1];\n const isValidYear = (year?.length === 4 || year?.length === 2) && !isNaN(parseInt(year));\n if (!isValidYear) {\n return false;\n }\n\n const acYearVal: string = year.slice(-2); // take last 2 digits of year\n const acDateVal = `${acMonthVal}/${acYearVal}`;\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_DATE,\n autoComplete: acDateVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_DATE].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_DATE), csfConfig.loadingContext);\n return true;\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_MONTH)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_MONTH,\n autoComplete: acMonthVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_MONTH].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_MONTH), csfConfig.loadingContext);\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n // Dirty! - Need to wait til next page draw if setting month and year at the same time, otherwise only year gets set\n setTimeout(() => {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_YEAR,\n autoComplete: acYearVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_YEAR].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_YEAR), csfConfig.loadingContext);\n }, 0);\n }\n return true;\n }\n\n return false;\n}\n"],"names":["processAutoComplete","csfState","csfConfig","csfCallbacks","pFeedbackObj","name","feedbackObj","_object_spread","numKey","ACFeedbackObj","onAutoComplete","dateValArr","value","replace","split","length","acMonthVal","year","isNaN","parseInt","acYearVal","slice","acDateVal","hasOwnProperty","securedFields","ENCRYPTED_EXPIRY_DATE","dataObj","txVariant","type","fieldType","autoComplete","postMessageToIframe","getIframeContentWin","loadingContext","ENCRYPTED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,UAAW1B,EAAS2B,KACpBC,UAAWM,EACXL,aAAcV,EACdZ,OAAQP,EAASuB,cAAcW,GAAuB3B,QAE1DuB,EAAoBL,EAASM,EAAoB/B,EAAUkC,GAAwBjC,EAAU+B,iBAC9F,IAEA,CACX,CAEA,OAAO,CACX"}
1
+ {"version":3,"file":"processAutoComplete.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.ts"],"sourcesContent":["import postMessageToIframe from '../utils/iframes/postMessageToIframe';\nimport { ENCRYPTED_EXPIRY_DATE, ENCRYPTED_EXPIRY_MONTH, ENCRYPTED_EXPIRY_YEAR } from '../../constants';\nimport { SFFeedbackObj, CardAutoCompleteData } from '../../types';\nimport { hasOwnProperty } from '../../../../../../utils/hasOwnProperty';\nimport getIframeContentWin from '../utils/iframes/getIframeContentWin';\nimport { CSFThisObject } from '../types';\n\n/**\n *\n * @param csfState - comes from initial, partial, implementation\n * @param csfConfig - comes from initial, partial, implementation\n * @param csfCallbacks - comes from initial, partial, implementation\n *\n * @param pFeedbackObj -\n */\nexport function processAutoComplete({ csfState, csfConfig, csfCallbacks }: CSFThisObject, pFeedbackObj: SFFeedbackObj): boolean {\n /**\n * NOTE: It seems Chrome has started autofilling across cross-origin iframes. Have tested as far back as v104 but have no resources to test further back\n * So, in theory for Chrome \\>= v104 we don't need to do any of this, including having special listeners in the securedFields\n */\n\n // Specifically for cc-name (but no reason not to propagate all AC objects to the merchant)\n if (pFeedbackObj.name === 'cc-name') {\n const feedbackObj: SFFeedbackObj = { ...pFeedbackObj };\n delete feedbackObj.numKey;\n const ACFeedbackObj: CardAutoCompleteData = feedbackObj as CardAutoCompleteData;\n csfCallbacks.onAutoComplete(ACFeedbackObj);\n return true;\n }\n\n // Send date info to relevant secured fields (needed for Safari whose Security model won't allow direct population of fields in 3rd party iframes)\n if (pFeedbackObj.name === 'cc-exp') {\n const splittableDateVal = pFeedbackObj.value.replace(/[^0-9]/gi, '/'); // Replace any non-digits with a fwd-slash so we can always split it\n\n const dateValArr: string[] = splittableDateVal.split('/');\n\n if (dateValArr.length !== 2) {\n // To avoid bug in some versions of Safari where date doesn't come through as expected\n return false;\n }\n\n if (dateValArr[0].length === 1) dateValArr[0] = `0${dateValArr[0]}`; // pad, if required\n\n const acMonthVal: string = dateValArr[0];\n\n // Extra checks that passed year is a valid value\n const year = dateValArr[1];\n const isValidYear = (year?.length === 4 || year?.length === 2) && !isNaN(parseInt(year));\n if (!isValidYear) {\n return false;\n }\n\n const acYearVal: string = year.slice(-2); // take last 2 digits of year\n const acDateVal = `${acMonthVal}/${acYearVal}`;\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_DATE)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_DATE,\n autoComplete: acDateVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_DATE].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_DATE), csfConfig.loadingContext);\n return true;\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_MONTH)) {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_MONTH,\n autoComplete: acMonthVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_MONTH].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_MONTH), csfConfig.loadingContext);\n }\n\n if (hasOwnProperty(csfState.securedFields, ENCRYPTED_EXPIRY_YEAR)) {\n // Dirty! - Need to wait til next page draw if setting month and year at the same time, otherwise only year gets set\n setTimeout(() => {\n const dataObj: object = {\n txVariant: csfState.type,\n fieldType: ENCRYPTED_EXPIRY_YEAR,\n autoComplete: acYearVal,\n numKey: csfState.securedFields[ENCRYPTED_EXPIRY_YEAR].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(csfState, ENCRYPTED_EXPIRY_YEAR), csfConfig.loadingContext);\n }, 0);\n }\n return true;\n }\n\n return false;\n}\n"],"names":["processAutoComplete","csfState","csfConfig","csfCallbacks","pFeedbackObj","name","feedbackObj","_object_spread","numKey","ACFeedbackObj","onAutoComplete","dateValArr","value","replace","split","length","acMonthVal","year","isNaN","parseInt","acYearVal","slice","acDateVal","hasOwnProperty","securedFields","ENCRYPTED_EXPIRY_DATE","dataObj","txVariant","type","fieldType","autoComplete","postMessageToIframe","getIframeContentWin","loadingContext","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","setTimeout"],"mappings":"maAeO,SAASA,GAAoBC,SAAEA,EAAQC,UAAEA,EAASC,aAAEA,GAA+BC,GAOtF,GAA0B,YAAtBA,EAAaC,KAAoB,CACjC,MAAMC,oUAA6BC,CAAA,CAAA,EAAKH,UACjCE,EAAYE,OACnB,MAAMC,EAAsCH,EAE5C,OADAH,EAAaO,eAAeD,IACrB,CACX,CAGA,GAA0B,WAAtBL,EAAaC,KAAmB,CAChC,MAEMM,EAFoBP,EAAaQ,MAAMC,QAAQ,WAAY,KAElBC,MAAM,KAErD,GAA0B,IAAtBH,EAAWI,OAEX,OAAO,EAGkB,IAAzBJ,EAAW,GAAGI,SAAcJ,EAAW,GAAK,IAAIA,EAAW,MAE/D,MAAMK,EAAqBL,EAAW,GAGhCM,EAAON,EAAW,GAExB,MADsC,KAAjBM,eAAAA,EAAMF,SAAiC,KAAjBE,aAAAA,EAAAA,EAAMF,WAAkBG,MAAMC,SAASF,KAE9E,OAAO,EAGX,MAAMG,EAAoBH,EAAKI,OAAM,GAC/BC,EAAY,GAAGN,KAAcI,IAEnC,GAAIG,EAAetB,EAASuB,cAAeC,GAAwB,CAC/D,MAAMC,EAAkB,CACpBC,UAAW1B,EAAS2B,KACpBC,UAAWJ,EACXK,aAAcR,EACdd,OAAQP,EAASuB,cAAcC,GAAuBjB,QAG1D,OADAuB,EAAoBL,EAASM,EAAoB/B,EAAUwB,GAAwBvB,EAAU+B,iBACtF,CACX,CAEA,GAA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