@adyen/adyen-web 6.43.0 → 6.44.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 (219) 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 +26 -27
  4. package/dist/es/components/Card/Card.js +1 -1
  5. package/dist/es/components/Card/Card.js.map +1 -1
  6. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  7. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  8. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  9. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  10. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  11. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js +1 -1
  13. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -1
  14. package/dist/es/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  16. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  17. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  18. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  19. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  20. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  21. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  22. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  23. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  24. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  25. package/dist/es/components/Dropin/Dropin.js +1 -1
  26. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  27. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  28. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  29. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  30. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  31. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  32. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  33. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  34. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  35. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  36. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  37. package/dist/es/components/internal/Address/Address.js +1 -1
  38. package/dist/es/components/internal/Address/Address.js.map +1 -1
  39. package/dist/es/components/internal/Address/validate.js.map +1 -1
  40. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  41. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  42. package/dist/es/components/internal/Button/Button.js +1 -1
  43. package/dist/es/components/internal/Button/Button.js.map +1 -1
  44. package/dist/es/components/internal/Button/CopyButton.js +1 -1
  45. package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
  46. package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
  47. package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
  48. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  49. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  50. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  51. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  52. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  53. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  54. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  55. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  56. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  57. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  58. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  59. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  60. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  61. package/dist/es/components/internal/Modal/Modal.js +1 -1
  62. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  63. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  64. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  65. package/dist/es/components/internal/QRLoader/components/QRFinalState.js +1 -1
  66. package/dist/es/components/internal/QRLoader/components/QRFinalState.js.map +1 -1
  67. package/dist/es/components/internal/QRLoader/components/QRLoaderPendingState.js +2 -0
  68. package/dist/es/components/internal/QRLoader/components/QRLoaderPendingState.js.map +1 -0
  69. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  70. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  71. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  72. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  73. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  74. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  75. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  76. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  77. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  78. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  79. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  80. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  81. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  82. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  83. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  84. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  85. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  86. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  87. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  88. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  89. package/dist/es/core/Errors/SRMessages.js +1 -1
  90. package/dist/es/core/Errors/SRMessages.js.map +1 -1
  91. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  92. package/dist/es/core/Errors/SRPanelProvider.js.map +1 -1
  93. package/dist/es/core/Errors/constants.js +1 -1
  94. package/dist/es/core/Errors/constants.js.map +1 -1
  95. package/dist/es/core/Errors/useA11yReporter.js +1 -1
  96. package/dist/es/core/Errors/useA11yReporter.js.map +1 -1
  97. package/dist/es/core/Errors/useLoadingA11yReporter.js +2 -0
  98. package/dist/es/core/Errors/useLoadingA11yReporter.js.map +1 -0
  99. package/dist/es/core/Errors/utils.js +1 -1
  100. package/dist/es/core/Errors/utils.js.map +1 -1
  101. package/dist/es/core/config.js +1 -1
  102. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  103. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  104. package/dist/es/external/preact/dist/preact.js +1 -1
  105. package/dist/es/external/preact/dist/preact.js.map +1 -1
  106. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  107. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  108. package/dist/es/index.d.ts +26 -27
  109. package/dist/es/packages/server/translations/en-US.json.js +1 -1
  110. package/dist/es/utils/useForm/useForm.js +1 -1
  111. package/dist/es/utils/useForm/useForm.js.map +1 -1
  112. package/dist/es-legacy/components/Card/Card.js +1 -1
  113. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  114. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  115. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  116. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  117. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  118. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  119. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  120. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js +1 -1
  121. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -1
  122. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  123. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  124. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  125. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  126. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  127. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  128. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  129. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  130. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  131. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  132. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  133. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  134. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  135. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  136. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  137. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  138. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  139. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  140. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  141. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  142. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  143. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  144. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  145. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  146. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  147. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  148. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  149. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  150. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  151. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  152. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  153. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  154. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  155. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  156. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  157. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  158. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  159. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  160. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  161. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  162. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  163. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  164. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  165. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  166. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  167. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  168. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  169. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  170. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  171. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  172. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  173. package/dist/es-legacy/components/internal/QRLoader/components/QRFinalState.js +1 -1
  174. package/dist/es-legacy/components/internal/QRLoader/components/QRFinalState.js.map +1 -1
  175. package/dist/es-legacy/components/internal/QRLoader/components/QRLoaderPendingState.js +2 -0
  176. package/dist/es-legacy/components/internal/QRLoader/components/QRLoaderPendingState.js.map +1 -0
  177. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  178. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  179. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  180. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  181. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  182. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  183. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  184. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  185. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  186. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  187. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  188. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  189. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  190. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  191. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  192. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  193. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  194. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  195. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  196. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  197. package/dist/es-legacy/core/Errors/SRMessages.js +1 -1
  198. package/dist/es-legacy/core/Errors/SRMessages.js.map +1 -1
  199. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  200. package/dist/es-legacy/core/Errors/SRPanelProvider.js.map +1 -1
  201. package/dist/es-legacy/core/Errors/constants.js +1 -1
  202. package/dist/es-legacy/core/Errors/constants.js.map +1 -1
  203. package/dist/es-legacy/core/Errors/useA11yReporter.js +1 -1
  204. package/dist/es-legacy/core/Errors/useA11yReporter.js.map +1 -1
  205. package/dist/es-legacy/core/Errors/useLoadingA11yReporter.js +2 -0
  206. package/dist/es-legacy/core/Errors/useLoadingA11yReporter.js.map +1 -0
  207. package/dist/es-legacy/core/Errors/utils.js +1 -1
  208. package/dist/es-legacy/core/Errors/utils.js.map +1 -1
  209. package/dist/es-legacy/core/config.js +1 -1
  210. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  211. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  212. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  213. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  214. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  215. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  216. package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
  217. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  218. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  219. package/package.json +8 -8
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_REQUIRED as n,CVC_POLICY_OPTIONAL as a,CVC_POLICY_HIDDEN as c,ENCRYPTED_SECURITY_CODE as l}from"../../../../internal/SecuredFields/lib/constants.js";import d from"./DataSfSpan.js";import{alternativeLabelContent as s}from"./FieldLabelAlternative.js";function u(u){const{label:_,onFocusField:m=()=>{},error:p="",className:f="",classNameModifiers:C=[],focused:y,filled:h,isValid:x,frontCVC:F=!1,cvcPolicy:k=n,showContextualElement:v,contextualText:b}=u,{i18n:j}=r(),V=t(f,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":k===c,"adyen-checkout__field__cvc--optional":k===a}),N=t({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":p,"adyen-checkout__input--focus":y,"adyen-checkout__input--valid":x}),T=k!==a?_:j.get("creditCard.securityCode.label.optional");return e(i,{label:T,focused:y,filled:h,classNameModifiers:[...C,"securityCode"],onFocusField:()=>m(l),className:V,errorMessage:p,isValid:x,dir:"ltr",name:l,i18n:j,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:s,showContextualElement:v,contextualText:b,onInputContainerClick:()=>{m(l)}},e(d,{encryptedFieldType:l,className:N}),e(o,{frontCVC:F}))}export{u as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_REQUIRED as n,CVC_POLICY_OPTIONAL as a,CVC_POLICY_HIDDEN as c,ENCRYPTED_SECURITY_CODE as l}from"../../../../internal/SecuredFields/lib/constants.js";import d from"./DataSfSpan.js";import{alternativeLabelContent as s}from"./FieldLabelAlternative.js";import{resolveCVCErrorKey as u}from"../utils.js";function _(_){const{label:m,onFocusField:p=()=>{},errorCode:f="",className:C="",classNameModifiers:y=[],focused:h,filled:x,isValid:F,frontCVC:k=!1,cvcPolicy:v=n,showContextualElement:j,contextualText:b}=_,{i18n:V}=r(),N=f?V.get(u(f,k)):"",T=t(C,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":v===c,"adyen-checkout__field__cvc--optional":v===a}),E=t({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":N,"adyen-checkout__input--focus":h,"adyen-checkout__input--valid":F}),S=v!==a?m:V.get("creditCard.securityCode.label.optional");return e(i,{label:S,focused:h,filled:x,classNameModifiers:[...y,"securityCode"],onFocusField:()=>p(l),className:T,errorMessage:N,isValid:F,dir:"ltr",name:l,i18n:V,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:s,showContextualElement:j,contextualText:b,onInputContainerClick:()=>{p(l)}},e(d,{encryptedFieldType:l,className:E}),e(o,{frontCVC:k}))}export{_ as default};
2
2
  //# sourceMappingURL=CVC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CVC.scss';\n\nexport default function CVC(props: Readonly<CVCProps>) {\n const {\n label,\n onFocusField = () => {},\n error = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_SECURITY_CODE);\n };\n\n return (\n <Field\n label={fieldLabel}\n focused={focused}\n filled={filled}\n classNameModifiers={[...classNameModifiers, 'securityCode']}\n onFocusField={() => onFocusField(ENCRYPTED_SECURITY_CODE)}\n className={fieldClassnames}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_SECURITY_CODE}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n onInputContainerClick={handleIconClick}\n >\n <DataSfSpan encryptedFieldType={ENCRYPTED_SECURITY_CODE} className={cvcClassnames} />\n\n <CVCHint frontCVC={frontCVC} />\n </Field>\n );\n}\n"],"names":["CVC","props","label","onFocusField","error","className","classNameModifiers","focused","filled","isValid","frontCVC","cvcPolicy","CVC_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","fieldClassnames","classNames","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","cvcClassnames","fieldLabel","get","h","Field","ENCRYPTED_SECURITY_CODE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","CVCHint"],"mappings":"gjBAgBe,SAASA,EAAIC,GACxB,MAAMC,MACFA,EAAKC,aACLA,EAAe,OAAQC,MACvBA,EAAQ,GAAEC,UACVA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,QACvBA,EAAOC,OACPA,EAAMC,QACNA,EAAOC,SACPA,GAAW,EAAKC,UAChBA,EAAYC,EAAmBC,sBAC/BA,EAAqBC,eACrBA,GACAb,GACEc,KAAEA,GAASC,IAEXC,EAAkBC,EAAWb,EAAW,CAC1C,8BAA8B,EAC9B,2CAA4CM,IAAcQ,EAC1D,uCAAwCR,IAAcS,IAGpDC,EAAgBH,EAAW,CAC7B,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCd,EAChC,+BAAgCG,EAChC,+BAAgCE,IAG9Ba,EAAaX,IAAcS,EAAsBlB,EAAQa,EAAKQ,IAAI,0CAMxE,OACIC,EAACC,EAAAA,CACGvB,MAAOoB,EACPf,QAASA,EACTC,OAAQA,EACRF,mBAAoB,IAAIA,EAAoB,gBAC5CH,aAAc,IAAMA,EAAauB,GACjCrB,UAAWY,EACXU,aAAcvB,EACdK,QAASA,EACTmB,IAAK,MACLC,KAAMH,EACNX,KAAMA,EACNe,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BpB,sBAAuBA,EACvBC,eAAgBA,EAChBoB,sBAtBgB,KACpB/B,EAAauB,KAuBTF,EAACW,EAAAA,CAAWC,mBAAoBV,EAAyBrB,UAAWgB,IAEpEG,EAACa,EAAAA,CAAQ3B,SAAUA,IAG/B"}
1
+ {"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport { resolveCVCErrorKey } from '../utils';\nimport './CVC.scss';\n\nexport default function CVC(props: Readonly<CVCProps>) {\n const {\n label,\n onFocusField = () => {},\n errorCode = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const errorMessage = errorCode ? i18n.get(resolveCVCErrorKey(errorCode, frontCVC)) : '';\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': errorMessage,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_SECURITY_CODE);\n };\n\n return (\n <Field\n label={fieldLabel}\n focused={focused}\n filled={filled}\n classNameModifiers={[...classNameModifiers, 'securityCode']}\n onFocusField={() => onFocusField(ENCRYPTED_SECURITY_CODE)}\n className={fieldClassnames}\n errorMessage={errorMessage}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_SECURITY_CODE}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n onInputContainerClick={handleIconClick}\n >\n <DataSfSpan encryptedFieldType={ENCRYPTED_SECURITY_CODE} className={cvcClassnames} />\n\n <CVCHint frontCVC={frontCVC} />\n </Field>\n );\n}\n"],"names":["CVC","props","label","onFocusField","errorCode","className","classNameModifiers","focused","filled","isValid","frontCVC","cvcPolicy","CVC_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","errorMessage","get","resolveCVCErrorKey","fieldClassnames","classNames","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","cvcClassnames","fieldLabel","h","Field","ENCRYPTED_SECURITY_CODE","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","CVCHint"],"mappings":"imBAiBe,SAASA,EAAIC,GACxB,MAAMC,MACFA,EAAKC,aACLA,EAAe,OAAQC,UACvBA,EAAY,GAAEC,UACdA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,QACvBA,EAAOC,OACPA,EAAMC,QACNA,EAAOC,SACPA,GAAW,EAAKC,UAChBA,EAAYC,EAAmBC,sBAC/BA,EAAqBC,eACrBA,GACAb,GACEc,KAAEA,GAASC,IAEXC,EAAeb,EAAYW,EAAKG,IAAIC,EAAmBf,EAAWM,IAAa,GAE/EU,EAAkBC,EAAWhB,EAAW,CAC1C,8BAA8B,EAC9B,2CAA4CM,IAAcW,EAC1D,uCAAwCX,IAAcY,IAGpDC,EAAgBH,EAAW,CAC7B,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCJ,EAChC,+BAAgCV,EAChC,+BAAgCE,IAG9BgB,EAAad,IAAcY,EAAsBrB,EAAQa,EAAKG,IAAI,0CAMxE,OACIQ,EAACC,EAAAA,CACGzB,MAAOuB,EACPlB,QAASA,EACTC,OAAQA,EACRF,mBAAoB,IAAIA,EAAoB,gBAC5CH,aAAc,IAAMA,EAAayB,GACjCvB,UAAWe,EACXH,aAAcA,EACdR,QAASA,EACToB,IAAK,MACLC,KAAMF,EACNb,KAAMA,EACNgB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BrB,sBAAuBA,EACvBC,eAAgBA,EAChBqB,sBAtBgB,KACpBhC,EAAayB,KAuBTF,EAACU,EAAAA,CAAWC,mBAAoBT,EAAyBvB,UAAWmB,IAEpEE,EAACY,EAAAA,CAAQ5B,SAAUA,IAG/B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import n from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as i,ENCRYPTED_CARD_NUMBER as o,DATE_POLICY_HIDDEN as c,ENCRYPTED_EXPIRY_DATE as l,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:y,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f,errors:b,focusedElement:g,hasCVC:_,cvcPolicy:h,expiryDatePolicy:v,onFocusField:E,showBrandIcon:B,valid:F,showContextualElement:N}){const{i18n:j}=d(),V=(e,r)=>e[r]?j.get(e[r]):null,D=p?.filter(e=>!i?.includes(e.name)),w="amex"===m,P=w?j.get("creditCard.securityCode.contextualText.4digits"):j.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:y,error:V(b,o),focused:g===o,isValid:!!F.encryptedCardNumber,label:j.get("creditCard.cardNumber.label"),onFocusField:E,filled:!!b.encryptedCardNumber||!!F.encryptedCardNumber,showBrandIcon:B,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f}),e(u,{activeBrand:m,brands:D}),e("div",{className:n("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":v===c})},e(a,{classNameModifiers:["col-50"],error:V(b,l),focused:g===l,isValid:!!F.encryptedExpiryMonth&&!!F.encryptedExpiryYear,filled:!!b.encryptedExpiryDate||!!F.encryptedExpiryYear,label:j.get("creditCard.expiryDate.label"),onFocusField:E,expiryDatePolicy:v,showContextualElement:N,contextualText:j.get("creditCard.expiryDate.contextualText")}),_&&e(t,{classNameModifiers:["col-50"],error:V(b,s),focused:g===s,cvcPolicy:h,isValid:!!F.encryptedSecurityCode,filled:!!b.encryptedSecurityCode||!!F.encryptedSecurityCode,label:j.get("creditCard.securityCode.label"),onFocusField:E,frontCVC:w,showContextualElement:N,contextualText:P})))}export{m as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import n from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as o,ENCRYPTED_CARD_NUMBER as i,DATE_POLICY_HIDDEN as c,ENCRYPTED_EXPIRY_DATE as l,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:C,dualBrandingElements:y,selectedBrandValue:x,dualBrandingChangeHandler:f,errors:b,focusedElement:g,hasCVC:_,cvcPolicy:h,expiryDatePolicy:v,onFocusField:E,showBrandIcon:B,valid:F,showContextualElement:N}){const{i18n:j}=d(),V=(e,r)=>{const t=e[r];return t?j.get(t):null},D=p?.filter(e=>!o?.includes(e.name)),w="amex"===m,P=w?j.get("creditCard.securityCode.contextualText.4digits"):j.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:C,error:V(b,i),focused:g===i,isValid:!!F.encryptedCardNumber,label:j.get("creditCard.cardNumber.label"),onFocusField:E,filled:!!b.encryptedCardNumber||!!F.encryptedCardNumber,showBrandIcon:B,dualBrandingElements:y,selectedBrandValue:x,dualBrandingChangeHandler:f}),e(u,{activeBrand:m,brands:D}),e("div",{className:n("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":v===c})},e(a,{classNameModifiers:["col-50"],error:V(b,l),focused:g===l,isValid:!!F.encryptedExpiryMonth&&!!F.encryptedExpiryYear,filled:!!b.encryptedExpiryDate||!!F.encryptedExpiryYear,label:j.get("creditCard.expiryDate.label"),onFocusField:E,expiryDatePolicy:v,showContextualElement:N,contextualText:j.get("creditCard.expiryDate.contextualText")}),_&&e(t,{classNameModifiers:["col-50"],errorCode:b[s],focused:g===s,cvcPolicy:h,isValid:!!F.encryptedSecurityCode,filled:!!b.encryptedSecurityCode||!!F.encryptedSecurityCode,label:j.get("creditCard.securityCode.label"),onFocusField:E,frontCVC:w,showContextualElement:N,contextualText:P})))}export{m as default};
2
2
  //# sourceMappingURL=CardFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardNumber from './CardNumber';\nimport CVC from './CVC';\nimport ExpirationDate from './ExpirationDate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardFieldsProps } from './types';\nimport classNames from 'classnames';\nimport {\n BRAND_ICON_UI_EXCLUSION_LIST,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport AvailableBrands from './AvailableBrands';\nimport './CardFields.scss';\n\nexport default function CardFields({\n brand,\n brandsIcons,\n brandsConfiguration,\n dualBrandingElements,\n selectedBrandValue,\n dualBrandingChangeHandler,\n errors,\n focusedElement,\n hasCVC,\n cvcPolicy,\n expiryDatePolicy,\n onFocusField,\n showBrandIcon,\n valid,\n showContextualElement\n}: Readonly<CardFieldsProps>) {\n const { i18n } = useCoreContext();\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n // A set of brands filtered to exclude those that can never appear in the UI\n const allowedBrands = brandsIcons?.filter(brandsIcons => !BRAND_ICON_UI_EXCLUSION_LIST?.includes(brandsIcons.name));\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n return (\n <div className=\"adyen-checkout__card__form\">\n <CardNumber\n brand={brand}\n brandsConfiguration={brandsConfiguration}\n error={getError(errors, ENCRYPTED_CARD_NUMBER)}\n focused={focusedElement === ENCRYPTED_CARD_NUMBER}\n isValid={!!valid.encryptedCardNumber}\n label={i18n.get('creditCard.cardNumber.label')}\n onFocusField={onFocusField}\n filled={!!errors.encryptedCardNumber || !!valid.encryptedCardNumber}\n showBrandIcon={showBrandIcon}\n dualBrandingElements={dualBrandingElements}\n selectedBrandValue={selectedBrandValue}\n dualBrandingChangeHandler={dualBrandingChangeHandler}\n />\n\n <AvailableBrands activeBrand={brand} brands={allowedBrands} />\n\n <div\n className={classNames('adyen-checkout__card__exp-cvc', {\n 'adyen-checkout__card__exp-cvc__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN\n })}\n >\n <ExpirationDate\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_EXPIRY_DATE)}\n focused={focusedElement === ENCRYPTED_EXPIRY_DATE}\n isValid={!!valid.encryptedExpiryMonth && !!valid.encryptedExpiryYear}\n filled={!!errors.encryptedExpiryDate || !!valid.encryptedExpiryYear}\n label={i18n.get('creditCard.expiryDate.label')}\n onFocusField={onFocusField}\n expiryDatePolicy={expiryDatePolicy}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('creditCard.expiryDate.contextualText')}\n />\n\n {hasCVC && (\n <CVC\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === ENCRYPTED_SECURITY_CODE}\n cvcPolicy={cvcPolicy}\n isValid={!!valid.encryptedSecurityCode}\n filled={!!errors.encryptedSecurityCode || !!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["CardFields","brand","brandsIcons","brandsConfiguration","dualBrandingElements","selectedBrandValue","dualBrandingChangeHandler","errors","focusedElement","hasCVC","cvcPolicy","expiryDatePolicy","onFocusField","showBrandIcon","valid","showContextualElement","i18n","useCoreContext","getError","fieldType","get","allowedBrands","filter","BRAND_ICON_UI_EXCLUSION_LIST","includes","name","isAmex","cvcContextualText","h","div","className","CardNumber","error","ENCRYPTED_CARD_NUMBER","focused","isValid","encryptedCardNumber","label","filled","AvailableBrands","activeBrand","brands","classNames","DATE_POLICY_HIDDEN","ExpirationDate","classNameModifiers","ENCRYPTED_EXPIRY_DATE","encryptedExpiryMonth","encryptedExpiryYear","encryptedExpiryDate","contextualText","CVC","ENCRYPTED_SECURITY_CODE","encryptedSecurityCode","frontCVC"],"mappings":"uiBAiBe,SAASA,GAAWC,MAC/BA,EAAKC,YACLA,EAAWC,oBACXA,EAAmBC,qBACnBA,EAAoBC,mBACpBA,EAAkBC,0BAClBA,EAAyBC,OACzBA,EAAMC,eACNA,EAAcC,OACdA,EAAMC,UACNA,EAASC,iBACTA,EAAgBC,aAChBA,EAAYC,cACZA,EAAaC,MACbA,EAAKC,sBACLA,IAEA,MAAMC,KAAEA,GAASC,IAEXC,EAAW,CAACX,EAAQY,IACfZ,EAAOY,GAAaH,EAAKI,IAAIb,EAAOY,IAAc,KAIvDE,EAAgBnB,GAAaoB,OAAOpB,IAAgBqB,GAA8BC,SAAStB,EAAYuB,OACvGC,EAAmB,SAAVzB,EACT0B,EAAoBD,EACpBV,EAAKI,IAAI,kDACTJ,EAAKI,IAAI,kDAEf,OACIQ,EAACC,MAAAA,CAAIC,UAAU,8BACXF,EAACG,EAAAA,CACG9B,MAAOA,EACPE,oBAAqBA,EACrB6B,MAAOd,EAASX,EAAQ0B,GACxBC,QAAS1B,IAAmByB,EAC5BE,UAAWrB,EAAMsB,oBACjBC,MAAOrB,EAAKI,IAAI,+BAChBR,aAAcA,EACd0B,SAAU/B,EAAO6B,uBAAyBtB,EAAMsB,oBAChDvB,cAAeA,EACfT,qBAAsBA,EACtBC,mBAAoBA,EACpBC,0BAA2BA,IAG/BsB,EAACW,EAAAA,CAAgBC,YAAavC,EAAOwC,OAAQpB,IAE7CO,EAACC,MAAAA,CACGC,UAAWY,EAAW,gCAAiC,CACnD,yDAA0D/B,IAAqBgC,KAGnFf,EAACgB,EAAAA,CACGC,mBAAoB,CAAC,UACrBb,MAAOd,EAASX,EAAQuC,GACxBZ,QAAS1B,IAAmBsC,EAC5BX,UAAWrB,EAAMiC,wBAA0BjC,EAAMkC,oBACjDV,SAAU/B,EAAO0C,uBAAyBnC,EAAMkC,oBAChDX,MAAOrB,EAAKI,IAAI,+BAChBR,aAAcA,EACdD,iBAAkBA,EAClBI,sBAAuBA,EACvBmC,eAAgBlC,EAAKI,IAAI,0CAG5BX,GACGmB,EAACuB,EAAAA,CACGN,mBAAoB,CAAC,UACrBb,MAAOd,EAASX,EAAQ6C,GACxBlB,QAAS1B,IAAmB4C,EAC5B1C,UAAWA,EACXyB,UAAWrB,EAAMuC,sBACjBf,SAAU/B,EAAO8C,yBAA2BvC,EAAMuC,sBAClDhB,MAAOrB,EAAKI,IAAI,iCAChBR,aAAcA,EACd0C,SAAU5B,EACVX,sBAAuBA,EACvBmC,eAAgBvB,KAMxC"}
1
+ {"version":3,"file":"CardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardNumber from './CardNumber';\nimport CVC from './CVC';\nimport ExpirationDate from './ExpirationDate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CardFieldsProps } from './types';\nimport classNames from 'classnames';\nimport {\n BRAND_ICON_UI_EXCLUSION_LIST,\n DATE_POLICY_HIDDEN,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport AvailableBrands from './AvailableBrands';\nimport './CardFields.scss';\n\nexport default function CardFields({\n brand,\n brandsIcons,\n brandsConfiguration,\n dualBrandingElements,\n selectedBrandValue,\n dualBrandingChangeHandler,\n errors,\n focusedElement,\n hasCVC,\n cvcPolicy,\n expiryDatePolicy,\n onFocusField,\n showBrandIcon,\n valid,\n showContextualElement\n}: Readonly<CardFieldsProps>) {\n const { i18n } = useCoreContext();\n\n const getError = (errors, fieldType) => {\n const errorKey = errors[fieldType];\n return errorKey ? i18n.get(errorKey) : null;\n };\n\n // A set of brands filtered to exclude those that can never appear in the UI\n const allowedBrands = brandsIcons?.filter(brandsIcons => !BRAND_ICON_UI_EXCLUSION_LIST?.includes(brandsIcons.name));\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n return (\n <div className=\"adyen-checkout__card__form\">\n <CardNumber\n brand={brand}\n brandsConfiguration={brandsConfiguration}\n error={getError(errors, ENCRYPTED_CARD_NUMBER)}\n focused={focusedElement === ENCRYPTED_CARD_NUMBER}\n isValid={!!valid.encryptedCardNumber}\n label={i18n.get('creditCard.cardNumber.label')}\n onFocusField={onFocusField}\n filled={!!errors.encryptedCardNumber || !!valid.encryptedCardNumber}\n showBrandIcon={showBrandIcon}\n dualBrandingElements={dualBrandingElements}\n selectedBrandValue={selectedBrandValue}\n dualBrandingChangeHandler={dualBrandingChangeHandler}\n />\n\n <AvailableBrands activeBrand={brand} brands={allowedBrands} />\n\n <div\n className={classNames('adyen-checkout__card__exp-cvc', {\n 'adyen-checkout__card__exp-cvc__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN\n })}\n >\n <ExpirationDate\n classNameModifiers={['col-50']}\n error={getError(errors, ENCRYPTED_EXPIRY_DATE)}\n focused={focusedElement === ENCRYPTED_EXPIRY_DATE}\n isValid={!!valid.encryptedExpiryMonth && !!valid.encryptedExpiryYear}\n filled={!!errors.encryptedExpiryDate || !!valid.encryptedExpiryYear}\n label={i18n.get('creditCard.expiryDate.label')}\n onFocusField={onFocusField}\n expiryDatePolicy={expiryDatePolicy}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('creditCard.expiryDate.contextualText')}\n />\n\n {hasCVC && (\n <CVC\n classNameModifiers={['col-50']}\n errorCode={errors[ENCRYPTED_SECURITY_CODE]}\n focused={focusedElement === ENCRYPTED_SECURITY_CODE}\n cvcPolicy={cvcPolicy}\n isValid={!!valid.encryptedSecurityCode}\n filled={!!errors.encryptedSecurityCode || !!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </div>\n </div>\n );\n}\n"],"names":["CardFields","brand","brandsIcons","brandsConfiguration","dualBrandingElements","selectedBrandValue","dualBrandingChangeHandler","errors","focusedElement","hasCVC","cvcPolicy","expiryDatePolicy","onFocusField","showBrandIcon","valid","showContextualElement","i18n","useCoreContext","getError","fieldType","errorKey","get","allowedBrands","filter","BRAND_ICON_UI_EXCLUSION_LIST","includes","name","isAmex","cvcContextualText","h","div","className","CardNumber","error","ENCRYPTED_CARD_NUMBER","focused","isValid","encryptedCardNumber","label","filled","AvailableBrands","activeBrand","brands","classNames","DATE_POLICY_HIDDEN","ExpirationDate","classNameModifiers","ENCRYPTED_EXPIRY_DATE","encryptedExpiryMonth","encryptedExpiryYear","encryptedExpiryDate","contextualText","CVC","errorCode","ENCRYPTED_SECURITY_CODE","encryptedSecurityCode","frontCVC"],"mappings":"uiBAiBe,SAASA,GAAWC,MAC/BA,EAAKC,YACLA,EAAWC,oBACXA,EAAmBC,qBACnBA,EAAoBC,mBACpBA,EAAkBC,0BAClBA,EAAyBC,OACzBA,EAAMC,eACNA,EAAcC,OACdA,EAAMC,UACNA,EAASC,iBACTA,EAAgBC,aAChBA,EAAYC,cACZA,EAAaC,MACbA,EAAKC,sBACLA,IAEA,MAAMC,KAAEA,GAASC,IAEXC,EAAW,CAACX,EAAQY,KACtB,MAAMC,EAAWb,EAAOY,GACxB,OAAOC,EAAWJ,EAAKK,IAAID,GAAY,MAIrCE,EAAgBpB,GAAaqB,OAAOrB,IAAgBsB,GAA8BC,SAASvB,EAAYwB,OACvGC,EAAmB,SAAV1B,EACT2B,EAAoBD,EACpBX,EAAKK,IAAI,kDACTL,EAAKK,IAAI,kDAEf,OACIQ,EAACC,MAAAA,CAAIC,UAAU,8BACXF,EAACG,EAAAA,CACG/B,MAAOA,EACPE,oBAAqBA,EACrB8B,MAAOf,EAASX,EAAQ2B,GACxBC,QAAS3B,IAAmB0B,EAC5BE,UAAWtB,EAAMuB,oBACjBC,MAAOtB,EAAKK,IAAI,+BAChBT,aAAcA,EACd2B,SAAUhC,EAAO8B,uBAAyBvB,EAAMuB,oBAChDxB,cAAeA,EACfT,qBAAsBA,EACtBC,mBAAoBA,EACpBC,0BAA2BA,IAG/BuB,EAACW,EAAAA,CAAgBC,YAAaxC,EAAOyC,OAAQpB,IAE7CO,EAACC,MAAAA,CACGC,UAAWY,EAAW,gCAAiC,CACnD,yDAA0DhC,IAAqBiC,KAGnFf,EAACgB,EAAAA,CACGC,mBAAoB,CAAC,UACrBb,MAAOf,EAASX,EAAQwC,GACxBZ,QAAS3B,IAAmBuC,EAC5BX,UAAWtB,EAAMkC,wBAA0BlC,EAAMmC,oBACjDV,SAAUhC,EAAO2C,uBAAyBpC,EAAMmC,oBAChDX,MAAOtB,EAAKK,IAAI,+BAChBT,aAAcA,EACdD,iBAAkBA,EAClBI,sBAAuBA,EACvBoC,eAAgBnC,EAAKK,IAAI,0CAG5BZ,GACGoB,EAACuB,EAAAA,CACGN,mBAAoB,CAAC,UACrBO,UAAW9C,EAAO+C,GAClBnB,QAAS3B,IAAmB8C,EAC5B5C,UAAWA,EACX0B,UAAWtB,EAAMyC,sBACjBhB,SAAUhC,EAAOgD,yBAA2BzC,EAAMyC,sBAClDjB,MAAOtB,EAAKK,IAAI,iCAChBT,aAAcA,EACd4C,SAAU7B,EACVZ,sBAAuBA,EACvBoC,eAAgBvB,KAMxC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useState as a}from"../../../../../external/preact/hooks/dist/hooks.js";import r from"../../../../../_virtual/index.js";import{mapDualBrandButtons as t}from"../utils.js";import o from"./DualBrandSelector.module.scss.js";import{useCoreContext as n}from"../../../../../core/Context/CoreProvider.js";function l({dualBrandingElements:l,brandsConfiguration:d,dualBrandingChangeHandler:i,selectedBrandValue:s}){const{i18n:u}=n(),c=t(l,d),[m,p]=a(s),f=e=>{p(e),i(e)};return e("div",{className:o.dualBrandSelector,role:"group","aria-label":u.get("creditCard.dualBrand.description")},c.map(a=>e("button",{key:a.id,type:"button",className:r(o.dualBrandSelectorButton,{[o.dualBrandSelectorButtonSelected]:m===a.id}),onMouseDown:e=>e.preventDefault(),onClick:()=>f(a.id),onKeyDown:e=>((e,a)=>{"Enter"===e.key&&(e.preventDefault(),f(a))})(e,a.id),"aria-label":a.altName,"aria-pressed":m===a.id},e("img",{src:a.imageURL,alt:a.altName,className:o.dualBrandSelectorIcon}))))}export{l as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useState as r}from"../../../../../external/preact/hooks/dist/hooks.js";import a from"../../../../../_virtual/index.js";import{mapDualBrandButtons as t}from"../utils.js";import o from"./DualBrandSelector.module.scss.js";import{useCoreContext as n}from"../../../../../core/Context/CoreProvider.js";import{stopPropagationForActionKeys as l}from"../../../../internal/Button/stopPropagationForActionKeys.js";function i({dualBrandingElements:i,brandsConfiguration:d,dualBrandingChangeHandler:s,selectedBrandValue:u}){const{i18n:m}=n(),c=t(i,d),[p,B]=r(u);return e("div",{className:o.dualBrandSelector,role:"group","aria-label":m.get("creditCard.dualBrand.description")},c.map(r=>e("button",{key:r.id,type:"button",className:a(o.dualBrandSelectorButton,{[o.dualBrandSelectorButtonSelected]:p===r.id}),onMouseDown:e=>e.preventDefault(),onClick:()=>{return e=r.id,B(e),void s(e);var e},onKeyDown:l,"aria-label":r.altName,"aria-pressed":p===r.id},e("img",{src:r.imageURL,alt:r.altName,className:o.dualBrandSelectorIcon}))))}export{i as default};
2
2
  //# sourceMappingURL=DualBrandSelector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DualBrandSelector.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/DualBrandSelector.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { CardBrandsConfiguration, DualBrandSelectElement, DualBrandButtons, DualBrandingChangeHandler } from '../../../types';\nimport { mapDualBrandButtons } from '../utils';\nimport styles from './DualBrandSelector.module.scss';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\n\ninterface DualBrandSelectorProps {\n dualBrandingElements: DualBrandSelectElement[];\n dualBrandingChangeHandler: DualBrandingChangeHandler;\n brandsConfiguration?: CardBrandsConfiguration;\n selectedBrandValue: string;\n}\n\nexport default function DualBrandSelector({\n dualBrandingElements,\n brandsConfiguration,\n dualBrandingChangeHandler,\n selectedBrandValue\n}: Readonly<DualBrandSelectorProps>) {\n const { i18n } = useCoreContext();\n const dualBrandItems = mapDualBrandButtons(dualBrandingElements, brandsConfiguration);\n const [selectedBrand, setSelectedBrand] = useState<string>(selectedBrandValue);\n\n const handleBrandSelect = (brandId: string) => {\n setSelectedBrand(brandId);\n dualBrandingChangeHandler(brandId);\n };\n\n // override enter key to prevent submit form (default behavior)\n const handleKeyDown = (e: KeyboardEvent, brandId: string) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n handleBrandSelect(brandId);\n }\n };\n\n return (\n <div className={styles.dualBrandSelector} role=\"group\" aria-label={i18n.get('creditCard.dualBrand.description')}>\n {dualBrandItems.map((item: DualBrandButtons) => (\n <button\n key={item.id}\n type=\"button\"\n className={classNames(styles.dualBrandSelectorButton, {\n [styles.dualBrandSelectorButtonSelected]: selectedBrand === item.id\n })}\n onMouseDown={e => e.preventDefault()}\n onClick={() => handleBrandSelect(item.id)}\n onKeyDown={e => handleKeyDown(e, item.id)}\n aria-label={item.altName}\n aria-pressed={selectedBrand === item.id}\n >\n <img src={item.imageURL} alt={item.altName} className={styles.dualBrandSelectorIcon} />\n </button>\n ))}\n </div>\n );\n}\n"],"names":["DualBrandSelector","dualBrandingElements","brandsConfiguration","dualBrandingChangeHandler","selectedBrandValue","i18n","useCoreContext","dualBrandItems","mapDualBrandButtons","selectedBrand","setSelectedBrand","useState","handleBrandSelect","brandId","h","div","className","styles","dualBrandSelector","role","aria-label","get","map","item","button","key","id","type","classNames","dualBrandSelectorButton","dualBrandSelectorButtonSelected","onMouseDown","e","preventDefault","onClick","onKeyDown","handleKeyDown","altName","aria-pressed","img","src","imageURL","alt","dualBrandSelectorIcon"],"mappings":"6XAee,SAASA,GAAkBC,qBACtCA,EAAoBC,oBACpBA,EAAmBC,0BACnBA,EAAyBC,mBACzBA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAiBC,EAAoBP,EAAsBC,IAC1DO,EAAeC,GAAoBC,EAAiBP,GAErDQ,EAAqBC,IACvBH,EAAiBG,GACjBV,EAA0BU,IAW9B,OACIC,EAACC,MAAAA,CAAIC,UAAWC,EAAOC,kBAAmBC,KAAK,QAAQC,aAAYf,EAAKgB,IAAI,qCACvEd,EAAee,IAAKC,GACjBT,EAACU,SAAAA,CACGC,IAAKF,EAAKG,GACVC,KAAK,SACLX,UAAWY,EAAWX,EAAOY,wBAAyB,CAClD,CAACZ,EAAOa,iCAAkCrB,IAAkBc,EAAKG,KAErEK,YAAaC,GAAKA,EAAEC,iBACpBC,QAAS,IAAMtB,EAAkBW,EAAKG,IACtCS,UAAWH,GAlBL,EAACA,EAAkBnB,KACvB,UAAVmB,EAAEP,MACFO,EAAEC,iBACFrB,EAAkBC,KAeMuB,CAAcJ,EAAGT,EAAKG,IACtCN,aAAYG,EAAKc,QACjBC,eAAc7B,IAAkBc,EAAKG,IAErCZ,EAACyB,MAAAA,CAAIC,IAAKjB,EAAKkB,SAAUC,IAAKnB,EAAKc,QAASrB,UAAWC,EAAO0B,0BAKlF"}
1
+ {"version":3,"file":"DualBrandSelector.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/DualBrandSelector.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { CardBrandsConfiguration, DualBrandSelectElement, DualBrandButtons, DualBrandingChangeHandler } from '../../../types';\nimport { mapDualBrandButtons } from '../utils';\nimport styles from './DualBrandSelector.module.scss';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { stopPropagationForActionKeys } from '../../../../internal/Button/stopPropagationForActionKeys';\n\ninterface DualBrandSelectorProps {\n dualBrandingElements: DualBrandSelectElement[];\n dualBrandingChangeHandler: DualBrandingChangeHandler;\n brandsConfiguration?: CardBrandsConfiguration;\n selectedBrandValue: string;\n}\n\nexport default function DualBrandSelector({\n dualBrandingElements,\n brandsConfiguration,\n dualBrandingChangeHandler,\n selectedBrandValue\n}: Readonly<DualBrandSelectorProps>) {\n const { i18n } = useCoreContext();\n const dualBrandItems = mapDualBrandButtons(dualBrandingElements, brandsConfiguration);\n const [selectedBrand, setSelectedBrand] = useState<string>(selectedBrandValue);\n\n const handleBrandSelect = (brandId: string) => {\n setSelectedBrand(brandId);\n dualBrandingChangeHandler(brandId);\n };\n\n return (\n <div className={styles.dualBrandSelector} role=\"group\" aria-label={i18n.get('creditCard.dualBrand.description')}>\n {dualBrandItems.map((item: DualBrandButtons) => (\n <button\n key={item.id}\n type=\"button\"\n className={classNames(styles.dualBrandSelectorButton, {\n [styles.dualBrandSelectorButtonSelected]: selectedBrand === item.id\n })}\n onMouseDown={e => e.preventDefault()}\n onClick={() => handleBrandSelect(item.id)}\n onKeyDown={stopPropagationForActionKeys}\n aria-label={item.altName}\n aria-pressed={selectedBrand === item.id}\n >\n <img src={item.imageURL} alt={item.altName} className={styles.dualBrandSelectorIcon} />\n </button>\n ))}\n </div>\n );\n}\n"],"names":["DualBrandSelector","dualBrandingElements","brandsConfiguration","dualBrandingChangeHandler","selectedBrandValue","i18n","useCoreContext","dualBrandItems","mapDualBrandButtons","selectedBrand","setSelectedBrand","useState","h","div","className","styles","dualBrandSelector","role","aria-label","get","map","item","button","key","id","type","classNames","dualBrandSelectorButton","dualBrandSelectorButtonSelected","onMouseDown","e","preventDefault","onClick","handleBrandSelect","brandId","onKeyDown","stopPropagationForActionKeys","altName","aria-pressed","img","src","imageURL","alt","dualBrandSelectorIcon"],"mappings":"weAgBe,SAASA,GAAkBC,qBACtCA,EAAoBC,oBACpBA,EAAmBC,0BACnBA,EAAyBC,mBACzBA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAiBC,EAAoBP,EAAsBC,IAC1DO,EAAeC,GAAoBC,EAAiBP,GAO3D,OACIQ,EAACC,MAAAA,CAAIC,UAAWC,EAAOC,kBAAmBC,KAAK,QAAQC,aAAYb,EAAKc,IAAI,qCACvEZ,EAAea,IAAKC,GACjBT,EAACU,SAAAA,CACGC,IAAKF,EAAKG,GACVC,KAAK,SACLX,UAAWY,EAAWX,EAAOY,wBAAyB,CAClD,CAACZ,EAAOa,iCAAkCnB,IAAkBY,EAAKG,KAErEK,YAAaC,GAAKA,EAAEC,iBACpBC,QAAS,KAAMC,OAfJC,EAesBb,EAAKG,GAdlDd,EAAiBwB,QACjB/B,EAA0B+B,GAFJ,IAACA,GAgBXC,UAAWC,EACXlB,aAAYG,EAAKgB,QACjBC,eAAc7B,IAAkBY,EAAKG,IAErCZ,EAAC2B,MAAAA,CAAIC,IAAKnB,EAAKoB,SAAUC,IAAKrB,EAAKgB,QAASvB,UAAWC,EAAO4B,0BAKlF"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"./CVC.js";import r from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import{ENCRYPTED_SECURITY_CODE as a}from"../../../../internal/SecuredFields/lib/constants.js";import i from"../../../../internal/FormFields/InputText.js";import o from"../../../../internal/FormFields/Fieldset/Fieldset.js";function c({brand:c,hasCVC:l,onFocusField:s,errors:n,valid:u,cvcPolicy:m,focusedElement:p,lastFour:C,expiryMonth:y,expiryYear:_,showContextualElement:x}){const{i18n:F}=d(),f=`${F.get("creditCard.storedCard.description.ariaLabel").replace("%@",C)}${y&&_?` ${F.get("creditCard.expiryDate.label")} ${y}/${_}`:""}`,b="amex"===c,h=b?F.get("creditCard.securityCode.contextualText.4digits"):F.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form adyen-checkout__card__form--oneClick","aria-label":f},e(o,{classNamesFields:["adyen-checkout__card__exp-cvc"]},y&&_&&e(r,{label:F.get("creditCard.expiryDate.label"),classNameModifiers:["col-50","storedCard"],name:"expiryDateField",disabled:!0},e(i,{name:"expiryDateField",className:"adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick",value:`${y} / ${_}`,disabled:!0,dir:"ltr",autocomplete:void 0})),l&&e(t,{cvcPolicy:m,error:((e,t)=>e[t]?F.get(e[t]):null)(n,a),focused:"encryptedSecurityCode"===p,filled:!!u.encryptedSecurityCode||!!n.encryptedSecurityCode,isValid:!!u.encryptedSecurityCode,label:F.get("creditCard.securityCode.label"),onFocusField:s,classNameModifiers:[...y&&_?["col-50","storedCard"]:["storedCard"]],frontCVC:b,showContextualElement:x,contextualText:h})))}export{c as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"./CVC.js";import r from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import{ENCRYPTED_SECURITY_CODE as a}from"../../../../internal/SecuredFields/lib/constants.js";import i from"../../../../internal/FormFields/InputText.js";import o from"../../../../internal/FormFields/Fieldset/Fieldset.js";function c({brand:c,hasCVC:l,onFocusField:s,errors:n,valid:u,cvcPolicy:m,focusedElement:p,lastFour:C,expiryMonth:y,expiryYear:_,showContextualElement:x}){const{i18n:F}=d(),f=`${F.get("creditCard.storedCard.description.ariaLabel").replace("%@",C)}${y&&_?` ${F.get("creditCard.expiryDate.label")} ${y}/${_}`:""}`,b="amex"===c,h=b?F.get("creditCard.securityCode.contextualText.4digits"):F.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form adyen-checkout__card__form--oneClick","aria-label":f},e(o,{classNamesFields:["adyen-checkout__card__exp-cvc"]},y&&_&&e(r,{label:F.get("creditCard.expiryDate.label"),classNameModifiers:["col-50","storedCard"],name:"expiryDateField",disabled:!0},e(i,{name:"expiryDateField",className:"adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick",value:`${y} / ${_}`,disabled:!0,dir:"ltr",autocomplete:void 0})),l&&e(t,{cvcPolicy:m,errorCode:n[a],focused:"encryptedSecurityCode"===p,filled:!!u.encryptedSecurityCode||!!n.encryptedSecurityCode,isValid:!!u.encryptedSecurityCode,label:F.get("creditCard.securityCode.label"),onFocusField:s,classNameModifiers:[...y&&_?["col-50","storedCard"]:["storedCard"]],frontCVC:b,showContextualElement:x,contextualText:h})))}export{c as default};
2
2
  //# sourceMappingURL=StoredCardFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoredCardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/StoredCardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CVC from './CVC';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { StoredCardFieldsProps } from './types';\nimport { ENCRYPTED_SECURITY_CODE } from '../../../../internal/SecuredFields/lib/constants';\nimport InputText from '../../../../internal/FormFields/InputText';\nimport Fieldset from '../../../../internal/FormFields/Fieldset';\nimport './StoredCardFields.scss';\n\nexport default function StoredCardFields({\n brand,\n hasCVC,\n onFocusField,\n errors,\n valid,\n cvcPolicy,\n focusedElement,\n lastFour,\n expiryMonth,\n expiryYear,\n showContextualElement\n}: Readonly<StoredCardFieldsProps>) {\n const { i18n } = useCoreContext();\n const storedCardDescription = i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', lastFour);\n const storedCardDescriptionSuffix = expiryMonth && expiryYear ? ` ${i18n.get('creditCard.expiryDate.label')} ${expiryMonth}/${expiryYear}` : '';\n const ariaLabel = `${storedCardDescription}${storedCardDescriptionSuffix}`;\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n const getError = (errors, fieldType) => {\n return errors[fieldType] ? i18n.get(errors[fieldType]) : null;\n };\n\n return (\n <div className=\"adyen-checkout__card__form adyen-checkout__card__form--oneClick\" aria-label={ariaLabel}>\n <Fieldset classNamesFields={['adyen-checkout__card__exp-cvc']}>\n {expiryMonth && expiryYear && (\n <Field\n label={i18n.get('creditCard.expiryDate.label')}\n classNameModifiers={['col-50', 'storedCard']}\n name={'expiryDateField'}\n disabled\n >\n <InputText\n name={'expiryDateField'}\n className={'adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick'}\n value={`${expiryMonth} / ${expiryYear}`}\n disabled={true}\n dir={'ltr'}\n autocomplete={undefined}\n />\n </Field>\n )}\n\n {hasCVC && (\n <CVC\n cvcPolicy={cvcPolicy}\n error={getError(errors, ENCRYPTED_SECURITY_CODE)}\n focused={focusedElement === 'encryptedSecurityCode'}\n filled={!!valid.encryptedSecurityCode || !!errors.encryptedSecurityCode}\n isValid={!!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n classNameModifiers={[...(expiryMonth && expiryYear ? ['col-50', 'storedCard'] : ['storedCard'])]}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </Fieldset>\n </div>\n );\n}\n"],"names":["StoredCardFields","brand","hasCVC","onFocusField","errors","valid","cvcPolicy","focusedElement","lastFour","expiryMonth","expiryYear","showContextualElement","i18n","useCoreContext","ariaLabel","get","replace","isAmex","cvcContextualText","h","div","className","aria-label","Fieldset","classNamesFields","Field","label","classNameModifiers","name","disabled","InputText","value","dir","autocomplete","undefined","CVC","error","fieldType","getError","ENCRYPTED_SECURITY_CODE","focused","filled","encryptedSecurityCode","isValid","frontCVC","contextualText"],"mappings":"+cAUe,SAASA,GAAiBC,MACrCA,EAAKC,OACLA,EAAMC,aACNA,EAAYC,OACZA,EAAMC,MACNA,EAAKC,UACLA,EAASC,eACTA,EAAcC,SACdA,EAAQC,YACRA,EAAWC,WACXA,EAAUC,sBACVA,IAEA,MAAMC,KAAEA,GAASC,IAGXC,EAAY,GAFYF,EAAKG,IAAI,+CAA+CC,QAAQ,KAAMR,KAChEC,GAAeC,EAAa,IAAIE,EAAKG,IAAI,kCAAkCN,KAAeC,IAAe,KAEvIO,EAAmB,SAAVhB,EACTiB,EAAoBD,EACpBL,EAAKG,IAAI,kDACTH,EAAKG,IAAI,kDAMf,OACII,EAACC,MAAAA,CAAIC,UAAU,kEAAkEC,aAAYR,GACzFK,EAACI,EAAAA,CAASC,iBAAkB,CAAC,kCACxBf,GAAeC,GACZS,EAACM,EAAAA,CACGC,MAAOd,EAAKG,IAAI,+BAChBY,mBAAoB,CAAC,SAAU,cAC/BC,KAAM,kBACNC,UAAAA,GAEAV,EAACW,EAAAA,CACGF,KAAM,kBACNP,UAAW,wGACXU,MAAO,GAAGtB,OAAiBC,IAC3BmB,UAAU,EACVG,IAAK,MACLC,kBAAcC,KAKzBhC,GACGiB,EAACgB,EAAAA,CACG7B,UAAWA,EACX8B,MA5BH,EAAChC,EAAQiC,IACfjC,EAAOiC,GAAazB,EAAKG,IAAIX,EAAOiC,IAAc,KA2BlCC,CAASlC,EAAQmC,GACxBC,QAA4B,0BAAnBjC,EACTkC,SAAUpC,EAAMqC,yBAA2BtC,EAAOsC,sBAClDC,UAAWtC,EAAMqC,sBACjBhB,MAAOd,EAAKG,IAAI,iCAChBZ,aAAcA,EACdwB,mBAAoB,IAAKlB,GAAeC,EAAa,CAAC,SAAU,cAAgB,CAAC,eACjFkC,SAAU3B,EACVN,sBAAuBA,EACvBkC,eAAgB3B,KAMxC"}
1
+ {"version":3,"file":"StoredCardFields.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/StoredCardFields.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CVC from './CVC';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { StoredCardFieldsProps } from './types';\nimport { ENCRYPTED_SECURITY_CODE } from '../../../../internal/SecuredFields/lib/constants';\nimport InputText from '../../../../internal/FormFields/InputText';\nimport Fieldset from '../../../../internal/FormFields/Fieldset';\nimport './StoredCardFields.scss';\n\nexport default function StoredCardFields({\n brand,\n hasCVC,\n onFocusField,\n errors,\n valid,\n cvcPolicy,\n focusedElement,\n lastFour,\n expiryMonth,\n expiryYear,\n showContextualElement\n}: Readonly<StoredCardFieldsProps>) {\n const { i18n } = useCoreContext();\n const storedCardDescription = i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', lastFour);\n const storedCardDescriptionSuffix = expiryMonth && expiryYear ? ` ${i18n.get('creditCard.expiryDate.label')} ${expiryMonth}/${expiryYear}` : '';\n const ariaLabel = `${storedCardDescription}${storedCardDescriptionSuffix}`;\n const isAmex = brand === 'amex';\n const cvcContextualText = isAmex\n ? i18n.get('creditCard.securityCode.contextualText.4digits')\n : i18n.get('creditCard.securityCode.contextualText.3digits');\n\n return (\n <div className=\"adyen-checkout__card__form adyen-checkout__card__form--oneClick\" aria-label={ariaLabel}>\n <Fieldset classNamesFields={['adyen-checkout__card__exp-cvc']}>\n {expiryMonth && expiryYear && (\n <Field\n label={i18n.get('creditCard.expiryDate.label')}\n classNameModifiers={['col-50', 'storedCard']}\n name={'expiryDateField'}\n disabled\n >\n <InputText\n name={'expiryDateField'}\n className={'adyen-checkout__input adyen-checkout__input--disabled adyen-checkout__card__exp-date__input--oneclick'}\n value={`${expiryMonth} / ${expiryYear}`}\n disabled={true}\n dir={'ltr'}\n autocomplete={undefined}\n />\n </Field>\n )}\n\n {hasCVC && (\n <CVC\n cvcPolicy={cvcPolicy}\n errorCode={errors[ENCRYPTED_SECURITY_CODE]}\n focused={focusedElement === 'encryptedSecurityCode'}\n filled={!!valid.encryptedSecurityCode || !!errors.encryptedSecurityCode}\n isValid={!!valid.encryptedSecurityCode}\n label={i18n.get('creditCard.securityCode.label')}\n onFocusField={onFocusField}\n classNameModifiers={[...(expiryMonth && expiryYear ? ['col-50', 'storedCard'] : ['storedCard'])]}\n frontCVC={isAmex}\n showContextualElement={showContextualElement}\n contextualText={cvcContextualText}\n />\n )}\n </Fieldset>\n </div>\n );\n}\n"],"names":["StoredCardFields","brand","hasCVC","onFocusField","errors","valid","cvcPolicy","focusedElement","lastFour","expiryMonth","expiryYear","showContextualElement","i18n","useCoreContext","ariaLabel","get","replace","isAmex","cvcContextualText","h","div","className","aria-label","Fieldset","classNamesFields","Field","label","classNameModifiers","name","disabled","InputText","value","dir","autocomplete","undefined","CVC","errorCode","ENCRYPTED_SECURITY_CODE","focused","filled","encryptedSecurityCode","isValid","frontCVC","contextualText"],"mappings":"+cAUe,SAASA,GAAiBC,MACrCA,EAAKC,OACLA,EAAMC,aACNA,EAAYC,OACZA,EAAMC,MACNA,EAAKC,UACLA,EAASC,eACTA,EAAcC,SACdA,EAAQC,YACRA,EAAWC,WACXA,EAAUC,sBACVA,IAEA,MAAMC,KAAEA,GAASC,IAGXC,EAAY,GAFYF,EAAKG,IAAI,+CAA+CC,QAAQ,KAAMR,KAChEC,GAAeC,EAAa,IAAIE,EAAKG,IAAI,kCAAkCN,KAAeC,IAAe,KAEvIO,EAAmB,SAAVhB,EACTiB,EAAoBD,EACpBL,EAAKG,IAAI,kDACTH,EAAKG,IAAI,kDAEf,OACII,EAACC,MAAAA,CAAIC,UAAU,kEAAkEC,aAAYR,GACzFK,EAACI,EAAAA,CAASC,iBAAkB,CAAC,kCACxBf,GAAeC,GACZS,EAACM,EAAAA,CACGC,MAAOd,EAAKG,IAAI,+BAChBY,mBAAoB,CAAC,SAAU,cAC/BC,KAAM,kBACNC,UAAAA,GAEAV,EAACW,EAAAA,CACGF,KAAM,kBACNP,UAAW,wGACXU,MAAO,GAAGtB,OAAiBC,IAC3BmB,UAAU,EACVG,IAAK,MACLC,kBAAcC,KAKzBhC,GACGiB,EAACgB,EAAAA,CACG7B,UAAWA,EACX8B,UAAWhC,EAAOiC,GAClBC,QAA4B,0BAAnB/B,EACTgC,SAAUlC,EAAMmC,yBAA2BpC,EAAOoC,sBAClDC,UAAWpC,EAAMmC,sBACjBd,MAAOd,EAAKG,IAAI,iCAChBZ,aAAcA,EACdwB,mBAAoB,IAAKlB,GAAeC,EAAa,CAAC,SAAU,cAAgB,CAAC,eACjFgC,SAAUzB,EACVN,sBAAuBA,EACvBgC,eAAgBzB,KAMxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardFocusData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\nimport type { Form } from '../../../../utils/useForm/types';\nimport type { SecuredFieldsProviderRef } from '../../../internal/SecuredFields/SFP/types';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: 'components' | 'custom';\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => void;\n onAdditionalSFRemoved?: () => void;\n onAllValid?: (o: CardAllValidData) => void;\n onAutoComplete?: (o: CardAutoCompleteData) => void;\n onBinValue?: (o: CardBinValueData) => void;\n onBlur?: (e) => void;\n onBrand?: (o: CardBrandData) => void;\n onConfigSuccess?: (O: CardConfigSuccessData) => void;\n onChange: (state) => void;\n onError?: () => void;\n onFieldValid?: (o: CardFieldValidData) => void;\n onFocus?: (e) => void;\n onLoad?: (o: CardLoadData) => void;\n onSubmitAnalytics: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: SecuredFieldsProviderRef;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n\nexport type CardSetFormData = Form<CardInputDataState>['setData'];\nexport type CardSetFormValid = Form<CardInputDataState>['setValid'];\nexport type CardSetFormErrors = Form<CardInputDataState>['setErrors'];\n\nexport type OnFieldFocus = (who: string, e: Event | CardFocusData) => void;\n"],"names":["AddressModeOptions"],"mappings":"AA+MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardFocusData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\nimport type { Form } from '../../../../utils/useForm/types';\nimport type { SecuredFieldsProviderRef } from '../../../internal/SecuredFields/SFP/types';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData | null;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: 'components' | 'custom';\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => void;\n onAdditionalSFRemoved?: () => void;\n onAllValid?: (o: CardAllValidData) => void;\n onAutoComplete?: (o: CardAutoCompleteData) => void;\n onBinValue?: (o: CardBinValueData) => void;\n onBlur?: (e) => void;\n onBrand?: (o: CardBrandData) => void;\n onConfigSuccess?: (O: CardConfigSuccessData) => void;\n onChange: (state) => void;\n onError?: () => void;\n onFieldValid?: (o: CardFieldValidData) => void;\n onFocus?: (e) => void;\n onLoad?: (o: CardLoadData) => void;\n onSubmitAnalytics: (event: AbstractAnalyticsEvent) => void;\n handleKeyDown?: (event: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: SecuredFieldsProviderRef;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n\nexport type CardSetFormData = Form<CardInputDataState>['setData'];\nexport type CardSetFormValid = Form<CardInputDataState>['setValid'];\nexport type CardSetFormErrors = Form<CardInputDataState>['setErrors'];\n\nexport type OnFieldFocus = (who: string, e: Event | CardFocusData) => void;\n"],"names":["AddressModeOptions"],"mappings":"AA+MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
@@ -1,2 +1,2 @@
1
- import{useState as r,useEffect as s}from"../../../../external/preact/hooks/dist/hooks.js";import e from"../../../../core/Errors/useSRPanelContext.js";import{mapFieldKey as o,handlePartialAddressMode as t,lookupBlurBasedErrors as i}from"./utils.js";import{usePrevious as a}from"../../../../utils/hookUtils.js";import{ERROR_ACTION_BLUR_SCENARIO as l,ERROR_ACTION_FOCUS_FIELD as n}from"../../../../core/Errors/constants.js";import{setFocusOnFirstField as c}from"./handlers.js";import{getArrayDifferences as u}from"../../../../utils/arrayUtils.js";const d=({errors:d,props:f,isValidating:p,retrieveLayout:m,specifications:g,billingAddress:S,sfp:y})=>{const{setSRMessagesFromObjects:b,setSRMessagesFromStrings:j,clearSRPanel:R,shouldMoveFocusSR:h}=e(),E=b?.({fieldTypeMappingFn:o}),F=t(f.billingAddressMode),[M,k]=r(null),L=a(M),T=y.current?.mapErrorsToValidationRuleResult(),A={...d,...T};return s(()=>{try{const{billingAddress:r,...s}=A,e={...s,...r},o=E?.({errors:e,isValidating:p.current,layout:m(),countrySpecificLabels:g.getAddressLabelsForCountry(S?.country)??F?.default?.labels}),t=o?.currentErrorsSortedByLayout;switch(k(t),o?.action){case n:h&&o?.fieldToFocus&&c(p.current,y,o?.fieldToFocus),setTimeout(()=>{p.current=!1},300);break;case l:{const r=u(t,L,"field"),s=r?.[0];if(s){const r=i(s.errorCode)?s.errorMessage:null;j(r)}else R();break}}}catch(r){}},[d]),{sortedErrorList:M,previousSortedErrors:L,clearSRPanel:R}};export{d as default};
1
+ import{useState as r,useEffect as s}from"../../../../external/preact/hooks/dist/hooks.js";import e from"../../../../core/Errors/useSRPanelContext.js";import{mapFieldKey as o,handlePartialAddressMode as t,lookupBlurBasedErrors as i}from"./utils.js";import{usePrevious as a}from"../../../../utils/hookUtils.js";import{ERROR_ACTION_BLUR_SCENARIO as l,ERROR_ACTION_FOCUS_FIELD as n}from"../../../../core/Errors/constants.js";import{setFocusOnFirstField as c}from"./handlers.js";import{getArrayDifferences as u}from"../../../../utils/arrayUtils.js";const d=({errors:d,props:p,isValidating:f,retrieveLayout:m,specifications:g,billingAddress:y,sfp:S})=>{const{setSRMessagesFromObjects:b,setSRMessagesFromStrings:h,clearSRPanel:j,shouldMoveFocusSR:E}=e(),R=b?.({fieldTypeMappingFn:o}),F=t(p.billingAddressMode),[M,k]=r(null),L=a(M),T=S.current?.mapErrorsToValidationRuleResult(),A={...d,...T};return s(()=>{try{const{billingAddress:r,...s}=A,e={...s,...r},o=R?.({errors:e,isValidating:f.current,layout:m(),countrySpecificLabels:g.getAddressLabelsForCountry(y?.country)??F?.default?.labels,hasDisplayedErrors:!!M?.length}),t=o?.currentErrorsSortedByLayout;switch(k(t),o?.action){case n:E&&o?.fieldToFocus&&c(f.current,S,o?.fieldToFocus),setTimeout(()=>{f.current=!1},300);break;case l:{const r=u(t,L,"field"),s=r?.[0];if(s){const r=i(s.errorCode)?s.errorMessage:null;h(r)}else j();break}}}catch(r){}},[d]),{sortedErrorList:M,previousSortedErrors:L,clearSRPanel:j}};export{d as default};
2
2
  //# sourceMappingURL=useSRPanelForCardInputErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSRPanelForCardInputErrors.js","sources":["../../../../../../src/components/Card/components/CardInput/useSRPanelForCardInputErrors.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport { handlePartialAddressMode, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport { setFocusOnFirstField } from './handlers';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\n\nconst useSRPanelForCardInputErrors = ({ errors, props, isValidating, retrieveLayout, specifications, billingAddress, sfp }) => {\n // Extract fns from context\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n // Get the previous list of errors\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n const sfStateErrorsObj = sfp.current?.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj };\n\n useEffect(() => {\n try {\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n setSortedErrorList(currentErrorsSortedByLayout);\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR && srPanelResp?.fieldToFocus) {\n setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n }\n\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors]);\n\n return { sortedErrorList, previousSortedErrors, clearSRPanel };\n};\n\nexport default useSRPanelForCardInputErrors;\n"],"names":["useSRPanelForCardInputErrors","errors","props","isValidating","retrieveLayout","specifications","billingAddress","sfp","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","partialAddressSchema","handlePartialAddressMode","billingAddressMode","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","sfStateErrorsObj","current","mapErrorsToValidationRuleResult","mergedErrors","useEffect","extractedAddressErrors","errorsWithoutAddress","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","country","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","setFocusOnFirstField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","_"],"mappings":"giBAUA,MAAMA,EAA+B,EAAGC,SAAQC,QAAOC,eAAcC,iBAAgBC,iBAAgBC,iBAAgBC,UAEjH,MAAMC,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAG1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAGlBC,EAAuBC,EAAyBf,EAAMgB,qBAErDC,EAAiBC,GAAsBC,EAA8B,MAGtEC,EAAuBC,EAAYJ,GAEnCK,EAAmBjB,EAAIkB,SAASC,kCAChCC,EAAe,IAAK1B,KAAWuB,GAwErC,OAtEAI,EAAU,KACN,IAEI,MAAQtB,eAAgBuB,KAA2BC,GAAyBH,EAEtEI,EAAiB,IAAKD,KAAyBD,GAG/CG,EAAyCnB,IAAgB,CAC3DZ,OAAQ8B,EACR5B,aAAcA,EAAasB,QAC3BQ,OAAQ7B,IAER8B,sBAAuB7B,EAAe8B,2BAA2B7B,GAAgB8B,UAAYpB,GAAsBqB,SAASC,SAI1HC,EAA8BP,GAAaO,4BAMjD,OALAnB,EAAmBmB,GAKXP,GAAaQ,QAEjB,KAAKC,EACG9B,GAAqBqB,GAAaU,cAClCC,EAAqBxC,EAAasB,QAASlB,EAAKyB,GAAaU,cAIjEE,WAAW,KACPzC,EAAasB,SAAU,GACxB,KACH,MAKJ,KAAKoB,EAA4B,CAC7B,MAAMC,EAAaC,EAA+CR,EAA6BjB,EAAsB,SAE/G0B,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAMMC,EANmBC,EAAsBF,EAAeG,WAMrBH,EAAeI,aAAe,KAEvE3C,EAAyBwC,EAC7B,MAGIvC,IAEJ,KACJ,EAIR,CAAE,MAAO2C,GAET,GACD,CAACpD,IAEG,CAAEkB,kBAAiBG,uBAAsBZ"}
1
+ {"version":3,"file":"useSRPanelForCardInputErrors.js","sources":["../../../../../../src/components/Card/components/CardInput/useSRPanelForCardInputErrors.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport { handlePartialAddressMode, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport { setFocusOnFirstField } from './handlers';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\n\nconst useSRPanelForCardInputErrors = ({ errors, props, isValidating, retrieveLayout, specifications, billingAddress, sfp }) => {\n // Extract fns from context\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n // Get the previous list of errors\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n const sfStateErrorsObj = sfp.current?.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj };\n\n useEffect(() => {\n try {\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels,\n // Only let this form clear the shared SR panel if it currently has errors on\n // display. Otherwise it wipes status messages (loading etc) written by others.\n hasDisplayedErrors: !!sortedErrorList?.length\n });\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n setSortedErrorList(currentErrorsSortedByLayout);\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR && srPanelResp?.fieldToFocus) {\n setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n }\n\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors]);\n\n return { sortedErrorList, previousSortedErrors, clearSRPanel };\n};\n\nexport default useSRPanelForCardInputErrors;\n"],"names":["useSRPanelForCardInputErrors","errors","props","isValidating","retrieveLayout","specifications","billingAddress","sfp","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","partialAddressSchema","handlePartialAddressMode","billingAddressMode","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","sfStateErrorsObj","current","mapErrorsToValidationRuleResult","mergedErrors","useEffect","extractedAddressErrors","errorsWithoutAddress","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","country","default","labels","hasDisplayedErrors","length","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","setFocusOnFirstField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","_"],"mappings":"giBAUA,MAAMA,EAA+B,EAAGC,SAAQC,QAAOC,eAAcC,iBAAgBC,iBAAgBC,iBAAgBC,UAEjH,MAAMC,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAG1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAGlBC,EAAuBC,EAAyBf,EAAMgB,qBAErDC,EAAiBC,GAAsBC,EAA8B,MAGtEC,EAAuBC,EAAYJ,GAEnCK,EAAmBjB,EAAIkB,SAASC,kCAChCC,EAAe,IAAK1B,KAAWuB,GA2ErC,OAzEAI,EAAU,KACN,IAEI,MAAQtB,eAAgBuB,KAA2BC,GAAyBH,EAEtEI,EAAiB,IAAKD,KAAyBD,GAG/CG,EAAyCnB,IAAgB,CAC3DZ,OAAQ8B,EACR5B,aAAcA,EAAasB,QAC3BQ,OAAQ7B,IAER8B,sBAAuB7B,EAAe8B,2BAA2B7B,GAAgB8B,UAAYpB,GAAsBqB,SAASC,OAG5HC,qBAAsBpB,GAAiBqB,SAIrCC,EAA8BT,GAAaS,4BAMjD,OALArB,EAAmBqB,GAKXT,GAAaU,QAEjB,KAAKC,EACGhC,GAAqBqB,GAAaY,cAClCC,EAAqB1C,EAAasB,QAASlB,EAAKyB,GAAaY,cAIjEE,WAAW,KACP3C,EAAasB,SAAU,GACxB,KACH,MAKJ,KAAKsB,EAA4B,CAC7B,MAAMC,EAAaC,EAA+CR,EAA6BnB,EAAsB,SAE/G4B,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAMMC,EANmBC,EAAsBF,EAAeG,WAMrBH,EAAeI,aAAe,KAEvE7C,EAAyB0C,EAC7B,MAGIzC,IAEJ,KACJ,EAIR,CAAE,MAAO6C,GAET,GACD,CAACtD,IAEG,CAAEkB,kBAAiBG,uBAAsBZ"}
@@ -1,2 +1,2 @@
1
- import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as r,KCP_CARD_NAME_BOTTOM as i,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as a,CREDIT_CARD as s,KCP_CARD as l,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as c}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as u}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),g=e=>["revolving","bonus"].includes(e?.plan)||e?.value>1,h=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=s;const g=e.hasHolderName&&e.holderNameRequired;if(g&&(C=e.positionHolderNameOnTop?o:n),c&&(C=l,g&&(C=e.positionHolderNameOnTop?r:i)),u&&(C=d,g&&(C=e.positionHolderNameOnTop?t:a)),m){const r=m.flat(2).filter(e=>"number"!=typeof e);let i=r;p&&(i=r.filter(e=>p.includes(e))),C=s.concat(i),g&&(C=e.positionHolderNameOnTop?o.concat(i):n.concat(i))}return C},R=(e,o,n)=>{switch(e){case"socialSecurityNumber":return o.get(`boleto.${e}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return n?.[e]?o.get(n?.[e]):o.get(e);default:return null}},y=e=>({billingAddressRequired:e.billingAddressRequired,billingAddressRequiredFields:e.billingAddressRequiredFields,billingAddressAllowedCountries:e.billingAddressAllowedCountries,brandsConfiguration:e.brandsConfiguration,showStoreDetailsCheckbox:e.showStoreDetailsCheckbox,hasCVC:e.hasCVC,hasHolderName:e.hasHolderName,holderNameRequired:e.holderNameRequired,installmentOptions:e.installmentOptions,placeholders:e.placeholders,positionHolderNameOnTop:e.positionHolderNameOnTop,showBrandIcon:e.showBrandIcon,showContextualElement:e.showContextualElement,lastFour:e.lastFour,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear,disclaimerMessage:e.disclaimerMessage}),O=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,countryCode:e.countryCode,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,maskSecurityCode:e.maskSecurityCode,exposeExpiryDate:e.exposeExpiryDate,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onConfigSuccess:e.onConfigSuccess,handleKeyPress:e.handleKeyPress,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),b=o=>o==e.partial?c:null;function f(e){return![p.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,p.ERROR_MSG_CARD_TOO_OLD,p.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,p.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(e)}function S(e){return u[e]??e}const x=(e,o)=>e.map(e=>{const n=e.id,r=m(),i="card"===n?"nocard":n,t=o?.[n]?.icon??C(i,r);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:t,altName:S(n)}}),A=(e,o,n)=>o.some(o=>e.includes(o[n])),E=({installmentOptions:e,fundingSource:o,amount:n})=>!(!e||0===Object.keys(e).length)&&(!(!n||0===n.value)&&(!o||"credit"===o));export{y as extractPropsForCardFields,O as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,h as getLayout,b as handlePartialAddressMode,f as lookupBlurBasedErrors,x as mapDualBrandButtons,R as mapFieldKey,A as requiresDualBrandSelection,g as shouldIncludeInstallmentsInPaymentData,E as shouldShowInstallmentsComponent};
1
+ import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as i,KCP_CARD_NAME_BOTTOM as r,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as a,CREDIT_CARD as s,KCP_CARD as l,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as c}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as u}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),g=e=>["revolving","bonus"].includes(e?.plan)||e?.value>1,h=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=s;const g=e.hasHolderName&&e.holderNameRequired;if(g&&(C=e.positionHolderNameOnTop?o:n),c&&(C=l,g&&(C=e.positionHolderNameOnTop?i:r)),u&&(C=d,g&&(C=e.positionHolderNameOnTop?t:a)),m){const i=m.flat(2).filter(e=>"number"!=typeof e);let r=i;p&&(r=i.filter(e=>p.includes(e))),C=s.concat(r),g&&(C=e.positionHolderNameOnTop?o.concat(r):n.concat(r))}return C},R=(e,o,n)=>{switch(e){case"socialSecurityNumber":return o.get(`boleto.${e}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return n?.[e]?o.get(n?.[e]):o.get(e);default:return null}},y=e=>({billingAddressRequired:e.billingAddressRequired,billingAddressRequiredFields:e.billingAddressRequiredFields,billingAddressAllowedCountries:e.billingAddressAllowedCountries,brandsConfiguration:e.brandsConfiguration,showStoreDetailsCheckbox:e.showStoreDetailsCheckbox,hasCVC:e.hasCVC,hasHolderName:e.hasHolderName,holderNameRequired:e.holderNameRequired,installmentOptions:e.installmentOptions,placeholders:e.placeholders,positionHolderNameOnTop:e.positionHolderNameOnTop,showBrandIcon:e.showBrandIcon,showContextualElement:e.showContextualElement,lastFour:e.lastFour,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear,disclaimerMessage:e.disclaimerMessage}),O=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,countryCode:e.countryCode,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,maskSecurityCode:e.maskSecurityCode,exposeExpiryDate:e.exposeExpiryDate,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onConfigSuccess:e.onConfigSuccess,handleKeyDown:e.handleKeyDown,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),b=o=>o==e.partial?c:null;function f(e){return![p.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,p.ERROR_MSG_CARD_TOO_OLD,p.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,p.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(e)}function S(e){return u[e]??e}const x={"cc.cvc.920":"cc.cvc.920.amex","cc.cvc.921":"cc.cvc.921.amex"};function A(e,o){return o&&x[e]||e}const E=(e,o)=>e.map(e=>{const n=e.id,i=m(),r="card"===n?"nocard":n,t=o?.[n]?.icon??C(r,i);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:t,altName:S(n)}}),N=(e,o,n)=>o.some(o=>e.includes(o[n])),_=({installmentOptions:e,fundingSource:o,amount:n})=>!(!e||0===Object.keys(e).length)&&(!(!n||0===n.value)&&(!o||"credit"===o));export{x as CVC_AMEX_ERROR_KEYS,y as extractPropsForCardFields,O as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,h as getLayout,b as handlePartialAddressMode,f as lookupBlurBasedErrors,E as mapDualBrandButtons,R as mapFieldKey,N as requiresDualBrandSelection,A as resolveCVCErrorKey,g as shouldIncludeInstallmentsInPaymentData,_ as shouldShowInstallmentsComponent};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport type { InstallmentOptions, InstallmentsState } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement, DualBrandButtons } from '../../types';\nimport { PaymentAmount } from '../../../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * 'installments' should be added to the payload if it has plan as revolving or bonus\n * or value greater than 1.\n *\n * More about it here: COWEB-1070\n */\nexport const shouldIncludeInstallmentsInPaymentData = (installment?: InstallmentsState): boolean => {\n return ['revolving', 'bonus'].includes(installment?.plan) || installment?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number');\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs hasCVC, installmentOptions)\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps): Pick<SFPProps, 'clientKey' | 'loadingContext'> & Partial<SFPProps> => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n };\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand: string): string {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const mapDualBrandButtons = (\n dualBrandSelectElements: DualBrandSelectElement[],\n brandsConfiguration?: CardBrandsConfiguration\n): DualBrandButtons[] => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration?.[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Checks if any of the brands requiring a selection mechanism are present in the binLookup response.\n *\n * If the result from Array.some is true - then we are in a dual branding scenario that requires selection, i.e.\n * - Show the dualBranding selector UI\n * - Preselect a card brand\n */\nexport const requiresDualBrandSelection = (\n brandsRequiringSelection: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => brandsRequiringSelection.includes(item[key]));\n\n/**\n * Determines whether the Installments component should be rendered.\n *\n * Installments Component is displayed when:\n * - installmentOptions is provided and not empty\n * - amount is provided and not zero\n * - fundingSource is not provided or is 'credit'\n *\n * @param params.installmentOptions - The installment configuration options\n * @param params.fundingSource - The card funding source (e.g. 'credit', 'debit')\n * @param params.amount - The payment amount\n * @returns Whether the Installments component should be rendered\n */\nexport const shouldShowInstallmentsComponent = ({\n installmentOptions,\n fundingSource,\n amount\n}: {\n installmentOptions?: InstallmentOptions;\n fundingSource?: string;\n amount?: PaymentAmount;\n}): boolean => {\n if (!installmentOptions || Object.keys(installmentOptions).length === 0) return false;\n if (!amount || amount.value === 0) return false;\n if (fundingSource && fundingSource !== 'credit') return false;\n\n return true;\n};\n"],"names":["getCardImageUrl","brand","getImage","type","extension","shouldIncludeInstallmentsInPaymentData","installment","includes","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyPress","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","name","brandObject","localeBrand","altName","requiresDualBrandSelection","brandsRequiringSelection","returnedDualBrandingObjects","some","shouldShowInstallmentsComponent","fundingSource","amount","Object","keys","length"],"mappings":"ojBAuBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GASrBI,EAA0CC,GAC5C,CAAC,YAAa,SAASC,SAASD,GAAaE,OAASF,GAAaG,MAAQ,EAGzEC,EAAY,EACrBC,QACAC,UACAC,mBACAC,yBAAyB,KACzBC,+BAA+B,SAE/B,IAAIC,EAASC,EACb,MAAMC,EAAwBP,EAAMQ,eAAiBR,EAAMS,mBAqB3D,GAnBIF,IACAF,EAASL,EAAMU,wBAA0BC,EAAuBC,GAGhEX,IACAI,EAASQ,EACLN,IACAF,EAASL,EAAMU,wBAA0BI,EAAoBC,IAIjEb,IACAG,EAASW,EACLT,IACAF,EAASL,EAAMU,wBAA0BO,EAAoBC,IAKjEf,EAAwB,CAExB,MAAMgB,EAAuChB,EAAuB,KAAQ,GAAGiB,OAAOC,GAAwB,iBAATA,GAErG,IAAIC,EAA4BH,EAE5Bf,IAEAkB,EAA4BH,EAA2BC,OAAOG,GAAKnB,EAA6BR,SAAS2B,KAG7GlB,EAASC,EAAYkB,OAAOF,GACxBf,IACAF,EAASL,EAAMU,wBACTC,EAAqBa,OAAOF,GAC5BV,EAAwBY,OAAOF,GAG7C,CACA,OAAOjB,GAMEoB,EAAc,CAACC,EAAaC,EAAgBC,KAErD,OAAQF,GACJ,IAAK,uBACD,OAAOC,EAAKE,IAAI,UAAUH,KAE9B,IAAK,SACL,IAAK,oBACL,IAAK,aACL,IAAK,kBACL,IAAK,OACL,IAAK,UACD,OAAOE,IAAwBF,GAAOC,EAAKE,IAAID,IAAwBF,IAAQC,EAAKE,IAAIH,GAE5F,QACI,OAAO,OAINI,EAA6B9B,IAC/B,CAEH+B,uBAAwB/B,EAAM+B,uBAC9B3B,6BAA8BJ,EAAMI,6BACpC4B,+BAAgChC,EAAMgC,+BACtCC,oBAAqBjC,EAAMiC,oBAC3BC,yBAA0BlC,EAAMkC,yBAChCC,OAAQnC,EAAMmC,OACd3B,cAAeR,EAAMQ,cACrBC,mBAAoBT,EAAMS,mBAC1B2B,mBAAoBpC,EAAMoC,mBAC1BC,aAAcrC,EAAMqC,aACpB3B,wBAAyBV,EAAMU,wBAE/B4B,cAAetC,EAAMsC,cACrBC,sBAAuBvC,EAAMuC,sBAE7BC,SAAUxC,EAAMwC,SAChBC,YAAazC,EAAMyC,YACnBC,WAAY1C,EAAM0C,WAClBC,kBAAmB3C,EAAM2C,oBAIpBC,EAAsB5C,IACxB,CACH6C,UAAW7C,EAAM6C,UACjBC,OAAQ9C,EAAM8C,OACdb,oBAAqBjC,EAAMiC,oBAC3Bc,UAAW/C,EAAM+C,UACjBC,YAAahD,EAAMgD,YACnBC,YAAajD,EAAMiD,YACnBtB,KAAM3B,EAAM2B,KACZuB,mBAAoBlD,EAAMkD,mBAC1BC,UAAWnD,EAAMmD,UACjBC,gBAAiBpD,EAAMoD,gBACvBC,eAAgBrD,EAAMqD,eACtBC,iBAAkBtD,EAAMsD,iBACxBC,iBAAkBvD,EAAMuD,iBACxBC,kBAAmBxD,EAAMwD,kBACzBC,qBAAsBzD,EAAMyD,qBAC5BC,sBAAuB1D,EAAM0D,sBAC7BC,WAAY3D,EAAM2D,WAClBC,eAAgB5D,EAAM4D,eACtBC,WAAY7D,EAAM6D,WAClBC,gBAAiB9D,EAAM8D,gBACvBC,eAAgB/D,EAAM+D,eACtBC,QAAShE,EAAMgE,QACfC,aAAcjE,EAAMiE,aACpBC,OAAQlE,EAAMkE,OACd7B,aAAcrC,EAAMqC,aACpB8B,UAAWnE,EAAMmE,UACjB5B,sBAAuBvC,EAAMuC,sBAC7B6B,aAAcpE,EAAMoE,aACpBC,sBAAuBrE,EAAMqE,wBAIxBC,EAA4BC,GAC9BA,GAAeC,EAAmBC,QAAUC,EAAyB,KAIzE,SAASC,EAAsBC,GAElC,OAAQ,CACJC,EAAcC,mCACdD,EAAcE,uBACdF,EAAcG,iCACdH,EAAcI,iCAChBrF,SAASgF,EACf,CAEO,SAASM,EAAiB5F,GAC7B,OAAO6F,EAAwB7F,IAAUA,CAC7C,CAEO,MAAM8F,EAAsB,CAC/BC,EACApD,IAEOoD,EAAwBC,IAAIjE,IAC/B,MAAM/B,EAAQ+B,EAAKkE,GACbhG,EAAWiG,IACXC,EAAsB,SAAVnG,EAAmB,SAAWA,EAC1CoG,EAAWzD,IAAsB3C,IAAQqG,MAAQtG,EAAgBoG,EAAWlG,GAIlF,MAAO,CACHgG,GAAIlE,EAAKkE,GACTK,KAAMvE,EAAKwE,YAAYC,aAAezE,EAAKwE,YAAYvG,MACvDoG,WACAK,QAASb,EAAiB5F,MAYzB0G,EAA6B,CACtCC,EACAC,EACAxE,IACCwE,EAA4BC,KAAK9E,GAAQ4E,EAAyBrG,SAASyB,EAAKK,KAexE0E,EAAkC,EAC3ChE,qBACAiE,gBACAC,eAMKlE,GAAiE,IAA3CmE,OAAOC,KAAKpE,GAAoBqE,aACtDH,GAA2B,IAAjBA,EAAOxG,UAClBuG,GAAmC,WAAlBA"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport type { InstallmentOptions, InstallmentsState } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement, DualBrandButtons } from '../../types';\nimport { PaymentAmount } from '../../../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * 'installments' should be added to the payload if it has plan as revolving or bonus\n * or value greater than 1.\n *\n * More about it here: COWEB-1070\n */\nexport const shouldIncludeInstallmentsInPaymentData = (installment?: InstallmentsState): boolean => {\n return ['revolving', 'bonus'].includes(installment?.plan) || installment?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number');\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs hasCVC, installmentOptions)\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps): Pick<SFPProps, 'clientKey' | 'loadingContext'> & Partial<SFPProps> => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyDown: props.handleKeyDown,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n };\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand: string): string {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\n// CVC's format guidance (digit count/position) is brand-dependent, so the Amex variant of each CVC\n// error message is a distinct, fully-translated key rather than something composed at runtime.\n// Shared between CVC.tsx (on-screen error) and SecuredFieldsProvider.mapErrorsToValidationRuleResult\n// (SR-live-panel announcement & the public state.errors.<field>.errorI18n API), so both resolve the\n// same key for the same errorCode/brand combination.\nexport const CVC_AMEX_ERROR_KEYS: Record<string, string> = {\n 'cc.cvc.920': 'cc.cvc.920.amex',\n 'cc.cvc.921': 'cc.cvc.921.amex'\n};\n\n/**\n * Resolve the correct (brand-aware) translation key for a CVC error code.\n * @param errorCode - the raw, untranslated CVC error key (e.g. 'cc.cvc.920')\n * @param isAmex - whether the current/detected card brand is Amex\n */\nexport function resolveCVCErrorKey(errorCode: string, isAmex: boolean): string {\n return (isAmex && CVC_AMEX_ERROR_KEYS[errorCode]) || errorCode;\n}\n\nexport const mapDualBrandButtons = (\n dualBrandSelectElements: DualBrandSelectElement[],\n brandsConfiguration?: CardBrandsConfiguration\n): DualBrandButtons[] => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration?.[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Checks if any of the brands requiring a selection mechanism are present in the binLookup response.\n *\n * If the result from Array.some is true - then we are in a dual branding scenario that requires selection, i.e.\n * - Show the dualBranding selector UI\n * - Preselect a card brand\n */\nexport const requiresDualBrandSelection = (\n brandsRequiringSelection: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => brandsRequiringSelection.includes(item[key]));\n\n/**\n * Determines whether the Installments component should be rendered.\n *\n * Installments Component is displayed when:\n * - installmentOptions is provided and not empty\n * - amount is provided and not zero\n * - fundingSource is not provided or is 'credit'\n *\n * @param params.installmentOptions - The installment configuration options\n * @param params.fundingSource - The card funding source (e.g. 'credit', 'debit')\n * @param params.amount - The payment amount\n * @returns Whether the Installments component should be rendered\n */\nexport const shouldShowInstallmentsComponent = ({\n installmentOptions,\n fundingSource,\n amount\n}: {\n installmentOptions?: InstallmentOptions;\n fundingSource?: string;\n amount?: PaymentAmount;\n}): boolean => {\n if (!installmentOptions || Object.keys(installmentOptions).length === 0) return false;\n if (!amount || amount.value === 0) return false;\n if (fundingSource && fundingSource !== 'credit') return false;\n\n return true;\n};\n"],"names":["getCardImageUrl","brand","getImage","type","extension","shouldIncludeInstallmentsInPaymentData","installment","includes","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyDown","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","CVC_AMEX_ERROR_KEYS","resolveCVCErrorKey","isAmex","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","name","brandObject","localeBrand","altName","requiresDualBrandSelection","brandsRequiringSelection","returnedDualBrandingObjects","some","shouldShowInstallmentsComponent","fundingSource","amount","Object","keys","length"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import n from"./CustomCardInput/CustomCardInput.js";import s from"../../utils/browserInfo.js";import{triggerBinLookUp as o}from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as r,fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{TxVariants as a}from"../tx-variants.js";import{AnalyticsInfoEvent as d,InfoEventType as p}from"../../core/Analytics/events/AnalyticsInfoEvent.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as u}from"../Card/constants.js";function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class l extends t{formatProps(e){return{...e,type:a.customCard}}formatData(){const e=this.state.selectedBrandValue;return{paymentMethod:{type:"scheme",...this.state.data,...e&&{brand:e}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(e){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(e),this}setFocusOn(e){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(e),this}dualBrandingChangeHandler(e){return this.componentRef?.dualBrandingChangeHandler&&this.componentRef.dualBrandingChangeHandler(e),this}handleUnsupportedCard(e){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){const t={...e};if(t.rootNode=this._node,!t.isReset){t.supportedBrandsRaw=e.supportedBrandsRaw?.map(e=>(e.brandImageUrl=this.props.brandsConfiguration[e.brand]?.icon??r(e.brand,this.resources),e));let n=!1,s=!1;e.supportedBrandsRaw?.length>1&&(n=!0,s=e.detectedBrands.some(e=>u.includes(e))),t.dualBrandingType=null,n&&(t.dualBrandingType=s?"Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism":"Dual Branded (Display-only): No selection mechanism required")}this.props.onBinLookup(t)}get isValid(){return!!this.state.isValid}get browserInfo(){return s()}componentToRender(){return e(n,{ref:e=>{this.componentRef=e},...this.props,...this.state,handleKeyPress:this.handleKeyPress,rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.brand,onFocus:this.onFocus,onSubmitAnalytics:this.submitAnalytics})}constructor(...e){super(...e),c(this,"brand",a.card),c(this,"onBinValue",o(this)),c(this,"onFocus",e=>{const t=new d({component:this.type,type:!0===e.focus?p.focus:p.unfocus,target:i(e.fieldType)});this.submitAnalytics(t),this.props.onFocus?.(e)}),c(this,"onEnterKeyPressed",(e,t)=>{this.props.onEnterKeyPressed?.(e,t)})}}c(l,"type",a.customCard),c(l,"defaultProps",{onBinLookup:()=>{},brandsConfiguration:{}});export{l as CustomCard,l as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import n from"./CustomCardInput/CustomCardInput.js";import o from"../../utils/browserInfo.js";import{triggerBinLookUp as s}from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as r,fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{TxVariants as a}from"../tx-variants.js";import{AnalyticsInfoEvent as d,InfoEventType as p}from"../../core/Analytics/events/AnalyticsInfoEvent.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as u}from"../Card/constants.js";function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class l extends t{formatProps(e){return{...e,type:a.customCard}}formatData(){const e=this.state.selectedBrandValue;return{paymentMethod:{type:"scheme",...this.state.data,...e&&{brand:e}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(e){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(e),this}setFocusOn(e){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(e),this}dualBrandingChangeHandler(e){return this.componentRef?.dualBrandingChangeHandler&&this.componentRef.dualBrandingChangeHandler(e),this}handleUnsupportedCard(e){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){const t={...e};if(t.rootNode=this._node,!t.isReset){t.supportedBrandsRaw=e.supportedBrandsRaw?.map(e=>(e.brandImageUrl=this.props.brandsConfiguration[e.brand]?.icon??r(e.brand,this.resources),e));let n=!1,o=!1;e.supportedBrandsRaw?.length>1&&(n=!0,o=e.detectedBrands.some(e=>u.includes(e))),t.dualBrandingType=null,n&&(t.dualBrandingType=o?"Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism":"Dual Branded (Display-only): No selection mechanism required")}this.props.onBinLookup(t)}get isValid(){return!!this.state.isValid}get browserInfo(){return o()}componentToRender(){return e(n,{ref:e=>{this.componentRef=e},...this.props,...this.state,handleKeyDown:this.handleKeyDown,rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.brand,onFocus:this.onFocus,onSubmitAnalytics:this.submitAnalytics})}constructor(...e){super(...e),c(this,"brand",a.card),c(this,"onBinValue",s(this)),c(this,"onFocus",e=>{const t=new d({component:this.type,type:!0===e.focus?p.focus:p.unfocus,target:i(e.fieldType)});this.submitAnalytics(t),this.props.onFocus?.(e)}),c(this,"onEnterKeyPressed",(e,t)=>{this.props.onEnterKeyPressed?.(e,t)})}}c(l,"type",a.customCard),c(l,"defaultProps",{onBinLookup:()=>{},brandsConfiguration:{}});export{l as CustomCard,l as default};
2
2
  //# sourceMappingURL=CustomCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../Card/constants';\n\nconst SELECTABLE_DUAL_BRANDED_SCENARIO = 'Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism';\nconst DISPLAY_ONLY_DUAL_BRANDED_SCENARIO = 'Dual Branded (Display-only): No selection mechanism required';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static readonly type = TxVariants.customCard;\n\n protected static readonly defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CardBinLookupData) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n\n // Check for dual branded scenario and, if so, discern which type\n let isDualBrandedScenario = false;\n let isSelectableDualBrandedScenario = false;\n\n if (obj.supportedBrandsRaw?.length > 1) {\n isDualBrandedScenario = true;\n isSelectableDualBrandedScenario = obj.detectedBrands.some(item =>\n (DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as readonly string[]).includes(item)\n );\n }\n\n // Set the dual branding type\n nuObj.dualBrandingType = null;\n\n if (isDualBrandedScenario) {\n nuObj.dualBrandingType = isSelectableDualBrandedScenario ? SELECTABLE_DUAL_BRANDED_SCENARIO : DISPLAY_ONLY_DUAL_BRANDED_SCENARIO;\n }\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyPress={this.handleKeyPress}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isDualBrandedScenario","isSelectableDualBrandedScenario","length","detectedBrands","some","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","includes","dualBrandingType","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyPress","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","defaultProps"],"mappings":"8vBAgBO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA,CAAaC,GAET,OADIX,KAAKY,cAAcF,cAAcV,KAAKY,aAAaF,aAAaC,GAC7DX,IACX,CAEAa,UAAAA,CAAWC,GAEP,OADId,KAAKY,cAAcC,YAAYb,KAAKY,aAAaC,WAAWC,GACzDd,IACX,CAEAe,wBAAAA,CAAyBC,GAErB,OADIhB,KAAKY,cAAcG,0BAA0Bf,KAAKY,aAAaG,yBAAyBC,GACrFhB,IACX,CAEAiB,yBAAAA,CAA0BC,GAEtB,OADIlB,KAAKY,cAAcK,2BAA2BjB,KAAKY,aAAaK,0BAA0BC,GACvFlB,IACX,CAEAmB,qBAAAA,CAAsBC,GAElB,OADIpB,KAAKY,cAAcO,uBAAuBnB,KAAKY,aAAaO,sBAAsBC,GAC/EpB,IACX,CAEAqB,WAAAA,CAAYC,GACR,MAAMC,EAAQ,IAAKD,GAGnB,GAFAC,EAAMC,SAAWxB,KAAKyB,OAEjBF,EAAMG,QAAS,CAEhBH,EAAMI,mBAAqBL,EAAIK,oBAAoBC,IAAKC,IACpDA,EAAKC,cAAgB9B,KAAKN,MAAMqC,oBAAoBF,EAAKxB,QAAQ2B,MAAQC,EAAgBJ,EAAKxB,MAAOL,KAAKkC,WACnGL,IAIX,IAAIM,GAAwB,EACxBC,GAAkC,EAElCd,EAAIK,oBAAoBU,OAAS,IACjCF,GAAwB,EACxBC,EAAkCd,EAAIgB,eAAeC,KAAKV,GACrDW,EAAgEC,SAASZ,KAKlFN,EAAMmB,iBAAmB,KAErBP,IACAZ,EAAMmB,iBAAmBN,EAvFA,mGACE,+DAwFnC,CAEApC,KAAKN,MAAM2B,YAAYE,EAC3B,CAIA,WAAIoB,GACA,QAAS3C,KAAKC,MAAM0C,OACxB,CAEA,eAAIrC,GACA,OAAOsC,GACX,CAmBmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,IAAKA,IACDhD,KAAKY,aAAeoC,MAEpBhD,KAAKN,SACLM,KAAKC,MACTgD,eAAgBjD,KAAKiD,eACrBzB,SAAUxB,KAAKyB,MACfyB,SAAUlD,KAAKmD,SACfC,WAAYpD,KAAKoD,WACjBC,mBAAoB,SACpBnB,UAAWlC,KAAKkC,UAChB7B,MAAOL,KAAKK,MACZiD,QAAStD,KAAKsD,QACdC,kBAAmBvD,KAAKwD,iBAGpC,mBAzIGC,SAAAC,GAQHC,EAAA3D,KAAQK,QAAQT,EAAWgE,MAmF3BD,EAAA3D,KAAOoD,aAAaS,EAAiB7D,OAUrC2D,EAAA3D,KAAQsD,UAAWhC,IACf,MAAMwC,EAAQ,IAAIC,EAAmB,CACjCC,UAAWhE,KAAKL,KAChBA,MAAoB,IAAd2B,EAAI2C,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqB/C,EAAIgD,aAGrCtE,KAAKwD,gBAAgBM,GAGrB9D,KAAKN,MAAM4D,UAAUhC,KAGzBqC,EAAA3D,KAAUuE,oBAAoB,CAACC,EAAwBR,KACnDhE,KAAKN,MAAM6E,oBAAoBC,EAAeR,MAlHlDL,EADSpE,EACcI,OAAOC,EAAWC,YAEzC8D,EAHSpE,EAGiBkF,eAAe,CACrCpD,YAAa,OACbU,oBAAqB,CAAA"}
1
+ {"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../Card/constants';\n\nconst SELECTABLE_DUAL_BRANDED_SCENARIO = 'Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism';\nconst DISPLAY_ONLY_DUAL_BRANDED_SCENARIO = 'Dual Branded (Display-only): No selection mechanism required';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static readonly type = TxVariants.customCard;\n\n protected static readonly defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CardBinLookupData) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n\n // Check for dual branded scenario and, if so, discern which type\n let isDualBrandedScenario = false;\n let isSelectableDualBrandedScenario = false;\n\n if (obj.supportedBrandsRaw?.length > 1) {\n isDualBrandedScenario = true;\n isSelectableDualBrandedScenario = obj.detectedBrands.some(item =>\n (DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as readonly string[]).includes(item)\n );\n }\n\n // Set the dual branding type\n nuObj.dualBrandingType = null;\n\n if (isDualBrandedScenario) {\n nuObj.dualBrandingType = isSelectableDualBrandedScenario ? SELECTABLE_DUAL_BRANDED_SCENARIO : DISPLAY_ONLY_DUAL_BRANDED_SCENARIO;\n }\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyDown={this.handleKeyDown}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isDualBrandedScenario","isSelectableDualBrandedScenario","length","detectedBrands","some","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","includes","dualBrandingType","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyDown","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","defaultProps"],"mappings":"8vBAgBO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA,CAAaC,GAET,OADIX,KAAKY,cAAcF,cAAcV,KAAKY,aAAaF,aAAaC,GAC7DX,IACX,CAEAa,UAAAA,CAAWC,GAEP,OADId,KAAKY,cAAcC,YAAYb,KAAKY,aAAaC,WAAWC,GACzDd,IACX,CAEAe,wBAAAA,CAAyBC,GAErB,OADIhB,KAAKY,cAAcG,0BAA0Bf,KAAKY,aAAaG,yBAAyBC,GACrFhB,IACX,CAEAiB,yBAAAA,CAA0BC,GAEtB,OADIlB,KAAKY,cAAcK,2BAA2BjB,KAAKY,aAAaK,0BAA0BC,GACvFlB,IACX,CAEAmB,qBAAAA,CAAsBC,GAElB,OADIpB,KAAKY,cAAcO,uBAAuBnB,KAAKY,aAAaO,sBAAsBC,GAC/EpB,IACX,CAEAqB,WAAAA,CAAYC,GACR,MAAMC,EAAQ,IAAKD,GAGnB,GAFAC,EAAMC,SAAWxB,KAAKyB,OAEjBF,EAAMG,QAAS,CAEhBH,EAAMI,mBAAqBL,EAAIK,oBAAoBC,IAAKC,IACpDA,EAAKC,cAAgB9B,KAAKN,MAAMqC,oBAAoBF,EAAKxB,QAAQ2B,MAAQC,EAAgBJ,EAAKxB,MAAOL,KAAKkC,WACnGL,IAIX,IAAIM,GAAwB,EACxBC,GAAkC,EAElCd,EAAIK,oBAAoBU,OAAS,IACjCF,GAAwB,EACxBC,EAAkCd,EAAIgB,eAAeC,KAAKV,GACrDW,EAAgEC,SAASZ,KAKlFN,EAAMmB,iBAAmB,KAErBP,IACAZ,EAAMmB,iBAAmBN,EAvFA,mGACE,+DAwFnC,CAEApC,KAAKN,MAAM2B,YAAYE,EAC3B,CAIA,WAAIoB,GACA,QAAS3C,KAAKC,MAAM0C,OACxB,CAEA,eAAIrC,GACA,OAAOsC,GACX,CAmBmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,IAAKA,IACDhD,KAAKY,aAAeoC,MAEpBhD,KAAKN,SACLM,KAAKC,MACTgD,cAAejD,KAAKiD,cACpBzB,SAAUxB,KAAKyB,MACfyB,SAAUlD,KAAKmD,SACfC,WAAYpD,KAAKoD,WACjBC,mBAAoB,SACpBnB,UAAWlC,KAAKkC,UAChB7B,MAAOL,KAAKK,MACZiD,QAAStD,KAAKsD,QACdC,kBAAmBvD,KAAKwD,iBAGpC,mBAzIGC,SAAAC,GAQHC,EAAA3D,KAAQK,QAAQT,EAAWgE,MAmF3BD,EAAA3D,KAAOoD,aAAaS,EAAiB7D,OAUrC2D,EAAA3D,KAAQsD,UAAWhC,IACf,MAAMwC,EAAQ,IAAIC,EAAmB,CACjCC,UAAWhE,KAAKL,KAChBA,MAAoB,IAAd2B,EAAI2C,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqB/C,EAAIgD,aAGrCtE,KAAKwD,gBAAgBM,GAGrB9D,KAAKN,MAAM4D,UAAUhC,KAGzBqC,EAAA3D,KAAUuE,oBAAoB,CAACC,EAAwBR,KACnDhE,KAAKN,MAAM6E,oBAAoBC,EAAeR,MAlHlDL,EADSpE,EACcI,OAAOC,EAAWC,YAEzC8D,EAHSpE,EAGiBkF,eAAe,CACrCpD,YAAa,OACbU,oBAAqB,CAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as o,useState as n,useMemo as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import a from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import s from"../../internal/SecuredFields/binLookup/extensions.js";function i(i){const l=o(null),[u,p]=n({}),[c,m]=n({}),[y,h]=n({}),[S,C]=n(!1),[f,g]=n(null),[F,V]=n([]),[E,x]=n(""),B=r(()=>s(i,{sfp:l},{dualBrandSelectElements:F,setDualBrandSelectElements:V,setSelectedBrandValue:x,issuingCountryCode:f,setIssuingCountryCode:g}),[F,f]);return this.processBinLookupResponse=(e,o)=>{B.processBinLookup(e,o)},this.dualBrandingChangeHandler=B.handleDualBrandSelection,t(()=>(this.setFocusOn=l.current.setFocusOn,this.updateStyles=l.current.updateStyles,this.showValidation=l.current.showValidation,this.handleUnsupportedCard=l.current.handleUnsupportedCard,()=>{l.current.destroy()}),[]),t(()=>{const e=l.current.mapErrorsToValidationRuleResult(),o={...u,...e};if(i.onChange({data:y,valid:c,errors:o,isValid:S,selectedBrandValue:E}),Object.keys(o).length){const e=Object.entries(o).map(([e,o])=>({fieldType:e,...o||{error:"",rootNode:this.props.rootNode}}));this.props.onValidationError?.(e)}},[y,c,u,E]),e(a,{ref:l,...d(i),type:i.brand,componentType:i.type,onChange:e=>{h({...y,...e.data}),p({...u,...e.errors}),m({...c,...e.valid}),C(e.isSfpValid)},onSubmitAnalytics:i.onSubmitAnalytics,exposeExpiryDate:!1,disableIOSArrowKeys:null,render:()=>null})}i.defaultProps={onChange:()=>{},onError:()=>{},onValidationError:()=>{}};const d=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onBrand:e.onBrand,onConfigSuccess:e.onConfigSuccess,handleKeyPress:e.handleKeyPress,onError:e.onError,onFieldValid:e.onFieldValid,onFocus:e.onFocus,onLoad:e.onLoad,rootNode:e.rootNode,showWarnings:e.showWarnings,styles:e.styles,trimTrailingSeparator:e.trimTrailingSeparator,resources:e.resources,maskSecurityCode:e.maskSecurityCode,placeholders:e.placeholders});export{i as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as o,useState as n,useMemo as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import a from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import i from"../../internal/SecuredFields/binLookup/extensions.js";function s(s){const l=o(null),[u,p]=n({}),[c,m]=n({}),[y,h]=n({}),[S,C]=n(!1),[f,g]=n(null),[F,V]=n([]),[E,x]=n(""),B=r(()=>i(s,{sfp:l},{dualBrandSelectElements:F,setDualBrandSelectElements:V,setSelectedBrandValue:x,issuingCountryCode:f,setIssuingCountryCode:g}),[F,f]);return this.processBinLookupResponse=(e,o)=>{B.processBinLookup(e,o)},this.dualBrandingChangeHandler=B.handleDualBrandSelection,t(()=>(this.setFocusOn=l.current.setFocusOn,this.updateStyles=l.current.updateStyles,this.showValidation=l.current.showValidation,this.handleUnsupportedCard=l.current.handleUnsupportedCard,()=>{l.current.destroy()}),[]),t(()=>{const e=l.current.mapErrorsToValidationRuleResult(),o={...u,...e};if(s.onChange({data:y,valid:c,errors:o,isValid:S,selectedBrandValue:E}),Object.keys(o).length){const e=Object.entries(o).map(([e,o])=>({fieldType:e,...o||{error:"",rootNode:this.props.rootNode}}));this.props.onValidationError?.(e)}},[y,c,u,E]),e(a,{ref:l,...d(s),type:s.brand,componentType:s.type,onChange:e=>{h({...y,...e.data}),p({...u,...e.errors}),m({...c,...e.valid}),C(e.isSfpValid)},onSubmitAnalytics:s.onSubmitAnalytics,exposeExpiryDate:!1,disableIOSArrowKeys:null,render:()=>null})}s.defaultProps={onChange:()=>{},onError:()=>{},onValidationError:()=>{}};const d=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onBrand:e.onBrand,onConfigSuccess:e.onConfigSuccess,handleKeyDown:e.handleKeyDown,onError:e.onError,onFieldValid:e.onFieldValid,onFocus:e.onFocus,onLoad:e.onLoad,rootNode:e.rootNode,showWarnings:e.showWarnings,styles:e.styles,trimTrailingSeparator:e.trimTrailingSeparator,resources:e.resources,maskSecurityCode:e.maskSecurityCode,placeholders:e.placeholders});export{s as default};
2
2
  //# sourceMappingURL=CustomCardInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCardInput.js","sources":["../../../../../src/components/CustomCard/CustomCardInput/CustomCardInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef, useMemo } from 'preact/hooks';\nimport Language from '../../../language/Language';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { SFPState } from '../../internal/SecuredFields/SFP/types';\nimport { BinLookupResponse, CardBrandsConfiguration, CardPlaceholders } from '../../Card/types';\nimport SFExtensions from '../../internal/SecuredFields/binLookup/extensions';\nimport { StylesObject } from '../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../core/Context/Resources';\nimport { SFError } from '../../Card/components/CardInput/types';\nimport { ValidationError } from '../types';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\n\ninterface SecuredFieldsProps {\n autoFocus?: boolean;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n clientKey: string;\n countryCode?: string;\n forceCompat?: boolean;\n i18n: Language;\n implementationType?: 'components' | 'custom';\n keypadFix?: boolean;\n loadingContext?: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: () => {};\n onAutoComplete?: () => {};\n onBinValue?: () => {};\n onBrand?: () => {};\n onConfigSuccess?: () => {};\n onChange: (data) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onError?: () => {};\n onFieldValid?: () => {};\n onFocus?: (e) => {};\n onLoad?: () => {};\n placeholders?: CardPlaceholders;\n rootNode: HTMLElement;\n resources: Resources;\n showWarnings?: boolean;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n}\n\nconst defaultProps = {\n onChange: () => {},\n onError: () => {},\n onValidationError: () => {}\n};\n\nfunction CustomCardInput(props: Readonly<SecuredFieldsProps>) {\n const sfp = useRef(null);\n\n const [errors, setErrors] = useState({});\n const [valid, setValid] = useState({});\n const [data, setData] = useState({});\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n\n const [issuingCountryCode, setIssuingCountryCode] = useState(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState('');\n\n const handleSecuredFieldsChange = (sfState: SFPState): void => {\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n SFExtensions(\n props,\n { sfp },\n { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode }\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPECTED METHODS ON SecuredFields.this\n */\n this.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n this.dualBrandingChangeHandler = extensions.handleDualBrandSelection;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n this.showValidation = sfp.current.showValidation;\n this.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n\n const mappedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors\n\n props.onChange({\n data,\n valid,\n errors: mappedErrors,\n isValid: isSfpValid,\n selectedBrandValue\n });\n\n // Create an array of Validation error objects and send to callback\n if (Object.keys(mappedErrors).length) {\n const validationErrors: ValidationError[] = Object.entries(mappedErrors).map(([fieldType, error]) => {\n const valErr: ValidationError = {\n fieldType,\n ...(error ? (error as SFError) : { error: '', rootNode: this.props.rootNode })\n };\n return valErr;\n });\n this.props.onValidationError?.(validationErrors);\n }\n }, [data, valid, errors, selectedBrandValue]);\n\n /**\n * RENDER\n */\n // prettier-ignore\n return (\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n type={props.brand}\n componentType={props.type}\n onChange={handleSecuredFieldsChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n exposeExpiryDate={false}\n disableIOSArrowKeys={null}\n render={() => null}\n />\n );\n}\n\nCustomCardInput.defaultProps = defaultProps;\n\nexport default CustomCardInput;\n\nconst extractPropsForSFP = (props: SecuredFieldsProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n forceCompat: props.forceCompat,\n // countryCode: props.countryCode, // only used for korean cards when koreanAuthenticationRequired is true\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onBrand: props.onBrand,\n // onChange // set directly\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n // render // set directly\n rootNode: props.rootNode,\n showWarnings: props.showWarnings,\n styles: props.styles,\n trimTrailingSeparator: props.trimTrailingSeparator,\n resources: props.resources,\n maskSecurityCode: props.maskSecurityCode,\n placeholders: props.placeholders\n };\n};\n"],"names":["CustomCardInput","props","sfp","useRef","errors","setErrors","useState","valid","setValid","data","setData","isSfpValid","setIsSfpValid","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","extensions","useMemo","SFExtensions","this","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","dualBrandingChangeHandler","handleDualBrandSelection","useEffect","setFocusOn","current","updateStyles","showValidation","handleUnsupportedCard","destroy","sfStateErrorsObj","mapErrorsToValidationRuleResult","mappedErrors","onChange","isValid","Object","keys","length","validationErrors","entries","map","fieldType","error","rootNode","onValidationError","h","SecuredFieldsProvider","ref","extractPropsForSFP","type","brand","componentType","sfState","onSubmitAnalytics","exposeExpiryDate","disableIOSArrowKeys","render","defaultProps","onError","autoFocus","brands","brandsConfiguration","clientKey","forceCompat","i18n","implementationType","keypadFix","legacyInputMode","loadingContext","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onBrand","onConfigSuccess","handleKeyPress","onFieldValid","onFocus","onLoad","showWarnings","styles","trimTrailingSeparator","resources","maskSecurityCode","placeholders"],"mappings":"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"}
1
+ {"version":3,"file":"CustomCardInput.js","sources":["../../../../../src/components/CustomCard/CustomCardInput/CustomCardInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef, useMemo } from 'preact/hooks';\nimport Language from '../../../language/Language';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { SFPState } from '../../internal/SecuredFields/SFP/types';\nimport { BinLookupResponse, CardBrandsConfiguration, CardPlaceholders } from '../../Card/types';\nimport SFExtensions from '../../internal/SecuredFields/binLookup/extensions';\nimport { StylesObject } from '../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../core/Context/Resources';\nimport { SFError } from '../../Card/components/CardInput/types';\nimport { ValidationError } from '../types';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\n\ninterface SecuredFieldsProps {\n autoFocus?: boolean;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n clientKey: string;\n countryCode?: string;\n forceCompat?: boolean;\n i18n: Language;\n implementationType?: 'components' | 'custom';\n keypadFix?: boolean;\n loadingContext?: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: () => {};\n onAutoComplete?: () => {};\n onBinValue?: () => {};\n onBrand?: () => {};\n onConfigSuccess?: () => {};\n onChange: (data) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyDown?: (event: KeyboardEvent) => void;\n onError?: () => {};\n onFieldValid?: () => {};\n onFocus?: (e) => {};\n onLoad?: () => {};\n placeholders?: CardPlaceholders;\n rootNode: HTMLElement;\n resources: Resources;\n showWarnings?: boolean;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n}\n\nconst defaultProps = {\n onChange: () => {},\n onError: () => {},\n onValidationError: () => {}\n};\n\nfunction CustomCardInput(props: Readonly<SecuredFieldsProps>) {\n const sfp = useRef(null);\n\n const [errors, setErrors] = useState({});\n const [valid, setValid] = useState({});\n const [data, setData] = useState({});\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n\n const [issuingCountryCode, setIssuingCountryCode] = useState(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState('');\n\n const handleSecuredFieldsChange = (sfState: SFPState): void => {\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n SFExtensions(\n props,\n { sfp },\n { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode }\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPECTED METHODS ON SecuredFields.this\n */\n this.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n this.dualBrandingChangeHandler = extensions.handleDualBrandSelection;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n this.showValidation = sfp.current.showValidation;\n this.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n\n const mappedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors\n\n props.onChange({\n data,\n valid,\n errors: mappedErrors,\n isValid: isSfpValid,\n selectedBrandValue\n });\n\n // Create an array of Validation error objects and send to callback\n if (Object.keys(mappedErrors).length) {\n const validationErrors: ValidationError[] = Object.entries(mappedErrors).map(([fieldType, error]) => {\n const valErr: ValidationError = {\n fieldType,\n ...(error ? (error as SFError) : { error: '', rootNode: this.props.rootNode })\n };\n return valErr;\n });\n this.props.onValidationError?.(validationErrors);\n }\n }, [data, valid, errors, selectedBrandValue]);\n\n /**\n * RENDER\n */\n // prettier-ignore\n return (\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n type={props.brand}\n componentType={props.type}\n onChange={handleSecuredFieldsChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n exposeExpiryDate={false}\n disableIOSArrowKeys={null}\n render={() => null}\n />\n );\n}\n\nCustomCardInput.defaultProps = defaultProps;\n\nexport default CustomCardInput;\n\nconst extractPropsForSFP = (props: SecuredFieldsProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onBrand: props.onBrand,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyDown: props.handleKeyDown,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n rootNode: props.rootNode,\n showWarnings: props.showWarnings,\n styles: props.styles,\n trimTrailingSeparator: props.trimTrailingSeparator,\n resources: props.resources,\n maskSecurityCode: props.maskSecurityCode,\n placeholders: props.placeholders\n };\n};\n"],"names":["CustomCardInput","props","sfp","useRef","errors","setErrors","useState","valid","setValid","data","setData","isSfpValid","setIsSfpValid","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","extensions","useMemo","SFExtensions","this","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","dualBrandingChangeHandler","handleDualBrandSelection","useEffect","setFocusOn","current","updateStyles","showValidation","handleUnsupportedCard","destroy","sfStateErrorsObj","mapErrorsToValidationRuleResult","mappedErrors","onChange","isValid","Object","keys","length","validationErrors","entries","map","fieldType","error","rootNode","onValidationError","h","SecuredFieldsProvider","ref","extractPropsForSFP","type","brand","componentType","sfState","onSubmitAnalytics","exposeExpiryDate","disableIOSArrowKeys","render","defaultProps","onError","autoFocus","brands","brandsConfiguration","clientKey","forceCompat","i18n","implementationType","keypadFix","legacyInputMode","loadingContext","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onBrand","onConfigSuccess","handleKeyDown","onFieldValid","onFocus","onLoad","showWarnings","styles","trimTrailingSeparator","resources","maskSecurityCode","placeholders"],"mappings":"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"}