@adyen/adyen-web 6.40.1 → 6.41.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 (235) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +54 -61
  4. package/dist/es/components/ANCV/ANCV.js +1 -1
  5. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  6. package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
  7. package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
  8. package/dist/es/components/Blik/Blik.js +1 -1
  9. package/dist/es/components/Blik/Blik.js.map +1 -1
  10. package/dist/es/components/Card/Card.js +1 -1
  11. package/dist/es/components/Card/Card.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  13. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  14. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  15. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  16. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  17. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  18. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  19. package/dist/es/components/Dropin/Dropin.js +1 -1
  20. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  21. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  22. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  23. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  24. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  25. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  26. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  27. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  28. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  29. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  30. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  31. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  32. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  33. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  34. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  35. package/dist/es/components/Giftcard/components/GiftcardPinField.js +1 -1
  36. package/dist/es/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  37. package/dist/es/components/Iris/Iris.js +1 -1
  38. package/dist/es/components/Iris/Iris.js.map +1 -1
  39. package/dist/es/components/MBWay/MBWay.js +1 -1
  40. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  41. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  42. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  43. package/dist/es/components/PayTo/PayTo.js +1 -1
  44. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  45. package/dist/es/components/PayTo/components/BSBInput.js +1 -1
  46. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
  47. package/dist/es/components/PayTo/components/IdentifierSelector.js +1 -1
  48. package/dist/es/components/PayTo/components/IdentifierSelector.js.map +1 -1
  49. package/dist/es/components/PayTo/components/PayIDInput.js +1 -1
  50. package/dist/es/components/PayTo/components/PayIDInput.js.map +1 -1
  51. package/dist/es/components/PayTo/components/validate.js +1 -1
  52. package/dist/es/components/PayTo/components/validate.js.map +1 -1
  53. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  54. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  55. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  56. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  57. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  58. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  59. package/dist/es/components/UPI/UPI.js +1 -1
  60. package/dist/es/components/UPI/UPI.js.map +1 -1
  61. package/dist/es/components/internal/Await/Await.js +1 -1
  62. package/dist/es/components/internal/Await/Await.js.map +1 -1
  63. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  64. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  65. package/dist/es/components/internal/Button/Button.js +1 -1
  66. package/dist/es/components/internal/Button/Button.js.map +1 -1
  67. package/dist/es/components/internal/Button/CopyButton.js +1 -1
  68. package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
  69. package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
  70. package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
  71. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  72. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  73. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  74. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  75. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  76. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  77. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  78. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  79. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  80. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  81. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  82. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  83. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  84. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  85. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  86. package/dist/es/components/internal/Modal/Modal.js +1 -1
  87. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  88. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  89. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  90. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  91. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  92. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  93. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  94. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  95. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  96. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  97. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  98. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  99. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  100. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  101. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  102. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  103. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  104. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  105. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  106. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  107. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  108. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  109. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  110. package/dist/es/core/config.js +1 -1
  111. package/dist/es/index.d.ts +54 -61
  112. package/dist/es/language/utils.js +1 -1
  113. package/dist/es/language/utils.js.map +1 -1
  114. package/dist/es/packages/server/translations/en-US.json.js +1 -1
  115. package/dist/es/utils/commonUtils.js +1 -1
  116. package/dist/es/utils/commonUtils.js.map +1 -1
  117. package/dist/es/utils/get-process-message-handler.js +1 -1
  118. package/dist/es/utils/get-process-message-handler.js.map +1 -1
  119. package/dist/es/utils/promiseTimeout.js.map +1 -1
  120. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  121. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  122. package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
  123. package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
  124. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  125. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  126. package/dist/es-legacy/components/Card/Card.js +1 -1
  127. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  128. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  129. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  130. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  131. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  132. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  133. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  134. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  135. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  136. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  137. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  138. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  139. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  140. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  141. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  142. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  143. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  144. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  145. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  146. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  147. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  148. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  149. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  150. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  151. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js +1 -1
  152. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  153. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  154. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  155. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  156. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  157. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  158. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  159. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  160. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  161. package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
  162. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
  163. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js +1 -1
  164. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js.map +1 -1
  165. package/dist/es-legacy/components/PayTo/components/PayIDInput.js +1 -1
  166. package/dist/es-legacy/components/PayTo/components/PayIDInput.js.map +1 -1
  167. package/dist/es-legacy/components/PayTo/components/validate.js +1 -1
  168. package/dist/es-legacy/components/PayTo/components/validate.js.map +1 -1
  169. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  170. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  171. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  172. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  173. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  174. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  175. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  176. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  177. package/dist/es-legacy/components/internal/Await/Await.js +1 -1
  178. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  179. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  180. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  181. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  182. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  183. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  184. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  185. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  186. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  187. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  188. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  189. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  190. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  191. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  192. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  193. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  194. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  195. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  196. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  197. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  198. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  199. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  200. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  201. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  202. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  203. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  204. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  205. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  206. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  207. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  208. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  209. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  210. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  211. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  212. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  213. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  214. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  215. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  216. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  217. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  218. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  219. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  220. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  221. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  222. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  223. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  224. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  225. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  226. package/dist/es-legacy/core/config.js +1 -1
  227. package/dist/es-legacy/language/utils.js +1 -1
  228. package/dist/es-legacy/language/utils.js.map +1 -1
  229. package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
  230. package/dist/es-legacy/utils/commonUtils.js +1 -1
  231. package/dist/es-legacy/utils/commonUtils.js.map +1 -1
  232. package/dist/es-legacy/utils/get-process-message-handler.js +1 -1
  233. package/dist/es-legacy/utils/get-process-message-handler.js.map +1 -1
  234. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  235. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"SecuredFieldsProviderHandlers.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.ts"],"sourcesContent":["import { getCardImageUrl } from '../utils';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n CVC_POLICY_REQUIRED,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE,\n OPTIONAL,\n HIDDEN,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../lib/constants';\nimport {\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { existy } from '../../../../utils/commonUtils';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\n\n/**\n * Emits the onLoad event\n * Here we can assume all securedFields iframes have fired their 'load' event\n */\nfunction handleOnLoad(cbObj: CardLoadData): void {\n // Clear 'loading' timeout\n clearTimeout(this.csfLoadFailTimeout);\n this.csfLoadFailTimeout = null;\n\n // Propagate onLoad event\n this.props.onLoad(cbObj);\n\n /**\n * Having seen that the securedFields iframes have loaded some kind of content (we don't know what, yet)\n * - setTimeout since we expect to get a successful configuration message \"within a reasonable time\"\n *\n * Now we catch clientKey & environment mismatch in core.ts - this timeout being called indicates that the securedFields have not all configured\n * - so we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n this.csfConfigFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfConfigFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured fields have failed to configure'));\n }\n }, this.csfConfigFailTimeoutMS);\n}\n\n/**\n * Emits the onConfigSuccess (ready) event\n * Here we can assume CSF is loaded, configured and ready to be used\n */\nfunction handleOnConfigSuccess(cbObj: CardConfigSuccessData): void {\n // Clear 'config' timeout\n clearTimeout(this.csfConfigFailTimeout);\n this.csfConfigFailTimeout = null;\n\n this.setState({ status: 'ready' }, () => {\n // Propagate onConfigSuccess event\n this.props.onConfigSuccess(cbObj);\n });\n}\n\n/**\n * Emits the onAllValid event\n */\nfunction handleOnAllValid(status: CardAllValidData): boolean {\n // Form cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands) {\n return false;\n }\n\n this.setState({ isSfpValid: status.allValid }, () => {\n // New - fixes maestro-with-error-on-optional-cvc-field bug\n this.props.onChange(this.state, { event: 'handleOnAllValid' });\n // Propagate onAllValid event\n this.props.onAllValid(status);\n });\n\n return true;\n}\n\n/**\n * Saves a field value from CSF in the CardInput state\n * Emits the onFieldValid event\n */\nfunction handleOnFieldValid(fieldObj: CardFieldValidData): boolean {\n // A card number field cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands && fieldObj.fieldType === ENCRYPTED_CARD_NUMBER) {\n return false;\n }\n\n const setValidFieldState = prevState => ({\n data: { ...prevState.data, [fieldObj.encryptedFieldName]: fieldObj.blob },\n valid: { ...prevState.valid, [fieldObj.encryptedFieldName]: fieldObj.valid },\n /**\n * For a field that has just received valid:true (field has just been completed & encrypted) - mark the error state for this field as false\n * For a field that has just received valid:false (field was encrypted, now is not)\n * - field is either in a state of being incomplete but without errors (digit deleted) - so mark the error state for this field as false\n * or has switched from valid/encrypted state to being in error (digit edited to one that puts the field in error) - so keep any error that\n * might just have been set\n */\n errors: { ...prevState.errors, [fieldObj.fieldType]: prevState.errors[fieldObj.fieldType] ?? null }\n });\n\n this.setState(setValidFieldState, () => {\n this.props.onChange(this.state, { event: 'handleOnFieldValid', fieldType: fieldObj.fieldType });\n\n // Propagate onFieldValid event\n this.props.onFieldValid(fieldObj);\n });\n\n return true;\n}\n\nfunction fieldIsInError(fieldType: string, policy: string, numCharsObj: object, errorsObj) {\n return (policy === OPTIONAL || policy === HIDDEN) && numCharsObj[fieldType] === 0 ? false : errorsObj[fieldType];\n}\n\n/**\n * Saves the card brand in state\n * Emits the onBrand event\n */\nfunction handleOnBrand(cardInfo: CardBrandData): void {\n this.setState(\n prevState => {\n /**\n * If we change brand to one where the cvc or date field(s) are not required & are empty - then these fields cannot be in error\n * (scenario: have validated empty form, then choose brand w. optional/hidden cvc or date)...\n * ...else propagate the existing error.\n */\n const cvcFieldInError = fieldIsInError(ENCRYPTED_SECURITY_CODE, cardInfo.cvcPolicy, this.numCharsInField, prevState.errors);\n\n const dateFieldInError =\n this.numDateFields === 1\n ? fieldIsInError(ENCRYPTED_EXPIRY_DATE, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n // For custom card comp\n const monthFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_MONTH, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n const yearFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_YEAR, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n // --\n /** end */\n\n return {\n brand: cardInfo.brand,\n cvcPolicy: cardInfo.cvcPolicy ?? CVC_POLICY_REQUIRED,\n showSocialSecurityNumber: cardInfo.showSocialSecurityNumber,\n errors: {\n ...prevState.errors,\n ...(existy(cvcFieldInError) && { [ENCRYPTED_SECURITY_CODE]: cvcFieldInError }),\n ...(existy(dateFieldInError) && { [ENCRYPTED_EXPIRY_DATE]: dateFieldInError }),\n ...(existy(monthFieldInError) && { [ENCRYPTED_EXPIRY_MONTH]: monthFieldInError }),\n ...(existy(yearFieldInError) && { [ENCRYPTED_EXPIRY_YEAR]: yearFieldInError })\n },\n expiryDatePolicy: cardInfo.expiryDatePolicy ?? DATE_POLICY_REQUIRED\n };\n },\n () => {\n this.props.onChange(this.state, { event: 'handleOnBrand' });\n\n // Enhance data object with the url for the brand image, first checking if the merchant has configured their own one for this brand\n const brandImageUrl = this.props.brandsConfiguration[cardInfo.brand]?.icon ?? getCardImageUrl(cardInfo.brand, this.props.resources);\n this.props.onBrand({ ...cardInfo, brandImageUrl });\n }\n );\n}\n\n/**\n * Handles validation errors\n */\nfunction handleOnError(cbObj: CardErrorData, hasUnsupportedCard: boolean = null): boolean {\n const errorCode = cbObj.error;\n\n this.setState(\n prevState => ({\n errors: { ...prevState.errors, [cbObj.fieldType]: errorCode || null },\n // If dealing with an unsupported card ensure these card number related fields are reset re. pasting a full, unsupported card straight in\n ...(hasUnsupportedCard && { data: { ...prevState.data, [ENCRYPTED_CARD_NUMBER]: undefined } }),\n ...(hasUnsupportedCard && { valid: { ...prevState.valid, [ENCRYPTED_CARD_NUMBER]: false } }),\n ...(hasUnsupportedCard && { isSfpValid: false })\n }),\n () => {\n this.props.onChange(this.state, { event: 'handleOnError', fieldType: cbObj.fieldType });\n }\n );\n\n return true;\n}\n\nfunction handleFocus(cbObj: CardFocusData): void {\n this.numCharsInField[cbObj.fieldType] = cbObj.numChars;\n\n this.props.onFocus(cbObj);\n}\n\nfunction handleOnTouchstartIOS(cbObj): void {\n // disableIOSArrowKeys is either null or a function (in which case we should call it)\n this.props.disableIOSArrowKeys?.(cbObj);\n}\n\n// Only called for holder name (from CSF>partials>processAutoComplete)\nfunction handleOnAutoComplete(cbObj: CardAutoCompleteData): void {\n this.setState({ autoCompleteName: cbObj.value }, () => {\n this.props.onChange(this.state, { event: 'handleOnAutoComplete', fieldType: cbObj.fieldType });\n this.setState({ autoCompleteName: null }); // Nullify ref after sending it (lets shopper edit holder name)\n });\n this.props.onAutoComplete(cbObj);\n}\n\nfunction handleKeyPressed(obj: SFKeyPressObj): void {\n if (obj.action === 'enterKeyPressed') {\n const kb = new KeyboardEvent('keypress', {\n bubbles: true,\n cancelable: true,\n key: 'Enter',\n code: 'Enter'\n });\n this.props.handleKeyPress?.(kb);\n }\n}\n\n/**\n * Handles cases where no secured fields are necessary (one click payments without CVC)\n * Automatically resolves with a valid state\n */\nfunction handleOnNoDataRequired(): void {\n this.setState({ status: 'ready' }, () => this.props.onChange({ isSfpValid: true }));\n}\n\nexport default {\n handleFocus,\n handleOnAllValid,\n handleOnAutoComplete,\n handleOnFieldValid,\n handleOnLoad,\n handleOnConfigSuccess,\n handleOnBrand,\n handleOnError,\n handleOnNoDataRequired,\n handleOnTouchstartIOS,\n handleKeyPressed\n};\n"],"names":["fieldIsInError","fieldType","policy","numCharsObj","errorsObj","OPTIONAL","HIDDEN","handlers","handleFocus","cbObj","this","numCharsInField","numChars","props","onFocus","handleOnAllValid","status","state","detectedUnsupportedBrands","setState","isSfpValid","allValid","onChange","event","onAllValid","handleOnAutoComplete","autoCompleteName","value","onAutoComplete","handleOnFieldValid","fieldObj","ENCRYPTED_CARD_NUMBER","prevState","data","_object_spread_props","_object_spread","encryptedFieldName","blob","valid","errors","onFieldValid","handleOnLoad","clearTimeout","csfLoadFailTimeout","onLoad","csfConfigFailTimeout","setTimeout","onError","AdyenCheckoutError","csfConfigFailTimeoutMS","handleOnConfigSuccess","onConfigSuccess","handleOnBrand","cardInfo","cvcFieldInError","ENCRYPTED_SECURITY_CODE","cvcPolicy","dateFieldInError","numDateFields","ENCRYPTED_EXPIRY_DATE","expiryDatePolicy","monthFieldInError","ENCRYPTED_EXPIRY_MONTH","yearFieldInError","ENCRYPTED_EXPIRY_YEAR","brand","CVC_POLICY_REQUIRED","showSocialSecurityNumber","existy","DATE_POLICY_REQUIRED","_this_props_brandsConfiguration_cardInfo_brand","brandImageUrl","brandsConfiguration","icon","_ref","getCardImageUrl","resources","onBrand","handleOnError","hasUnsupportedCard","errorCode","error","undefined","handleOnNoDataRequired","handleOnTouchstartIOS","_this_props_disableIOSArrowKeys","_this_props","disableIOSArrowKeys","call","handleKeyPressed","obj","action","_this_props_handleKeyPress","kb","KeyboardE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BAAX,IAAAF,GAAAA,EAAAG,KAAAF,EAAiC7E,EACrC,EA0CIgF,iBA/BJ,SAA0BC,GACtB,GAAmB,oBAAfA,EAAIC,OAA8B,KAOlCC,EAAAN,EANA,MAAMO,EAAK,IAAIC,cAAc,WAAY,CACrCC,SAAS,EACTC,YAAY,EACZC,IAAK,QACLC,KAAM,UAEe,QAAzBN,GAAAN,EAAA5E,KAAKG,OAAMsF,sBAAX,IAAAP,GAAAA,EAAAJ,KAAAF,EAA4BO,EAChC,CACJ"}
1
+ {"version":3,"file":"SecuredFieldsProviderHandlers.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.ts"],"sourcesContent":["import { getCardImageUrl } from '../utils';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n CVC_POLICY_REQUIRED,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE,\n OPTIONAL,\n HIDDEN,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../lib/constants';\nimport {\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyDownObj\n} from '../lib/types';\nimport { existy } from '../../../../utils/commonUtils';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\n\n/**\n * Emits the onLoad event\n * Here we can assume all securedFields iframes have fired their 'load' event\n */\nfunction handleOnLoad(cbObj: CardLoadData): void {\n // Clear 'loading' timeout\n clearTimeout(this.csfLoadFailTimeout);\n this.csfLoadFailTimeout = null;\n\n // Propagate onLoad event\n this.props.onLoad(cbObj);\n\n /**\n * Having seen that the securedFields iframes have loaded some kind of content (we don't know what, yet)\n * - setTimeout since we expect to get a successful configuration message \"within a reasonable time\"\n *\n * Now we catch clientKey & environment mismatch in core.ts - this timeout being called indicates that the securedFields have not all configured\n * - so we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n this.csfConfigFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfConfigFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured fields have failed to configure'));\n }\n }, this.csfConfigFailTimeoutMS);\n}\n\n/**\n * Emits the onConfigSuccess (ready) event\n * Here we can assume CSF is loaded, configured and ready to be used\n */\nfunction handleOnConfigSuccess(cbObj: CardConfigSuccessData): void {\n // Clear 'config' timeout\n clearTimeout(this.csfConfigFailTimeout);\n this.csfConfigFailTimeout = null;\n\n this.setState({ status: 'ready' }, () => {\n // Propagate onConfigSuccess event\n this.props.onConfigSuccess(cbObj);\n });\n}\n\n/**\n * Emits the onAllValid event\n */\nfunction handleOnAllValid(status: CardAllValidData): boolean {\n // Form cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands) {\n return false;\n }\n\n this.setState({ isSfpValid: status.allValid }, () => {\n // New - fixes maestro-with-error-on-optional-cvc-field bug\n this.props.onChange(this.state, { event: 'handleOnAllValid' });\n // Propagate onAllValid event\n this.props.onAllValid(status);\n });\n\n return true;\n}\n\n/**\n * Saves a field value from CSF in the CardInput state\n * Emits the onFieldValid event\n */\nfunction handleOnFieldValid(fieldObj: CardFieldValidData): boolean {\n // A card number field cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands && fieldObj.fieldType === ENCRYPTED_CARD_NUMBER) {\n return false;\n }\n\n const setValidFieldState = prevState => ({\n data: { ...prevState.data, [fieldObj.encryptedFieldName]: fieldObj.blob },\n valid: { ...prevState.valid, [fieldObj.encryptedFieldName]: fieldObj.valid },\n /**\n * For a field that has just received valid:true (field has just been completed & encrypted) - mark the error state for this field as false\n * For a field that has just received valid:false (field was encrypted, now is not)\n * - field is either in a state of being incomplete but without errors (digit deleted) - so mark the error state for this field as false\n * or has switched from valid/encrypted state to being in error (digit edited to one that puts the field in error) - so keep any error that\n * might just have been set\n */\n errors: { ...prevState.errors, [fieldObj.fieldType]: prevState.errors[fieldObj.fieldType] ?? null }\n });\n\n this.setState(setValidFieldState, () => {\n this.props.onChange(this.state, { event: 'handleOnFieldValid', fieldType: fieldObj.fieldType });\n\n // Propagate onFieldValid event\n this.props.onFieldValid(fieldObj);\n });\n\n return true;\n}\n\nfunction fieldIsInError(fieldType: string, policy: string, numCharsObj: object, errorsObj) {\n return (policy === OPTIONAL || policy === HIDDEN) && numCharsObj[fieldType] === 0 ? false : errorsObj[fieldType];\n}\n\n/**\n * Saves the card brand in state\n * Emits the onBrand event\n */\nfunction handleOnBrand(cardInfo: CardBrandData): void {\n this.setState(\n prevState => {\n /**\n * If we change brand to one where the cvc or date field(s) are not required & are empty - then these fields cannot be in error\n * (scenario: have validated empty form, then choose brand w. optional/hidden cvc or date)...\n * ...else propagate the existing error.\n */\n const cvcFieldInError = fieldIsInError(ENCRYPTED_SECURITY_CODE, cardInfo.cvcPolicy, this.numCharsInField, prevState.errors);\n\n const dateFieldInError =\n this.numDateFields === 1\n ? fieldIsInError(ENCRYPTED_EXPIRY_DATE, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n // For custom card comp\n const monthFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_MONTH, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n const yearFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_YEAR, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n // --\n /** end */\n\n return {\n brand: cardInfo.brand,\n cvcPolicy: cardInfo.cvcPolicy ?? CVC_POLICY_REQUIRED,\n showSocialSecurityNumber: cardInfo.showSocialSecurityNumber,\n errors: {\n ...prevState.errors,\n ...(existy(cvcFieldInError) && { [ENCRYPTED_SECURITY_CODE]: cvcFieldInError }),\n ...(existy(dateFieldInError) && { [ENCRYPTED_EXPIRY_DATE]: dateFieldInError }),\n ...(existy(monthFieldInError) && { [ENCRYPTED_EXPIRY_MONTH]: monthFieldInError }),\n ...(existy(yearFieldInError) && { [ENCRYPTED_EXPIRY_YEAR]: yearFieldInError })\n },\n expiryDatePolicy: cardInfo.expiryDatePolicy ?? DATE_POLICY_REQUIRED\n };\n },\n () => {\n this.props.onChange(this.state, { event: 'handleOnBrand' });\n\n // Enhance data object with the url for the brand image, first checking if the merchant has configured their own one for this brand\n const brandImageUrl = this.props.brandsConfiguration[cardInfo.brand]?.icon ?? getCardImageUrl(cardInfo.brand, this.props.resources);\n this.props.onBrand({ ...cardInfo, brandImageUrl });\n }\n );\n}\n\n/**\n * Handles validation errors\n */\nfunction handleOnError(cbObj: CardErrorData, hasUnsupportedCard: boolean = null): boolean {\n const errorCode = cbObj.error;\n\n this.setState(\n prevState => ({\n errors: { ...prevState.errors, [cbObj.fieldType]: errorCode || null },\n // If dealing with an unsupported card ensure these card number related fields are reset re. pasting a full, unsupported card straight in\n ...(hasUnsupportedCard && { data: { ...prevState.data, [ENCRYPTED_CARD_NUMBER]: undefined } }),\n ...(hasUnsupportedCard && { valid: { ...prevState.valid, [ENCRYPTED_CARD_NUMBER]: false } }),\n ...(hasUnsupportedCard && { isSfpValid: false })\n }),\n () => {\n this.props.onChange(this.state, { event: 'handleOnError', fieldType: cbObj.fieldType });\n }\n );\n\n return true;\n}\n\nfunction handleFocus(cbObj: CardFocusData): void {\n this.numCharsInField[cbObj.fieldType] = cbObj.numChars;\n\n this.props.onFocus(cbObj);\n}\n\nfunction handleOnTouchstartIOS(cbObj): void {\n // disableIOSArrowKeys is either null or a function (in which case we should call it)\n this.props.disableIOSArrowKeys?.(cbObj);\n}\n\n// Only called for holder name (from CSF>partials>processAutoComplete)\nfunction handleOnAutoComplete(cbObj: CardAutoCompleteData): void {\n this.setState({ autoCompleteName: cbObj.value }, () => {\n this.props.onChange(this.state, { event: 'handleOnAutoComplete', fieldType: cbObj.fieldType });\n this.setState({ autoCompleteName: null }); // Nullify ref after sending it (lets shopper edit holder name)\n });\n this.props.onAutoComplete(cbObj);\n}\n\nfunction handleKeyDown(obj: SFKeyDownObj): void {\n if (obj.action === 'enterKeyPressed') {\n const kb = new KeyboardEvent('keydown', {\n bubbles: true,\n cancelable: true,\n key: 'Enter',\n code: 'Enter'\n });\n this.props.handleKeyDown?.(kb);\n }\n}\n\n/**\n * Handles cases where no secured fields are necessary (one click payments without CVC)\n * Automatically resolves with a valid state\n */\nfunction handleOnNoDataRequired(): void {\n this.setState({ status: 'ready' }, () => this.props.onChange({ isSfpValid: true }));\n}\n\nexport default {\n handleFocus,\n handleOnAllValid,\n handleOnAutoComplete,\n handleOnFieldValid,\n handleOnLoad,\n handleOnConfigSuccess,\n handleOnBrand,\n handleOnError,\n handleOnNoDataRequired,\n handleOnTouchstartIOS,\n handleKeyDown\n};\n"],"names":["fieldIsInError","fieldType","policy","numCharsObj","errorsObj","OPTIONAL","HIDDEN","handlers","handleFocus","cbObj","this","numCharsInField","numChars","props","onFocus","handleOnAllValid","status","state","detectedUnsupportedBrands","setState","isSfpValid","allValid","onChange","event","onAllValid","handleOnAutoComplete","autoCompleteName","value","onAutoComplete","handleOnFieldValid","fieldObj","ENCRYPTED_CARD_NUMBER","prevState","data","_object_spread_props","_object_spread","encryptedFieldName","blob","valid","errors","onFieldValid","handleOnLoad","clearTimeout","csfLoadFailTimeout","onLoad","csfConfigFailTimeout","setTimeout","onError","AdyenCheckoutError","csfConfigFailTimeoutMS","handleOnConfigSuccess","onConfigSuccess","handleOnBrand","cardInfo","cvcFieldInError","ENCRYPTED_SECURITY_CODE","cvcPolicy","dateFieldInError","numDateFields","ENCRYPTED_EXPIRY_DATE","expiryDatePolicy","monthFieldInError","ENCRYPTED_EXPIRY_MONTH","yearFieldInError","ENCRYPTED_EXPIRY_YEAR","brand","CVC_POLICY_REQUIRED","showSocialSecurityNumber","existy","DATE_POLICY_REQUIRED","_this_props_brandsConfiguration_cardInfo_brand","brandImageUrl","brandsConfiguration","icon","_ref","getCardImageUrl","resources","onBrand","handleOnError","hasUnsupportedCard","errorCode","error","undefined","handleOnNoDataRequired","handleOnTouchstartIOS","_this_props_disableIOSArrowKeys","_this_props","disableIOSArrowKeys","call","handleKeyDown","obj","action","_this_props_handleKeyDown","kb","KeyboardEvent","bubbles","cancelable","key","code"],"mappings":"ssCA0HA,SAASA,EAAeC,EAAmBC,EAAgBC,EAAqBC,GAC5E,OAAQF,IAAWG,GAAYH,IAAWI,GAAsC,IAA3BH,EAAYF,KAA2BG,EAAUH,EAC1G,CAwHA,IAAAM,EAAe,CACXC,YAzCJ,SAAqBC,GACjBC,KAAKC,gBAAgBF,EAAMR,WAAaQ,EAAMG,SAE9CF,KAAKG,MAAMC,QAAQL,EACvB,EAsCIM,iBA7KJ,SAA0BC,GAEtB,OAAIN,KAAKO,MAAMC,4BAIfR,KAAKS,SAAS,CAAEC,WAAYJ,EAAOK,UAAY,KAE3CX,KAAKG,MAAMS,SAASZ,KAAKO,MAAO,CAAEM,MAAO,qBAEzCb,KAAKG,MAAMW,WAAWR,MAGnB,EACX,EAgKIS,qBA/BJ,SAA8BhB,GAC1BC,KAAKS,SAAS,CAAEO,iBAAkBjB,EAAMkB,OAAS,KAC7CjB,KAAKG,MAAMS,SAASZ,KAAKO,MAAO,CAAEM,MAAO,uBAAwBtB,UAAWQ,EAAMR,YAClFS,KAAKS,SAAS,CAAEO,iBAAkB,SAEtChB,KAAKG,MAAMe,eAAenB,EAC9B,EA0BIoB,mBA3JJ,SAA4BC,GAExB,QAAIpB,KAAKO,MAAMC,2BAA6BY,EAAS7B,YAAc8B,KAiBnErB,KAAKS,SAbsBa,IAU8BA,IAAAA,EAVhB,MAAA,CACrCC,KAAMC,EAAAC,EAAA,CAAA,EAAKH,EAAUC,MAAI,CAAE,CAACH,EAASM,oBAAqBN,EAASO,OACnEC,MAAOJ,EAAAC,EAAA,CAAA,EAAKH,EAAUM,OAAK,CAAE,CAACR,EAASM,oBAAqBN,EAASQ,QAQrEC,OAAQL,EAAAC,EAAA,CA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AAW,IAAMN,KAAKG,MAAMS,SAAS,CAAEF,YAAY,IAC/E,EAYIgE,sBA5CJ,SAA+B3E,OAE3B4E,EAAAC,EAA8B,QAA9BD,GAAAC,EAAA5E,KAAKG,OAAM0E,2BAAX,IAAAF,GAAAA,EAAAG,KAAAF,EAAiC7E,EACrC,EA0CIgF,cA/BJ,SAAuBC,GACnB,GAAmB,oBAAfA,EAAIC,OAA8B,KAOlCC,EAAAN,EANA,MAAMO,EAAK,IAAIC,cAAc,UAAW,CACpCC,SAAS,EACTC,YAAY,EACZC,IAAK,QACLC,KAAM,UAEc,QAAxBN,GAAAN,EAAA5E,KAAKG,OAAM4E,qBAAX,IAAAG,GAAAA,EAAAJ,KAAAF,EAA2BO,EAC/B,CACJ"}
@@ -1,2 +1,2 @@
1
- var o={type:"card",keypadFix:!0,rootNode:null,loadingContext:null,brands:[],showWarnings:!1,autoFocus:!0,trimTrailingSeparator:!0,onChange:()=>{},onLoad:()=>{},onConfigSuccess:()=>{},onAllValid:()=>{},onFieldValid:()=>{},onBrand:()=>{},onError:()=>{},onBinValue:()=>{},onFocus:()=>{},onAutoComplete:()=>{},handleKeyPress:()=>{},styles:{}};export{o as default};
1
+ var o={type:"card",keypadFix:!0,rootNode:null,loadingContext:null,brands:[],showWarnings:!1,autoFocus:!0,trimTrailingSeparator:!0,onChange:()=>{},onLoad:()=>{},onConfigSuccess:()=>{},onAllValid:()=>{},onFieldValid:()=>{},onBrand:()=>{},onError:()=>{},onBinValue:()=>{},onFocus:()=>{},onAutoComplete:()=>{},handleKeyDown:()=>{},styles:{}};export{o as default};
2
2
  //# sourceMappingURL=defaultProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/defaultProps.ts"],"sourcesContent":["export default {\n type: 'card',\n\n // Settings\n keypadFix: true,\n rootNode: null,\n loadingContext: null,\n brands: [],\n showWarnings: false,\n autoFocus: true,\n trimTrailingSeparator: true,\n\n // Events\n onChange: () => {},\n onLoad: () => {},\n onConfigSuccess: () => {},\n onAllValid: () => {},\n onFieldValid: () => {},\n onBrand: () => {},\n onError: () => {},\n onBinValue: () => {},\n onFocus: () => {},\n onAutoComplete: () => {},\n handleKeyPress: () => {},\n\n // Customization\n styles: {}\n};\n"],"names":["defaultProps","type","keypadFix","rootNode","loadingContext","brands","showWarnings","autoFocus","trimTrailingSeparator","onChange","onLoad","onConfigSuccess","onAllValid","onFieldValid","onBrand","onError","onBinValue","onFocus","onAutoComplete","handleKeyPress","styles"],"mappings":"AAAA,IAAAA,EAAe,CACXC,KAAM,OAGNC,WAAW,EACXC,SAAU,KACVC,eAAgB,KAChBC,OAAQ,GACRC,cAAc,EACdC,WAAW,EACXC,uBAAuB,EAGvBC,SAAU,OACVC,OAAQ,OACRC,gBAAiB,OACjBC,WAAY,OACZC,aAAc,OACdC,QAAS,OACTC,QAAS,OACTC,WAAY,OACZC,QAAS,OACTC,eAAgB,OAChBC,eAAgB,OAGhBC,OAAQ,CAAA"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/defaultProps.ts"],"sourcesContent":["export default {\n type: 'card',\n\n // Settings\n keypadFix: true,\n rootNode: null,\n loadingContext: null,\n brands: [],\n showWarnings: false,\n autoFocus: true,\n trimTrailingSeparator: true,\n\n // Events\n onChange: () => {},\n onLoad: () => {},\n onConfigSuccess: () => {},\n onAllValid: () => {},\n onFieldValid: () => {},\n onBrand: () => {},\n onError: () => {},\n onBinValue: () => {},\n onFocus: () => {},\n onAutoComplete: () => {},\n handleKeyDown: () => {},\n\n // Customization\n styles: {}\n};\n"],"names":["defaultProps","type","keypadFix","rootNode","loadingContext","brands","showWarnings","autoFocus","trimTrailingSeparator","onChange","onLoad","onConfigSuccess","onAllValid","onFieldValid","onBrand","onError","onBinValue","onFocus","onAutoComplete","handleKeyDown","styles"],"mappings":"AAAA,IAAAA,EAAe,CACXC,KAAM,OAGNC,WAAW,EACXC,SAAU,KACVC,eAAgB,KAChBC,OAAQ,GACRC,cAAc,EACdC,WAAW,EACXC,uBAAuB,EAGvBC,SAAU,OACVC,OAAQ,OACRC,gBAAiB,OACjBC,WAAY,OACZC,aAAc,OACdC,QAAS,OACTC,QAAS,OACTC,WAAY,OACZC,QAAS,OACTC,eAAgB,OAChBC,cAAe,OAGfC,OAAQ,CAAA"}
@@ -1,2 +1,2 @@
1
- import{httpPost as e}from"../../../../core/Services/http.js";import{DEFAULT_CARD_GROUP_TYPES as r}from"../lib/constants.js";import{SF_ErrorCodes as n}from"../../../../core/Errors/constants.js";function t(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var o=o=>{let s=null;return p=>{if(!1!==o.props.doBinLookup){if(p.encryptedBin&&o.props.clientKey)s=p.uuid,e({loadingContext:o.props.loadingContext,path:`v3/bin/binLookup?token=${o.props.clientKey}`},{type:o.props.brand,supportedBrands:o.props.brands||r,encryptedBin:p.encryptedBin,requestId:p.uuid}).then(e=>{var d;if((null==e?void 0:e.requestId)===s)if(null===(d=e.brands)||void 0===d?void 0:d.length){const s=e.brands.reduce((e,r)=>(e.detectedBrands.push(r.brand),e.paymentMethodVariants.push(r.paymentMethodVariant),!0===r.supported?(e.supportedBrands.push(r),e):e),{supportedBrands:[],detectedBrands:[],paymentMethodVariants:[]});if(s.supportedBrands.length)return o.processBinLookupResponse(function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){t(e,r,n[r])})}return e}({issuingCountryCode:e.issuingCountryCode,supportedBrands:s.supportedBrands},e.showSocialSecurityNumber?{showSocialSecurityNumber:e.showSocialSecurityNumber}:{})),void o.onBinLookup({type:p.type,detectedBrands:s.detectedBrands,supportedBrands:s.supportedBrands.map(e=>e.brand),paymentMethodVariants:s.paymentMethodVariants,supportedBrandsRaw:s.supportedBrands,brands:o.props.brands||r,issuingCountryCode:e.issuingCountryCode});if(s.detectedBrands.length){const e={type:"card",fieldType:"encryptedCardNumber",error:n.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,detectedBrands:s.detectedBrands};return o.handleUnsupportedCard(e),void o.onBinLookup({type:p.type,detectedBrands:s.detectedBrands,supportedBrands:null,paymentMethodVariants:s.paymentMethodVariants,brands:o.props.brands||r})}}else o.onBinLookup({type:p.type,detectedBrands:null,supportedBrands:null,brands:o.props.brands||r}),o.processBinLookupResponse({},!0);else(null==e?void 0:e.requestId)||o.props.onError(e||{errorType:"binLookup",message:"unknownError"})});else if(s){o.processBinLookupResponse(null,!0),s=null;const e={type:"card",fieldType:"encryptedCardNumber",error:""};o.handleUnsupportedCard(e),o.onBinLookup({isReset:!0})}o.props.onBinValue&&o.props.onBinValue(p)}else o.props.onBinValue&&o.props.onBinValue(p)}};export{o as default};
1
+ import{httpPost as e}from"../../../../core/Services/http.js";import{DEFAULT_CARD_GROUP_TYPES as r}from"../lib/constants.js";import{SF_ErrorCodes as t}from"../../../../core/Errors/constants.js";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){n(e,r,t[r])})}return e}function s(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}var p=n=>{let p=null;return d=>{if(!1!==n.props.doBinLookup){if(d.encryptedBin&&n.props.clientKey)p=d.uuid,e({loadingContext:n.props.loadingContext,path:`v3/bin/binLookup?token=${n.props.clientKey}`},{type:n.props.brand,supportedBrands:n.props.brands||r,encryptedBin:d.encryptedBin,requestId:d.uuid}).then(e=>{var a;if((null==e?void 0:e.requestId)===p)if(null===(a=e.brands)||void 0===a?void 0:a.length){const p=e.brands.reduce((e,r)=>(e.detectedBrands.push(r.brand),e.paymentMethodVariants.push(r.paymentMethodVariant),void 0!==r.healthcare&&e.healthcare.push({[r.brand]:r.healthcare}),!0===r.supported?(e.supportedBrands.push(r),e):e),{supportedBrands:[],detectedBrands:[],paymentMethodVariants:[],healthcare:[]}),a=p.healthcare.length>0;if(p.supportedBrands.length)return n.processBinLookupResponse(o({issuingCountryCode:e.issuingCountryCode,supportedBrands:p.supportedBrands},e.showSocialSecurityNumber?{showSocialSecurityNumber:e.showSocialSecurityNumber}:{})),void n.onBinLookup(o({type:d.type,detectedBrands:p.detectedBrands,supportedBrands:p.supportedBrands.map(e=>e.brand),paymentMethodVariants:p.paymentMethodVariants,supportedBrandsRaw:p.supportedBrands,brands:n.props.brands||r,issuingCountryCode:e.issuingCountryCode},a&&{healthcare:p.healthcare}));if(p.detectedBrands.length){const e={type:"card",fieldType:"encryptedCardNumber",error:t.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,detectedBrands:p.detectedBrands};return n.handleUnsupportedCard(e),void n.onBinLookup(s(o({type:d.type,detectedBrands:p.detectedBrands,supportedBrands:null,paymentMethodVariants:p.paymentMethodVariants},a&&{healthcare:p.healthcare}),{brands:n.props.brands||r}))}}else n.onBinLookup({type:d.type,detectedBrands:null,supportedBrands:null,brands:n.props.brands||r}),n.processBinLookupResponse({},!0);else(null==e?void 0:e.requestId)||n.props.onError(e||{errorType:"binLookup",message:"unknownError"})});else if(p){n.processBinLookupResponse(null,!0),p=null;const e={type:"card",fieldType:"encryptedCardNumber",error:""};n.handleUnsupportedCard(e),n.onBinLookup({isReset:!0})}n.props.onBinValue&&n.props.onBinValue(d)}else n.props.onBinValue&&n.props.onBinValue(d)}};export{p as default};
2
2
  //# sourceMappingURL=triggerBinLookUp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"triggerBinLookUp.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/triggerBinLookUp.ts"],"sourcesContent":["import { httpPost } from '../../../../core/Services/http';\nimport { CardBinValueData, CardErrorData } from '../lib/types';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../lib/constants';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { 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 });\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 });\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 });\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 brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n });\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 });\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,aAC1BW,UAAWd,EAAYK,OAE7BU,KAAMC,IA8CIA,IAAAA,EA5CR,IAAIA,eAAAA,EAAMF,aAAcf,EA4CpB,WAAIiB,EAAAA,EAAKJ,kBAALI,OAAAA,EAAAA,EAAaC,OAAQ,CACrB,MAAMC,EAAiBF,EAAKJ,OAAOO,OAC/B,CAACC,EAAKC,KAEFD,EAAIE,eAAeC,KAAKF,EAAKX,OAE7BU,EAAII,sBAAsBD,KAAKF,EAAKI,uBAGb,IAAnBJ,EAAKK,WACLN,EAAIT,gBAAgBY,KAAKF,GAClBD,GAGJA,GAEX,CAAET,gBAAiB,GAAIW,eAAgB,GAAIE,sBAAuB,KAMtE,GAAIN,EAAeP,gBAAgBM,OAoB/B,OAlBAnB,EAAO6B,2VAAyBC,CAAA,CAC5BC,mBAAoBb,EAAKa,mBACzBlB,gBAAiBO,EAAeP,iBAC5BK,EAAKc,yBAA2B,CAAEA,yBAA0Bd,EAAKc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ookUp.ts"],"sourcesContent":["import { httpPost } from '../../../../core/Services/http';\nimport { CardBinValueData, CardErrorData } from '../lib/types';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../lib/constants';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BinLookupResponseRaw, BrandObject } 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: string | null = 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 healthcare: 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 healthcare: 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 // Add healthcare to the healthcare array, keyed by brand (only when the field is present)\n if (item.healthcare !== undefined) {\n acc.healthcare.push({ [item.brand]: item.healthcare });\n }\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 {\n supportedBrands: [] as BrandObject[],\n detectedBrands: [] as string[],\n paymentMethodVariants: [] as (string | undefined)[],\n healthcare: [] as Record<string, boolean>[]\n }\n );\n\n const hasHealthcareData = mappedResponse.healthcare.length > 0;\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 });\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 ...(hasHealthcareData && { healthcare: mappedResponse.healthcare })\n });\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 ...(hasHealthcareData && { healthcare: mappedResponse.healthcare }),\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n });\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 brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n });\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 });\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","undefined","healthcare","supported","hasHealthcareData","processBinLookupResponse","_object_spread","issuingCountryCode","showSocialSecurityNumber","onBinLookup","map","supportedBrandsRaw","errObj","fieldType","error","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","handleUnsupportedCard","_object_spread_props","onError","errorType","message","isReset","onBinValue"],"mappings":"0+BAUA,IAAAA,EAAeC,IACX,IAAIC,EAAkC,KAEtC,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,aAC1BW,UAAWd,EAAYK,OAE7BU,KAAMC,IAgDIA,IAAAA,EA9CR,IAAIA,eAAAA,EAAMF,aAAcf,EA8CpB,WAAIiB,EAAAA,EAAKJ,kBAALI,OAAAA,EAAAA,EAAaC,OAAQ,CACrB,MAAMC,EAAiBF,EAAKJ,OAAOO,OAC/B,CAACC,EAAKC,KAEFD,EAAIE,eAAeC,KAAKF,EAAKX,OAE7BU,EAAII,sBAAsBD,KAAKF,EAAKI,2BAEZC,IAApBL,EAAKM,YACLP,EAAIO,WAAWJ,KAAK,CAAE,CAACF,EAAKX,OAAQW,EAAKM,cAItB,IAAnBN,EAAKO,WACLR,EAAIT,gBAAgBY,KAAKF,GAClBD,GAGJA,GAEX,CACIT,gBAAiB,GACjB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AM,GAEtC/B,EAAmB,KAGnB,MAAMsC,EAAwB,CAC1B5B,KAAM,OACN6B,UAAW,sBACXC,MAAO,IAEXzC,EAAO4C,sBAAsBL,GAG7BvC,EAAOoC,YAAY,CACfa,SAAS,GAEjB,CAEIjD,EAAOG,MAAM+C,YAAYlD,EAAOG,MAAM+C,WAAWhD,EAlMrD,MAFQF,EAAOG,MAAM+C,YAAYlD,EAAOG,MAAM+C,WAAWhD,GAsMjE"}
@@ -1,2 +1,2 @@
1
- const o=()=>{};function n(n={}){this.callbacks.onLoad=n.onLoad?n.onLoad:o,this.callbacks.onConfigSuccess=n.onConfigSuccess?n.onConfigSuccess:o,this.callbacks.onFieldValid=n.onFieldValid?n.onFieldValid:o,this.callbacks.onAllValid=n.onAllValid?n.onAllValid:o,this.callbacks.onBrand=n.onBrand?n.onBrand:o,this.callbacks.onError=n.onError?n.onError:o,this.callbacks.onFocus=n.onFocus?n.onFocus:o,this.callbacks.onBinValue=n.onBinValue?n.onBinValue:o,this.callbacks.onAutoComplete=n.onAutoComplete?n.onAutoComplete:o,this.callbacks.onAdditionalSFConfig=n.onAdditionalSFConfig?n.onAdditionalSFConfig:o,this.callbacks.onAdditionalSFRemoved=n.onAdditionalSFRemoved?n.onAdditionalSFRemoved:o,this.callbacks.onTouchstartIOS=n.onTouchstartIOS?n.onTouchstartIOS:o,this.callbacks.onKeyPressed=n.onKeyPressed?n.onKeyPressed:o}export{n as configureCallbacks};
1
+ const o=()=>{};function n(n={}){this.callbacks.onLoad=n.onLoad?n.onLoad:o,this.callbacks.onConfigSuccess=n.onConfigSuccess?n.onConfigSuccess:o,this.callbacks.onFieldValid=n.onFieldValid?n.onFieldValid:o,this.callbacks.onAllValid=n.onAllValid?n.onAllValid:o,this.callbacks.onBrand=n.onBrand?n.onBrand:o,this.callbacks.onError=n.onError?n.onError:o,this.callbacks.onFocus=n.onFocus?n.onFocus:o,this.callbacks.onBinValue=n.onBinValue?n.onBinValue:o,this.callbacks.onAutoComplete=n.onAutoComplete?n.onAutoComplete:o,this.callbacks.onAdditionalSFConfig=n.onAdditionalSFConfig?n.onAdditionalSFConfig:o,this.callbacks.onAdditionalSFRemoved=n.onAdditionalSFRemoved?n.onAdditionalSFRemoved:o,this.callbacks.onTouchstartIOS=n.onTouchstartIOS?n.onTouchstartIOS:o,this.callbacks.onKeyDown=n.onKeyDown?n.onKeyDown:o}export{n as configureCallbacks};
2
2
  //# sourceMappingURL=configureCallbacks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configureCallbacks.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.ts"],"sourcesContent":["import { CSFCallbacksConfig } from '../types';\n\nconst noop = () => {};\n\nexport function configureCallbacks(callbacksObj: Partial<CSFCallbacksConfig> = {}): void {\n // --\n this.callbacks.onLoad = callbacksObj.onLoad ? callbacksObj.onLoad : noop;\n\n this.callbacks.onConfigSuccess = callbacksObj.onConfigSuccess ? callbacksObj.onConfigSuccess : noop;\n\n this.callbacks.onFieldValid = callbacksObj.onFieldValid ? callbacksObj.onFieldValid : noop;\n\n this.callbacks.onAllValid = callbacksObj.onAllValid ? callbacksObj.onAllValid : noop;\n\n this.callbacks.onBrand = callbacksObj.onBrand ? callbacksObj.onBrand : noop;\n\n this.callbacks.onError = callbacksObj.onError ? callbacksObj.onError : noop;\n\n this.callbacks.onFocus = callbacksObj.onFocus ? callbacksObj.onFocus : noop;\n\n this.callbacks.onBinValue = callbacksObj.onBinValue ? callbacksObj.onBinValue : noop;\n\n this.callbacks.onAutoComplete = callbacksObj.onAutoComplete ? callbacksObj.onAutoComplete : noop;\n\n this.callbacks.onAdditionalSFConfig = callbacksObj.onAdditionalSFConfig ? callbacksObj.onAdditionalSFConfig : noop;\n\n this.callbacks.onAdditionalSFRemoved = callbacksObj.onAdditionalSFRemoved ? callbacksObj.onAdditionalSFRemoved : noop;\n\n this.callbacks.onTouchstartIOS = callbacksObj.onTouchstartIOS ? callbacksObj.onTouchstartIOS : noop;\n\n this.callbacks.onKeyPressed = callbacksObj.onKeyPressed ? callbacksObj.onKeyPressed : noop;\n}\n"],"names":["noop","configureCallbacks","callbacksObj","this","callbacks","onLoad","onConfigSuccess","onFieldValid","onAllValid","onBrand","onError","onFocus","onBinValue","onAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","onKeyPressed"],"mappings":"AAEA,MAAMA,EAAO,OAEN,SAASC,EAAmBC,EAA4C,IAE3EC,KAAKC,UAAUC,OAASH,EAAaG,OAASH,EAAaG,OAASL,EAEpEG,KAAKC,UAAUE,gBAAkBJ,EAAaI,gBAAkBJ,EAAaI,gBAAkBN,EAE/FG,KAAKC,UAAUG,aAAeL,EAAaK,aAAeL,EAAaK,aAAeP,EAEtFG,KAAKC,UAAUI,WAAaN,EAAaM,WAAaN,EAAaM,WAAaR,EAEhFG,KAAKC,UAAUK,QAAUP,EAAaO,QAAUP,EAAaO,QAAUT,EAEvEG,KAAKC,UAAUM,QAAUR,EAAaQ,QAAUR,EAAaQ,QAAUV,EAEvEG,KAAKC,UAAUO,QAAUT,EAAaS,QAAUT,EAAaS,QAAUX,EAEvEG,KAAKC,UAAUQ,WAAaV,EAAaU,WAAaV,EAAaU,WAAaZ,EAEhFG,KAAKC,UAAUS,eAAiBX,EAAaW,eAAiBX,EAAaW,eAAiBb,EAE5FG,KAAKC,UAAUU,qBAAuBZ,EAAaY,qBAAuBZ,EAAaY,qBAAuBd,EAE9GG,KAAKC,UAAUW,sBAAwBb,EAAaa,sBAAwBb,EAAaa,sBAAwBf,EAEjHG,KAAKC,UAAUY,gBAAkBd,EAAac,gBAAkBd,EAAac,gBAAkBhB,EAE/FG,KAAKC,UAAUa,aAAef,EAAae,aAAef,EAAae,aAAejB,CAC1F"}
1
+ {"version":3,"file":"configureCallbacks.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.ts"],"sourcesContent":["import { CSFCallbacksConfig } from '../types';\n\nconst noop = () => {};\n\nexport function configureCallbacks(callbacksObj: Partial<CSFCallbacksConfig> = {}): void {\n // --\n this.callbacks.onLoad = callbacksObj.onLoad ? callbacksObj.onLoad : noop;\n\n this.callbacks.onConfigSuccess = callbacksObj.onConfigSuccess ? callbacksObj.onConfigSuccess : noop;\n\n this.callbacks.onFieldValid = callbacksObj.onFieldValid ? callbacksObj.onFieldValid : noop;\n\n this.callbacks.onAllValid = callbacksObj.onAllValid ? callbacksObj.onAllValid : noop;\n\n this.callbacks.onBrand = callbacksObj.onBrand ? callbacksObj.onBrand : noop;\n\n this.callbacks.onError = callbacksObj.onError ? callbacksObj.onError : noop;\n\n this.callbacks.onFocus = callbacksObj.onFocus ? callbacksObj.onFocus : noop;\n\n this.callbacks.onBinValue = callbacksObj.onBinValue ? callbacksObj.onBinValue : noop;\n\n this.callbacks.onAutoComplete = callbacksObj.onAutoComplete ? callbacksObj.onAutoComplete : noop;\n\n this.callbacks.onAdditionalSFConfig = callbacksObj.onAdditionalSFConfig ? callbacksObj.onAdditionalSFConfig : noop;\n\n this.callbacks.onAdditionalSFRemoved = callbacksObj.onAdditionalSFRemoved ? callbacksObj.onAdditionalSFRemoved : noop;\n\n this.callbacks.onTouchstartIOS = callbacksObj.onTouchstartIOS ? callbacksObj.onTouchstartIOS : noop;\n\n this.callbacks.onKeyDown = callbacksObj.onKeyDown ? callbacksObj.onKeyDown : noop;\n}\n"],"names":["noop","configureCallbacks","callbacksObj","this","callbacks","onLoad","onConfigSuccess","onFieldValid","onAllValid","onBrand","onError","onFocus","onBinValue","onAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","onKeyDown"],"mappings":"AAEA,MAAMA,EAAO,OAEN,SAASC,EAAmBC,EAA4C,IAE3EC,KAAKC,UAAUC,OAASH,EAAaG,OAASH,EAAaG,OAASL,EAEpEG,KAAKC,UAAUE,gBAAkBJ,EAAaI,gBAAkBJ,EAAaI,gBAAkBN,EAE/FG,KAAKC,UAAUG,aAAeL,EAAaK,aAAeL,EAAaK,aAAeP,EAEtFG,KAAKC,UAAUI,WAAaN,EAAaM,WAAaN,EAAaM,WAAaR,EAEhFG,KAAKC,UAAUK,QAAUP,EAAaO,QAAUP,EAAaO,QAAUT,EAEvEG,KAAKC,UAAUM,QAAUR,EAAaQ,QAAUR,EAAaQ,QAAUV,EAEvEG,KAAKC,UAAUO,QAAUT,EAAaS,QAAUT,EAAaS,QAAUX,EAEvEG,KAAKC,UAAUQ,WAAaV,EAAaU,WAAaV,EAAaU,WAAaZ,EAEhFG,KAAKC,UAAUS,eAAiBX,EAAaW,eAAiBX,EAAaW,eAAiBb,EAE5FG,KAAKC,UAAUU,qBAAuBZ,EAAaY,qBAAuBZ,EAAaY,qBAAuBd,EAE9GG,KAAKC,UAAUW,sBAAwBb,EAAaa,sBAAwBb,EAAaa,sBAAwBf,EAEjHG,KAAKC,UAAUY,gBAAkBd,EAAac,gBAAkBd,EAAac,gBAAkBhB,EAE/FG,KAAKC,UAAUa,UAAYf,EAAae,UAAYf,EAAae,UAAYjB,CACjF"}
@@ -1,2 +1,2 @@
1
- import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,CVC_POLICY_REQUIRED as o,DATE_POLICY_REQUIRED as s,ENCRYPTED_EXPIRY_YEAR as r,SF_CONFIG_TIMEOUT as n,DATA_UID as a,DATA_INFO as l}from"../../constants.js";import{existy as d}from"../../../../../../utils/commonUtils.js";import c from"../utils/cardType.js";import h from"../../securedField/SecuredField.js";import p from"../../../../../../core/Errors/AdyenCheckoutError.js";import{isSecuredField as u}from"../../../utils.js";function f(e,t){if(null==e)return{};var i,o,s,r={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(i=Reflect.ownKeys(Object(e)),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}if(r=function(e,t){if(null==e)return{};var i,o,s={},r=Object.getOwnPropertyNames(e);for(o=0;o<r.length;o++)i=r[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}(e,t),Object.getOwnPropertySymbols)for(i=Object.getOwnPropertySymbols(e),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}function m(){this.encryptedAttrName=i;const r=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),o=u(i);return o||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),o}),n=o,a=s;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(r,n,a),r.length):(this.createNonCardSecuredFields(r),r.length)}async function y(e){for(let t=0;t<e.length;t++){const i=e[t];await this.setupSecuredField(i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})}}async function g(e,t,i){let r=this.state.type;if("card"===r&&1===this.config.cardGroupTypes.length&&(r=this.config.cardGroupTypes[0],this.state.type=r),this.isSingleBrandedCard="card"!==r,this.isSingleBrandedCard){const e=c.getCardByBrand(r);d(e)?(t=e.cvcPolicy||o,i=e.expiryDatePolicy||s,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let o=0;o<e.length;o++){const s=e[o];window._b$dl&&console.log("\nAbout to set up securedField:",s),await this.setupSecuredField(s,t,i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}),window._b$dl&&console.log("Finished setting up securedField:",s)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:r,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function T(e,i,o){return new Promise((s,d)=>{const c=t(e,this.encryptedAttrName);c===r&&(this.state.hasSeparateDateFields=!0);const u={fieldType:c,extraFieldData:t(e,l),uid:t(e,a),cvcPolicy:i,holderEl:e,expiryDatePolicy:o,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders,submitAnalytics:this.props.onSubmitAnalytics,componentType:this.props.componentType},m=new h(u,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new p("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(m.loadToConfigTimeout=setTimeout(()=>{d({type:u.fieldType,failReason:"sf took too long to config"})},n),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(m.loadToConfigTimeout),m.loadToConfigTimeout=null,s(e)}).onFocus(e=>{this.handleFocus(e)}).onBinValue(e=>{this.handleBinValue(e)}).onTouchstart(e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})}).onShiftTab(e=>{this.handleSFShiftTab(e.fieldType)}).onEncryption(e=>{this.handleEncryption(e)}).onValidation(e=>{this.handleValidation(e)}).onAutoComplete(e=>{this.processAutoComplete(e)}).onKeyPressed(e=>{const{numKey:t}=e,i=f(e,["numKey"]);this.callbacks.onKeyPressed(i)});this.state.securedFields[c]=m})}export{g as createCardSecuredFields,y as createNonCardSecuredFields,m as createSecuredFields,T as setupSecuredField};
1
+ import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,CVC_POLICY_REQUIRED as o,DATE_POLICY_REQUIRED as s,ENCRYPTED_EXPIRY_YEAR as n,SF_CONFIG_TIMEOUT as r,DATA_UID as a,DATA_INFO as l}from"../../constants.js";import{existy as d}from"../../../../../../utils/commonUtils.js";import c from"../utils/cardType.js";import h from"../../securedField/SecuredField.js";import p from"../../../../../../core/Errors/AdyenCheckoutError.js";import{isSecuredField as u}from"../../../utils.js";function f(e,t){if(null==e)return{};var i,o,s,n={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(i=Reflect.ownKeys(Object(e)),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(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 m(){this.encryptedAttrName=i;const n=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),o=u(i);return o||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),o}),r=o,a=s;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(n,r,a),n.length):(this.createNonCardSecuredFields(n),n.length)}async function y(e){for(let t=0;t<e.length;t++){const i=e[t];await this.setupSecuredField(i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})}}async function g(e,t,i){let n=this.state.type;if("card"===n&&1===this.config.cardGroupTypes.length&&(n=this.config.cardGroupTypes[0],this.state.type=n),this.isSingleBrandedCard="card"!==n,this.isSingleBrandedCard){const e=c.getCardByBrand(n);d(e)?(t=e.cvcPolicy||o,i=e.expiryDatePolicy||s,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let o=0;o<e.length;o++){const s=e[o];window._b$dl&&console.log("\nAbout to set up securedField:",s),await this.setupSecuredField(s,t,i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}),window._b$dl&&console.log("Finished setting up securedField:",s)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:n,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function T(e,i,o){return new Promise((s,d)=>{const c=t(e,this.encryptedAttrName);c===n&&(this.state.hasSeparateDateFields=!0);const u={fieldType:c,extraFieldData:t(e,l),uid:t(e,a),cvcPolicy:i,holderEl:e,expiryDatePolicy:o,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders,submitAnalytics:this.props.onSubmitAnalytics,componentType:this.props.componentType},m=new h(u,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new p("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(m.loadToConfigTimeout=setTimeout(()=>{d({type:u.fieldType,failReason:"sf took too long to config"})},r),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(m.loadToConfigTimeout),m.loadToConfigTimeout=null,s(e)}).onFocus(e=>{this.handleFocus(e)}).onBinValue(e=>{this.handleBinValue(e)}).onTouchstart(e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})}).onShiftTab(e=>{this.handleSFShiftTab(e.fieldType)}).onEncryption(e=>{this.handleEncryption(e)}).onValidation(e=>{this.handleValidation(e)}).onAutoComplete(e=>{this.processAutoComplete(e)}).onKeyDown(e=>{const{numKey:t}=e,i=f(e,["numKey"]);this.callbacks.onKeyDown(i)});this.state.securedFields[c]=m})}export{g as createCardSecuredFields,y as createNonCardSecuredFields,m as createSecuredFields,T as setupSecuredField};
2
2
  //# sourceMappingURL=createSecuredFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSecuredFields.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.ts"],"sourcesContent":["import { select, getAttribute } from '../../utilities/dom';\nimport {\n ENCRYPTED_EXPIRY_YEAR,\n DATE_POLICY_REQUIRED,\n CVC_POLICY_REQUIRED,\n DATA_ENCRYPTED_FIELD_ATTR,\n DATA_INFO,\n DATA_UID,\n SF_CONFIG_TIMEOUT,\n ENCRYPTED_EXPIRY_MONTH\n} from '../../constants';\nimport { existy } from '../../../../../../utils/commonUtils';\nimport cardType from '../utils/cardType';\nimport { SecuredFieldSetupObject } from '../../types';\nimport SecuredField from '../../securedField/SecuredField';\nimport { CardObject, CardBrandData, SFFeedbackObj, CardLoadData, CVCPolicyType, DatePolicyType } from '../../types';\nimport AdyenCheckoutError from '../../../../../../core/Errors/AdyenCheckoutError';\nimport { isSecuredField } from '../../../utils';\n\n/**\n * Bound to the instance of CSF\n * Handles specific functionality related to configuring & creating SecuredFields\n */\nexport function createSecuredFields(): number {\n this.encryptedAttrName = DATA_ENCRYPTED_FIELD_ATTR;\n\n // Detect DOM elements that qualify as securedField holders & filter them for valid types\n const securedFields: HTMLElement[] = select(this.props.rootNode, `[${this.encryptedAttrName}]`).filter(field => {\n const fieldType: string = getAttribute(field, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_MONTH) {\n // TODO send analytics about separate date fields\n }\n\n const isValidType = isSecuredField(fieldType);\n if (!isValidType) {\n console.warn(\n `WARNING: '${fieldType}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`\n );\n }\n return isValidType;\n });\n\n /**\n * cvcPolicy - 'required' | 'optional' | 'hidden'\n * - Always 'required' for GiftCards\n * - Usually 'required' for single branded Credit Cards but with exceptions e.g. maestro ('optional'), bcmc ('hidden').\n * - Always 'required' for generic Credit Cards at start up - in this case, subsequent, supporting information about whether cvc stops being required\n * comes from the SF in the brand information (as the shopper inputs the cc number)\n */\n const cvcPolicy: CVCPolicyType = CVC_POLICY_REQUIRED;\n\n /** Usually 'required' for single branded Credit Cards but with exceptions e.g. ticket ('hidden', *technically* a meal voucher) */\n const expiryDatePolicy: DatePolicyType = DATE_POLICY_REQUIRED;\n\n // CHECK IF THIS SECURED FIELD IS NOT OF A CREDIT CARD TYPE\n if (!this.config.isCreditCardType) {\n this.createNonCardSecuredFields(securedFields);\n return securedFields.length;\n }\n\n // CONTINUE AS CREDIT-CARD TYPE...\n this.isSingleBrandedCard = false;\n\n this.securityCode = '';\n\n this.createCardSecuredFields(securedFields, cvcPolicy, expiryDatePolicy);\n\n // Return the number of iframes we're going to create\n return securedFields.length;\n}\n\n/**\n * i.e. giftcard and ach fields\n *\n * Create a new SecuredField for each detected holding element\n */\nexport async function createNonCardSecuredFields(securedFields: HTMLElement[]): Promise<void> {\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n await this.setupSecuredField(securedField).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n }\n}\n\nexport async function createCardSecuredFields(\n securedFields: HTMLElement[],\n cvcPolicy: CVCPolicyType,\n expiryDatePolicy: DatePolicyType\n): Promise<void> {\n // Declared card type from the initialisation of CSF\n let type: string = this.state.type;\n\n // Maybe it's a single branded card defined by setting type: 'card' & a single item in cardGroupTypes\n // In which case update the type var both locally AND in State\n if (type === 'card' && this.config.cardGroupTypes.length === 1) {\n type = this.config.cardGroupTypes[0];\n this.state.type = type;\n }\n\n // So, is it a single branded card? i.e. a storedCard or a regular card that has just one brand set in its brands array\n this.isSingleBrandedCard = type !== 'card';\n\n // If single branded card field...\n if (this.isSingleBrandedCard) {\n // Check that type exists\n const card: CardObject = cardType.getCardByBrand(type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (!existy(card)) {\n this.state.type = 'unrecognised-single-brand'; // Will let CVC field accept 4 digits in the input\n } else {\n // Assess whether cvc field is required based on the card type & whether the cvc field should even be visible\n cvcPolicy = card.cvcPolicy || CVC_POLICY_REQUIRED;\n expiryDatePolicy = card.expiryDatePolicy || DATE_POLICY_REQUIRED;\n\n this.securityCode = card.securityCode;\n }\n }\n\n /**\n * Create a new SecuredField for each detected holding element\n *\n * - we do this in sequence, waiting until one has configured before creating the next.\n * We do it this way to avoid the 'bug' whereby if something interrupts the loading of an iframe the listener we have for its load event\n * never fires; which means the iframe never configures.\n * (NB - you can recreate this 'bug' by creating the securedFields in a synchronous loop:\n * securedFields.forEach(this.setupSecuredField.bind(this));\n * and putting a breakpoint on the line where we declare the setupSecuredField function)\n *\n * Also note we tried the Array.map/Promise.all way of asynchronously looping through an array - but it didn't fix the issue,\n * - so we fall back to a good old for-loop\n */\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n if (window._b$dl) console.log('\\nAbout to set up securedField:', securedField);\n await this.setupSecuredField(securedField, cvcPolicy, expiryDatePolicy).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n if (window._b$dl) console.log('Finished setting up securedField:', securedField);\n }\n if (window._b$dl) console.log('Finished setting up all securedFields');\n\n /**\n * Now the securedFields have all been created and configured...\n *\n * For a single branded card we call to onBrand callback once.\n * This allows the UI to set the correct logo if they haven't already,\n * and we also pass the cvcPolicy & expiryDatePolicy so the UI can hide the iframe holders if necessary\n */\n if (this.isSingleBrandedCard) {\n const callbackObj: CardBrandData = {\n type: this.state.type,\n rootNode: this.props.rootNode,\n brand: type,\n cvcPolicy,\n expiryDatePolicy,\n cvcText: this.securityCode\n };\n\n // Allow a tick for the securedField to finish rendering\n setTimeout(() => {\n this.callbacks.onBrand(callbackObj);\n }, 0);\n }\n}\n\n// Run for each detected holder of a securedField...\nexport function setupSecuredField(pItem: HTMLElement, cvcPolicy?: CVCPolicyType, expiryDatePolicy?: DatePolicyType): Promise<SFFeedbackObj> {\n return new Promise((resolve, reject) => {\n /**\n * possible values:\n * encryptedCardNumber\n * encryptedExpiryDate\n * encryptedExpiryMonth\n * encryptedExpiryYear\n * encryptedSecurityCode\n * encryptedPassword\n */\n const fieldType: string = getAttribute(pItem, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_YEAR) {\n this.state.hasSeparateDateFields = true;\n }\n\n const extraFieldData: string = getAttribute(pItem, DATA_INFO);\n const uid = getAttribute(pItem, DATA_UID);\n\n // CREATE SecuredField passing config object\n const sfInitObj: SecuredFieldSetupObject = {\n fieldType,\n extraFieldData,\n uid,\n cvcPolicy,\n holderEl: pItem,\n expiryDatePolicy,\n txVariant: this.state.type,\n // from this.config (calculated)\n cardGroupTypes: this.config.cardGroupTypes,\n iframeUIConfig: this.config.iframeUIConfig,\n sfLogAtStart: this.config.sfLogAtStart,\n trimTrailingSeparator: this.config.trimTrailingSeparator,\n isCreditCardType: this.config.isCreditCardType,\n iframeSrc: this.config.iframeSrc,\n loadingContext: this.config.loadingContext,\n showWarnings: this.config.showWarnings,\n legacyInputMode: this.config.legacyInputMode,\n minimumExpiryDate: this.config.minimumExpiryDate,\n // from this.props (passed straight thru)\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n disableIOSArrowKeys: this.props.shouldDisableIOSArrowKeys,\n implementationType: this.props.implementationType,\n showContextualElement: this.props.showContextualElement,\n placeholders: this.props.placeholders,\n submitAnalytics: this.props.onSubmitAnalytics,\n componentType: this.props.componentType\n };\n\n const sf: SecuredField = new SecuredField(sfInitObj, this.props.i18n)\n .onIframeLoaded((): void => {\n // Count\n this.state.iframeCount += 1;\n\n if (window._b$dl) console.log('### createSecuredFields::onIframeLoaded:: this.state.iframeCount=', this.state.iframeCount);\n\n // One of our existing securedFields has just loaded new content!\n if (this.state.iframeCount > this.state.numIframes) {\n this.destroySecuredFields();\n // TODO send analytics about this error\n throw new AdyenCheckoutError(\n 'ERROR',\n `One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`\n );\n }\n\n /** Create timeout within which time we expect the securedField to configure */\n // @ts-ignore - timeout 'type' *is* a number\n sf.loadToConfigTimeout = setTimeout(() => {\n reject({ type: sfInitObj.fieldType, failReason: 'sf took too long to config' });\n }, SF_CONFIG_TIMEOUT);\n\n // If all iframes are loaded - call onLoad callback\n if (this.state.iframeCount === this.state.originalNumIframes) {\n const callbackObj: CardLoadData = { iframesLoaded: true };\n this.callbacks.onLoad(callbackObj);\n }\n })\n .onConfig((pFeedbackObj: SFFeedbackObj): void => {\n this.handleIframeConfigFeedback(pFeedbackObj);\n\n // Clear timeout since the securedField has configured\n clearTimeout(sf.loadToConfigTimeout);\n sf.loadToConfigTimeout = null;\n\n resolve(pFeedbackObj);\n })\n .onFocus((pFeedbackObj: SFFeedbackObj): void => {\n this.handleFocus(pFeedbackObj);\n })\n .onBinValue((pFeedbackObj: SFFeedbackObj): void => {\n this.handleBinValue(pFeedbackObj);\n })\n .onTouchstart((pFeedbackObj: SFFeedbackObj): void => {\n // re. Disabling arrow keys in iOS - need to disable all other fields in the form\n if (this.props.shouldDisableIOSArrowKeys) {\n /**\n * re. this.hasGenuineTouchEvents...\n * There seems to be an issue with Responsive Design mode in Safari that means it allows setting focus on cross-origin iframes,\n * without enabling the touch events that allow the \"disableIOSArrowKeys\" workaround to fully function.\n * This results in a click on an securedFields *label* leading to, for example, the holderName field being disabled, but w/o access\n * to the touch events that would let it re-enable itself.\n *\n * So we prevent the \"disableIOSArrowKeys\" workaround unless we genuinely have touch events available.\n */\n if (this.hasGenuineTouchEvents || pFeedbackObj.hasGenuineTouchEvents) {\n this.callbacks.onTouchstartIOS({ fieldType: pFeedbackObj.fieldType });\n }\n }\n\n // Only perform this step if we genuinely have touch events available\n if (pFeedbackObj.hasGenuineTouchEvents || this.hasGenuineTouchEvents) {\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n // - pass information about which field has just been clicked (gained focus) to the other iframes\n this.postMessageToAllIframes({ fieldType: pFeedbackObj.fieldType, fieldClick: true });\n }\n })\n .onShiftTab((pFeedbackObj: SFFeedbackObj): void => {\n // Only happens for Firefox & IE <= 11\n this.handleSFShiftTab(pFeedbackObj.fieldType);\n })\n .onEncryption((pFeedbackObj: SFFeedbackObj): void => {\n this.handleEncryption(pFeedbackObj);\n })\n .onValidation((pFeedbackObj: SFFeedbackObj): void => {\n this.handleValidation(pFeedbackObj);\n })\n .onAutoComplete((pFeedbackObj: SFFeedbackObj): void => {\n this.processAutoComplete(pFeedbackObj);\n })\n .onKeyPressed((pFeedbackObj: SFFeedbackObj): void => {\n const { numKey, ...rest } = pFeedbackObj;\n this.callbacks.onKeyPressed(rest);\n });\n\n // Store reference to securedField in this.state (under fieldType)\n this.state.securedFields[fieldType] = sf;\n });\n}\n"],"names":["createSecuredFields","this","encryptedAttrName","DATA_ENCRYPTED_FIELD_ATTR","securedFields","select","props","rootNode","filter","field","fieldType","getAttribute","isValidType","isSecuredField","console","warn","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","config","isCreditCardType","isSingleBrandedCard","securityCode","createCardSecuredFields","length","createNonCardSecuredFields","async","i","securedField","setupSecuredField","catch","e","window","_b$dl","log","type","state","cardGroupTypes","card","cardType","getCardByBrand","existy","callbackObj","brand","cvcText","setTimeout","callbacks","onBrand","pItem","Promise","resolve","reject","ENCRYPTED_EXPIRY_YEAR","hasSeparateDateFields","sfInitObj","extraFieldData","DATA_INFO","uid","DATA_UID","holderEl","txVariant","iframeUIConfig","sfLogAtStart","trimTrailingSeparator","iframeSrc","loadingContext","showWarnings","legacyInputMode","minimumExpiryDate","maskSecurityCode","exposeExpiryDate","disableIOSArrowKeys","shouldDisableIOSArrowKeys","implementationType","showContextualElement","placeholders","submitAnalytics","onSubmitAnalytics","componentType","sf","SecuredField","i18n","onIframeLoaded","iframeCount","numIframes","destroySecuredFields","AdyenCheckoutError","loadToConfigTimeout","failReason","SF_CONFIG_TIMEOUT","originalNumIframes","iframesLoaded","onLoad","onConfig","pFeedbackObj","handleIframeConfigFeedback","clearTimeout","onFocus","handleFocus","onBinValue","handleBinValue","onTouchstart","hasGenuineTouchEvents","onTouchstartIOS","postMessageToAllIframes","fieldClick","onShiftTab","handleSFShiftTab","onEncryption","handleEncryption","onValidation","handleValidation","onAutoComplete","processAutoComplete","onKeyPressed","numKey","rest"],"mappings":"woCAuBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAeH,GAMnC,OALKE,GACDE,QAAQC,KACJ,aAAaL,mCAA2CT,KAAKC,sFAG9DU,IAULI,EAA2BC,EAG3BC,EAAmCC,EAGzC,OAAKlB,KAAKmB,OAAOC,kBAMjBpB,KAAKqB,qBAAsB,EAE3BrB,KAAKsB,aAAe,GAEpBtB,KAAKuB,wBAAwBpB,EAAeY,EAAWE,GAGhDd,EAAcqB,SAZjBxB,KAAKyB,2BAA2BtB,GACzBA,EAAcqB,OAY7B,CAOOE,eAAeD,EAA2BtB,GAC7C,IAAK,IAAIwB,EAAI,EAAGA,EAAIxB,EAAcqB,OAAQG,IAAK,CAC3C,MAAMC,EAAezB,EAAcwB,SAC7B3B,KAAK6B,kBAAkBD,GAAcE,MAAMC,IACzCC,OAAOC,OAAOpB,QAAQqB,IAAI,mCAAoCH,IAE1E,CACJ,CAEOL,eAAeH,EAClBpB,EACAY,EACAE,GAGA,IAAIkB,EAAenC,KAAKoC,MAAMD,KAa9B,GATa,SAATA,GAAyD,IAAtCnC,KAAKmB,OAAOkB,eAAeb,SAC9CW,EAAOnC,KAAKmB,OAAOkB,eAAe,GAClCrC,KAAKoC,MAAMD,KAAOA,GAItBnC,KAAKqB,oBAA+B,SAATc,EAGvBnC,KAAKqB,oBAAqB,CAE1B,MAAMiB,EAAmBC,EAASC,eAAeL,GAI5CM,EAAOH,IAIRvB,EAAYuB,EAAKvB,WAAaC,EAC9BC,EAAmBqB,EAAKrB,kBAAoBC,EAE5ClB,KAAKsB,aAAegB,EAAKhB,cANzBtB,KAAKoC,MAA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AyBtG,KAAKsG,wBAG3CtG,KAAKwG,wBAAwB,CAAE/F,UAAWqF,EAAarF,UAAWgG,YAAY,MAGrFC,WAAYZ,IAET9F,KAAK2G,iBAAiBb,EAAarF,aAEtCmG,aAAcd,IACX9F,KAAK6G,iBAAiBf,KAEzBgB,aAAchB,IACX9F,KAAK+G,iBAAiBjB,KAEzBkB,eAAgBlB,IACb9F,KAAKiH,oBAAoBnB,KAE5BoB,aAAcpB,IACX,MAAMqB,OAAEA,GAAoBrB,EAATsB,EAAAA,EAAStB,EAAAA,YAC5B9F,KAAK8C,UAAUoE,aAAaE,KAIpCpH,KAAKoC,MAAMjC,cAAcM,GAAasE,GAE9C"}
1
+ {"version":3,"file":"createSecuredFields.js","sources":["../../../../../../../../src/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.ts"],"sourcesContent":["import { select, getAttribute } from '../../utilities/dom';\nimport {\n ENCRYPTED_EXPIRY_YEAR,\n DATE_POLICY_REQUIRED,\n CVC_POLICY_REQUIRED,\n DATA_ENCRYPTED_FIELD_ATTR,\n DATA_INFO,\n DATA_UID,\n SF_CONFIG_TIMEOUT,\n ENCRYPTED_EXPIRY_MONTH\n} from '../../constants';\nimport { existy } from '../../../../../../utils/commonUtils';\nimport cardType from '../utils/cardType';\nimport { SecuredFieldSetupObject } from '../../types';\nimport SecuredField from '../../securedField/SecuredField';\nimport { CardObject, CardBrandData, SFFeedbackObj, CardLoadData, CVCPolicyType, DatePolicyType } from '../../types';\nimport AdyenCheckoutError from '../../../../../../core/Errors/AdyenCheckoutError';\nimport { isSecuredField } from '../../../utils';\n\n/**\n * Bound to the instance of CSF\n * Handles specific functionality related to configuring & creating SecuredFields\n */\nexport function createSecuredFields(): number {\n this.encryptedAttrName = DATA_ENCRYPTED_FIELD_ATTR;\n\n // Detect DOM elements that qualify as securedField holders & filter them for valid types\n const securedFields: HTMLElement[] = select(this.props.rootNode, `[${this.encryptedAttrName}]`).filter(field => {\n const fieldType: string = getAttribute(field, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_MONTH) {\n // TODO send analytics about separate date fields\n }\n\n const isValidType = isSecuredField(fieldType);\n if (!isValidType) {\n console.warn(\n `WARNING: '${fieldType}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`\n );\n }\n return isValidType;\n });\n\n /**\n * cvcPolicy - 'required' | 'optional' | 'hidden'\n * - Always 'required' for GiftCards\n * - Usually 'required' for single branded Credit Cards but with exceptions e.g. maestro ('optional'), bcmc ('hidden').\n * - Always 'required' for generic Credit Cards at start up - in this case, subsequent, supporting information about whether cvc stops being required\n * comes from the SF in the brand information (as the shopper inputs the cc number)\n */\n const cvcPolicy: CVCPolicyType = CVC_POLICY_REQUIRED;\n\n /** Usually 'required' for single branded Credit Cards but with exceptions e.g. ticket ('hidden', *technically* a meal voucher) */\n const expiryDatePolicy: DatePolicyType = DATE_POLICY_REQUIRED;\n\n // CHECK IF THIS SECURED FIELD IS NOT OF A CREDIT CARD TYPE\n if (!this.config.isCreditCardType) {\n this.createNonCardSecuredFields(securedFields);\n return securedFields.length;\n }\n\n // CONTINUE AS CREDIT-CARD TYPE...\n this.isSingleBrandedCard = false;\n\n this.securityCode = '';\n\n this.createCardSecuredFields(securedFields, cvcPolicy, expiryDatePolicy);\n\n // Return the number of iframes we're going to create\n return securedFields.length;\n}\n\n/**\n * i.e. giftcard and ach fields\n *\n * Create a new SecuredField for each detected holding element\n */\nexport async function createNonCardSecuredFields(securedFields: HTMLElement[]): Promise<void> {\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n await this.setupSecuredField(securedField).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n }\n}\n\nexport async function createCardSecuredFields(\n securedFields: HTMLElement[],\n cvcPolicy: CVCPolicyType,\n expiryDatePolicy: DatePolicyType\n): Promise<void> {\n // Declared card type from the initialisation of CSF\n let type: string = this.state.type;\n\n // Maybe it's a single branded card defined by setting type: 'card' & a single item in cardGroupTypes\n // In which case update the type var both locally AND in State\n if (type === 'card' && this.config.cardGroupTypes.length === 1) {\n type = this.config.cardGroupTypes[0];\n this.state.type = type;\n }\n\n // So, is it a single branded card? i.e. a storedCard or a regular card that has just one brand set in its brands array\n this.isSingleBrandedCard = type !== 'card';\n\n // If single branded card field...\n if (this.isSingleBrandedCard) {\n // Check that type exists\n const card: CardObject = cardType.getCardByBrand(type);\n\n // It's possible we don't recognise the card type -\n // scenario: frontend initially recognises card as e.g. Visa - but then backend tokenises it as a sub-brand which we currently don't recognise\n if (!existy(card)) {\n this.state.type = 'unrecognised-single-brand'; // Will let CVC field accept 4 digits in the input\n } else {\n // Assess whether cvc field is required based on the card type & whether the cvc field should even be visible\n cvcPolicy = card.cvcPolicy || CVC_POLICY_REQUIRED;\n expiryDatePolicy = card.expiryDatePolicy || DATE_POLICY_REQUIRED;\n\n this.securityCode = card.securityCode;\n }\n }\n\n /**\n * Create a new SecuredField for each detected holding element\n *\n * - we do this in sequence, waiting until one has configured before creating the next.\n * We do it this way to avoid the 'bug' whereby if something interrupts the loading of an iframe the listener we have for its load event\n * never fires; which means the iframe never configures.\n * (NB - you can recreate this 'bug' by creating the securedFields in a synchronous loop:\n * securedFields.forEach(this.setupSecuredField.bind(this));\n * and putting a breakpoint on the line where we declare the setupSecuredField function)\n *\n * Also note we tried the Array.map/Promise.all way of asynchronously looping through an array - but it didn't fix the issue,\n * - so we fall back to a good old for-loop\n */\n for (let i = 0; i < securedFields.length; i++) {\n const securedField = securedFields[i];\n if (window._b$dl) console.log('\\nAbout to set up securedField:', securedField);\n await this.setupSecuredField(securedField, cvcPolicy, expiryDatePolicy).catch(e => {\n if (window._b$dl) console.log('Secured fields setup failure. e=', e);\n });\n if (window._b$dl) console.log('Finished setting up securedField:', securedField);\n }\n if (window._b$dl) console.log('Finished setting up all securedFields');\n\n /**\n * Now the securedFields have all been created and configured...\n *\n * For a single branded card we call to onBrand callback once.\n * This allows the UI to set the correct logo if they haven't already,\n * and we also pass the cvcPolicy & expiryDatePolicy so the UI can hide the iframe holders if necessary\n */\n if (this.isSingleBrandedCard) {\n const callbackObj: CardBrandData = {\n type: this.state.type,\n rootNode: this.props.rootNode,\n brand: type,\n cvcPolicy,\n expiryDatePolicy,\n cvcText: this.securityCode\n };\n\n // Allow a tick for the securedField to finish rendering\n setTimeout(() => {\n this.callbacks.onBrand(callbackObj);\n }, 0);\n }\n}\n\n// Run for each detected holder of a securedField...\nexport function setupSecuredField(pItem: HTMLElement, cvcPolicy?: CVCPolicyType, expiryDatePolicy?: DatePolicyType): Promise<SFFeedbackObj> {\n return new Promise((resolve, reject) => {\n /**\n * possible values:\n * encryptedCardNumber\n * encryptedExpiryDate\n * encryptedExpiryMonth\n * encryptedExpiryYear\n * encryptedSecurityCode\n * encryptedPassword\n */\n const fieldType: string = getAttribute(pItem, this.encryptedAttrName);\n\n if (fieldType === ENCRYPTED_EXPIRY_YEAR) {\n this.state.hasSeparateDateFields = true;\n }\n\n const extraFieldData: string = getAttribute(pItem, DATA_INFO);\n const uid = getAttribute(pItem, DATA_UID);\n\n // CREATE SecuredField passing config object\n const sfInitObj: SecuredFieldSetupObject = {\n fieldType,\n extraFieldData,\n uid,\n cvcPolicy,\n holderEl: pItem,\n expiryDatePolicy,\n txVariant: this.state.type,\n // from this.config (calculated)\n cardGroupTypes: this.config.cardGroupTypes,\n iframeUIConfig: this.config.iframeUIConfig,\n sfLogAtStart: this.config.sfLogAtStart,\n trimTrailingSeparator: this.config.trimTrailingSeparator,\n isCreditCardType: this.config.isCreditCardType,\n iframeSrc: this.config.iframeSrc,\n loadingContext: this.config.loadingContext,\n showWarnings: this.config.showWarnings,\n legacyInputMode: this.config.legacyInputMode,\n minimumExpiryDate: this.config.minimumExpiryDate,\n // from this.props (passed straight thru)\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n disableIOSArrowKeys: this.props.shouldDisableIOSArrowKeys,\n implementationType: this.props.implementationType,\n showContextualElement: this.props.showContextualElement,\n placeholders: this.props.placeholders,\n submitAnalytics: this.props.onSubmitAnalytics,\n componentType: this.props.componentType\n };\n\n const sf: SecuredField = new SecuredField(sfInitObj, this.props.i18n)\n .onIframeLoaded((): void => {\n // Count\n this.state.iframeCount += 1;\n\n if (window._b$dl) console.log('### createSecuredFields::onIframeLoaded:: this.state.iframeCount=', this.state.iframeCount);\n\n // One of our existing securedFields has just loaded new content!\n if (this.state.iframeCount > this.state.numIframes) {\n this.destroySecuredFields();\n // TODO send analytics about this error\n throw new AdyenCheckoutError(\n 'ERROR',\n `One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`\n );\n }\n\n /** Create timeout within which time we expect the securedField to configure */\n // @ts-ignore - timeout 'type' *is* a number\n sf.loadToConfigTimeout = setTimeout(() => {\n reject({ type: sfInitObj.fieldType, failReason: 'sf took too long to config' });\n }, SF_CONFIG_TIMEOUT);\n\n // If all iframes are loaded - call onLoad callback\n if (this.state.iframeCount === this.state.originalNumIframes) {\n const callbackObj: CardLoadData = { iframesLoaded: true };\n this.callbacks.onLoad(callbackObj);\n }\n })\n .onConfig((pFeedbackObj: SFFeedbackObj): void => {\n this.handleIframeConfigFeedback(pFeedbackObj);\n\n // Clear timeout since the securedField has configured\n clearTimeout(sf.loadToConfigTimeout);\n sf.loadToConfigTimeout = null;\n\n resolve(pFeedbackObj);\n })\n .onFocus((pFeedbackObj: SFFeedbackObj): void => {\n this.handleFocus(pFeedbackObj);\n })\n .onBinValue((pFeedbackObj: SFFeedbackObj): void => {\n this.handleBinValue(pFeedbackObj);\n })\n .onTouchstart((pFeedbackObj: SFFeedbackObj): void => {\n // re. Disabling arrow keys in iOS - need to disable all other fields in the form\n if (this.props.shouldDisableIOSArrowKeys) {\n /**\n * re. this.hasGenuineTouchEvents...\n * There seems to be an issue with Responsive Design mode in Safari that means it allows setting focus on cross-origin iframes,\n * without enabling the touch events that allow the \"disableIOSArrowKeys\" workaround to fully function.\n * This results in a click on an securedFields *label* leading to, for example, the holderName field being disabled, but w/o access\n * to the touch events that would let it re-enable itself.\n *\n * So we prevent the \"disableIOSArrowKeys\" workaround unless we genuinely have touch events available.\n */\n if (this.hasGenuineTouchEvents || pFeedbackObj.hasGenuineTouchEvents) {\n this.callbacks.onTouchstartIOS({ fieldType: pFeedbackObj.fieldType });\n }\n }\n\n // Only perform this step if we genuinely have touch events available\n if (pFeedbackObj.hasGenuineTouchEvents || this.hasGenuineTouchEvents) {\n // iOS ONLY - RE. iOS BUGS AROUND BLUR AND FOCUS EVENTS\n // - pass information about which field has just been clicked (gained focus) to the other iframes\n this.postMessageToAllIframes({ fieldType: pFeedbackObj.fieldType, fieldClick: true });\n }\n })\n .onShiftTab((pFeedbackObj: SFFeedbackObj): void => {\n // Only happens for Firefox & IE <= 11\n this.handleSFShiftTab(pFeedbackObj.fieldType);\n })\n .onEncryption((pFeedbackObj: SFFeedbackObj): void => {\n this.handleEncryption(pFeedbackObj);\n })\n .onValidation((pFeedbackObj: SFFeedbackObj): void => {\n this.handleValidation(pFeedbackObj);\n })\n .onAutoComplete((pFeedbackObj: SFFeedbackObj): void => {\n this.processAutoComplete(pFeedbackObj);\n })\n .onKeyDown((pFeedbackObj: SFFeedbackObj): void => {\n const { numKey, ...rest } = pFeedbackObj;\n this.callbacks.onKeyDown(rest);\n });\n\n // Store reference to securedField in this.state (under fieldType)\n this.state.securedFields[fieldType] = sf;\n });\n}\n"],"names":["createSecuredFields","this","encryptedAttrName","DATA_ENCRYPTED_FIELD_ATTR","securedFields","select","props","rootNode","filter","field","fieldType","getAttribute","isValidType","isSecuredField","console","warn","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","config","isCreditCardType","isSingleBrandedCard","securityCode","createCardSecuredFields","length","createNonCardSecuredFields","async","i","securedField","setupSecuredField","catch","e","window","_b$dl","log","type","state","cardGroupTypes","card","cardType","getCardByBrand","existy","callbackObj","brand","cvcText","setTimeout","callbacks","onBrand","pItem","Promise","resolve","reject","ENCRYPTED_EXPIRY_YEAR","hasSeparateDateFields","sfInitObj","extraFieldData","DATA_INFO","uid","DATA_UID","holderEl","txVariant","iframeUIConfig","sfLogAtStart","trimTrailingSeparator","iframeSrc","loadingContext","showWarnings","legacyInputMode","minimumExpiryDate","maskSecurityCode","exposeExpiryDate","disableIOSArrowKeys","shouldDisableIOSArrowKeys","implementationType","showContextualElement","placeholders","submitAnalytics","onSubmitAnalytics","componentType","sf","SecuredField","i18n","onIframeLoaded","iframeCount","numIframes","destroySecuredFields","AdyenCheckoutError","loadToConfigTimeout","failReason","SF_CONFIG_TIMEOUT","originalNumIframes","iframesLoaded","onLoad","onConfig","pFeedbackObj","handleIframeConfigFeedback","clearTimeout","onFocus","handleFocus","onBinValue","handleBinValue","onTouchstart","hasGenuineTouchEvents","onTouchstartIOS","postMessageToAllIframes","fieldClick","onShiftTab","handleSFShiftTab","onEncryption","handleEncryption","onValidation","handleValidation","onAutoComplete","processAutoComplete","onKeyDown","numKey","rest"],"mappings":"woCAuBO,SAASA,IACZC,KAAKC,kBAAoBC,EAGzB,MAAMC,EAA+BC,EAAOJ,KAAKK,MAAMC,SAAU,IAAIN,KAAKC,sBAAsBM,OAAOC,IACnG,MAAMC,EAAoBC,EAAaF,EAAOR,KAAKC,mBAM7CU,EAAcC,EAAeH,GAMnC,OALKE,GACDE,QAAQC,KACJ,aAAaL,mCAA2CT,KAAKC,sFAG9DU,IAULI,EAA2BC,EAG3BC,EAAmCC,EAGzC,OAAKlB,KAAKmB,OAAOC,kBAMjBpB,KAAKqB,qBAAsB,EAE3BrB,KAAKsB,aAAe,GAEpBtB,KAAKuB,wBAAwBpB,EAAeY,EAAWE,GAGhDd,EAAcqB,SAZjBxB,KAAKyB,2BAA2BtB,GACzBA,EAAcqB,OAY7B,CAOOE,eAAeD,EAA2BtB,GAC7C,IAAK,IAAIwB,EAAI,EAAGA,EAAIxB,EAAcqB,OAAQG,IAA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L,EAAGQ,oBAAsB1C,WAAW,KAChCM,EAAO,CAAEhB,KAAMmB,EAAU7C,UAAW+E,WAAY,gCACjDC,GAGCzF,KAAKoC,MAAM+C,cAAgBnF,KAAKoC,MAAMsD,mBAAoB,CAC1D,MAAMhD,EAA4B,CAAEiD,eAAe,GACnD3F,KAAK8C,UAAU8C,OAAOlD,EAC1B,IAEHmD,SAAUC,IACP9F,KAAK+F,2BAA2BD,GAGhCE,aAAajB,EAAGQ,qBAChBR,EAAGQ,oBAAsB,KAEzBrC,EAAQ4C,KAEXG,QAASH,IACN9F,KAAKkG,YAAYJ,KAEpBK,WAAYL,IACT9F,KAAKoG,eAAeN,KAEvBO,aAAcP,IAEP9F,KAAKK,MAAMmE,4BAUPxE,KAAKsG,uBAAyBR,EAAaQ,wBAC3CtG,KAAK8C,UAAUyD,gBAAgB,CAAE9F,UAAWqF,EAAarF,aAK7DqF,EAAaQ,uBAAyBtG,KAAKsG,wBAG3CtG,KAAKwG,wBAAwB,CAAE/F,UAAWqF,EAAarF,UAAWgG,YAAY,MAGrFC,WAAYZ,IAET9F,KAAK2G,iBAAiBb,EAAarF,aAEtCmG,aAAcd,IACX9F,KAAK6G,iBAAiBf,KAEzBgB,aAAchB,IACX9F,KAAK+G,iBAAiBjB,KAEzBkB,eAAgBlB,IACb9F,KAAKiH,oBAAoBnB,KAE5BoB,UAAWpB,IACR,MAAMqB,OAAEA,GAAoBrB,EAATsB,EAAAA,EAAStB,EAAAA,YAC5B9F,KAAK8C,UAAUoE,UAAUE,KAIjCpH,KAAKoC,MAAMjC,cAAcM,GAAasE,GAE9C"}
@@ -1,2 +1,2 @@
1
- function i(i,o,t){return o in i?Object.defineProperty(i,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[o]=t,i}class o{constructor(){i(this,"sfConfig",void 0),i(this,"componentType",void 0),i(this,"loadingContext",void 0),i(this,"holderEl",void 0),i(this,"iframeRef",void 0),i(this,"loadToConfigTimeout",void 0),i(this,"_isValid",void 0),i(this,"_iframeContentWindow",void 0),i(this,"_numKey",void 0),i(this,"_isEncrypted",void 0),i(this,"_hasError",void 0),i(this,"_errorType",void 0),i(this,"_cvcPolicy",void 0),i(this,"_expiryDatePolicy",void 0),i(this,"_iframeOnLoadListener",void 0),i(this,"_postMessageListener",void 0),i(this,"submitAnalytics",void 0),i(this,"onIframeLoadedCallback",void 0),i(this,"onConfigCallback",void 0),i(this,"onEncryptionCallback",void 0),i(this,"onValidationCallback",void 0),i(this,"onFocusCallback",void 0),i(this,"onBinValueCallback",void 0),i(this,"onTouchstartCallback",void 0),i(this,"onShiftTabCallback",void 0),i(this,"onAutoCompleteCallback",void 0),i(this,"onKeyPressedCallback",void 0),this.sfConfig={}}}export{o as default};
1
+ function i(i,o,t){return o in i?Object.defineProperty(i,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[o]=t,i}class o{constructor(){i(this,"sfConfig",void 0),i(this,"componentType",void 0),i(this,"loadingContext",void 0),i(this,"holderEl",void 0),i(this,"iframeRef",void 0),i(this,"loadToConfigTimeout",void 0),i(this,"_isValid",void 0),i(this,"_iframeContentWindow",void 0),i(this,"_numKey",void 0),i(this,"_isEncrypted",void 0),i(this,"_hasError",void 0),i(this,"_errorType",void 0),i(this,"_cvcPolicy",void 0),i(this,"_expiryDatePolicy",void 0),i(this,"_iframeOnLoadListener",void 0),i(this,"_postMessageListener",void 0),i(this,"submitAnalytics",void 0),i(this,"onIframeLoadedCallback",void 0),i(this,"onConfigCallback",void 0),i(this,"onEncryptionCallback",void 0),i(this,"onValidationCallback",void 0),i(this,"onFocusCallback",void 0),i(this,"onBinValueCallback",void 0),i(this,"onTouchstartCallback",void 0),i(this,"onShiftTabCallback",void 0),i(this,"onAutoCompleteCallback",void 0),i(this,"onKeyDownCallback",void 0),this.sfConfig={}}}export{o as default};
2
2
  //# sourceMappingURL=AbstractSecuredField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import {\n CVCPolicyType,\n DatePolicyType,\n RtnType_callbackFn,\n RtnType_noParamVoidFn,\n RtnType_postMessageListener,\n SecuredFieldCommonProps,\n SecuredFieldSetupObject\n} from '../types';\n\nabstract class AbstractSecuredField {\n public sfConfig: Partial<SecuredFieldCommonProps>; // could be protected but needs to be public for tests to run\n protected componentType: string;\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n protected submitAnalytics: SecuredFieldSetupObject['submitAnalytics'];\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n protected onKeyPressedCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {};\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","this","sfConfig","componentType","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","submitAnalytics","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyPressedCallback"],"mappings":"wHAUA,MAAeA,EA+BX,WAAAC,GA9BAC,EAAAC,KAAOC,gBAAP,GACAF,EAAAC,KAAUE,wBACVH,EAAAC,KAAUG,yBACVJ,EAAAC,KAAUI,mBACVL,EAAAC,KAAUK,oBACVN,EAAAC,KAAOM,8BAEPP,EAAAC,KAAUO,mBACVR,EAAAC,KAAUQ,+BACVT,EAAAC,KAAUS,kBACVV,EAAAC,KAAUU,uBACVX,EAAAC,KAAUW,oBACVZ,EAAAC,KAAUY,qBACVb,EAAAC,KAAUa,qBACVd,EAAAC,KAAUc,4BACVf,EAAAC,KAAUe,gCACVhB,EAAAC,KAAUgB,+BACVjB,EAAAC,KAAUiB,0BAEVlB,EAAAC,KAAUkB,iCACVnB,EAAAC,KAAUmB,2BACVpB,EAAAC,KAAUoB,+BACVrB,EAAAC,KAAUqB,+BACVtB,EAAAC,KAAUsB,0BACVvB,EAAAC,KAAUuB,6BACVxB,EAAAC,KAAUwB,+BACVzB,EAAAC,KAAUyB,6BACV1B,EAAAC,KAAU0B,iCACV3B,EAAAC,KAAU2B,+BAGN3B,KAAKC,SAAW,CAAA,CACpB"}
1
+ {"version":3,"file":"AbstractSecuredField.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.ts"],"sourcesContent":["import {\n CVCPolicyType,\n DatePolicyType,\n RtnType_callbackFn,\n RtnType_noParamVoidFn,\n RtnType_postMessageListener,\n SecuredFieldCommonProps,\n SecuredFieldSetupObject\n} from '../types';\n\nabstract class AbstractSecuredField {\n public sfConfig: Partial<SecuredFieldCommonProps>; // could be protected but needs to be public for tests to run\n protected componentType: string;\n protected loadingContext: string;\n protected holderEl: HTMLElement;\n protected iframeRef: HTMLElement;\n public loadToConfigTimeout: number;\n // From getters/setters with the same name\n protected _isValid: boolean;\n protected _iframeContentWindow: Window;\n protected _numKey: number;\n protected _isEncrypted: boolean;\n protected _hasError: boolean;\n protected _errorType: string;\n protected _cvcPolicy: CVCPolicyType;\n protected _expiryDatePolicy: DatePolicyType;\n protected _iframeOnLoadListener: RtnType_noParamVoidFn;\n protected _postMessageListener: RtnType_postMessageListener;\n protected submitAnalytics: SecuredFieldSetupObject['submitAnalytics'];\n // Callback fns assigned via public functions\n protected onIframeLoadedCallback: RtnType_noParamVoidFn;\n protected onConfigCallback: RtnType_callbackFn;\n protected onEncryptionCallback: RtnType_callbackFn;\n protected onValidationCallback: RtnType_callbackFn;\n protected onFocusCallback: RtnType_callbackFn;\n protected onBinValueCallback: RtnType_callbackFn;\n protected onTouchstartCallback: RtnType_callbackFn;\n protected onShiftTabCallback: RtnType_callbackFn;\n protected onAutoCompleteCallback: RtnType_callbackFn;\n protected onKeyDownCallback: RtnType_callbackFn;\n\n protected constructor() {\n this.sfConfig = {};\n }\n}\n\nexport default AbstractSecuredField;\n"],"names":["AbstractSecuredField","constructor","_define_property","this","sfConfig","componentType","loadingContext","holderEl","iframeRef","loadToConfigTimeout","_isValid","_iframeContentWindow","_numKey","_isEncrypted","_hasError","_errorType","_cvcPolicy","_expiryDatePolicy","_iframeOnLoadListener","_postMessageListener","submitAnalytics","onIframeLoadedCallback","onConfigCallback","onEncryptionCallback","onValidationCallback","onFocusCallback","onBinValueCallback","onTouchstartCallback","onShiftTabCallback","onAutoCompleteCallback","onKeyDownCallback"],"mappings":"wHAUA,MAAeA,EA+BX,WAAAC,GA9BAC,EAAAC,KAAOC,gBAAP,GACAF,EAAAC,KAAUE,wBACVH,EAAAC,KAAUG,yBACVJ,EAAAC,KAAUI,mBACVL,EAAAC,KAAUK,oBACVN,EAAAC,KAAOM,8BAEPP,EAAAC,KAAUO,mBACVR,EAAAC,KAAUQ,+BACVT,EAAAC,KAAUS,kBACVV,EAAAC,KAAUU,uBACVX,EAAAC,KAAUW,oBACVZ,EAAAC,KAAUY,qBACVb,EAAAC,KAAUa,qBACVd,EAAAC,KAAUc,4BACVf,EAAAC,KAAUe,gCACVhB,EAAAC,KAAUgB,+BACVjB,EAAAC,KAAUiB,0BAEVlB,EAAAC,KAAUkB,iCACVnB,EAAAC,KAAUmB,2BACVpB,EAAAC,KAAUoB,+BACVrB,EAAAC,KAAUqB,+BACVtB,EAAAC,KAAUsB,0BACVvB,EAAAC,KAAUuB,6BACVxB,EAAAC,KAAUwB,+BACVzB,EAAAC,KAAUyB,6BACV1B,EAAAC,KAAU0B,iCACV3B,EAAAC,KAAU2B,4BAGN3B,KAAKC,SAAW,CAAA,CACpB"}
@@ -1,2 +1,2 @@
1
- import{log as e,warn as i}from"../utilities/logger.js";import t from"./utils/createIframe.js";import{selectOne as s,removeAllChildren as r}from"../utilities/dom.js";import{on as n,off as o}from"../../../../../utils/listenerUtils.js";import a from"../CSF/utils/iframes/postMessageToIframe.js";import{originCheckPassed as l,isWebpackPostMsg as c,isChromeVoxPostMsg as h}from"../CSF/utils/iframes/postMessageValidation.js";import{ENCRYPTED_EXPIRY_DATE as f,ENCRYPTED_EXPIRY_MONTH as d,ENCRYPTED_EXPIRY_YEAR as u,DATE_POLICY_OPTIONAL as p,DATE_POLICY_HIDDEN as m,ENCRYPTED_SECURITY_CODE as y,CVC_POLICY_OPTIONAL as g,CVC_POLICY_HIDDEN as C}from"../constants.js";import{generateRandomNumber as b}from"../utilities/commonUtils.js";import w from"./AbstractSecuredField.js";import{reject as E}from"../../../../../utils/commonUtils.js";import{processAriaConfig as O}from"./utils/processAriaConfig.js";import{processPlaceholders as T}from"./utils/processPlaceholders.js";import{hasOwnProperty as P}from"../../../../../utils/hasOwnProperty.js";import{AnalyticsErrorEvent as L,ErrorEventType as k,ErrorEventCode as j}from"../../../../../core/Analytics/events/AnalyticsErrorEvent.js";function F(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function _(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{},s=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.forEach(function(i){F(e,i,t[i])})}return e}function S(e,i){return i=null!=i?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):function(e){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);i.push.apply(i,t)}return i}(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}),e}class v extends w{init(e,i,r,o){const a=O(this.sfConfig.txVariant,this.sfConfig.fieldType,e,o);this.sfConfig.iframeUIConfig.ariaConfig=a,this.sfConfig.iframeUIConfig.placeholders=T(this.sfConfig.txVariant,this.sfConfig.fieldType,r);const l={src:i,title:a[this.sfConfig.fieldType].iframeTitle,policy:"origin"},c=t(l);this.holderEl.appendChild(c);const h=s(this.holderEl,".js-iframe");if(h){if(!h.contentWindow){var f;console.error("ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?");const e=new L({component:this.componentType,code:j.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:k.implementation,message:`Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`});null===(f=this.submitAnalytics)||void 0===f||f.call(this,e)}this.iframeContentWindow=h.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,n(h,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=h,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,n(window,"message",this.postMessageListener,!1);const e=S(_({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),a(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(t){if(!l(t,this.loadingContext,this.sfConfig.showWarnings))return;let s;try{s=JSON.parse(t.data)}catch(i){return c(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):h(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",t.data))}if(P(s,"action")&&P(s,"numKey"))if(this.numKey===s.numKey)switch(s.action){case"encryption":this.isValid=!0,this.onEncryptionCallback(s);break;case"config":window._b$dl&&console.log("### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback",s.fieldType),this.onConfigCallback(s);break;case"focus":this.onFocusCallback(s);break;case"binValue":this.onBinValueCallback(s);break;case"touch":this.onTouchstartCallback(s);break;case"shifttab":this.onShiftTabCallback(s);break;case"autoComplete":this.onAutoCompleteCallback(s);break;case"enterKeyPressed":this.onKeyPressedCallback(s);break;case"encryptionError":{var r;const e=new L({component:this.componentType,code:s.code,errorType:k.internal,message:`${s.error}. Field= ${this.sfConfig.fieldType}`});null===(r=this.submitAnalytics)||void 0===r||r.call(this,e);break}default:this.isValid=!1,this.onValidationCallback(s)}else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){o(window,"message",this.postMessageListener,!1),o(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,r(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return!1}return!1}onIframeLoaded(e){return this.onIframeLoadedCallback=e,this}onEncryption(e){return this.onEncryptionCallback=e,this}onValidation(e){return this.onValidationCallback=e,this}onConfig(e){return this.onConfigCallback=e,this}onFocus(e){return this.onFocusCallback=e,this}onBinValue(e){return this.onBinValueCallback=e,this}onTouchstart(e){return this.onTouchstartCallback=e,this}onShiftTab(e){return this.onShiftTabCallback=e,this}onAutoComplete(e){return this.onAutoCompleteCallback=e,this}onKeyPressed(e){return this.onKeyPressedCallback=e,this}get errorType(){return this._errorType}set errorType(e){this._errorType=e}get hasError(){return this._hasError}set hasError(e){this._hasError=e}get isValid(){if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return this._isValid}return this._isValid}set isValid(e){this._isValid=e}get cvcPolicy(){return this._cvcPolicy}set cvcPolicy(e){this.sfConfig.fieldType===y&&e!==this.cvcPolicy&&(this._cvcPolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get expiryDatePolicy(){return this._expiryDatePolicy}set expiryDatePolicy(e){this.sfConfig.fieldType!==f&&this.sfConfig.fieldType!==d&&this.sfConfig.fieldType!==u||e!==this.expiryDatePolicy&&(this._expiryDatePolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get iframeContentWindow(){return this._iframeContentWindow}set iframeContentWindow(e){this._iframeContentWindow=e}get isEncrypted(){return this._isEncrypted}set isEncrypted(e){this._isEncrypted=e}get numKey(){return this._numKey}set numKey(e){this._numKey=e}get iframeOnLoadListener(){return this._iframeOnLoadListener}set iframeOnLoadListener(e){this._iframeOnLoadListener=e.bind(this)}get postMessageListener(){return this._postMessageListener}set postMessageListener(e){this._postMessageListener=e.bind(this)}constructor(e,i){super(),F(this,"sfConfig",void 0);const t=E(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=S(_({},t),{iframeUIConfig:_({},t.iframeUIConfig)});const{iframeSrc:s,placeholders:r,showContextualElement:n}=e;return this.loadingContext=e.loadingContext,this.holderEl=e.holderEl,this.submitAnalytics=e.submitAnalytics,this.componentType=e.componentType,this.isValid=!1,this.iframeContentWindow=null,this.numKey=b(),this.isEncrypted=!1,this.hasError=!1,this.errorType="",this.cvcPolicy=e.cvcPolicy,this.expiryDatePolicy=e.expiryDatePolicy,this.init(i,s,r,n)}}export{v as default};
1
+ import{log as e,warn as i}from"../utilities/logger.js";import t from"./utils/createIframe.js";import{selectOne as s,removeAllChildren as r}from"../utilities/dom.js";import{on as n,off as o}from"../../../../../utils/listenerUtils.js";import a from"../CSF/utils/iframes/postMessageToIframe.js";import{originCheckPassed as l,isWebpackPostMsg as c,isChromeVoxPostMsg as h}from"../CSF/utils/iframes/postMessageValidation.js";import{ENCRYPTED_EXPIRY_DATE as f,ENCRYPTED_EXPIRY_MONTH as d,ENCRYPTED_EXPIRY_YEAR as u,DATE_POLICY_OPTIONAL as p,DATE_POLICY_HIDDEN as m,ENCRYPTED_SECURITY_CODE as y,CVC_POLICY_OPTIONAL as g,CVC_POLICY_HIDDEN as C}from"../constants.js";import{generateRandomNumber as b}from"../utilities/commonUtils.js";import w from"./AbstractSecuredField.js";import{reject as E}from"../../../../../utils/commonUtils.js";import{processAriaConfig as O}from"./utils/processAriaConfig.js";import{processPlaceholders as T}from"./utils/processPlaceholders.js";import{hasOwnProperty as L}from"../../../../../utils/hasOwnProperty.js";import{AnalyticsErrorEvent as P,ErrorEventType as k,ErrorEventCode as j}from"../../../../../core/Analytics/events/AnalyticsErrorEvent.js";function F(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function _(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{},s=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.forEach(function(i){F(e,i,t[i])})}return e}function S(e,i){return i=null!=i?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):function(e){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);i.push.apply(i,t)}return i}(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}),e}class v extends w{init(e,i,r,o){const a=O(this.sfConfig.txVariant,this.sfConfig.fieldType,e,o);this.sfConfig.iframeUIConfig.ariaConfig=a,this.sfConfig.iframeUIConfig.placeholders=T(this.sfConfig.txVariant,this.sfConfig.fieldType,r);const l={src:i,title:a[this.sfConfig.fieldType].iframeTitle,policy:"origin"},c=t(l);this.holderEl.appendChild(c);const h=s(this.holderEl,".js-iframe");if(h){if(!h.contentWindow){var f;console.error("ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?");const e=new P({component:this.componentType,code:j.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:k.implementation,message:`Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`});null===(f=this.submitAnalytics)||void 0===f||f.call(this,e)}this.iframeContentWindow=h.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,n(h,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=h,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,n(window,"message",this.postMessageListener,!1);const e=S(_({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),a(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(t){if(!l(t,this.loadingContext,this.sfConfig.showWarnings))return;let s;try{s=JSON.parse(t.data)}catch(i){return c(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):h(t)?void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&e("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",t.data))}if(L(s,"action")&&L(s,"numKey"))if(this.numKey===s.numKey)switch(s.action){case"encryption":this.isValid=!0,this.onEncryptionCallback(s);break;case"config":window._b$dl&&console.log("### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback",s.fieldType),this.onConfigCallback(s);break;case"focus":this.onFocusCallback(s);break;case"binValue":this.onBinValueCallback(s);break;case"touch":this.onTouchstartCallback(s);break;case"shifttab":this.onShiftTabCallback(s);break;case"autoComplete":this.onAutoCompleteCallback(s);break;case"enterKeyPressed":this.onKeyDownCallback(s);break;case"encryptionError":{var r;const e=new P({component:this.componentType,code:s.code,errorType:k.internal,message:`${s.error}. Field= ${this.sfConfig.fieldType}`});null===(r=this.submitAnalytics)||void 0===r||r.call(this,e);break}default:this.isValid=!1,this.onValidationCallback(s)}else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&i("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){o(window,"message",this.postMessageListener,!1),o(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,r(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return!1}return!1}onIframeLoaded(e){return this.onIframeLoadedCallback=e,this}onEncryption(e){return this.onEncryptionCallback=e,this}onValidation(e){return this.onValidationCallback=e,this}onConfig(e){return this.onConfigCallback=e,this}onFocus(e){return this.onFocusCallback=e,this}onBinValue(e){return this.onBinValueCallback=e,this}onTouchstart(e){return this.onTouchstartCallback=e,this}onShiftTab(e){return this.onShiftTabCallback=e,this}onAutoComplete(e){return this.onAutoCompleteCallback=e,this}onKeyDown(e){return this.onKeyDownCallback=e,this}get errorType(){return this._errorType}set errorType(e){this._errorType=e}get hasError(){return this._hasError}set hasError(e){this._hasError=e}get isValid(){if(this.sfConfig.fieldType===y)switch(this.cvcPolicy){case C:return!0;case g:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===f||this.sfConfig.fieldType===d||this.sfConfig.fieldType===u)switch(this.expiryDatePolicy){case m:return!0;case p:return!this.hasError;default:return this._isValid}return this._isValid}set isValid(e){this._isValid=e}get cvcPolicy(){return this._cvcPolicy}set cvcPolicy(e){this.sfConfig.fieldType===y&&e!==this.cvcPolicy&&(this._cvcPolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get expiryDatePolicy(){return this._expiryDatePolicy}set expiryDatePolicy(e){this.sfConfig.fieldType!==f&&this.sfConfig.fieldType!==d&&this.sfConfig.fieldType!==u||e!==this.expiryDatePolicy&&(this._expiryDatePolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get iframeContentWindow(){return this._iframeContentWindow}set iframeContentWindow(e){this._iframeContentWindow=e}get isEncrypted(){return this._isEncrypted}set isEncrypted(e){this._isEncrypted=e}get numKey(){return this._numKey}set numKey(e){this._numKey=e}get iframeOnLoadListener(){return this._iframeOnLoadListener}set iframeOnLoadListener(e){this._iframeOnLoadListener=e.bind(this)}get postMessageListener(){return this._postMessageListener}set postMessageListener(e){this._postMessageListener=e.bind(this)}constructor(e,i){super(),F(this,"sfConfig",void 0);const t=E(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=S(_({},t),{iframeUIConfig:_({},t.iframeUIConfig)});const{iframeSrc:s,placeholders:r,showContextualElement:n}=e;return this.loadingContext=e.loadingContext,this.holderEl=e.holderEl,this.submitAnalytics=e.submitAnalytics,this.componentType=e.componentType,this.isValid=!1,this.iframeContentWindow=null,this.numKey=b(),this.isEncrypted=!1,this.hasError=!1,this.errorType="",this.cvcPolicy=e.cvcPolicy,this.expiryDatePolicy=e.expiryDatePolicy,this.init(i,s,r,n)}}export{v as default};
2
2
  //# sourceMappingURL=SecuredField.js.map