@adyen/adyen-web 6.41.0 → 6.42.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 (189) 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 +48 -33
  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/types.js.map +1 -1
  7. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  8. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  9. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  10. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  11. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  12. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  13. package/dist/es/components/Dropin/Dropin.js +1 -1
  14. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  15. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  16. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  17. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  18. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  19. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  20. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  21. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  22. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  23. package/dist/es/components/Dropin/utils/paymentMethodsAnalytics.js +2 -0
  24. package/dist/es/components/Dropin/utils/paymentMethodsAnalytics.js.map +1 -0
  25. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  26. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  27. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  28. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  29. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  30. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  31. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  32. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  33. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  34. package/dist/es/components/ThreeDS2/constants.js +1 -1
  35. package/dist/es/components/ThreeDS2/constants.js.map +1 -1
  36. package/dist/es/components/internal/Address/Address.js +1 -1
  37. package/dist/es/components/internal/Address/Address.js.map +1 -1
  38. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  39. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  40. package/dist/es/components/internal/Address/validate.js +1 -1
  41. package/dist/es/components/internal/Address/validate.js.map +1 -1
  42. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  43. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  44. package/dist/es/components/internal/Button/Button.js +1 -1
  45. package/dist/es/components/internal/Button/Button.js.map +1 -1
  46. package/dist/es/components/internal/Button/CopyButton.js +1 -1
  47. package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
  48. package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
  49. package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
  50. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  51. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  52. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  53. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  54. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  55. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  56. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  57. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  58. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  59. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  60. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  61. package/dist/es/components/internal/IFrame/Iframe.js +1 -1
  62. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  63. package/dist/es/components/internal/Modal/Modal.js +1 -1
  64. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  65. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  66. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  67. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  68. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  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/binLookup/triggerBinLookUp.js +1 -1
  76. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  77. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  78. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  79. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  80. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.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/Analytics/events/AnalyticsInfoEvent.js +1 -1
  90. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  91. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  92. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  93. package/dist/es/core/config.js +1 -1
  94. package/dist/es/index.d.ts +48 -33
  95. package/dist/es/utils/validator-utils.js +1 -1
  96. package/dist/es/utils/validator-utils.js.map +1 -1
  97. package/dist/es-legacy/components/Card/Card.js +1 -1
  98. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  99. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  100. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  101. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  102. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  103. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  104. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  105. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  106. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  107. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  108. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  109. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  110. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  111. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  112. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  113. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  114. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  115. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  116. package/dist/es-legacy/components/Dropin/utils/paymentMethodsAnalytics.js +2 -0
  117. package/dist/es-legacy/components/Dropin/utils/paymentMethodsAnalytics.js.map +1 -0
  118. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  119. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  120. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  121. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  122. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  123. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  124. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  125. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  126. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  127. package/dist/es-legacy/components/ThreeDS2/constants.js +1 -1
  128. package/dist/es-legacy/components/ThreeDS2/constants.js.map +1 -1
  129. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  130. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  131. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  132. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  133. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  134. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  135. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  136. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  137. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  138. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  139. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  140. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  141. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  142. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  143. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  144. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  145. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  146. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  147. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  148. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  149. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  150. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  151. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  152. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  153. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  154. package/dist/es-legacy/components/internal/IFrame/Iframe.js +1 -1
  155. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  156. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  157. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  158. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  159. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  160. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  161. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  162. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  163. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  164. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  165. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  166. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  167. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  168. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  169. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  170. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  171. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  172. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  173. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  174. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  175. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  176. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  177. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  178. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  179. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  180. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  181. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  182. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  183. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  184. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  185. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  186. package/dist/es-legacy/core/config.js +1 -1
  187. package/dist/es-legacy/utils/validator-utils.js +1 -1
  188. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  189. package/package.json +19 -19
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import o from"./Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import{PREFIX as c}from"../Icon/constants.js";import i from"../../../core/Context/useImage.js";import{stopPropagationForActionKeys as l}from"./stopPropagationForActionKeys.js";function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t}(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}const s=s=>{var u,b,m;const{i18n:f}=r(),j=i(),y=t((e,{complete:t})=>{var o;n(s.text),t(),null===(o=s.onClick)||void 0===o||o.call(s,e)},[s.text,s.onClick]);return e(o,a(function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){p(e,t,o[t])})}return e}({},s),{variant:"action",onClick:y,onKeyDown:l,icon:null!==(u=s.icon)&&void 0!==u?u:j({imageFolder:"components/"})(`${c}copy`),label:null!==(b=s.label)&&void 0!==b?b:f.get("button.copy"),onClickCompletedLabel:null!==(m=s.copiedLabel)&&void 0!==m?m:f.get("button.copied")}))};export{s as CopyButton};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import o from"./Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import{PREFIX as c}from"../Icon/constants.js";import i from"../../../core/Context/useImage.js";import{stopPropagationForActionKeys as l}from"./stopPropagationForActionKeys.js";function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function s(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t}(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}const a=a=>{var u,b,m;const{i18n:f}=r(),y=i(),j=t((e,{complete:t})=>{var o;n(a.text),t(),null===(o=a.onClick)||void 0===o||o.call(a,e)},[a.text,a.onClick]);return e(o,s(function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){p(e,t,o[t])})}return e}({},a),{variant:"action",onClick:j,onKeyPress:l,onKeyDown:l,icon:null!==(u=a.icon)&&void 0!==u?u:y({imageFolder:"components/"})(`${c}copy`),label:null!==(b=a.label)&&void 0!==b?b:f.get("button.copy"),onClickCompletedLabel:null!==(m=a.copiedLabel)&&void 0!==m?m:f.get("button.copied")}))};export{a as CopyButton};
2
2
  //# sourceMappingURL=CopyButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyButton.js","sources":["../../../../../src/components/internal/Button/CopyButton.tsx"],"sourcesContent":["import { h, TargetedMouseEvent } from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { PREFIX } from '../Icon/constants';\nimport useImage from '../../../core/Context/useImage';\nimport { stopPropagationForActionKeys } from './stopPropagationForActionKeys';\n\nexport interface CopyButtonProps extends Omit<ButtonProps, 'variant' | 'onClickCompletedLabel'> {\n /**\n * String that will get copied to the clipboard\n */\n text: string;\n copiedLabel?: string;\n onClick?: (e: TargetedMouseEvent<HTMLButtonElement>) => void;\n}\n\nconst CopyButton = (props: Readonly<CopyButtonProps>) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const onClick = useCallback(\n (e, { complete }) => {\n void copyToClipboard(props.text);\n complete();\n props.onClick?.(e);\n },\n [props.text, props.onClick]\n );\n\n return (\n <Button\n {...props}\n variant=\"action\"\n onClick={onClick}\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n onKeyDown={stopPropagationForActionKeys}\n icon={props.icon ?? getImage({ imageFolder: 'components/' })(`${PREFIX}copy`)}\n label={props.label ?? i18n.get('button.copy')}\n onClickCompletedLabel={props.copiedLabel ?? i18n.get('button.copied')}\n />\n );\n};\n\nexport { CopyButton };\n"],"names":["CopyButton","props","i18n","useCoreContext","getImage","useImage","onClick","useCallback","e","complete","copyToClipboard","text","h","Button","variant","onKeyDown","stopPropagationForActionKeys","icon","imageFolder","PREFIX","label","get","onClickCompletedLabel","copiedLabel"],"mappings":"w8BAmBA,MAAMA,EAAcC,IAoBFA,IAAAA,EACCA,EACgBA,EArB/B,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAEXC,EAAUC,EACZ,CAACC,GAAKC,eAGFR,IAAAA,EAFKS,EAAgBT,EAAMU,MAC3BF,IACa,QAAbR,EAAAA,EAAMK,mBAANL,GAAAA,OAAAA,EAAgBO,IAEpB,CAACP,EAAMU,KAAMV,EAAMK,UAGvB,OACIM,EAACC,EAAAA,oUAAAA,CAAAA,CAAAA,EACOZ,GAAAA,CACJa,QAAQ,SACRR,QAASA,EAETS,UAAWC,EACXC,KAAgB,QAAVhB,EAAAA,EAAMgB,YAANhB,IAAAA,EAAAA,EAAcG,EAAS,CAAEc,YAAa,eAAxBd,CAAyC,GAAGe,SAChEC,cAAOnB,EAAAA,EAAMmB,aAANnB,IAAAA,EAAAA,EAAeC,EAAKmB,IAAI,eAC/BC,8BAAuBrB,EAAAA,EAAMsB,uBAANtB,EAAAA,EAAqBC,EAAKmB,IAAI"}
1
+ {"version":3,"file":"CopyButton.js","sources":["../../../../../src/components/internal/Button/CopyButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { PREFIX } from '../Icon/constants';\nimport useImage from '../../../core/Context/useImage';\nimport { stopPropagationForActionKeys } from './stopPropagationForActionKeys';\n\nexport interface CopyButtonProps extends Omit<ButtonProps, 'variant' | 'onClickCompletedLabel'> {\n /**\n * String that will get copied to the clipboard\n */\n text: string;\n copiedLabel?: string;\n onClick?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n}\n\nconst CopyButton = (props: Readonly<CopyButtonProps>) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const onClick = useCallback(\n (e, { complete }) => {\n void copyToClipboard(props.text);\n complete();\n props.onClick?.(e);\n },\n [props.text, props.onClick]\n );\n\n return (\n <Button\n {...props}\n variant=\"action\"\n onClick={onClick}\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n onKeyPress={stopPropagationForActionKeys}\n onKeyDown={stopPropagationForActionKeys}\n icon={props.icon ?? getImage({ imageFolder: 'components/' })(`${PREFIX}copy`)}\n label={props.label ?? i18n.get('button.copy')}\n onClickCompletedLabel={props.copiedLabel ?? i18n.get('button.copied')}\n />\n );\n};\n\nexport { CopyButton };\n"],"names":["CopyButton","props","i18n","useCoreContext","getImage","useImage","onClick","useCallback","e","complete","copyToClipboard","text","h","Button","variant","onKeyPress","stopPropagationForActionKeys","onKeyDown","icon","imageFolder","PREFIX","label","get","onClickCompletedLabel","copiedLabel"],"mappings":"w8BAmBA,MAAMA,EAAcC,IAqBFA,IAAAA,EACCA,EACgBA,EAtB/B,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAEXC,EAAUC,EACZ,CAACC,GAAKC,eAGFR,IAAAA,EAFKS,EAAgBT,EAAMU,MAC3BF,IACa,QAAbR,EAAAA,EAAMK,mBAANL,GAAAA,OAAAA,EAAgBO,IAEpB,CAACP,EAAMU,KAAMV,EAAMK,UAGvB,OACIM,EAACC,EAAAA,oUAAAA,CAAAA,CAAAA,EACOZ,GAAAA,CACJa,QAAQ,SACRR,QAASA,EAETS,WAAYC,EACZC,UAAWD,EACXE,KAAgB,QAAVjB,EAAAA,EAAMiB,YAANjB,IAAAA,EAAAA,EAAcG,EAAS,CAAEe,YAAa,eAAxBf,CAAyC,GAAGgB,SAChEC,cAAOpB,EAAAA,EAAMoB,aAANpB,IAAAA,EAAAA,EAAeC,EAAKoB,IAAI,eAC/BC,8BAAuBtB,EAAAA,EAAMuB,uBAANvB,EAAAA,EAAqBC,EAAKoB,IAAI"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../external/preact/dist/preact.js";import{useRef as e,useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import r from"./Button.js";import{useCoreContext as n}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as c}from"../../../utils/clipboard.js";import{SingletonTooltipProvider as i,useTooltip as a}from"../Tooltip/SingletonTooltipProvider.js";import{stopPropagationForActionKeys as s}from"./stopPropagationForActionKeys.js";function p(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}const u=i=>{var u;const{i18n:b}=n(),f=e(null),{showTooltip:y,hideTooltip:O}=a(),m=o(()=>{c(i.text),y({anchorRef:f,text:b.get("button.copied")})},[i.text,b,y]),j=o(t=>{s(t),"Escape"!==t.key&&"Escape"!==t.code||(t.stopPropagation(),O())},[O]),g=o(()=>{y({anchorRef:f,text:b.get("button.copy")})},[f,b,y]);return t(r,l(function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){p(t,e,o[e])})}return t}({},i),{variant:"iconOnly",buttonRef:f,ariaLabel:null!==(u=i.ariaLabel)&&void 0!==u?u:b.get("button.copy"),onMouseEnter:g,onMouseLeave:O,onFocus:g,onBlur:O,onClick:m,onKeyDown:j}),t("svg",{className:"adyen-checkout__button--iconOnly__icon",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},t("path",{d:"M3.5 1.25C2.25736 1.25 1.25 2.25736 1.25 3.5V8.5C1.25 9.74264 2.25736 10.75 3.5 10.75H5.25V12.5C5.25 13.7426 6.25736 14.75 7.5 14.75H12.5C13.7426 14.75 14.75 13.7426 14.75 12.5V7.5C14.75 6.25736 13.7426 5.25 12.5 5.25H10.75V3.5C10.75 2.25736 9.74264 1.25 8.5 1.25H3.5ZM9.25 5.25H7.5C6.25736 5.25 5.25 6.25736 5.25 7.5V9.25H3.5C3.08579 9.25 2.75 8.91421 2.75 8.5V3.5C2.75 3.08579 3.08579 2.75 3.5 2.75H8.5C8.91421 2.75 9.25 3.08579 9.25 3.5V5.25ZM6.75 12.5V7.5C6.75 7.08579 7.08579 6.75 7.5 6.75H12.5C12.9142 6.75 13.25 7.08579 13.25 7.5V12.5C13.25 12.9142 12.9142 13.25 12.5 13.25H7.5C7.08579 13.25 6.75 12.9142 6.75 12.5Z"})))},b=e=>t(i,null,t(u,e));export{b as CopyIconButton};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{useRef as e,useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import r from"./Button.js";import{useCoreContext as n}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as c}from"../../../utils/clipboard.js";import{SingletonTooltipProvider as i,useTooltip as s}from"../Tooltip/SingletonTooltipProvider.js";import{stopPropagationForActionKeys as a}from"./stopPropagationForActionKeys.js";function p(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}const u=i=>{var u;const{i18n:b}=n(),f=e(null),{showTooltip:y,hideTooltip:O}=s(),m=o(()=>{c(i.text),y({anchorRef:f,text:b.get("button.copied")})},[i.text,b,y]),j=o(t=>{a(t),"Escape"!==t.key&&"Escape"!==t.code||(t.stopPropagation(),O())},[O]),g=o(()=>{y({anchorRef:f,text:b.get("button.copy")})},[f,b,y]);return t(r,l(function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){p(t,e,o[e])})}return t}({},i),{variant:"iconOnly",buttonRef:f,ariaLabel:null!==(u=i.ariaLabel)&&void 0!==u?u:b.get("button.copy"),onMouseEnter:g,onMouseLeave:O,onFocus:g,onBlur:O,onClick:m,onKeyPress:a,onKeyDown:j}),t("svg",{className:"adyen-checkout__button--iconOnly__icon",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},t("path",{d:"M3.5 1.25C2.25736 1.25 1.25 2.25736 1.25 3.5V8.5C1.25 9.74264 2.25736 10.75 3.5 10.75H5.25V12.5C5.25 13.7426 6.25736 14.75 7.5 14.75H12.5C13.7426 14.75 14.75 13.7426 14.75 12.5V7.5C14.75 6.25736 13.7426 5.25 12.5 5.25H10.75V3.5C10.75 2.25736 9.74264 1.25 8.5 1.25H3.5ZM9.25 5.25H7.5C6.25736 5.25 5.25 6.25736 5.25 7.5V9.25H3.5C3.08579 9.25 2.75 8.91421 2.75 8.5V3.5C2.75 3.08579 3.08579 2.75 3.5 2.75H8.5C8.91421 2.75 9.25 3.08579 9.25 3.5V5.25ZM6.75 12.5V7.5C6.75 7.08579 7.08579 6.75 7.5 6.75H12.5C12.9142 6.75 13.25 7.08579 13.25 7.5V12.5C13.25 12.9142 12.9142 13.25 12.5 13.25H7.5C7.08579 13.25 6.75 12.9142 6.75 12.5Z"})))},b=e=>t(i,null,t(u,e));export{b as CopyIconButton};
2
2
  //# sourceMappingURL=CopyIconButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyIconButton.js","sources":["../../../../../src/components/internal/Button/CopyIconButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { SingletonTooltipProvider, useTooltip } from '../Tooltip/SingletonTooltipProvider';\nimport { stopPropagationForActionKeys } from './stopPropagationForActionKeys';\nimport './CopyIconButton.scss';\n\nexport interface CopyIconButtonProps extends ButtonProps {\n /**\n * String that will get copied to the clipboard\n */\n text: string;\n}\n\nconst CopyIconButton = (props: Readonly<CopyIconButtonProps>) => {\n const { i18n } = useCoreContext();\n const anchorRef = useRef<HTMLButtonElement>(null);\n const { showTooltip, hideTooltip } = useTooltip();\n\n const onClick = useCallback(() => {\n void copyToClipboard(props.text);\n showTooltip({ anchorRef, text: i18n.get('button.copied') });\n }, [props.text, i18n, showTooltip]);\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent) => {\n stopPropagationForActionKeys(event);\n\n if (event.key === 'Escape' || event.code === 'Escape') {\n event.stopPropagation();\n hideTooltip();\n }\n },\n [hideTooltip]\n );\n\n const handleShowTooltip = useCallback(() => {\n showTooltip({ anchorRef, text: i18n.get('button.copy') });\n }, [anchorRef, i18n, showTooltip]);\n\n return (\n <Button\n {...props}\n variant=\"iconOnly\"\n buttonRef={anchorRef}\n ariaLabel={props.ariaLabel ?? i18n.get('button.copy')}\n onMouseEnter={handleShowTooltip}\n onMouseLeave={hideTooltip}\n onFocus={handleShowTooltip}\n onBlur={hideTooltip}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n <svg\n className=\"adyen-checkout__button--iconOnly__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n >\n <path d=\"M3.5 1.25C2.25736 1.25 1.25 2.25736 1.25 3.5V8.5C1.25 9.74264 2.25736 10.75 3.5 10.75H5.25V12.5C5.25 13.7426 6.25736 14.75 7.5 14.75H12.5C13.7426 14.75 14.75 13.7426 14.75 12.5V7.5C14.75 6.25736 13.7426 5.25 12.5 5.25H10.75V3.5C10.75 2.25736 9.74264 1.25 8.5 1.25H3.5ZM9.25 5.25H7.5C6.25736 5.25 5.25 6.25736 5.25 7.5V9.25H3.5C3.08579 9.25 2.75 8.91421 2.75 8.5V3.5C2.75 3.08579 3.08579 2.75 3.5 2.75H8.5C8.91421 2.75 9.25 3.08579 9.25 3.5V5.25ZM6.75 12.5V7.5C6.75 7.08579 7.08579 6.75 7.5 6.75H12.5C12.9142 6.75 13.25 7.08579 13.25 7.5V12.5C13.25 12.9142 12.9142 13.25 12.5 13.25H7.5C7.08579 13.25 6.75 12.9142 6.75 12.5Z\" />\n </svg>\n </Button>\n );\n};\n\nconst withTooltip = (props: Readonly<CopyIconButtonProps>) => {\n return (\n <SingletonTooltipProvider>\n <CopyIconButton {...props} />\n </SingletonTooltipProvider>\n );\n};\n\nexport { withTooltip as CopyIconButton };\n"],"names":["CopyIconButton","props","i18n","useCoreContext","anchorRef","useRef","showTooltip","hideTooltip","useTooltip","onClick","useCallback","copyToClipboard","text","get","onKeyDown","event","stopPropagationForActionKeys","key","code","stopPropagation","handleShowTooltip","h","Button","variant","buttonRef","ariaLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","svg","className","xmlns","width","height","viewBox","fill","path","d","withTooltip","SingletonTooltipProvider"],"mappings":"u9BAiBA,MAAMA,EAAkBC,IA+BDA,IAAAA,EA9BnB,MAAMC,KAAEA,GAASC,IACXC,EAAYC,EAA0B,OACtCC,YAAEA,EAAWC,YAAEA,GAAgBC,IAE/BC,EAAUC,EAAY,KACnBC,EAAgBV,EAAMW,MAC3BN,EAAY,CAAEF,YAAWQ,KAAMV,EAAKW,IAAI,oBACzC,CAACZ,EAAMW,KAAMV,EAAMI,IAEhBQ,EAAYJ,EACbK,IACGC,EAA6BD,GAEX,WAAdA,EAAME,KAAmC,WAAfF,EAAMG,OAChCH,EAAMI,kBACNZ,MAGR,CAACA,IAGCa,EAAoBV,EAAY,KAClCJ,EAAY,CAAEF,YAAWQ,KAAMV,EAAKW,IAAI,kBACzC,CAACT,EAAWF,EAAMI,IAErB,OACIe,EAACC,EAAAA,oUAAAA,CAAAA,CAAAA,EACOrB,GAAAA,CACJsB,QAAQ,WACRC,UAAWpB,EACXqB,kBAAWxB,EAAAA,EAAMwB,iBAANxB,IAAAA,EAAAA,EAAmBC,EAAKW,IAAI,eACvCa,aAAcN,EACdO,aAAcpB,EACdqB,QAASR,EACTS,OAAQtB,EACRE,QAASA,EACTK,UAAWA,IAEXO,EAACS,MAAAA,CACGC,UAAU,yCACVC,MAAM,6BACNC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,QAELf,EAACgB,OAAAA,CAAKC,EAAE,snBAMlBC,EAAetC,GAEboB,EAACmB,EAAAA,KACGnB,EAACrB,EAAmBC"}
1
+ {"version":3,"file":"CopyIconButton.js","sources":["../../../../../src/components/internal/Button/CopyIconButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { SingletonTooltipProvider, useTooltip } from '../Tooltip/SingletonTooltipProvider';\nimport './CopyIconButton.scss';\nimport { stopPropagationForActionKeys } from './stopPropagationForActionKeys';\n\nexport interface CopyIconButtonProps extends ButtonProps {\n /**\n * String that will get copied to the clipboard\n */\n text: string;\n}\n\nconst CopyIconButton = (props: Readonly<CopyIconButtonProps>) => {\n const { i18n } = useCoreContext();\n const anchorRef = useRef<HTMLButtonElement>(null);\n const { showTooltip, hideTooltip } = useTooltip();\n\n const onClick = useCallback(() => {\n void copyToClipboard(props.text);\n showTooltip({ anchorRef, text: i18n.get('button.copied') });\n }, [props.text, i18n, showTooltip]);\n\n // We need it because onKeyPress does not trigger for Esc key\n const onKeyDown = useCallback(\n (event: KeyboardEvent) => {\n stopPropagationForActionKeys(event);\n\n if (event.key === 'Escape' || event.code === 'Escape') {\n event.stopPropagation();\n hideTooltip();\n }\n },\n [hideTooltip]\n );\n\n const handleShowTooltip = useCallback(() => {\n showTooltip({ anchorRef, text: i18n.get('button.copy') });\n }, [anchorRef, i18n, showTooltip]);\n\n return (\n <Button\n {...props}\n variant=\"iconOnly\"\n buttonRef={anchorRef}\n ariaLabel={props.ariaLabel ?? i18n.get('button.copy')}\n onMouseEnter={handleShowTooltip}\n onMouseLeave={hideTooltip}\n onFocus={handleShowTooltip}\n onBlur={hideTooltip}\n onClick={onClick}\n // It's ok to have both, browsers will fire only one click event for enter/space key pressed.\n onKeyPress={stopPropagationForActionKeys}\n onKeyDown={onKeyDown}\n >\n <svg\n className=\"adyen-checkout__button--iconOnly__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n >\n <path d=\"M3.5 1.25C2.25736 1.25 1.25 2.25736 1.25 3.5V8.5C1.25 9.74264 2.25736 10.75 3.5 10.75H5.25V12.5C5.25 13.7426 6.25736 14.75 7.5 14.75H12.5C13.7426 14.75 14.75 13.7426 14.75 12.5V7.5C14.75 6.25736 13.7426 5.25 12.5 5.25H10.75V3.5C10.75 2.25736 9.74264 1.25 8.5 1.25H3.5ZM9.25 5.25H7.5C6.25736 5.25 5.25 6.25736 5.25 7.5V9.25H3.5C3.08579 9.25 2.75 8.91421 2.75 8.5V3.5C2.75 3.08579 3.08579 2.75 3.5 2.75H8.5C8.91421 2.75 9.25 3.08579 9.25 3.5V5.25ZM6.75 12.5V7.5C6.75 7.08579 7.08579 6.75 7.5 6.75H12.5C12.9142 6.75 13.25 7.08579 13.25 7.5V12.5C13.25 12.9142 12.9142 13.25 12.5 13.25H7.5C7.08579 13.25 6.75 12.9142 6.75 12.5Z\" />\n </svg>\n </Button>\n );\n};\n\nconst withTooltip = (props: Readonly<CopyIconButtonProps>) => {\n return (\n <SingletonTooltipProvider>\n <CopyIconButton {...props} />\n </SingletonTooltipProvider>\n );\n};\n\nexport { withTooltip as CopyIconButton };\n"],"names":["CopyIconButton","props","i18n","useCoreContext","anchorRef","useRef","showTooltip","hideTooltip","useTooltip","onClick","useCallback","copyToClipboard","text","get","onKeyDown","event","stopPropagationForActionKeys","key","code","stopPropagation","handleShowTooltip","h","Button","variant","buttonRef","ariaLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","onKeyPress","svg","className","xmlns","width","height","viewBox","fill","path","d","withTooltip","SingletonTooltipProvider"],"mappings":"u9BAiBA,MAAMA,EAAkBC,IAgCDA,IAAAA,EA/BnB,MAAMC,KAAEA,GAASC,IACXC,EAAYC,EAA0B,OACtCC,YAAEA,EAAWC,YAAEA,GAAgBC,IAE/BC,EAAUC,EAAY,KACnBC,EAAgBV,EAAMW,MAC3BN,EAAY,CAAEF,YAAWQ,KAAMV,EAAKW,IAAI,oBACzC,CAACZ,EAAMW,KAAMV,EAAMI,IAGhBQ,EAAYJ,EACbK,IACGC,EAA6BD,GAEX,WAAdA,EAAME,KAAmC,WAAfF,EAAMG,OAChCH,EAAMI,kBACNZ,MAGR,CAACA,IAGCa,EAAoBV,EAAY,KAClCJ,EAAY,CAAEF,YAAWQ,KAAMV,EAAKW,IAAI,kBACzC,CAACT,EAAWF,EAAMI,IAErB,OACIe,EAACC,EAAAA,oUAAAA,CAAAA,CAAAA,EACOrB,GAAAA,CACJsB,QAAQ,WACRC,UAAWpB,EACXqB,kBAAWxB,EAAAA,EAAMwB,iBAANxB,IAAAA,EAAAA,EAAmBC,EAAKW,IAAI,eACvCa,aAAcN,EACdO,aAAcpB,EACdqB,QAASR,EACTS,OAAQtB,EACRE,QAASA,EAETqB,WAAYd,EACZF,UAAWA,IAEXO,EAACU,MAAAA,CACGC,UAAU,yCACVC,MAAM,6BACNC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,QAELhB,EAACiB,OAAAA,CAAKC,EAAE,snBAMlBC,EAAevC,GAEboB,EAACoB,EAAAA,KACGpB,EAACrB,EAAmBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: Readonly<ClickToPayComponentProps>): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n void sendOneTimePassword();\n }\n }, [ctpState]);\n\n /**\n * We capture the ENTER keydown within the ClickToPay component because we do not want to propagate the event up to the UIElement\n * UIElement would perform the payment flow (by calling .submit), which is not relevant/supported by Click to Pay\n */\n const handleEnterKeyPress = useCallback((event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n event.stopPropagation(); // Prevent global BaseElement keydown event to be triggered\n }\n }, []);\n\n if (ctpState === CtpState.NotAvailable) {\n return null;\n }\n\n return (\n <CtPSection onEnterKeyPress={handleEnterKeyPress}>\n {[CtpState.Loading, CtpState.ShopperIdentified].includes(ctpState) && <CtPLoader />}\n {ctpState === CtpState.OneTimePassword && <CtPOneTimePassword onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Ready && <CtPCards onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Login && <CtPLogin />}\n </CtPSection>\n );\n};\n\nexport default ClickToPayComponent;\n"],"names":["ClickToPayComponent","onDisplayCardComponent","ctpState","onReady","startIdentityValidation","logoutShopper","useClickToPayContext","useEffect","CtpState","OneTimePassword","Login","Ready","includes","ShopperIdentified","async","error","SrciError","console","warn","toString","sendOneTimePassword","handleEnterKeyPress","useCallback","event","key","preventDefault","stopPropagation","NotAvailable","h","CtPSection","onEnterKeyPress","Loading","CtPLoader","CtPOneTimePassword","CtPCards","CtPLogin"],"mappings":"ykBAeA,MAAMA,EAAsB,EAAGC,6BAC3B,MAAMC,SAAEA,EAAQC,QAAEA,EAAOC,wBAAEA,EAAuBC,cAAEA,GAAkBC,IAEtEC,EAAU,KACF,CAACC,EAASC,gBAAiBD,EAASE,MAAOF,EAASG,OAAOC,SAASV,IACpEC,KAEL,CAACD,EAAUC,IAEdI,EAAU,KASFL,IAAaM,EAASK,mBAR1BC,iBACI,UACUV,GACV,CAAE,MAAOW,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,oCAAoCH,EAAMI,oBACjFd,GACV,CACJ,CAESe,IAEV,CAAClB,IAMJ,MAAMmB,EAAsBC,EAAaC,IACnB,UAAdA,EAAMC,MACND,EAAME,iBACNF,EAAMG,oBAEX,IAEH,OAAIxB,IAAaM,EAASmB,aACf,KAIPC,EAACC,EAAAA,CAAWC,gBAAiBT,GACxB,CAACb,EAASuB,QAASvB,EAASK,mBAAmBD,SAASV,IAAa0B,EAACI,QACtE9B,IAAaM,EAASC,iBAAmBmB,EAACK,EAAAA,CAAmBhC,uBAAwBA,IACrFC,IAAaM,EAASG,OAASiB,EAACM,EAAAA,CAASjC,uBAAwBA,IACjEC,IAAaM,EAASE,OAASkB,EAACO,EAAAA"}
1
+ {"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: Readonly<ClickToPayComponentProps>): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n void sendOneTimePassword();\n }\n }, [ctpState]);\n\n /**\n * We capture the ENTER keypress within the ClickToPay component because we do not want to propagate the event up to the UIElement\n * UIElement would perform the payment flow (by calling .submit), which is not relevant/supported by Click to Pay\n */\n const handleEnterKeyPress = useCallback((event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n event.stopPropagation(); // Prevent global BaseElement keypress event to be triggered\n }\n }, []);\n\n if (ctpState === CtpState.NotAvailable) {\n return null;\n }\n\n return (\n <CtPSection onEnterKeyPress={handleEnterKeyPress}>\n {[CtpState.Loading, CtpState.ShopperIdentified].includes(ctpState) && <CtPLoader />}\n {ctpState === CtpState.OneTimePassword && <CtPOneTimePassword onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Ready && <CtPCards onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Login && <CtPLogin />}\n </CtPSection>\n );\n};\n\nexport default ClickToPayComponent;\n"],"names":["ClickToPayComponent","onDisplayCardComponent","ctpState","onReady","startIdentityValidation","logoutShopper","useClickToPayContext","useEffect","CtpState","OneTimePassword","Login","Ready","includes","ShopperIdentified","async","error","SrciError","console","warn","toString","sendOneTimePassword","handleEnterKeyPress","useCallback","event","key","preventDefault","stopPropagation","NotAvailable","h","CtPSection","onEnterKeyPress","Loading","CtPLoader","CtPOneTimePassword","CtPCards","CtPLogin"],"mappings":"ykBAeA,MAAMA,EAAsB,EAAGC,6BAC3B,MAAMC,SAAEA,EAAQC,QAAEA,EAAOC,wBAAEA,EAAuBC,cAAEA,GAAkBC,IAEtEC,EAAU,KACF,CAACC,EAASC,gBAAiBD,EAASE,MAAOF,EAASG,OAAOC,SAASV,IACpEC,KAEL,CAACD,EAAUC,IAEdI,EAAU,KASFL,IAAaM,EAASK,mBAR1BC,iBACI,UACUV,GACV,CAAE,MAAOW,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,oCAAoCH,EAAMI,oBACjFd,GACV,CACJ,CAESe,IAEV,CAAClB,IAMJ,MAAMmB,EAAsBC,EAAaC,IACnB,UAAdA,EAAMC,MACND,EAAME,iBACNF,EAAMG,oBAEX,IAEH,OAAIxB,IAAaM,EAASmB,aACf,KAIPC,EAACC,EAAAA,CAAWC,gBAAiBT,GACxB,CAACb,EAASuB,QAASvB,EAASK,mBAAmBD,SAASV,IAAa0B,EAACI,QACtE9B,IAAaM,EAASC,iBAAmBmB,EAACK,EAAAA,CAAmBhC,uBAAwBA,IACrFC,IAAaM,EAASG,OAASiB,EAACM,EAAAA,CAASjC,uBAAwBA,IACjEC,IAAaM,EAASE,OAASkB,EAACO,EAAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as l}from"../../../../../utils/setFocus.js";import p from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const m=m=>{const{i18n:d}=a(),c=r(null),{handleChangeFor:g,data:h,triggerValidation:f,valid:L,errors:F,isValid:v}=i({schema:["shopperLogin"],rules:n,formHolder:c}),j=r({validateInput:null,focusInput:null}),[I,b]=o(!1),E=s(()=>{b(!0),f()},[f]);t(()=>{c.current&&m.errorMessage&&l(c.current,"shopperLogin")},[m.errorMessage]),t(()=>{h.shopperLogin&&b(!0)},[h.shopperLogin]),t(()=>{j.current.validateInput=E,m.onSetInputHandlers(j.current)},[E,m.onSetInputHandlers]);const M=s(e=>{"Enter"===e.key&&m.onPressEnter()},[m.onPressEnter]);return t(()=>{m.onChange({data:h,valid:L,errors:F,isValid:v})},[h,L,F]),e("div",{ref:c},e(p,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:I?m.errorMessage||F.shopperLogin&&d.get(F.shopperLogin.errorMessage):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:h.shopperLogin,disabled:m.disabled,onInput:g("shopperLogin","input"),onBlur:g("shopperLogin","blur"),onKeyDown:M,autocomplete:"email"})))};export{m as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as l}from"../../../../../utils/setFocus.js";import p from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const m=m=>{const{i18n:d}=a(),c=r(null),{handleChangeFor:g,data:h,triggerValidation:f,valid:L,errors:F,isValid:v}=i({schema:["shopperLogin"],rules:n,formHolder:c}),j=r({validateInput:null,focusInput:null}),[I,b]=o(!1),E=s(()=>{b(!0),f()},[f]);t(()=>{c.current&&m.errorMessage&&l(c.current,"shopperLogin")},[m.errorMessage]),t(()=>{h.shopperLogin&&b(!0)},[h.shopperLogin]),t(()=>{j.current.validateInput=E,m.onSetInputHandlers(j.current)},[E,m.onSetInputHandlers]);const M=s(e=>{"Enter"===e.key&&m.onPressEnter()},[m.onPressEnter]);return t(()=>{m.onChange({data:h,valid:L,errors:F,isValid:v})},[h,L,F]),e("div",{ref:c},e(p,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:I?m.errorMessage||F.shopperLogin&&d.get(F.shopperLogin.errorMessage):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:h.shopperLogin,disabled:m.disabled,onInput:g("shopperLogin","input"),onBlur:g("shopperLogin","blur"),onKeyPress:M,autocomplete:"email"})))};export{m as default};
2
2
  //# sourceMappingURL=CtPLoginInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\nimport { setFocusOnField } from '../../../../../utils/setFocus';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n focusInput(): void;\n};\n\nconst CtPLoginInput = (props: Readonly<CtPLoginInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useFormWithA11y<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules,\n formHolder: containerRef\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null, focusInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'shopperLogin');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnKeyDown = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <div ref={containerRef}>\n <Field\n name=\"shopperLogin\"\n label={i18n.get('ctp.login.inputLabel')}\n errorMessage={isLoginInputDirty ? props.errorMessage || (errors.shopperLogin && i18n.get(errors.shopperLogin.errorMessage)) : null}\n classNameModifiers={['shopperLogin']}\n errorLive={true}\n >\n <InputEmail\n name={'shopperLogin'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.shopperLogin}\n disabled={props.disabled}\n onInput={handleChangeFor('shopperLogin', 'input')}\n onBlur={handleChangeFor('shopperLogin', 'blur')}\n onKeyDown={handleOnKeyDown}\n autocomplete={'email'}\n />\n </Field>\n </div>\n );\n};\n\nexport default CtPLoginInput;\n"],"names":["CtPLoginInput","props","i18n","useCoreContext","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","useFormWithA11y","schema","rules","loginValidationRules","formHolder","loginInputHandlersRef","validateInput","focusInput","isLoginInputDirty","setIsLoginInputDirty","useState","useCallback","useEffect","current","errorMessage","setFocusOnField","shopperLogin","onSetInputHandlers","handleOnKeyDown","event","key","onPressEnter","onChange","h","div","ref","Field","name","label","get","classNameModifiers","errorLive","InputEmail","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyDown","autocomplete"],"mappings":"+iBA4BA,MAAMA,EAAiBC,IACnB,MAAMC,KAAEA,GAASC,IAEXC,EAAeC,EAAuB,OACtCC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAwC,CACjHC,OAHe,CAAC,gBAIhBC,MAAOC,EACPC,WAAYZ,IAEVa,EAAwBZ,EAA8B,CAAEa,cAAe,KAAMC,WAAY,QACxFC,EAAmBC,GAAwBC,GAAkB,GAE9DJ,EAAgBK,EAAY,KAC9BF,GAAqB,GACrBb,KACD,CAACA,IAEJgB,EAAU,KACFpB,EAAaqB,SAAWxB,EAAMyB,cAC9BC,EAAgBvB,EAAaqB,QAAS,iBAE3C,CAACxB,EAAMyB,eAEVF,EAAU,KACFjB,EAAKqB,cAAcP,GAAqB,IAC7C,CAACd,EAAKqB,eAETJ,EAAU,KACNP,EAAsBQ,QAAQP,cAAgBA,EAC9CjB,EAAM4B,mBAAmBZ,EAAsBQ,UAChD,CAACP,EAAejB,EAAM4B,qBAEzB,MAAMC,EAAkBP,EACnBQ,IACqB,UAAdA,EAAMC,KACD/B,EAAMgC,gBAGnB,CAAChC,EAAMgC,eAOX,OAJAT,EAAU,KACNvB,EAAMiC,SAAS,CAAE3B,OAAME,QAAOC,SAAQC,aACvC,CAACJ,EAAME,EAAOC,IAGbyB,EAACC,MAAAA,CAAIC,IAAKjC,GACN+B,EAACG,EAAAA,CACGC,KAAK,eACLC,MAAOtC,EAAKuC,IAAI,wBAChBf,aAAcN,EAAoBnB,EAAMyB,cAAiBhB,EAAOkB,cAAgB1B,EAAKuC,IAAI/B,EAAOkB,aAAaF,cAAiB,KAC9HgB,mBAAoB,CAAC,gBACrBC,WAAW,GAEXR,EAACS,EAAAA,CACGL,KAAM,eACNM,YAAa,MACbC,YAAY,EACZC,MAAOxC,EAAKqB,aACZoB,SAAU/C,EAAM+C,SAChBC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,QACxC6C,UAAWrB,EACXsB,aAAc"}
1
+ {"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\nimport { setFocusOnField } from '../../../../../utils/setFocus';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n focusInput(): void;\n};\n\nconst CtPLoginInput = (props: Readonly<CtPLoginInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useFormWithA11y<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules,\n formHolder: containerRef\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null, focusInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'shopperLogin');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnKeyPress = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <div ref={containerRef}>\n <Field\n name=\"shopperLogin\"\n label={i18n.get('ctp.login.inputLabel')}\n errorMessage={isLoginInputDirty ? props.errorMessage || (errors.shopperLogin && i18n.get(errors.shopperLogin.errorMessage)) : null}\n classNameModifiers={['shopperLogin']}\n errorLive={true}\n >\n <InputEmail\n name={'shopperLogin'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.shopperLogin}\n disabled={props.disabled}\n onInput={handleChangeFor('shopperLogin', 'input')}\n onBlur={handleChangeFor('shopperLogin', 'blur')}\n onKeyPress={handleOnKeyPress}\n autocomplete={'email'}\n />\n </Field>\n </div>\n );\n};\n\nexport default CtPLoginInput;\n"],"names":["CtPLoginInput","props","i18n","useCoreContext","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","useFormWithA11y","schema","rules","loginValidationRules","formHolder","loginInputHandlersRef","validateInput","focusInput","isLoginInputDirty","setIsLoginInputDirty","useState","useCallback","useEffect","current","errorMessage","setFocusOnField","shopperLogin","onSetInputHandlers","handleOnKeyPress","event","key","onPressEnter","onChange","h","div","ref","Field","name","label","get","classNameModifiers","errorLive","InputEmail","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyPress","autocomplete"],"mappings":"+iBA4BA,MAAMA,EAAiBC,IACnB,MAAMC,KAAEA,GAASC,IAEXC,EAAeC,EAAuB,OACtCC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAwC,CACjHC,OAHe,CAAC,gBAIhBC,MAAOC,EACPC,WAAYZ,IAEVa,EAAwBZ,EAA8B,CAAEa,cAAe,KAAMC,WAAY,QACxFC,EAAmBC,GAAwBC,GAAkB,GAE9DJ,EAAgBK,EAAY,KAC9BF,GAAqB,GACrBb,KACD,CAACA,IAEJgB,EAAU,KACFpB,EAAaqB,SAAWxB,EAAMyB,cAC9BC,EAAgBvB,EAAaqB,QAAS,iBAE3C,CAACxB,EAAMyB,eAEVF,EAAU,KACFjB,EAAKqB,cAAcP,GAAqB,IAC7C,CAACd,EAAKqB,eAETJ,EAAU,KACNP,EAAsBQ,QAAQP,cAAgBA,EAC9CjB,EAAM4B,mBAAmBZ,EAAsBQ,UAChD,CAACP,EAAejB,EAAM4B,qBAEzB,MAAMC,EAAmBP,EACpBQ,IACqB,UAAdA,EAAMC,KACD/B,EAAMgC,gBAGnB,CAAChC,EAAMgC,eAOX,OAJAT,EAAU,KACNvB,EAAMiC,SAAS,CAAE3B,OAAME,QAAOC,SAAQC,aACvC,CAACJ,EAAME,EAAOC,IAGbyB,EAACC,MAAAA,CAAIC,IAAKjC,GACN+B,EAACG,EAAAA,CACGC,KAAK,eACLC,MAAOtC,EAAKuC,IAAI,wBAChBf,aAAcN,EAAoBnB,EAAMyB,cAAiBhB,EAAOkB,cAAgB1B,EAAKuC,IAAI/B,EAAOkB,aAAaF,cAAiB,KAC9HgB,mBAAoB,CAAC,gBACrBC,WAAW,GAEXR,EAACS,EAAAA,CACGL,KAAM,eACNM,YAAa,MACbC,YAAY,EACZC,MAAOxC,EAAKqB,aACZoB,SAAU/C,EAAM+C,SAChBC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,QACxC6C,WAAYrB,EACZsB,aAAc"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as r,useRef as t,useCallback as o,useEffect as s}from"../../../../../../external/preact/hooks/dist/hooks.js";import{otpValidationRules as a}from"./validate.js";import n from"./CtPResendOtpLink.js";import l from"../../../context/useClickToPayContext.js";import{useCoreContext as i}from"../../../../../../core/Context/CoreProvider.js";import p from"../../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as u}from"../../../../../../utils/setFocus.js";import c from"../../../../FormFields/Field/Field.js";import d from"../../../../FormFields/InputText.js";import{getErrorMessage as m}from"../../../../../../utils/getErrorMessage.js";const f=f=>{const{i18n:g}=i(),{configuration:{disableOtpAutoFocus:j}}=l(),[C,F]=r(null),h=t(null),{handleChangeFor:v,data:b,triggerValidation:k,valid:x,errors:E,isValid:M,setData:y}=p({schema:["otp"],rules:a,formHolder:h}),I=t({validateInput:null}),P=t(null),[R,w]=r(!1),L=o(()=>{w(!0),k()},[k]);s(()=>{b.otp&&w(!0)},[b.otp]),s(()=>{!j&&P.current&&P.current.focus()},[P.current,j]),s(()=>{h.current&&f.errorMessage&&u(h.current,"otp")},[f.errorMessage]),s(()=>{I.current.validateInput=L,f.onSetInputHandlers(I.current)},[L,f.onSetInputHandlers]);const V=o(()=>{y("otp",""),F(null),j||P.current.focus(),f.onResendCode()},[f.onResendCode,P.current,j]),_=o(e=>{const r=g.get(`ctp.errors.${e}`);r&&F(r)},[g]),H=o(e=>{"Enter"===e.key&&f.onPressEnter()},[f.onPressEnter]);s(()=>{f.onChange({data:b,valid:x,errors:E,isValid:M})},[b,x,E]);const N=o(()=>R?C||f.errorMessage||m(g,E.otp,g.get("ctp.otp.fieldLabel")):null,[R,C,f.errorMessage,E.otp,g]);return e("div",{ref:h,className:"adyen-checkout-ctp__otp-field-wrapper"},e(c,{name:"oneTimePassword",label:g.get("ctp.otp.fieldLabel"),errorMessage:N(),classNameModifiers:["otp"],errorLive:!0},e(d,{name:"otp",autocorrect:"off",spellcheck:!1,value:b.otp,disabled:f.disabled,onInput:v("otp","input"),onBlur:v("otp","blur"),onKeyDown:H,setRef:e=>{P.current=e},autocomplete:"off"})),e("div",{className:"adyen-checkout-ctp__otp-resend-code-wrapper"},e(n,{disabled:f.isValidatingOtp,onError:_,onResendCode:V})))};export{f as default};
1
+ import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as r,useRef as t,useCallback as o,useEffect as s}from"../../../../../../external/preact/hooks/dist/hooks.js";import{otpValidationRules as a}from"./validate.js";import n from"./CtPResendOtpLink.js";import l from"../../../context/useClickToPayContext.js";import{useCoreContext as i}from"../../../../../../core/Context/CoreProvider.js";import p from"../../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as u}from"../../../../../../utils/setFocus.js";import c from"../../../../FormFields/Field/Field.js";import d from"../../../../FormFields/InputText.js";import{getErrorMessage as m}from"../../../../../../utils/getErrorMessage.js";const f=f=>{const{i18n:g}=i(),{configuration:{disableOtpAutoFocus:j}}=l(),[C,F]=r(null),h=t(null),{handleChangeFor:v,data:b,triggerValidation:k,valid:x,errors:E,isValid:M,setData:P}=p({schema:["otp"],rules:a,formHolder:h}),y=t({validateInput:null}),I=t(null),[R,L]=r(!1),V=o(()=>{L(!0),k()},[k]);s(()=>{b.otp&&L(!0)},[b.otp]),s(()=>{!j&&I.current&&I.current.focus()},[I.current,j]),s(()=>{h.current&&f.errorMessage&&u(h.current,"otp")},[f.errorMessage]),s(()=>{y.current.validateInput=V,f.onSetInputHandlers(y.current)},[V,f.onSetInputHandlers]);const _=o(()=>{P("otp",""),F(null),j||I.current.focus(),f.onResendCode()},[f.onResendCode,I.current,j]),w=o(e=>{const r=g.get(`ctp.errors.${e}`);r&&F(r)},[g]),H=o(e=>{"Enter"===e.key&&f.onPressEnter()},[f.onPressEnter]);s(()=>{f.onChange({data:b,valid:x,errors:E,isValid:M})},[b,x,E]);const N=o(()=>R?C||f.errorMessage||m(g,E.otp,g.get("ctp.otp.fieldLabel")):null,[R,C,f.errorMessage,E.otp,g]);return e("div",{ref:h,className:"adyen-checkout-ctp__otp-field-wrapper"},e(c,{name:"oneTimePassword",label:g.get("ctp.otp.fieldLabel"),errorMessage:N(),classNameModifiers:["otp"],errorLive:!0},e(d,{name:"otp",autocorrect:"off",spellcheck:!1,value:b.otp,disabled:f.disabled,onInput:v("otp","input"),onBlur:v("otp","blur"),onKeyPress:H,setRef:e=>{I.current=e},autocomplete:"off"})),e("div",{className:"adyen-checkout-ctp__otp-resend-code-wrapper"},e(n,{disabled:f.isValidatingOtp,onError:w,onResendCode:_})))};export{f as default};
2
2
  //# sourceMappingURL=CtPOneTimePasswordInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../../utils/useForm';\nimport { setFocusOnField } from '../../../../../../utils/setFocus';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\nimport { getErrorMessage } from '../../../../../../utils/getErrorMessage';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: Readonly<CtPOneTimePasswordInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useFormWithA11y<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules,\n formHolder: containerRef\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'otp');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const handleOnKeyDown = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n const getOtpErrorMessage = useCallback(() => {\n if (!isOtpFielDirty) return null;\n\n return resendOtpError || props.errorMessage || getErrorMessage(i18n, errors.otp, i18n.get('ctp.otp.fieldLabel'));\n }, [isOtpFielDirty, resendOtpError, props.errorMessage, errors.otp, i18n]);\n\n return (\n <div ref={containerRef} className={'adyen-checkout-ctp__otp-field-wrapper'}>\n <Field\n name=\"oneTimePassword\"\n label={i18n.get('ctp.otp.fieldLabel')}\n errorMessage={getOtpErrorMessage()}\n classNameModifiers={['otp']}\n errorLive={true}\n >\n <InputText\n name={'otp'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.otp}\n disabled={props.disabled}\n onInput={handleChangeFor('otp', 'input')}\n onBlur={handleChangeFor('otp', 'blur')}\n onKeyDown={handleOnKeyDown}\n setRef={(ref: HTMLInputElement) => {\n inputRef.current = ref;\n }}\n autocomplete={'off'}\n />\n </Field>\n <div className={'adyen-checkout-ctp__otp-resend-code-wrapper'}>\n <CtPResendOtpLink disabled={props.isValidatingOtp} onError={handleOnResendOtpError} onResendCode={handleOnResendOtp} />\n </div>\n </div>\n );\n};\n\nexport default CtPOneTimePasswordInput;\n"],"names":["CtPOneTimePasswordInput","props","i18n","useCoreContext","configuration","disableOtpAutoFocus","useClickToPayContext","resendOtpError","setResendOtpError","useState","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","setData","useFormWithA11y","schema","rules","otpValidationRules","formHolder","otpInputHandlersRef","validateInput","inputRef","isOtpFielDirty","setIsOtpFieldDirty","useCallback","useEffect","otp","current","focus","errorMessage","setFocusOnField","onSetInputHandlers","handleOnResendOtp","onResendCode","handleOnResendOtpError","errorCode","message","get","handleOnKeyDown","event","key","onPressEnter","onChange","getOtpErrorMessage","getErrorMessage","h","div","ref","className","Field","name","label","classNameModifiers","errorLive","InputText","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyDown","setRef","autocomplete","CtPResendOtpLink","isValidatingOtp","onError"],"mappings":"2uBAkCA,MAAMA,EAA2BC,IAC7B,MAAMC,KAAEA,GAASC,KAEbC,eAAeC,oBAAEA,IACjBC,KAGGC,EAAgBC,GAAqBC,EAAiB,MACvDC,EAAeC,EAAuB,OACtCC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,QAAEA,GAAYC,EAAkD,CACpIC,OAJe,CAAC,OAKhBC,MAAOC,EACPC,WAAYb,IAEVc,EAAsBb,EAAwC,CAAEc,cAAe,OAC/EC,EAAWf,EAAyB,OACnCgB,EAAgBC,GAAsBnB,GAAkB,GAEzDgB,EAAgBI,EAAY,KAC9BD,GAAmB,GACnBd,KACD,CAACA,IAKJgB,EAAU,KACFjB,EAAKkB,KAAKH,GAAmB,IAClC,CAACf,EAAKkB,MAETD,EAAU,MACDzB,GAAuBqB,EAASM,SACjCN,EAASM,QAAQC,SAEtB,CAACP,EAASM,QAAS3B,IAEtByB,EAAU,KACFpB,EAAasB,SAAW/B,EAAMiC,cAC9BC,EAAgBzB,EAAasB,QAAS,QAE3C,CAAC/B,EAAMiC,eAEVJ,EAAU,KACNN,EAAoBQ,QAAQP,cAAgBA,EAC5CxB,EAAMmC,mBAAmBZ,EAAoBQ,UAC9C,CAACP,EAAexB,EAAMmC,qBAEzB,MAAMC,EAAoBR,EAAY,KAClCX,EAAQ,MAAO,IACfV,EAAkB,MACbH,GACDqB,EAASM,QAAQC,QAErBhC,EAAMqC,gBACP,CAACrC,EAAMqC,aAAcZ,EAASM,QAAS3B,IAEpCkC,EAAyBV,EAC1BW,IACG,MAAMC,EAAUvC,EAAKwC,IAAI,cAAcF,KACnCC,GAASjC,EAAkBiC,IAEnC,CAACvC,IAGCyC,EAAkBd,EACnBe,IACqB,UAAdA,EAAMC,KACD5C,EAAM6C,gBAGnB,CAAC7C,EAAM6C,eAGXhB,EAAU,KACN7B,EAAM8C,SAAS,CAAElC,OAAME,QAAOC,SAAQC,aACvC,CAACJ,EAAME,EAAOC,IAEjB,MAAMgC,EAAqBnB,EAAY,IAC9BF,EAEEpB,GAAkBN,EAAMiC,cAAgBe,EAAgB/C,EAAMc,EAAOe,IAAK7B,EAAKwC,IAAI,uBAF9D,KAG7B,CAACf,EAAgBpB,EAAgBN,EAAMiC,aAAclB,EAAOe,IAAK7B,IAEpE,OACIgD,EAACC,MAAAA,CAAIC,IAAK1C,EAAc2C,UAAW,yCAC/BH,EAACI,EAAAA,CACGC,KAAK,kBACLC,MAAOtD,EAAKwC,IAAI,sBAChBR,aAAcc,IACdS,mBAAoB,CAAC,OACrBC,WAAW,GAEXR,EAACS,EAAAA,CACGJ,KAAM,MACNK,YAAa,MACbC,YAAY,EACZC,MAAOjD,EAAKkB,IACZgC,SAAU9D,EAAM8D,SAChBC,QAASpD,EAAgB,MAAO,SAChCqD,OAAQrD,EAAgB,MAAO,QAC/BsD,UAAWvB,EACXwB,OAASf,IACL1B,EAASM,QAAUoB,GAEvBgB,aAAc,SAGtBlB,EAACC,MAAAA,CAAIE,UAAW,+CACZH,EAACmB,EAAAA,CAAiBN,SAAU9D,EAAMqE,gBAAiBC,QAAShC,EAAwBD,aAAcD"}
1
+ {"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../../utils/useForm';\nimport { setFocusOnField } from '../../../../../../utils/setFocus';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\nimport { getErrorMessage } from '../../../../../../utils/getErrorMessage';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: Readonly<CtPOneTimePasswordInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useFormWithA11y<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules,\n formHolder: containerRef\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'otp');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const handleOnKeyPress = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n const getOtpErrorMessage = useCallback(() => {\n if (!isOtpFielDirty) return null;\n\n return resendOtpError || props.errorMessage || getErrorMessage(i18n, errors.otp, i18n.get('ctp.otp.fieldLabel'));\n }, [isOtpFielDirty, resendOtpError, props.errorMessage, errors.otp, i18n]);\n\n return (\n <div ref={containerRef} className={'adyen-checkout-ctp__otp-field-wrapper'}>\n <Field\n name=\"oneTimePassword\"\n label={i18n.get('ctp.otp.fieldLabel')}\n errorMessage={getOtpErrorMessage()}\n classNameModifiers={['otp']}\n errorLive={true}\n >\n <InputText\n name={'otp'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.otp}\n disabled={props.disabled}\n onInput={handleChangeFor('otp', 'input')}\n onBlur={handleChangeFor('otp', 'blur')}\n onKeyPress={handleOnKeyPress}\n setRef={(ref: HTMLInputElement) => {\n inputRef.current = ref;\n }}\n autocomplete={'off'}\n />\n </Field>\n <div className={'adyen-checkout-ctp__otp-resend-code-wrapper'}>\n <CtPResendOtpLink disabled={props.isValidatingOtp} onError={handleOnResendOtpError} onResendCode={handleOnResendOtp} />\n </div>\n </div>\n );\n};\n\nexport default CtPOneTimePasswordInput;\n"],"names":["CtPOneTimePasswordInput","props","i18n","useCoreContext","configuration","disableOtpAutoFocus","useClickToPayContext","resendOtpError","setResendOtpError","useState","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","setData","useFormWithA11y","schema","rules","otpValidationRules","formHolder","otpInputHandlersRef","validateInput","inputRef","isOtpFielDirty","setIsOtpFieldDirty","useCallback","useEffect","otp","current","focus","errorMessage","setFocusOnField","onSetInputHandlers","handleOnResendOtp","onResendCode","handleOnResendOtpError","errorCode","message","get","handleOnKeyPress","event","key","onPressEnter","onChange","getOtpErrorMessage","getErrorMessage","h","div","ref","className","Field","name","label","classNameModifiers","errorLive","InputText","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyPress","setRef","autocomplete","CtPResendOtpLink","isValidatingOtp","onError"],"mappings":"2uBAkCA,MAAMA,EAA2BC,IAC7B,MAAMC,KAAEA,GAASC,KAEbC,eAAeC,oBAAEA,IACjBC,KAGGC,EAAgBC,GAAqBC,EAAiB,MACvDC,EAAeC,EAAuB,OACtCC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,QAAEA,GAAYC,EAAkD,CACpIC,OAJe,CAAC,OAKhBC,MAAOC,EACPC,WAAYb,IAEVc,EAAsBb,EAAwC,CAAEc,cAAe,OAC/EC,EAAWf,EAAyB,OACnCgB,EAAgBC,GAAsBnB,GAAkB,GAEzDgB,EAAgBI,EAAY,KAC9BD,GAAmB,GACnBd,KACD,CAACA,IAKJgB,EAAU,KACFjB,EAAKkB,KAAKH,GAAmB,IAClC,CAACf,EAAKkB,MAETD,EAAU,MACDzB,GAAuBqB,EAASM,SACjCN,EAASM,QAAQC,SAEtB,CAACP,EAASM,QAAS3B,IAEtByB,EAAU,KACFpB,EAAasB,SAAW/B,EAAMiC,cAC9BC,EAAgBzB,EAAasB,QAAS,QAE3C,CAAC/B,EAAMiC,eAEVJ,EAAU,KACNN,EAAoBQ,QAAQP,cAAgBA,EAC5CxB,EAAMmC,mBAAmBZ,EAAoBQ,UAC9C,CAACP,EAAexB,EAAMmC,qBAEzB,MAAMC,EAAoBR,EAAY,KAClCX,EAAQ,MAAO,IACfV,EAAkB,MACbH,GACDqB,EAASM,QAAQC,QAErBhC,EAAMqC,gBACP,CAACrC,EAAMqC,aAAcZ,EAASM,QAAS3B,IAEpCkC,EAAyBV,EAC1BW,IACG,MAAMC,EAAUvC,EAAKwC,IAAI,cAAcF,KACnCC,GAASjC,EAAkBiC,IAEnC,CAACvC,IAGCyC,EAAmBd,EACpBe,IACqB,UAAdA,EAAMC,KACD5C,EAAM6C,gBAGnB,CAAC7C,EAAM6C,eAGXhB,EAAU,KACN7B,EAAM8C,SAAS,CAAElC,OAAME,QAAOC,SAAQC,aACvC,CAACJ,EAAME,EAAOC,IAEjB,MAAMgC,EAAqBnB,EAAY,IAC9BF,EAEEpB,GAAkBN,EAAMiC,cAAgBe,EAAgB/C,EAAMc,EAAOe,IAAK7B,EAAKwC,IAAI,uBAF9D,KAG7B,CAACf,EAAgBpB,EAAgBN,EAAMiC,aAAclB,EAAOe,IAAK7B,IAEpE,OACIgD,EAACC,MAAAA,CAAIC,IAAK1C,EAAc2C,UAAW,yCAC/BH,EAACI,EAAAA,CACGC,KAAK,kBACLC,MAAOtD,EAAKwC,IAAI,sBAChBR,aAAcc,IACdS,mBAAoB,CAAC,OACrBC,WAAW,GAEXR,EAACS,EAAAA,CACGJ,KAAM,MACNK,YAAa,MACbC,YAAY,EACZC,MAAOjD,EAAKkB,IACZgC,SAAU9D,EAAM8D,SAChBC,QAASpD,EAAgB,MAAO,SAChCqD,OAAQrD,EAAgB,MAAO,QAC/BsD,WAAYvB,EACZwB,OAASf,IACL1B,EAASM,QAAUoB,GAEvBgB,aAAc,SAGtBlB,EAACC,MAAAA,CAAIE,UAAW,+CACZH,EAACmB,EAAAA,CAAiBN,SAAU9D,EAAMqE,gBAAiBC,QAAShC,EAAwBD,aAAcD"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import n from"./CtPLogoutLink.js";import{CtPBrand as c}from"../CtPBrand/CtPBrand.js";import o from"../../context/useClickToPayContext.js";const a=({children:a,onEnterKeyPress:s})=>{const{isStandaloneComponent:r}=o();return e("div",{className:t("adyen-checkout-ctp__section",{"adyen-checkout-ctp__section--standalone":r}),onKeyDown:s},e("div",{className:"adyen-checkout-ctp__section-brand"},e(c,null),e(n,null)),a)};a.Title=({endAdornment:t,children:n})=>e("div",{className:"adyen-checkout-ctp__section-header"},e("h1",{className:"adyen-checkout-ctp__section-header-title"},n),t&&e("span",{className:"adyen-checkout-ctp__section-header-adornment"},t)),a.Text=({children:t})=>e("p",{className:"adyen-checkout-ctp__section-text"},t);export{a as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import n from"./CtPLogoutLink.js";import{CtPBrand as c}from"../CtPBrand/CtPBrand.js";import a from"../../context/useClickToPayContext.js";const o=({children:o,onEnterKeyPress:s})=>{const{isStandaloneComponent:r}=a();return e("div",{className:t("adyen-checkout-ctp__section",{"adyen-checkout-ctp__section--standalone":r}),onKeyPress:s},e("div",{className:"adyen-checkout-ctp__section-brand"},e(c,null),e(n,null)),o)};o.Title=({endAdornment:t,children:n})=>e("div",{className:"adyen-checkout-ctp__section-header"},e("h1",{className:"adyen-checkout-ctp__section-header-title"},n),t&&e("span",{className:"adyen-checkout-ctp__section-header-adornment"},t)),o.Text=({children:t})=>e("p",{className:"adyen-checkout-ctp__section-text"},t);export{o as default};
2
2
  //# sourceMappingURL=CtPSection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPSection.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPSection.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport classnames from 'classnames';\nimport CtPLogoutLink from './CtPLogoutLink';\nimport { CtPBrand } from '../CtPBrand';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport './CtPSection.scss';\n\ninterface CtPSectionProps {\n onEnterKeyPress: (event: TargetedKeyboardEvent<HTMLInputElement>) => void;\n children?: h.JSX.Element[];\n}\n\nconst CtPSection = ({ children, onEnterKeyPress }: Readonly<CtPSectionProps>): h.JSX.Element => {\n const { isStandaloneComponent } = useClickToPayContext();\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={classnames('adyen-checkout-ctp__section', { 'adyen-checkout-ctp__section--standalone': isStandaloneComponent })}\n onKeyDown={onEnterKeyPress}\n >\n <div className=\"adyen-checkout-ctp__section-brand\">\n <CtPBrand />\n <CtPLogoutLink />\n </div>\n\n {children}\n </div>\n );\n};\n\nconst Title = ({ endAdornment, children }: Readonly<{ endAdornment?; children }>) => (\n <div className=\"adyen-checkout-ctp__section-header\">\n <h1 className=\"adyen-checkout-ctp__section-header-title\">{children}</h1>\n {endAdornment && <span className=\"adyen-checkout-ctp__section-header-adornment\">{endAdornment}</span>}\n </div>\n);\nconst Text = ({ children }: Readonly<{ children }>) => <p className=\"adyen-checkout-ctp__section-text\">{children}</p>;\n\nCtPSection.Title = Title;\nCtPSection.Text = Text;\n\nexport default CtPSection;\n"],"names":["CtPSection","children","onEnterKeyPress","isStandaloneComponent","useClickToPayContext","h","div","className","classnames","onKeyDown","CtPBrand","CtPLogoutLink","Title","endAdornment","h1","span","Text","p"],"mappings":"wQAYA,MAAMA,EAAa,EAAGC,WAAUC,sBAC5B,MAAMC,sBAAEA,GAA0BC,IAElC,OAEIC,EAACC,MAAAA,CACGC,UAAWC,EAAW,8BAA+B,CAAE,0CAA2CL,IAClGM,UAAWP,GAEXG,EAACC,MAAAA,CAAIC,UAAU,qCACXF,EAACK,EAAAA,MACDL,EAACM,EAAAA,OAGJV,IAabD,EAAWY,MARG,EAAGC,eAAcZ,cAC3BI,EAACC,MAAAA,CAAIC,UAAU,sCACXF,EAACS,KAAAA,CAAGP,UAAU,4CAA4CN,GACzDY,GAAgBR,EAACU,OAAAA,CAAKR,UAAU,gDAAgDM,IAMzFb,EAAWgB,KAHE,EAAGf,cAAuCI,EAACY,IAAAA,CAAEV,UAAU,oCAAoCN"}
1
+ {"version":3,"file":"CtPSection.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPSection.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classnames from 'classnames';\nimport CtPLogoutLink from './CtPLogoutLink';\nimport { CtPBrand } from '../CtPBrand';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport './CtPSection.scss';\n\ninterface CtPSectionProps {\n onEnterKeyPress: (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => void;\n children?: h.JSX.Element[];\n}\n\nconst CtPSection = ({ children, onEnterKeyPress }: Readonly<CtPSectionProps>): h.JSX.Element => {\n const { isStandaloneComponent } = useClickToPayContext();\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={classnames('adyen-checkout-ctp__section', { 'adyen-checkout-ctp__section--standalone': isStandaloneComponent })}\n onKeyPress={onEnterKeyPress}\n >\n <div className=\"adyen-checkout-ctp__section-brand\">\n <CtPBrand />\n <CtPLogoutLink />\n </div>\n\n {children}\n </div>\n );\n};\n\nconst Title = ({ endAdornment, children }: Readonly<{ endAdornment?; children }>) => (\n <div className=\"adyen-checkout-ctp__section-header\">\n <h1 className=\"adyen-checkout-ctp__section-header-title\">{children}</h1>\n {endAdornment && <span className=\"adyen-checkout-ctp__section-header-adornment\">{endAdornment}</span>}\n </div>\n);\nconst Text = ({ children }: Readonly<{ children }>) => <p className=\"adyen-checkout-ctp__section-text\">{children}</p>;\n\nCtPSection.Title = Title;\nCtPSection.Text = Text;\n\nexport default CtPSection;\n"],"names":["CtPSection","children","onEnterKeyPress","isStandaloneComponent","useClickToPayContext","h","div","className","classnames","onKeyPress","CtPBrand","CtPLogoutLink","Title","endAdornment","h1","span","Text","p"],"mappings":"wQAYA,MAAMA,EAAa,EAAGC,WAAUC,sBAC5B,MAAMC,sBAAEA,GAA0BC,IAElC,OAEIC,EAACC,MAAAA,CACGC,UAAWC,EAAW,8BAA+B,CAAE,0CAA2CL,IAClGM,WAAYP,GAEZG,EAACC,MAAAA,CAAIC,UAAU,qCACXF,EAACK,EAAAA,MACDL,EAACM,EAAAA,OAGJV,IAabD,EAAWY,MARG,EAAGC,eAAcZ,cAC3BI,EAACC,MAAAA,CAAIC,UAAU,sCACXF,EAACS,KAAAA,CAAGP,UAAU,4CAA4CN,GACzDY,GAAgBR,EAACU,OAAAA,CAAKR,UAAU,gDAAgDM,IAMzFb,EAAWgB,KAHE,EAAGf,cAAuCI,EAACY,IAAAA,CAAEV,UAAU,oCAAoCN"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../../external/preact/dist/preact.js";import{CtpState as o}from"../services/ClickToPayService.js";import{ClickToPayContext as e}from"./ClickToPayContext.js";import{useState as a,useRef as n,useEffect as i,useCallback as s}from"../../../../external/preact/hooks/dist/hooks.js";const r=({isStandaloneComponent:r=!1,clickToPayService:l,configuration:d,children:c,setClickToPayRef:u,onSubmit:p,onSetStatus:v,onError:y})=>{var S,m;const[C]=a(l),[f,h]=a((null==l?void 0:l.state)||o.NotAvailable),[k,I]=a(!0),[P,w]=a("ready"),b=n({}),g=n(!1);i(()=>{u(b.current),b.current.setStatus=w},[]),i(()=>{null==C||C.subscribeOnStateChange(t=>h(t))},[C]);const E=s(()=>{var t;g.current||(null===(t=d.onReady)||void 0===t||t.call(d),g.current=!0)},[null==d?void 0:d.onReady]),V=s(async t=>{await(null==C?void 0:C.finishIdentityValidation(t))},[C]),R=s(async()=>await(null==C?void 0:C.startIdentityValidation()),[C]),j=s(async t=>await(null==C?void 0:C.checkout(t)),[C]),x=s(async t=>await(null==C?void 0:C.verifyIfShopperIsEnrolled(t)),[C]),T=s(async()=>{await(null==C?void 0:C.logout())},[C]),M=s(t=>{C.updateStoreCookiesConsent(t)},[C]);return t(e.Provider,{value:{status:P,onSubmit:p,onError:y,onSetStatus:v,configuration:d,isStoringCookies:null==C?void 0:C.storeCookies,isStandaloneComponent:r,isCtpPrimaryPaymentMethod:k,setIsCtpPrimaryPaymentMethod:I,ctpState:f,verifyIfShopperIsEnrolled:x,cards:null==C?void 0:C.shopperCards,schemes:null==C?void 0:C.schemes,otpMaskedContact:null==C||null===(S=C.identityValidationData)||void 0===S?void 0:S.maskedShopperContact,otpNetwork:null==C||null===(m=C.identityValidationData)||void 0===m?void 0:m.selectedNetwork,checkout:j,logoutShopper:T,startIdentityValidation:R,finishIdentityValidation:V,updateStoreCookiesConsent:M,onReady:E}},c)};export{r as default};
1
+ import{createElement as t}from"../../../../external/preact/dist/preact.js";import{CtpState as o}from"../services/ClickToPayService.js";import{ClickToPayContext as e}from"./ClickToPayContext.js";import{useState as a,useRef as n,useEffect as i,useCallback as s}from"../../../../external/preact/hooks/dist/hooks.js";const r=({isStandaloneComponent:r=!1,clickToPayService:l,configuration:d,children:c,setClickToPayRef:u,onSubmit:p,onSetStatus:v,onError:y})=>{var S,m;const[C]=a(l),[f,h]=a((null==l?void 0:l.state)||o.NotAvailable),[k,I]=a(!0),[P,w]=a("ready"),b=n(!1),g=n({setStatus:w});i(()=>{u(g.current)},[]),i(()=>{null==C||C.subscribeOnStateChange(t=>h(t))},[C]);const E=s(()=>{var t;b.current||(null===(t=d.onReady)||void 0===t||t.call(d),b.current=!0)},[null==d?void 0:d.onReady]),V=s(async t=>{await(null==C?void 0:C.finishIdentityValidation(t))},[C]),R=s(async()=>await(null==C?void 0:C.startIdentityValidation()),[C]),j=s(async t=>await(null==C?void 0:C.checkout(t)),[C]),x=s(async t=>await(null==C?void 0:C.verifyIfShopperIsEnrolled(t)),[C]),T=s(async()=>{await(null==C?void 0:C.logout())},[C]),M=s(t=>{C.updateStoreCookiesConsent(t)},[C]);return t(e.Provider,{value:{status:P,onSubmit:p,onError:y,onSetStatus:v,configuration:d,isStoringCookies:null==C?void 0:C.storeCookies,isStandaloneComponent:r,isCtpPrimaryPaymentMethod:k,setIsCtpPrimaryPaymentMethod:I,ctpState:f,verifyIfShopperIsEnrolled:x,cards:null==C?void 0:C.shopperCards,schemes:null==C?void 0:C.schemes,otpMaskedContact:null==C||null===(S=C.identityValidationData)||void 0===S?void 0:S.maskedShopperContact,otpNetwork:null==C||null===(m=C.identityValidationData)||void 0===m?void 0:m.selectedNetwork,checkout:j,logoutShopper:T,startIdentityValidation:R,finishIdentityValidation:V,updateStoreCookiesConsent:M,onReady:E}},c)};export{r as default};
2
2
  //# sourceMappingURL=ClickToPayProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClickToPayProvider.js","sources":["../../../../../../src/components/internal/ClickToPay/context/ClickToPayProvider.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { CtpState } from '../services/ClickToPayService';\nimport { ClickToPayContext } from './ClickToPayContext';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { ClickToPayCheckoutPayload, IClickToPayService, IdentityLookupParams } from '../services/types';\nimport ShopperCard from '../models/ShopperCard';\nimport { ClickToPayProps } from '../types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { UIElementStatus } from '../../UIElement/types';\n\ntype ClickToPayProviderRef = {\n setStatus?(status: UIElementStatus): void;\n};\n\nexport type ClickToPayProviderProps = {\n isStandaloneComponent: boolean;\n clickToPayService: IClickToPayService | null;\n configuration: ClickToPayProps;\n children: any;\n setClickToPayRef(ref): void;\n onSubmit(payload: ClickToPayCheckoutPayload): void;\n onSetStatus(status: UIElementStatus): void;\n onError(error: AdyenCheckoutError): void;\n};\n\nconst ClickToPayProvider = ({\n isStandaloneComponent = false,\n clickToPayService,\n configuration,\n children,\n setClickToPayRef,\n onSubmit,\n onSetStatus,\n onError\n}: Readonly<ClickToPayProviderProps>) => {\n const [ctpService] = useState<IClickToPayService | null>(clickToPayService);\n const [ctpState, setCtpState] = useState<CtpState>(clickToPayService?.state || CtpState.NotAvailable);\n const [isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod] = useState<boolean>(true);\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const clickToPayRef = useRef<ClickToPayProviderRef>({});\n const isOnReadyInvoked = useRef<boolean>(false);\n\n useEffect(() => {\n setClickToPayRef(clickToPayRef.current);\n clickToPayRef.current.setStatus = setStatus;\n }, []);\n\n useEffect(() => {\n ctpService?.subscribeOnStateChange(status => setCtpState(status));\n }, [ctpService]);\n\n const onReady = useCallback(() => {\n if (isOnReadyInvoked.current) {\n return;\n }\n configuration.onReady?.();\n isOnReadyInvoked.current = true;\n }, [configuration?.onReady]);\n\n const finishIdentityValidation = useCallback(\n async (otpValue: string) => {\n await ctpService?.finishIdentityValidation(otpValue);\n },\n [ctpService]\n );\n\n const startIdentityValidation = useCallback(async () => {\n const data = await ctpService?.startIdentityValidation();\n return data;\n }, [ctpService]);\n\n const checkout = useCallback(\n async (card: ShopperCard) => {\n return await ctpService?.checkout(card);\n },\n [ctpService]\n );\n\n const verifyIfShopperIsEnrolled = useCallback(\n async (shopperIdentity: IdentityLookupParams) => {\n return await ctpService?.verifyIfShopperIsEnrolled(shopperIdentity);\n },\n [ctpService]\n );\n\n const logoutShopper = useCallback(async () => {\n await ctpService?.logout();\n }, [ctpService]);\n\n const updateStoreCookiesConsent = useCallback(\n (shouldStore: boolean) => {\n ctpService.updateStoreCookiesConsent(shouldStore);\n },\n [ctpService]\n );\n\n return (\n <ClickToPayContext.Provider\n value={{\n status,\n onSubmit,\n onError,\n onSetStatus,\n configuration,\n isStoringCookies: ctpService?.storeCookies,\n isStandaloneComponent,\n isCtpPrimaryPaymentMethod,\n setIsCtpPrimaryPaymentMethod,\n ctpState,\n verifyIfShopperIsEnrolled,\n cards: ctpService?.shopperCards,\n schemes: ctpService?.schemes,\n otpMaskedContact: ctpService?.identityValidationData?.maskedShopperContact,\n otpNetwork: ctpService?.identityValidationData?.selectedNetwork,\n checkout,\n logoutShopper,\n startIdentityValidation,\n finishIdentityValidation,\n updateStoreCookiesConsent,\n onReady\n }}\n >\n {children}\n </ClickToPayContext.Provider>\n );\n};\n\nexport default ClickToPayProvider;\n"],"names":["ClickToPayProvider","isStandaloneComponent","clickToPayService","configuration","children","setClickToPayRef","onSubmit","onSetStatus","onError","ctpService","useState","ctpState","setCtpState","state","CtpState","NotAvailable","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","status","setStatus","clickToPayRef","useRef","isOnReadyInvoked","useEffect","current","subscribeOnStateChange","onReady","useCallback","finishIdentityValidation","async","otpValue","startIdentityValidation","checkout","card","verifyIfShopperIsEnrolled","shopperIdentity","logoutShopper","logout","updateStoreCookiesConsent","shouldStore","h","ClickToPayContext","Provider","value","isStoringCookies","storeCookies","cards","shopperCards","schemes","otpMaskedContact","identityValidationData","maskedShopperContact","otpNetwork","selectedNetwork"],"mappings":"yTAyBA,MAAMA,EAAqB,EACvBC,yBAAwB,EACxBC,oBACAC,gBACAC,WACAC,mBACAC,WACAC,cACAC,kBA+E8BC,EACNA,EA9ExB,MAAOA,GAAcC,EAAoCR,IAClDS,EAAUC,GAAeF,GAAmBR,aAAAA,EAAAA,EAAmBW,QAASC,EAASC,eACjFC,EAA2BC,GAAgCP,GAAkB,IAC7EQ,EAAQC,GAAaT,EAA0B,SAChDU,EAAgBC,EAA8B,IAC9CC,EAAmBD,GAAgB,GAEzCE,EAAU,KACNlB,EAAiBe,EAAcI,SAC/BJ,EAAcI,QAAQL,UAAYA,GACnC,IAEHI,EAAU,KACNd,SAAAA,EAAYgB,uBAAuBP,GAAUN,EAAYM,KAC1D,CAACT,IAEJ,MAAMiB,EAAUC,EAAY,KAIxBxB,IAAAA,EAHImB,EAAiBE,UAGA,QAArBrB,EAAAA,EAAcuB,eAAdvB,IAAAA,GAAAA,EAAAA,KAAAA,GACAmB,EAAiBE,SAAU,IAC5B,CAACrB,aAAAA,EAAAA,EAAeuB,UAEbE,EAA2BD,EAC7BE,MAAOC,UACGrB,aAAAA,EAAAA,EAAYmB,yBAAyBE,KAE/C,CAACrB,IAGCsB,EAA0BJ,EAAYE,eACrBpB,aAAAA,EAAAA,EAAYsB,2BAEhC,CAACtB,IAEEuB,EAAWL,EACbE,MAAOI,SACUxB,aAAAA,EAAAA,EAAYuB,SAASC,IAEtC,CAACxB,IAGCyB,EAA4BP,EAC9BE,MAAOM,SACU1B,aAAAA,EAAAA,EAAYyB,0BAA0BC,IAEvD,CAAC1B,IAGC2B,EAAgBT,EAAYE,gBACxBpB,eAAAA,EAAY4B,WACnB,CAAC5B,IAEE6B,EAA4BX,EAC7BY,IACG9B,EAAW6B,0BAA0BC,IAEzC,CAAC9B,IAGL,OACI+B,EAACC,EAAkBC,SAAQ,CACvBC,MAAO,CACHzB,SACAZ,WACAE,UACAD,cACAJ,gBACAyC,iBAAkBnC,aAAAA,EAAAA,EAAYoC,aAC9B5C,wBACAe,4BACAC,+BACAN,WACAuB,4BACAY,MAAOrC,aAAAA,EAAAA,EAAYsC,aACnBC,QAASvC,aAAAA,EAAAA,EAAYuC,QACrBC,iBAAkBxC,SAAkC,QAAlCA,EAAAA,EAAYyC,8BAAZzC,IAAAA,OAAAA,EAAAA,EAAoC0C,qBACtDC,WAAY3C,SAAkC,QAAlCA,EAAAA,EAAYyC,8BAAZzC,IAAAA,OAAAA,EAAAA,EAAoC4C,gBAChDrB,WACAI,gBACAL,0BACAH,2BACAU,4BACAZ,YAGHtB"}
1
+ {"version":3,"file":"ClickToPayProvider.js","sources":["../../../../../../src/components/internal/ClickToPay/context/ClickToPayProvider.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { CtpState } from '../services/ClickToPayService';\nimport { ClickToPayContext } from './ClickToPayContext';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { ClickToPayCheckoutPayload, IClickToPayService, IdentityLookupParams } from '../services/types';\nimport ShopperCard from '../models/ShopperCard';\nimport { ClickToPayProps } from '../types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { ComponentMethodsRef, UIElementStatus } from '../../UIElement/types';\n\ntype ClickToPayProviderRef = {\n setStatus?(status: UIElementStatus): void;\n};\n\nexport type ClickToPayProviderProps = {\n isStandaloneComponent: boolean;\n clickToPayService: IClickToPayService | null;\n configuration: ClickToPayProps;\n children: any;\n setClickToPayRef(ref: ComponentMethodsRef): void;\n onSubmit(payload: ClickToPayCheckoutPayload): void;\n onSetStatus(status: UIElementStatus): void;\n onError(error: AdyenCheckoutError): void;\n};\n\nconst ClickToPayProvider = ({\n isStandaloneComponent = false,\n clickToPayService,\n configuration,\n children,\n setClickToPayRef,\n onSubmit,\n onSetStatus,\n onError\n}: Readonly<ClickToPayProviderProps>) => {\n const [ctpService] = useState<IClickToPayService | null>(clickToPayService);\n const [ctpState, setCtpState] = useState<CtpState>(clickToPayService?.state || CtpState.NotAvailable);\n const [isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod] = useState<boolean>(true);\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const isOnReadyInvoked = useRef<boolean>(false);\n\n const clickToPayRef = useRef<ClickToPayProviderRef>({\n setStatus\n });\n\n useEffect(() => {\n setClickToPayRef(clickToPayRef.current);\n }, []);\n\n useEffect(() => {\n ctpService?.subscribeOnStateChange(status => setCtpState(status));\n }, [ctpService]);\n\n const onReady = useCallback(() => {\n if (isOnReadyInvoked.current) {\n return;\n }\n configuration.onReady?.();\n isOnReadyInvoked.current = true;\n }, [configuration?.onReady]);\n\n const finishIdentityValidation = useCallback(\n async (otpValue: string) => {\n await ctpService?.finishIdentityValidation(otpValue);\n },\n [ctpService]\n );\n\n const startIdentityValidation = useCallback(async () => {\n const data = await ctpService?.startIdentityValidation();\n return data;\n }, [ctpService]);\n\n const checkout = useCallback(\n async (card: ShopperCard) => {\n return await ctpService?.checkout(card);\n },\n [ctpService]\n );\n\n const verifyIfShopperIsEnrolled = useCallback(\n async (shopperIdentity: IdentityLookupParams) => {\n return await ctpService?.verifyIfShopperIsEnrolled(shopperIdentity);\n },\n [ctpService]\n );\n\n const logoutShopper = useCallback(async () => {\n await ctpService?.logout();\n }, [ctpService]);\n\n const updateStoreCookiesConsent = useCallback(\n (shouldStore: boolean) => {\n ctpService.updateStoreCookiesConsent(shouldStore);\n },\n [ctpService]\n );\n\n return (\n <ClickToPayContext.Provider\n value={{\n status,\n onSubmit,\n onError,\n onSetStatus,\n configuration,\n isStoringCookies: ctpService?.storeCookies,\n isStandaloneComponent,\n isCtpPrimaryPaymentMethod,\n setIsCtpPrimaryPaymentMethod,\n ctpState,\n verifyIfShopperIsEnrolled,\n cards: ctpService?.shopperCards,\n schemes: ctpService?.schemes,\n otpMaskedContact: ctpService?.identityValidationData?.maskedShopperContact,\n otpNetwork: ctpService?.identityValidationData?.selectedNetwork,\n checkout,\n logoutShopper,\n startIdentityValidation,\n finishIdentityValidation,\n updateStoreCookiesConsent,\n onReady\n }}\n >\n {children}\n </ClickToPayContext.Provider>\n );\n};\n\nexport default ClickToPayProvider;\n"],"names":["ClickToPayProvider","isStandaloneComponent","clickToPayService","configuration","children","setClickToPayRef","onSubmit","onSetStatus","onError","ctpService","useState","ctpState","setCtpState","state","CtpState","NotAvailable","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","status","setStatus","isOnReadyInvoked","useRef","clickToPayRef","useEffect","current","subscribeOnStateChange","onReady","useCallback","finishIdentityValidation","async","otpValue","startIdentityValidation","checkout","card","verifyIfShopperIsEnrolled","shopperIdentity","logoutShopper","logout","updateStoreCookiesConsent","shouldStore","h","ClickToPayContext","Provider","value","isStoringCookies","storeCookies","cards","shopperCards","schemes","otpMaskedContact","identityValidationData","maskedShopperContact","otpNetwork","selectedNetwork"],"mappings":"yTAyBA,MAAMA,EAAqB,EACvBC,yBAAwB,EACxBC,oBACAC,gBACAC,WACAC,mBACAC,WACAC,cACAC,kBAiF8BC,EACNA,EAhFxB,MAAOA,GAAcC,EAAoCR,IAClDS,EAAUC,GAAeF,GAAmBR,aAAAA,EAAAA,EAAmBW,QAASC,EAASC,eACjFC,EAA2BC,GAAgCP,GAAkB,IAC7EQ,EAAQC,GAAaT,EAA0B,SAChDU,EAAmBC,GAAgB,GAEnCC,EAAgBD,EAA8B,CAChDF,cAGJI,EAAU,KACNlB,EAAiBiB,EAAcE,UAChC,IAEHD,EAAU,KACNd,SAAAA,EAAYgB,uBAAuBP,GAAUN,EAAYM,KAC1D,CAACT,IAEJ,MAAMiB,EAAUC,EAAY,KAIxBxB,IAAAA,EAHIiB,EAAiBI,UAGA,QAArBrB,EAAAA,EAAcuB,eAAdvB,IAAAA,GAAAA,EAAAA,KAAAA,GACAiB,EAAiBI,SAAU,IAC5B,CAACrB,aAAAA,EAAAA,EAAeuB,UAEbE,EAA2BD,EAC7BE,MAAOC,UACGrB,aAAAA,EAAAA,EAAYmB,yBAAyBE,KAE/C,CAACrB,IAGCsB,EAA0BJ,EAAYE,eACrBpB,aAAAA,EAAAA,EAAYsB,2BAEhC,CAACtB,IAEEuB,EAAWL,EACbE,MAAOI,SACUxB,aAAAA,EAAAA,EAAYuB,SAASC,IAEtC,CAACxB,IAGCyB,EAA4BP,EAC9BE,MAAOM,SACU1B,aAAAA,EAAAA,EAAYyB,0BAA0BC,IAEvD,CAAC1B,IAGC2B,EAAgBT,EAAYE,gBACxBpB,eAAAA,EAAY4B,WACnB,CAAC5B,IAEE6B,EAA4BX,EAC7BY,IACG9B,EAAW6B,0BAA0BC,IAEzC,CAAC9B,IAGL,OACI+B,EAACC,EAAkBC,SAAQ,CACvBC,MAAO,CACHzB,SACAZ,WACAE,UACAD,cACAJ,gBACAyC,iBAAkBnC,aAAAA,EAAAA,EAAYoC,aAC9B5C,wBACAe,4BACAC,+BACAN,WACAuB,4BACAY,MAAOrC,aAAAA,EAAAA,EAAYsC,aACnBC,QAASvC,aAAAA,EAAAA,EAAYuC,QACrBC,iBAAkBxC,SAAkC,QAAlCA,EAAAA,EAAYyC,8BAAZzC,IAAAA,OAAAA,EAAAA,EAAoC0C,qBACtDC,WAAY3C,SAAkC,QAAlCA,EAAAA,EAAYyC,8BAAZzC,IAAAA,OAAAA,EAAAA,EAAoC4C,gBAChDrB,WACAI,gBACAL,0BACAH,2BACAU,4BACAZ,YAGHtB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as n,ARIA_CONTEXT_SUFFIX as o}from"../../../core/Errors/constants.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function i(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function c(c){let{setRef:u}=c,s=i(c,["setRef"]);const{autoCorrect:p,classNameModifiers:d,isInvalid:y,isValid:f,readonly:b=null,spellcheck:O,type:m,uniqueId:j,disabled:v}=s,g=s.className;Object.prototype.hasOwnProperty.call(s,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const h=t(e=>{s.onInput(e)},[s.onInput]),w=t(e=>{(null==s?void 0:s.onKeyDown)&&s.onKeyDown(e)},[null==s?void 0:s.onKeyDown]),P=t(e=>{var t,r;null==s||null===(t=s.onBlurHandler)||void 0===t||t.call(s,e),s.trimOnBlur&&(e.target.value=e.target.value.trim()),null==s||null===(r=s.onBlur)||void 0===r||r.call(s,e)},[s.onBlur,s.onBlurHandler]),I=t(e=>{var t;null==s||null===(t=s.onFocusHandler)||void 0===t||t.call(s,e)},[s.onFocusHandler]),k=r("adyen-checkout__input",[`adyen-checkout__input--${m}`],g,{"adyen-checkout__input--invalid":y,"adyen-checkout__input--valid":f},d.map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:_,uniqueId:x,isInvalid:E,isValid:B,addContextualElement:D,"aria-describedby":C,autocomplete:N}=s,K=i(s,["classNameModifiers","uniqueId","isInvalid","isValid","addContextualElement","aria-describedby","autocomplete"]),S=["string"==typeof C&&C?C:null,j?`${j}${y?n:o}`:null].filter(Boolean).join(" ")||null;return e("input",a(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({id:j},K),{autocomplete:N,"aria-required":K.required,type:m,className:k,readOnly:b,spellcheck:O,autoCorrect:p,"aria-describedby":S,"aria-invalid":y,onInput:h,onBlur:P,onFocus:I,onKeyDown:w,disabled:v,ref:u}))}c.defaultProps={type:"text",classNameModifiers:[]};export{c as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as n,ARIA_CONTEXT_SUFFIX as o}from"../../../core/Errors/constants.js";import{trimValWithOneSpace as l}from"../../../utils/validator-utils.js";function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function u(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function c(c){let{setRef:s}=c,p=u(c,["setRef"]);const{autoCorrect:d,classNameModifiers:y,isInvalid:f,isValid:b,readonly:O=null,spellcheck:m,type:v,uniqueId:j,disabled:h}=p,g=p.className;Object.prototype.hasOwnProperty.call(p,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const P=t(e=>{var t;null===(t=p.onInput)||void 0===t||t.call(p,e)},[p.onInput]),w=t(e=>{(null==p?void 0:p.onKeyPress)&&p.onKeyPress(e)},[null==p?void 0:p.onKeyPress]),I=t(e=>{(null==p?void 0:p.onKeyUp)&&p.onKeyUp(e)},[null==p?void 0:p.onKeyUp]),k=t(e=>{var t,r;if(null==p||null===(t=p.onBlurHandler)||void 0===t||t.call(p,e),p.trimOnBlur){const t=e.target;t.value=l(t.value)}null==p||null===(r=p.onBlur)||void 0===r||r.call(p,e)},[p.onBlur,p.onBlurHandler]),_=t(e=>{var t;null==p||null===(t=p.onFocusHandler)||void 0===t||t.call(p,e)},[p.onFocusHandler]),x=r("adyen-checkout__input",[`adyen-checkout__input--${v}`],g,{"adyen-checkout__input--invalid":f,"adyen-checkout__input--valid":b},(null!=y?y:[]).map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:E,uniqueId:K,isInvalid:B,isValid:C,addContextualElement:N,"aria-describedby":S,autocomplete:q}=p,R=u(p,["classNameModifiers","uniqueId","isInvalid","isValid","addContextualElement","aria-describedby","autocomplete"]),D=["string"==typeof S&&S?S:null,j?`${j}${f?n:o}`:null].filter(Boolean).join(" ")||null;return e("input",i(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){a(e,t,r[t])})}return e}({id:j},R),{autocomplete:q,"aria-required":R.required,type:v,className:x,readOnly:O,spellcheck:m,autoCorrect:d,"aria-describedby":D,"aria-invalid":f,onInput:P,onBlur:k,onFocus:_,onKeyUp:I,onKeyPress:w,disabled:h,ref:s}))}c.defaultProps={type:"text",classNameModifiers:[]};export{c as default};
2
2
  //# sourceMappingURL=InputBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputBase.js","sources":["../../../../../src/components/internal/FormFields/InputBase.tsx"],"sourcesContent":["import {\n h,\n RefCallback,\n InputHTMLAttributes,\n GenericEventHandler,\n TargetedInputEvent,\n TargetedKeyboardEvent,\n TargetedFocusEvent,\n TargetedEvent\n} from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../core/Errors/constants';\nimport Language from '../../../language';\nimport { AutocompleteValue } from './types';\nimport './FormFields.scss';\n\nexport interface InputBaseProps extends InputHTMLAttributes {\n classNameModifiers?: string[];\n isInvalid?: boolean;\n isValid?: boolean;\n readonly?: boolean;\n uniqueId?: string;\n disabled?: boolean;\n className?: string;\n placeholder?: string;\n value?: string;\n name?: string;\n checked?: boolean;\n setRef?: RefCallback<HTMLInputElement>;\n trimOnBlur?: boolean;\n i18n?: Language;\n label?: string;\n onBlurHandler?: GenericEventHandler<HTMLInputElement>;\n onFocusHandler?: GenericEventHandler<HTMLInputElement>;\n maxlength?: number | null;\n addContextualElement?: boolean;\n type?: string;\n /**\n * WCAG 2.2 autocomplete token for browser autofill.\n * Pass undefined to omit the attribute entirely.\n * @see https://www.w3.org/TR/WCAG22/#input-purposes\n */\n autocomplete: AutocompleteValue;\n}\n\nexport default function InputBase({ setRef, ...props }: Readonly<InputBaseProps>) {\n const { autoCorrect, classNameModifiers, isInvalid, isValid, readonly = null, spellcheck, type, uniqueId, disabled } = props;\n const className = props.className;\n\n /**\n * To avoid confusion with misplaced/misdirected onChange handlers - InputBase only accepts onInput, onBlur & onFocus handlers.\n * The first 2 being the means by which we expect useForm--handleChangeFor validation functionality to be applied.\n */\n if (Object.prototype.hasOwnProperty.call(props, 'onChange')) {\n console.error('Error: Form fields that rely on InputBase may not have an onChange property');\n }\n\n const handleInput = useCallback(\n (event: TargetedInputEvent<HTMLInputElement>) => {\n props.onInput(event);\n },\n [props.onInput]\n );\n\n const handleKeyDown = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (props?.onKeyDown) props.onKeyDown(event);\n },\n [props?.onKeyDown]\n );\n\n const handleBlur = useCallback(\n (event: TargetedFocusEvent<HTMLInputElement>) => {\n props?.onBlurHandler?.(event); // From Field component\n\n if (props.trimOnBlur) {\n (event.target as HTMLInputElement).value = (event.target as HTMLInputElement).value.trim(); // needed to trim trailing spaces in field (leading spaces can be done via formatting)\n }\n\n props?.onBlur?.(event);\n },\n [props.onBlur, props.onBlurHandler]\n );\n\n const handleFocus = useCallback(\n (event: TargetedEvent<HTMLInputElement>) => {\n props?.onFocusHandler?.(event); // From Field component\n },\n [props.onFocusHandler]\n );\n\n const inputClassNames = classNames(\n 'adyen-checkout__input',\n [`adyen-checkout__input--${type}`],\n className,\n {\n 'adyen-checkout__input--invalid': isInvalid,\n 'adyen-checkout__input--valid': isValid\n },\n classNameModifiers.map(m => `adyen-checkout__input--${m}`)\n );\n\n // Don't spread classNameModifiers etc to input element (it ends up as an attribute on the element itself)\n const {\n classNameModifiers: cnm,\n uniqueId: uid,\n isInvalid: iiv,\n isValid: iv,\n addContextualElement: ace,\n 'aria-describedby': ariaDescribedByProp,\n autocomplete,\n ...restProps\n } = props;\n\n const internalDescribedBy = uniqueId ? `${uniqueId}${isInvalid ? ARIA_ERROR_SUFFIX : ARIA_CONTEXT_SUFFIX}` : null;\n const extraDescribedBy = typeof ariaDescribedByProp === 'string' && ariaDescribedByProp ? ariaDescribedByProp : null;\n const mergedAriaDescribedBy = [extraDescribedBy, internalDescribedBy].filter(Boolean).join(' ') || null;\n\n return (\n <input\n id={uniqueId}\n {...restProps}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'autocomplete'\n autocomplete={autocomplete}\n aria-required={restProps.required}\n type={type}\n className={inputClassNames}\n readOnly={readonly}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'spellcheck'\n spellcheck={spellcheck}\n autoCorrect={autoCorrect}\n aria-describedby={mergedAriaDescribedBy}\n aria-invalid={isInvalid}\n onInput={handleInput}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n disabled={disabled}\n ref={setRef}\n />\n );\n}\n\nInputBase.defaultProps = {\n type: 'text',\n classNameModifiers: []\n};\n"],"names":["InputBase","_0","setRef","props","autoCorrect","classNameModifiers","isInvalid","isValid","readonly","spellcheck","type","uniqueId","disabled","className","Object","prototype","hasOwnProperty","call","console","error","handleInput","useCallback","event","onInput","handleKeyDown","onKeyDown","handleBlur","onBlurHandler","trimOnBlur","target","value","trim","onBlur","handleFocus","onFocusHandler","inputClassNames","classNames","map","m","cnm","uid","iiv","iv","addContextualElement","ace","ariaDescribedByProp","autocomplete","restProps","mergedAriaDescribedBy","ARIA_ERROR_SUFFIX","ARIA_CONTEXT_SUFFIX","filter","Boolean","join","h","input","id","aria-required","required","readOnly","aria-describedby","aria-invalid","onFocus","ref","defaultProps"],"mappings":"03CA8Ce,SAASA,EAAUC,OAAAC,OAAEA,GAA4CD,EAAjCE,EAAAA,EAAAA,EAAAA,YAC3C,MAAMC,YAAEA,EAAWC,mBAAEA,EAAkBC,UAAEA,EAASC,QAAEA,EAAOC,SAAEA,EAAW,KAAIC,WAAEA,EAAUC,KAAEA,EAAIC,SAAEA,EAAQC,SAAEA,GAAaT,EACjHU,EAAYV,EAAMU,UAMpBC,OAAOC,UAAUC,eAAeC,KAAKd,EAAO,aAC5Ce,QAAQC,MAAM,+EAGlB,MAAMC,EAAcC,EACfC,IACGnB,EAAMoB,QAAQD,IAElB,CAACnB,EAAMoB,UAGLC,EAAgBH,EACjBC,KACOnB,aAAAA,EAAAA,EAAOsB,YAAWtB,EAAMsB,UAAUH,IAE1C,CAACnB,aAAAA,EAAAA,EAAOsB,YAGNC,EAAaL,EACdC,QACGnB,EAMAA,EANAA,iBAAAA,EAAAA,EAAOwB,qBAAPxB,IAAAA,GAAAA,EAAAA,KAAAA,EAAuBmB,GAEnBnB,EAAMyB,aACLN,EAAMO,OAA4BC,MAAQR,EAAOO,OAA4BC,MAAMC,QAGxF5B,SAAa,QAAbA,EAAAA,EAAO6B,cAAP7B,IAAAA,GAAAA,OAAAA,EAAgBmB,IAEpB,CAACnB,EAAM6B,OAAQ7B,EAAMwB,gBAGnBM,EAAcZ,EACfC,IACGnB,IAAAA,EAAAA,iBAAAA,EAAAA,EAAO+B,sBAAP/B,IAAAA,GAAAA,EAAAA,KAAAA,EAAwBmB,IAE5B,CAACnB,EAAM+B,iBAGLC,EAAkBC,EACpB,wBACA,CAAC,0BAA0B1B,KAC3BG,EACA,CACI,iCAAkCP,EAClC,+BAAgCC,GAEpCF,EAAmBgC,IAAIC,GAAK,0BAA0BA,OAKtDjC,mBAAoBkC,EACpB5B,SAAU6B,EACVlC,UAAWmC,EACXlC,QAASmC,EACTC,qBAAsBC,EACtB,mBAAoBC,EAAmBC,aACvCA,GAEA3C,EADG4C,EAAAA,EACH5C,EAAAA,8EAHA,oCAOE6C,EAAwB,CAD0B,iBAAxBH,GAAoCA,EAAsBA,EAAsB,KADpFlC,EAAW,GAAGA,IAAWL,EAAY2C,EAAoBC,IAAwB,MAEvCC,OAAOC,SAASC,KAAK,MAAQ,KAEnG,OACIC,EAACC,QAAAA,oUAAAA,CAAAA,CACGC,GAAI7C,GACAoC,GAAAA,CAEJD,aAAcA,EACdW,gBAAeV,EAAUW,SACzBhD,KAAMA,EACNG,UAAWsB,EACXwB,SAAUnD,EAEVC,WAAYA,EACZL,YAAaA,EACbwD,mBAAkBZ,EAClBa,eAAcvD,EACdiB,QAASH,EACTY,OAAQN,EACRoC,QAAS7B,EACTR,UAAWD,EACXZ,SAAUA,EACVmD,IAAK7D,IAGjB,CAEAF,EAAUgE,aAAe,CACrBtD,KAAM,OACNL,mBAAoB"}
1
+ {"version":3,"file":"InputBase.js","sources":["../../../../../src/components/internal/FormFields/InputBase.tsx"],"sourcesContent":["import {\n h,\n RefCallback,\n InputHTMLAttributes,\n GenericEventHandler,\n TargetedInputEvent,\n TargetedKeyboardEvent,\n TargetedFocusEvent,\n TargetedEvent\n} from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../core/Errors/constants';\nimport { trimValWithOneSpace } from '../../../utils/validator-utils';\nimport Language from '../../../language';\nimport { AutocompleteValue } from './types';\nimport './FormFields.scss';\n\nexport interface InputBaseProps extends InputHTMLAttributes {\n classNameModifiers?: string[];\n isInvalid?: boolean;\n isValid?: boolean;\n readonly?: boolean;\n uniqueId?: string;\n disabled?: boolean;\n className?: string;\n placeholder?: string;\n value?: string;\n name?: string;\n checked?: boolean;\n setRef?: RefCallback<HTMLInputElement>;\n trimOnBlur?: boolean;\n i18n?: Language;\n label?: string;\n onBlurHandler?: GenericEventHandler<HTMLInputElement>;\n onFocusHandler?: GenericEventHandler<HTMLInputElement>;\n maxlength?: number | null;\n addContextualElement?: boolean;\n type?: string;\n /**\n * WCAG 2.2 autocomplete token for browser autofill.\n * Pass undefined to omit the attribute entirely.\n * @see https://www.w3.org/TR/WCAG22/#input-purposes\n */\n autocomplete: AutocompleteValue;\n}\n\nexport default function InputBase({ setRef, ...props }: Readonly<InputBaseProps>) {\n const { autoCorrect, classNameModifiers, isInvalid, isValid, readonly = null, spellcheck, type, uniqueId, disabled } = props;\n const className = props.className;\n\n /**\n * To avoid confusion with misplaced/misdirected onChange handlers - InputBase only accepts onInput, onBlur & onFocus handlers.\n * The first 2 being the means by which we expect useForm--handleChangeFor validation functionality to be applied.\n */\n if (Object.prototype.hasOwnProperty.call(props, 'onChange')) {\n console.error('Error: Form fields that rely on InputBase may not have an onChange property');\n }\n\n const handleInput = useCallback(\n (event: TargetedInputEvent<HTMLInputElement>) => {\n props.onInput?.(event);\n },\n [props.onInput]\n );\n\n /**\n * Event is fired when a key that produces a character value is pressed down.\n * ENTER keypress also triggers this event.\n *\n * TODO: 'keypress' event is deprecated\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/keypress_event\n */\n const handleKeyPress = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (props?.onKeyPress) props.onKeyPress(event);\n },\n [props?.onKeyPress]\n );\n\n /**\n * Event is fired when certain keys are pressed (keys that do not output characters):\n * Backspace, Arrow keys, Shift, Ctrl, Command, Option, Esc\n *\n * Exception: ENTER keypress triggers 'onKeyPress' AND 'onKeyUp'\n */\n const handleKeyUp = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (props?.onKeyUp) props.onKeyUp(event);\n },\n [props?.onKeyUp]\n );\n\n const handleBlur = useCallback(\n (event: TargetedFocusEvent<HTMLInputElement>) => {\n props?.onBlurHandler?.(event); // From Field component\n\n if (props.trimOnBlur) {\n const input = event.target as HTMLInputElement;\n input.value = trimValWithOneSpace(input.value);\n }\n\n props?.onBlur?.(event);\n },\n [props.onBlur, props.onBlurHandler]\n );\n\n const handleFocus = useCallback(\n (event: TargetedEvent<HTMLInputElement>) => {\n props?.onFocusHandler?.(event); // From Field component\n },\n [props.onFocusHandler]\n );\n\n const inputClassNames = classNames(\n 'adyen-checkout__input',\n [`adyen-checkout__input--${type}`],\n className,\n {\n 'adyen-checkout__input--invalid': isInvalid,\n 'adyen-checkout__input--valid': isValid\n },\n (classNameModifiers ?? []).map(m => `adyen-checkout__input--${m}`)\n );\n\n // Don't spread classNameModifiers etc to input element (it ends up as an attribute on the element itself)\n const {\n classNameModifiers: cnm,\n uniqueId: uid,\n isInvalid: iiv,\n isValid: iv,\n addContextualElement: ace,\n 'aria-describedby': ariaDescribedByProp,\n autocomplete,\n ...restProps\n } = props;\n\n const internalDescribedBy = uniqueId ? `${uniqueId}${isInvalid ? ARIA_ERROR_SUFFIX : ARIA_CONTEXT_SUFFIX}` : null;\n const extraDescribedBy = typeof ariaDescribedByProp === 'string' && ariaDescribedByProp ? ariaDescribedByProp : null;\n const mergedAriaDescribedBy = [extraDescribedBy, internalDescribedBy].filter(Boolean).join(' ') || null;\n\n return (\n <input\n id={uniqueId}\n {...restProps}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'autocomplete'\n autocomplete={autocomplete}\n aria-required={restProps.required}\n type={type}\n className={inputClassNames}\n readOnly={readonly}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'spellcheck'\n spellcheck={spellcheck}\n autoCorrect={autoCorrect}\n aria-describedby={mergedAriaDescribedBy}\n aria-invalid={isInvalid}\n onInput={handleInput}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyPress={handleKeyPress}\n disabled={disabled}\n ref={setRef}\n />\n );\n}\n\nInputBase.defaultProps = {\n type: 'text',\n classNameModifiers: []\n};\n"],"names":["InputBase","_0","setRef","props","autoCorrect","classNameModifiers","isInvalid","isValid","readonly","spellcheck","type","uniqueId","disabled","className","Object","prototype","hasOwnProperty","call","console","error","handleInput","useCallback","event","onInput","handleKeyPress","onKeyPress","handleKeyUp","onKeyUp","handleBlur","onBlurHandler","trimOnBlur","input","target","value","trimValWithOneSpace","onBlur","handleFocus","onFocusHandler","inputClassNames","classNames","map","m","cnm","uid","iiv","iv","addContextualElement","ace","ariaDescribedByProp","autocomplete","restProps","mergedAriaDescribedBy","ARIA_ERROR_SUFFIX","ARIA_CONTEXT_SUFFIX","filter","Boolean","join","h","id","aria-required","required","readOnly","aria-describedby","aria-invalid","onFocus","ref","defaultProps"],"mappings":"k8CA+Ce,SAASA,EAAUC,OAAAC,OAAEA,GAA4CD,EAAjCE,EAAAA,EAAAA,EAAAA,YAC3C,MAAMC,YAAEA,EAAWC,mBAAEA,EAAkBC,UAAEA,EAASC,QAAEA,EAAOC,SAAEA,EAAW,KAAIC,WAAEA,EAAUC,KAAEA,EAAIC,SAAEA,EAAQC,SAAEA,GAAaT,EACjHU,EAAYV,EAAMU,UAMpBC,OAAOC,UAAUC,eAAeC,KAAKd,EAAO,aAC5Ce,QAAQC,MAAM,+EAGlB,MAAMC,EAAcC,EACfC,IACGnB,IAAAA,EAAa,QAAbA,EAAAA,EAAMoB,mBAANpB,GAAAA,OAAAA,EAAgBmB,IAEpB,CAACnB,EAAMoB,UAULC,EAAiBH,EAClBC,KACOnB,aAAAA,EAAAA,EAAOsB,aAAYtB,EAAMsB,WAAWH,IAE5C,CAACnB,aAAAA,EAAAA,EAAOsB,aASNC,EAAcL,EACfC,KACOnB,aAAAA,EAAAA,EAAOwB,UAASxB,EAAMwB,QAAQL,IAEtC,CAACnB,aAAAA,EAAAA,EAAOwB,UAGNC,EAAaP,EACdC,QACGnB,EAOAA,EALA,GAFAA,iBAAAA,EAAAA,EAAO0B,qBAAP1B,IAAAA,GAAAA,EAAAA,KAAAA,EAAuBmB,GAEnBnB,EAAM2B,WAAY,CAClB,MAAMC,EAAQT,EAAMU,OACpBD,EAAME,MAAQC,EAAoBH,EAAME,MAC5C,CAEA9B,SAAa,QAAbA,EAAAA,EAAOgC,cAAPhC,IAAAA,GAAAA,OAAAA,EAAgBmB,IAEpB,CAACnB,EAAMgC,OAAQhC,EAAM0B,gBAGnBO,EAAcf,EACfC,IACGnB,IAAAA,EAAAA,iBAAAA,EAAAA,EAAOkC,sBAAPlC,IAAAA,GAAAA,EAAAA,KAAAA,EAAwBmB,IAE5B,CAACnB,EAAMkC,iBAGLC,EAAkBC,EACpB,wBACA,CAAC,0BAA0B7B,KAC3BG,EACA,CACI,iCAAkCP,EAClC,+BAAgCC,IAEnCF,QAAAA,EAAsB,IAAImC,IAAIC,GAAK,0BAA0BA,OAK9DpC,mBAAoBqC,EACpB/B,SAAUgC,EACVrC,UAAWsC,EACXrC,QAASsC,EACTC,qBAAsBC,EACtB,mBAAoBC,EAAmBC,aACvCA,GAEA9C,EADG+C,EAAAA,EACH/C,EAAAA,8EAHA,oCAOEgD,EAAwB,CAD0B,iBAAxBH,GAAoCA,EAAsBA,EAAsB,KADpFrC,EAAW,GAAGA,IAAWL,EAAY8C,EAAoBC,IAAwB,MAEvCC,OAAOC,SAASC,KAAK,MAAQ,KAEnG,OACIC,EAAC1B,QAAAA,oUAAAA,CAAAA,CACG2B,GAAI/C,GACAuC,GAAAA,CAEJD,aAAcA,EACdU,gBAAeT,EAAUU,SACzBlD,KAAMA,EACNG,UAAWyB,EACXuB,SAAUrD,EAEVC,WAAYA,EACZL,YAAaA,EACb0D,mBAAkBX,EAClBY,eAAczD,EACdiB,QAASH,EACTe,OAAQP,EACRoC,QAAS5B,EACTT,QAASD,EACTD,WAAYD,EACZZ,SAAUA,EACVqD,IAAK/D,IAGjB,CAEAF,EAAUkE,aAAe,CACrBxD,KAAM,OACNL,mBAAoB"}
@@ -1,2 +1,2 @@
1
- import{Component as e,createElement as i}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";function a(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}class n extends e{iframeOnLoad(){this.props.callback&&"function"==typeof this.props.callback&&this.props.callback(this.iframeEl.contentWindow)}componentDidMount(){this.iframeEl.addEventListener?this.iframeEl.addEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.attachEvent?this.iframeEl.attachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=this.iframeOnLoad.bind(this)}componentWillUnmount(){this.iframeEl.removeEventListener?this.iframeEl.removeEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.detachEvent?this.iframeEl.detachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=null}render({name:e,src:a,width:n,height:r,minWidth:o,minHeight:l,allow:s,title:h,classNameModifiers:m}){const d=m.filter(e=>!!e);return i("iframe",{ref:e=>{this.iframeEl=e},allow:s,className:t("adyen-checkout__iframe",`adyen-checkout__iframe--${e}`,d.length&&m.map(i=>`adyen-checkout__iframe--${e}-${i}`)),name:e,src:a,width:n,height:r,frameBorder:"0",title:h,referrerpolicy:"origin","min-width":o,"min-height":l})}constructor(...e){super(...e),a(this,"iframeEl",void 0)}}a(n,"defaultProps",{width:"0",height:"0",minWidth:"0",minHeight:"0",src:null,allow:null,title:"components iframe",classNameModifiers:[]});export{n as default};
1
+ import{Component as e,createElement as i}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";function a(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}class n extends e{iframeOnLoad(){this.props.callback&&"function"==typeof this.props.callback&&this.props.callback(this.iframeEl.contentWindow)}componentDidMount(){this.iframeEl.addEventListener?this.iframeEl.addEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.attachEvent?this.iframeEl.attachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=this.iframeOnLoad.bind(this)}componentWillUnmount(){this.iframeEl.removeEventListener?this.iframeEl.removeEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.detachEvent?this.iframeEl.detachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=null}render({name:e,src:a,width:n,height:r,minWidth:o,minHeight:s,allow:l,title:h,sandbox:m,classNameModifiers:d}){const f=d.filter(e=>!!e);return i("iframe",{ref:e=>{this.iframeEl=e},allow:l,className:t("adyen-checkout__iframe",`adyen-checkout__iframe--${e}`,f.length&&d.map(i=>`adyen-checkout__iframe--${e}-${i}`)),name:e,src:a,width:n,height:r,frameBorder:"0",title:h,referrerpolicy:"origin","min-width":o,"min-height":s,sandbox:m})}constructor(...e){super(...e),a(this,"iframeEl",void 0)}}a(n,"defaultProps",{width:"0",height:"0",minWidth:"0",minHeight:"0",src:null,allow:null,title:"components iframe",classNameModifiers:[]});export{n as default};
2
2
  //# sourceMappingURL=Iframe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Iframe.js","sources":["../../../../../src/components/internal/IFrame/Iframe.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport './Iframe.scss';\n\ninterface IframeProps {\n width?: string;\n height?: string;\n minWidth?: string;\n minHeight?: string;\n border?: string;\n src?: string;\n allow?: string;\n name?: string;\n title?: string;\n classNameModifiers?: string[];\n callback?: (contentWindow) => void;\n}\n\nclass Iframe extends Component<Readonly<IframeProps>> {\n public static readonly defaultProps = {\n width: '0',\n height: '0',\n minWidth: '0',\n minHeight: '0',\n src: null,\n allow: null,\n title: 'components iframe',\n classNameModifiers: []\n };\n\n private iframeEl;\n\n iframeOnLoad() {\n if (this.props.callback && typeof this.props.callback === 'function') {\n this.props.callback(this.iframeEl.contentWindow);\n }\n }\n\n componentDidMount() {\n if (this.iframeEl.addEventListener) {\n this.iframeEl.addEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.attachEvent) {\n // IE fallback\n this.iframeEl.attachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = this.iframeOnLoad.bind(this);\n }\n }\n\n componentWillUnmount() {\n if (this.iframeEl.removeEventListener) {\n this.iframeEl.removeEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.detachEvent) {\n // IE fallback\n this.iframeEl.detachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = null;\n }\n }\n\n render({ name, src, width, height, minWidth, minHeight, allow, title, classNameModifiers }: IframeProps) {\n const validClassNameModifiers = classNameModifiers.filter(m => !!m);\n\n return (\n <iframe\n ref={ref => {\n this.iframeEl = ref;\n }}\n allow={allow}\n className={classNames(\n 'adyen-checkout__iframe',\n `adyen-checkout__iframe--${name}`,\n validClassNameModifiers.length && classNameModifiers.map(m => `adyen-checkout__iframe--${name}-${m}`)\n )}\n name={name}\n src={src}\n width={width}\n height={height}\n frameBorder=\"0\"\n title={title}\n /* eslint-disable react/no-unknown-property */\n referrerpolicy=\"origin\"\n min-width={minWidth}\n min-height={minHeight}\n /* eslint-enable react/no-unknown-property */\n />\n );\n }\n}\n\nexport default Iframe;\n"],"names":["Iframe","Component","iframeOnLoad","this","props","callback","iframeEl","contentWindow","componentDidMount","addEventListener","bind","attachEvent","onload","componentWillUnmount","removeEventListener","detachEvent","render","name","src","width","height","minWidth","minHeight","allow","title","classNameModifiers","validClassNameModifiers","filter","m","h","iframe","ref","className","classNames","length","map","frameBorder","referrerpolicy","min-width","min-height","super","args","_define_property","defaultProps"],"mappings":"yPAkBA,MAAMA,UAAeC,EAcjBC,YAAAA,GACQC,KAAKC,MAAMC,UAA2C,mBAAxBF,KAAKC,MAAMC,UACzCF,KAAKC,MAAMC,SAASF,KAAKG,SAASC,cAE1C,CAEAC,iBAAAA,GACQL,KAAKG,SAASG,iBACdN,KAAKG,SAASG,iBAAiB,OAAQN,KAAKD,aAAaQ,KAAKP,OAAO,GAC9DA,KAAKG,SAASK,YAErBR,KAAKG,SAASK,YAAY,SAAUR,KAAKD,aAAaQ,KAAKP,OAE3DA,KAAKG,SAASM,OAAST,KAAKD,aAAaQ,KAAKP,KAEtD,CAEAU,oBAAAA,GACQV,KAAKG,SAASQ,oBACdX,KAAKG,SAASQ,oBAAoB,OAAQX,KAAKD,aAAaQ,KAAKP,OAAO,GACjEA,KAAKG,SAASS,YAErBZ,KAAKG,SAASS,YAAY,SAAUZ,KAAKD,aAAaQ,KAAKP,OAE3DA,KAAKG,SAASM,OAAS,IAE/B,CAEAI,MAAAA,EAAOC,KAAEA,EAAIC,IAAEA,EAAGC,MAAEA,EAAKC,OAAEA,EAAMC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,EAAKC,MAAEA,EAAKC,mBAAEA,IAClE,MAAMC,EAA0BD,EAAmBE,OAAOC,KAAOA,GAEjE,OACIC,EAACC,SAAAA,CACGC,IAAKA,IACD5B,KAAKG,SAAWyB,GAEpBR,MAAOA,EACPS,UAAWC,EACP,yBACA,2BAA2BhB,IAC3BS,EAAwBQ,QAAUT,EAAmBU,IAAIP,GAAK,2BAA2BX,KAAQW,MAErGX,KAAMA,EACNC,IAAKA,EACLC,MAAOA,EACPC,OAAQA,EACRgB,YAAY,IACZZ,MAAOA,EAEPa,eAAe,SACfC,YAAWjB,EACXkB,aAAYjB,GAIxB,mBArEJkB,SAAAC,GAYIC,EAAAvC,KAAQG,oBAXRoC,EADE1C,EACqB2C,eAAe,CAClCxB,MAAO,IACPC,OAAQ,IACRC,SAAU,IACVC,UAAW,IACXJ,IAAK,KACLK,MAAO,KACPC,MAAO,oBACPC,mBAAoB"}
1
+ {"version":3,"file":"Iframe.js","sources":["../../../../../src/components/internal/IFrame/Iframe.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport './Iframe.scss';\n\ninterface IframeProps {\n width?: string;\n height?: string;\n minWidth?: string;\n minHeight?: string;\n border?: string;\n src?: string;\n allow?: string;\n name?: string;\n title?: string;\n sandbox?: string;\n classNameModifiers?: string[];\n callback?: (contentWindow) => void;\n}\n\nclass Iframe extends Component<Readonly<IframeProps>> {\n public static readonly defaultProps = {\n width: '0',\n height: '0',\n minWidth: '0',\n minHeight: '0',\n src: null,\n allow: null,\n title: 'components iframe',\n classNameModifiers: []\n };\n\n private iframeEl;\n\n iframeOnLoad() {\n if (this.props.callback && typeof this.props.callback === 'function') {\n this.props.callback(this.iframeEl.contentWindow);\n }\n }\n\n componentDidMount() {\n if (this.iframeEl.addEventListener) {\n this.iframeEl.addEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.attachEvent) {\n // IE fallback\n this.iframeEl.attachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = this.iframeOnLoad.bind(this);\n }\n }\n\n componentWillUnmount() {\n if (this.iframeEl.removeEventListener) {\n this.iframeEl.removeEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.detachEvent) {\n // IE fallback\n this.iframeEl.detachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = null;\n }\n }\n\n render({ name, src, width, height, minWidth, minHeight, allow, title, sandbox, classNameModifiers }: IframeProps) {\n const validClassNameModifiers = classNameModifiers.filter(m => !!m);\n\n return (\n <iframe\n ref={ref => {\n this.iframeEl = ref;\n }}\n allow={allow}\n className={classNames(\n 'adyen-checkout__iframe',\n `adyen-checkout__iframe--${name}`,\n validClassNameModifiers.length && classNameModifiers.map(m => `adyen-checkout__iframe--${name}-${m}`)\n )}\n name={name}\n src={src}\n width={width}\n height={height}\n frameBorder=\"0\"\n title={title}\n /* eslint-disable react/no-unknown-property */\n referrerpolicy=\"origin\"\n min-width={minWidth}\n min-height={minHeight}\n sandbox={sandbox}\n /* eslint-enable react/no-unknown-property */\n />\n );\n }\n}\n\nexport default Iframe;\n"],"names":["Iframe","Component","iframeOnLoad","this","props","callback","iframeEl","contentWindow","componentDidMount","addEventListener","bind","attachEvent","onload","componentWillUnmount","removeEventListener","detachEvent","render","name","src","width","height","minWidth","minHeight","allow","title","sandbox","classNameModifiers","validClassNameModifiers","filter","m","h","iframe","ref","className","classNames","length","map","frameBorder","referrerpolicy","min-width","min-height","super","args","_define_property","defaultProps"],"mappings":"yPAmBA,MAAMA,UAAeC,EAcjBC,YAAAA,GACQC,KAAKC,MAAMC,UAA2C,mBAAxBF,KAAKC,MAAMC,UACzCF,KAAKC,MAAMC,SAASF,KAAKG,SAASC,cAE1C,CAEAC,iBAAAA,GACQL,KAAKG,SAASG,iBACdN,KAAKG,SAASG,iBAAiB,OAAQN,KAAKD,aAAaQ,KAAKP,OAAO,GAC9DA,KAAKG,SAASK,YAErBR,KAAKG,SAASK,YAAY,SAAUR,KAAKD,aAAaQ,KAAKP,OAE3DA,KAAKG,SAASM,OAAST,KAAKD,aAAaQ,KAAKP,KAEtD,CAEAU,oBAAAA,GACQV,KAAKG,SAASQ,oBACdX,KAAKG,SAASQ,oBAAoB,OAAQX,KAAKD,aAAaQ,KAAKP,OAAO,GACjEA,KAAKG,SAASS,YAErBZ,KAAKG,SAASS,YAAY,SAAUZ,KAAKD,aAAaQ,KAAKP,OAE3DA,KAAKG,SAASM,OAAS,IAE/B,CAEAI,MAAAA,EAAOC,KAAEA,EAAIC,IAAEA,EAAGC,MAAEA,EAAKC,OAAEA,EAAMC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,mBAAEA,IAC3E,MAAMC,EAA0BD,EAAmBE,OAAOC,KAAOA,GAEjE,OACIC,EAACC,SAAAA,CACGC,IAAKA,IACD7B,KAAKG,SAAW0B,GAEpBT,MAAOA,EACPU,UAAWC,EACP,yBACA,2BAA2BjB,IAC3BU,EAAwBQ,QAAUT,EAAmBU,IAAIP,GAAK,2BAA2BZ,KAAQY,MAErGZ,KAAMA,EACNC,IAAKA,EACLC,MAAOA,EACPC,OAAQA,EACRiB,YAAY,IACZb,MAAOA,EAEPc,eAAe,SACfC,YAAWlB,EACXmB,aAAYlB,EACZG,QAASA,GAIrB,mBAtEJgB,SAAAC,GAYIC,EAAAxC,KAAQG,oBAXRqC,EADE3C,EACqB4C,eAAe,CAClCzB,MAAO,IACPC,OAAQ,IACRC,SAAU,IACVC,UAAW,IACXJ,IAAK,KACLK,MAAO,KACPC,MAAO,oBACPE,mBAAoB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../_virtual/index.js";import{useModal as n}from"./useModal.js";function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function s(e,r){if(null==e)return{};var t,o,n,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(t=Reflect.ownKeys(Object(e)),n=0;n<t.length;n++)o=t[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(l[o]=e[o]);return l}if(l=function(e,r){if(null==e)return{};var t,o,n={},l=Object.getOwnPropertyNames(e);for(o=0;o<l.length;o++)t=l[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t]);return n}(e,r),Object.getOwnPropertySymbols)for(t=Object.getOwnPropertySymbols(e),n=0;n<t.length;n++)o=t[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(l[o]=e[o]);return l}const c=c=>{let{children:i,classNameModifiers:a=[],isOpen:u,onClose:f,isDismissible:d=!0,labelledBy:p,describedBy:m,focusFirst:y,focusAfterClose:b}=c,O=s(c,["children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose"]);const j=r(),{closeModal:h,handleClickOutside:w}=n({modalElement:j.current,isOpen:u,isDismissible:d,focusFirst:y,focusAfterClose:b,onClose:f});return t(()=>{if(!j.current)return;const e=e=>{"Enter"!==e.key&&"Enter"!==e.code||e.stopPropagation()};return j.current.addEventListener("keydown",e,{capture:!0}),()=>{j.current.removeEventListener("keydown",e)}},[j.current]),e("div",function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){l(e,r,t[r])})}return e}({className:o("adyen-checkout__modal-wrapper",a.map(e=>`adyen-checkout__modal-wrapper--${e}`),{"adyen-checkout__modal-wrapper--open":u}),role:"dialog","aria-labelledby":p,"aria-describedby":m,"aria-modal":"true","aria-hidden":!u,onClick:w},O),e("div",{className:"adyen-checkout__modal",ref:j},i({onCloseModal:h})))};export{c as Modal};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../_virtual/index.js";import{useModal as n}from"./useModal.js";function s(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){if(null==e)return{};var t,o,n,s={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(t=Reflect.ownKeys(Object(e)),n=0;n<t.length;n++)o=t[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o]);return s}if(s=function(e,r){if(null==e)return{};var t,o,n={},s=Object.getOwnPropertyNames(e);for(o=0;o<s.length;o++)t=s[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t]);return n}(e,r),Object.getOwnPropertySymbols)for(t=Object.getOwnPropertySymbols(e),n=0;n<t.length;n++)o=t[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o]);return s}const c=c=>{let{children:i,classNameModifiers:a=[],isOpen:u,onClose:f,isDismissible:p=!0,labelledBy:d,describedBy:m,focusFirst:y,focusAfterClose:b}=c,O=l(c,["children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose"]);const j=r(),{closeModal:h,handleClickOutside:g}=n({modalElement:j.current,isOpen:u,isDismissible:p,focusFirst:y,focusAfterClose:b,onClose:f});return t(()=>{if(!j.current)return;const e=e=>{"Enter"!==e.key&&"Enter"!==e.code||e.stopPropagation()};return j.current.addEventListener("keypress",e,{capture:!0}),()=>{j.current.removeEventListener("keypress",e)}},[j.current]),e("div",function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){s(e,r,t[r])})}return e}({className:o("adyen-checkout__modal-wrapper",a.map(e=>`adyen-checkout__modal-wrapper--${e}`),{"adyen-checkout__modal-wrapper--open":u}),role:"dialog","aria-labelledby":d,"aria-describedby":m,"aria-modal":"true","aria-hidden":!u,onClick:g},O),e("div",{className:"adyen-checkout__modal",ref:j},i({onCloseModal:h})))};export{c as Modal};
2
2
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../../src/components/internal/Modal/Modal.tsx"],"sourcesContent":["import { ComponentChildren, h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport cx from 'classnames';\nimport './Modal.scss';\nimport { useModal } from './useModal';\n\ntype ModalRenderFnProps = {\n /**\n * Function used to properly trigger the Modal close mechanism. It takes into account the element that the Modal needs\n * to set focus when it is dismissed.\n */\n onCloseModal(): void;\n};\n\ntype ModalProps = {\n children: ({ onCloseModal }: ModalRenderFnProps) => ComponentChildren;\n classNameModifiers?: string[];\n onClose(): void;\n isOpen: boolean;\n isDismissible?: boolean;\n labelledBy: string;\n describedBy: string;\n /**\n * Reference to the element that should be focused when the modal is opened\n */\n focusFirst: HTMLElement;\n /**\n * Reference to the element that should be focused when the modal is closed\n */\n focusAfterClose: HTMLElement;\n};\n\nconst Modal = ({\n children,\n classNameModifiers = [],\n isOpen,\n onClose,\n isDismissible = true,\n labelledBy,\n describedBy,\n focusFirst,\n focusAfterClose,\n ...props\n}: Readonly<ModalProps>) => {\n const modalContainerRef = useRef<HTMLDivElement>();\n const { closeModal, handleClickOutside } = useModal({\n modalElement: modalContainerRef.current,\n isOpen,\n isDismissible,\n focusFirst,\n focusAfterClose,\n onClose\n });\n\n /**\n * It shouldn't propagate ENTER key event to the parent component. This effect suppress the event propagation\n * (e.g. ENTER key press might trigger the payment flow for Card)\n */\n useEffect(() => {\n if (!modalContainerRef.current) return;\n\n const suppressKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.code === 'Enter') event.stopPropagation();\n };\n\n modalContainerRef.current.addEventListener('keydown', suppressKeyDown, { capture: true });\n return () => {\n modalContainerRef.current.removeEventListener('keydown', suppressKeyDown);\n };\n }, [modalContainerRef.current]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions\n <div\n className={cx(\n 'adyen-checkout__modal-wrapper',\n classNameModifiers.map(m => `adyen-checkout__modal-wrapper--${m}`),\n { 'adyen-checkout__modal-wrapper--open': isOpen }\n )}\n role=\"dialog\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-modal=\"true\"\n aria-hidden={!isOpen}\n onClick={handleClickOutside}\n {...props}\n >\n <div className=\"adyen-checkout__modal\" ref={modalContainerRef}>\n {children({ onCloseModal: closeModal })}\n </div>\n </div>\n );\n};\n\nexport { Modal };\n"],"names":["Modal","_0","children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose","props","modalContainerRef","useRef","closeModal","handleClickOutside","useModal","modalElement","current","useEffect","suppressKeyDown","event","key","code","stopPropagation","addEventListener","capture","removeEventListener","h","div","className","cx","map","m","role","aria-labelledby","aria-describedby","aria-modal","aria-hidden","onClick","ref","onCloseModal"],"mappings":"i+BAgCA,MAAMA,EAAQC,QAACC,SACXA,EAAQC,mBACRA,EAAqB,GAAEC,OACvBA,EAAMC,QACNA,EAAOC,cACPA,GAAgB,EAAIC,WACpBA,EAAUC,YACVA,EAAWC,WACXA,EAAUC,gBACVA,GAEmBT,EADhBU,EAAAA,EAAAA,EAAAA,gIAEH,MAAMC,EAAoBC,KACpBC,WAAEA,EAAUC,mBAAEA,GAAuBC,EAAS,CAChDC,aAAcL,EAAkBM,QAChCd,SACAE,gBACAG,aACAC,kBACAL,YAoBJ,OAbAc,EAAU,KACN,IAAKP,EAAkBM,QAAS,OAEhC,MAAME,EAAmBC,IACH,UAAdA,EAAMC,KAAkC,UAAfD,EAAME,MAAkBF,EAAMG,mBAI/D,OADAZ,EAAkBM,QAAQO,iBAAiB,UAAWL,EAAiB,CAAEM,SAAS,IAC3E,KACHd,EAAkBM,QAAQS,oBAAoB,UAAWP,KAE9D,CAACR,EAAkBM,UAIlBU,EAACC,wUAAAA,CAAAA,CACGC,UAAWC,EACP,gCACA5B,EAAmB6B,IAAIC,GAAK,kCAAkCA,KAC9D,CAAE,sCAAuC7B,IAE7C8B,KAAK,SACLC,kBAAiB5B,EACjB6B,mBAAkB5B,EAClB6B,aAAW,OACXC,eAAclC,EACdmC,QAASxB,GACLJ,GAEJiB,EAACC,MAAAA,CAAIC,UAAU,wBAAwBU,IAAK5B,GACvCV,EAAS,CAAEuC,aAAc3B"}
1
+ {"version":3,"file":"Modal.js","sources":["../../../../../src/components/internal/Modal/Modal.tsx"],"sourcesContent":["import { ComponentChildren, h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport cx from 'classnames';\nimport './Modal.scss';\nimport { useModal } from './useModal';\n\ntype ModalRenderFnProps = {\n /**\n * Function used to properly trigger the Modal close mechanism. It takes into account the element that the Modal needs\n * to set focus when it is dismissed.\n */\n onCloseModal(): void;\n};\n\ntype ModalProps = {\n children: ({ onCloseModal }: ModalRenderFnProps) => ComponentChildren;\n classNameModifiers?: string[];\n onClose(): void;\n isOpen: boolean;\n isDismissible?: boolean;\n labelledBy: string;\n describedBy: string;\n /**\n * Reference to the element that should be focused when the modal is opened\n */\n focusFirst: HTMLElement;\n /**\n * Reference to the element that should be focused when the modal is closed\n */\n focusAfterClose: HTMLElement;\n};\n\nconst Modal = ({\n children,\n classNameModifiers = [],\n isOpen,\n onClose,\n isDismissible = true,\n labelledBy,\n describedBy,\n focusFirst,\n focusAfterClose,\n ...props\n}: Readonly<ModalProps>) => {\n const modalContainerRef = useRef<HTMLDivElement>();\n const { closeModal, handleClickOutside } = useModal({\n modalElement: modalContainerRef.current,\n isOpen,\n isDismissible,\n focusFirst,\n focusAfterClose,\n onClose\n });\n\n /**\n * It shouldn't propagate ENTER key event to the parent component. This effect suppress the event propagation\n * (e.g. ENTER key press might trigger the payment flow for Card)\n */\n useEffect(() => {\n if (!modalContainerRef.current) return;\n\n const suppressKeyPress = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.code === 'Enter') event.stopPropagation();\n };\n\n modalContainerRef.current.addEventListener('keypress', suppressKeyPress, { capture: true });\n return () => {\n modalContainerRef.current.removeEventListener('keypress', suppressKeyPress);\n };\n }, [modalContainerRef.current]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions\n <div\n className={cx(\n 'adyen-checkout__modal-wrapper',\n classNameModifiers.map(m => `adyen-checkout__modal-wrapper--${m}`),\n { 'adyen-checkout__modal-wrapper--open': isOpen }\n )}\n role=\"dialog\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-modal=\"true\"\n aria-hidden={!isOpen}\n onClick={handleClickOutside}\n {...props}\n >\n <div className=\"adyen-checkout__modal\" ref={modalContainerRef}>\n {children({ onCloseModal: closeModal })}\n </div>\n </div>\n );\n};\n\nexport { Modal };\n"],"names":["Modal","_0","children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose","props","modalContainerRef","useRef","closeModal","handleClickOutside","useModal","modalElement","current","useEffect","suppressKeyPress","event","key","code","stopPropagation","addEventListener","capture","removeEventListener","h","div","className","cx","map","m","role","aria-labelledby","aria-describedby","aria-modal","aria-hidden","onClick","ref","onCloseModal"],"mappings":"i+BAgCA,MAAMA,EAAQC,QAACC,SACXA,EAAQC,mBACRA,EAAqB,GAAEC,OACvBA,EAAMC,QACNA,EAAOC,cACPA,GAAgB,EAAIC,WACpBA,EAAUC,YACVA,EAAWC,WACXA,EAAUC,gBACVA,GAEmBT,EADhBU,EAAAA,EAAAA,EAAAA,gIAEH,MAAMC,EAAoBC,KACpBC,WAAEA,EAAUC,mBAAEA,GAAuBC,EAAS,CAChDC,aAAcL,EAAkBM,QAChCd,SACAE,gBACAG,aACAC,kBACAL,YAoBJ,OAbAc,EAAU,KACN,IAAKP,EAAkBM,QAAS,OAEhC,MAAME,EAAoBC,IACJ,UAAdA,EAAMC,KAAkC,UAAfD,EAAME,MAAkBF,EAAMG,mBAI/D,OADAZ,EAAkBM,QAAQO,iBAAiB,WAAYL,EAAkB,CAAEM,SAAS,IAC7E,KACHd,EAAkBM,QAAQS,oBAAoB,WAAYP,KAE/D,CAACR,EAAkBM,UAIlBU,EAACC,wUAAAA,CAAAA,CACGC,UAAWC,EACP,gCACA5B,EAAmB6B,IAAIC,GAAK,kCAAkCA,KAC9D,CAAE,sCAAuC7B,IAE7C8B,KAAK,SACLC,kBAAiB5B,EACjB6B,mBAAkB5B,EAClB6B,aAAW,OACXC,eAAclC,EACdmC,QAASxB,GACLJ,GAEJiB,EAACC,MAAAA,CAAIC,UAAU,wBAAwBU,IAAK5B,GACvCV,EAAS,CAAEuC,aAAc3B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useState as s,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import n from"../CompanyDetails/CompanyDetails.js";import i from"../PersonalDetails/PersonalDetails.js";import a from"../Address/Address.js";import l from"../FormFields/Checkbox/Checkbox.js";import d from"../FormFields/ConsentCheckbox/ConsentCheckbox.js";import{getInitialActiveFieldsets as c,fieldsetsSchema as u,getActiveFieldsData as b}from"./utils.js";import p from"../IbanInput/IbanInput.js";import m from"../FormFields/Field/Field.js";import y from"../FormInstruction/FormInstruction.js";import f from"./useSRPanelForOpenInvoiceErrors.js";import v from"../../../_virtual/index.js";function h(e,r,s){return r in e?Object.defineProperty(e,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[r]=s,e}function C(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{},o=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),o.forEach(function(r){h(e,r,s[r])})}return e}function g(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r.push.apply(r,s)}return r}(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))}),e}const A={isValid:!1,errorMessage:"consent.checkbox.invalid",error:"consent.checkbox.invalid"};function k(h){var k,j,D,O;const{countryCode:x,visibility:w}=h,{i18n:F}=t(),P=r({});var S;Object.keys(P.current).length||(null===(S=h.setComponentRef)||void 0===S||S.call(h,P.current));const R=r(!1),E=c(w,h.data),[I,q]=s(E),{current:V}=r(u.reduce((e,r)=>(e[r]=e=>{V[r].current=e},e),{})),M=!!h.consentCheckboxLabel,N=!M&&Object.keys(I).every(e=>!I[e]),_="editable"===w.deliveryAddress&&"hidden"!==w.billingAddress,[L,B]=s(C({},h.data,M&&{consentCheckbox:!1})),[z,G]=s({}),[H,J]=s({}),[K,Q]=s("ready");P.current.showValidation=()=>{R.current=!0,u.forEach(e=>{V[e].current&&V[e].current.showValidation()}),G(C({},M&&{consentCheckbox:L.consentCheckbox?null:A}))},P.current.setStatus=Q,f({errors:z,data:L,props:h,isValidating:R}),o(()=>{const e=Object.keys(I).every(e=>!I[e]||!!H[e]),r=!M||!!H.consentCheckbox,s=e&&r,o=b(I,L);h.onChange({data:o,errors:z,valid:H,isValid:s})},[L,I]);const T=e=>r=>{B(s=>g(C({},s),{[e]:r.data})),J(s=>g(C({},s),{[e]:r.isValid})),G(s=>g(C({},s),{[e]:r.errors}))};return e("div",{className:v({"adyen-checkout__open-invoice":!0,"adyen-checkout__open-invoice--loading":"loading"===K})},e(y,null),I.companyDetails&&e(n,{data:h.data.companyDetails,label:"companyDetails",onChange:T("companyDetails"),setComponentRef:V.companyDetails,visibility:w.companyDetails}),I.personalDetails&&e(i,{data:h.data.personalDetails,requiredFields:h.personalDetailsRequiredFields,label:"personalDetails",onChange:T("personalDetails"),setComponentRef:V.personalDetails,visibility:w.personalDetails}),I.bankAccount&&e(p,{holderName:!0,label:"ach.bankAccount",data:L.bankAccount,onChange:T("bankAccount"),ref:V.bankAccount}),I.billingAddress&&e(a,{allowedCountries:null!==(k=null==h||null===(D=h.billingAddressSpecification)||void 0===D?void 0:D.allowedCountries)&&void 0!==k?k:h.allowedCountries,countryCode:x,requiredFields:h.billingAddressRequiredFields,specifications:h.billingAddressSpecification,data:L.billingAddress,label:"billingAddress",onChange:T("billingAddress"),setComponentRef:V.billingAddress,visibility:w.billingAddress}),_&&e(m,{classNameModifiers:["separateDeliveryAddress","consentCheckbox"],name:"separateDeliveryAddress",useLabelElement:!1,showErrorElement:!1},e(l,{label:F.get("separateDeliveryAddress"),checked:I.deliveryAddress,classNameModifiers:["separateDeliveryAddress"],name:"separateDeliveryAddress",onChange:()=>{q(e=>g(C({},e),{deliveryAddress:!I.deliveryAddress}))}})),I.deliveryAddress&&e(a,{allowedCountries:null!==(j=null==h||null===(O=h.deliveryAddressSpecification)||void 0===O?void 0:O.allowedCountries)&&void 0!==j?j:h.allowedCountries,countryCode:x,requiredFields:h.deliveryAddressRequiredFields,specifications:h.deliveryAddressSpecification,data:L.deliveryAddress,label:"deliveryAddress",onChange:T("deliveryAddress"),setComponentRef:V.deliveryAddress,visibility:w.deliveryAddress}),M&&e(d,{data:L,errorMessage:!!z.consentCheckbox,label:h.consentCheckboxLabel,onChange:e=>{const{checked:r}=e.target;B(e=>g(C({},e),{consentCheckbox:r})),J(e=>g(C({},e),{consentCheckbox:r})),G(e=>C({},e,{consentCheckbox:r?null:A}))},i18n:F}),h.showPayButton&&h.payButton({status:K,classNameModifiers:[...N?["standalone"]:[]],label:F.get("confirmPurchase")}))}export{k as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useState as s,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import n from"../CompanyDetails/CompanyDetails.js";import i from"../PersonalDetails/PersonalDetails.js";import a from"../Address/Address.js";import l from"../FormFields/Checkbox/Checkbox.js";import d from"../FormFields/ConsentCheckbox/ConsentCheckbox.js";import{getInitialActiveFieldsets as c,fieldsetsSchema as u,getActiveFieldsData as b}from"./utils.js";import p from"../IbanInput/IbanInput.js";import m from"../FormFields/Field/Field.js";import y from"../FormInstruction/FormInstruction.js";import f from"./useSRPanelForOpenInvoiceErrors.js";import v from"../../../_virtual/index.js";function h(e,r,s){return r in e?Object.defineProperty(e,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[r]=s,e}function C(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{},o=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),o.forEach(function(r){h(e,r,s[r])})}return e}function g(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r.push.apply(r,s)}return r}(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))}),e}const A={isValid:!1,errorMessage:"consent.checkbox.invalid",error:"consent.checkbox.invalid"};function k(h){var k,j,D,O;const{countryCode:x,visibility:w}=h,{i18n:F}=t(),P=r({});var R;Object.keys(P.current).length||(null===(R=h.setComponentRef)||void 0===R||R.call(h,P.current));const S=r(!1),E=r(null),I=c(w,h.data),[q,V]=s(I),{current:M}=r(u.reduce((e,r)=>(e[r]=e=>{M[r].current=e},e),{})),N=!!h.consentCheckboxLabel,_=!N&&Object.keys(q).every(e=>!q[e]),L="editable"===w.deliveryAddress&&"hidden"!==w.billingAddress,[B,z]=s(C({},h.data,N&&{consentCheckbox:!1})),[G,H]=s({}),[J,K]=s({}),[Q,T]=s("ready");P.current.showValidation=()=>{S.current=!0,u.forEach(e=>{M[e].current&&M[e].current.showValidation()}),H(C({},N&&{consentCheckbox:B.consentCheckbox?null:A}))},P.current.setStatus=T,f({errors:G,data:B,props:h,isValidating:S,containerRef:E}),o(()=>{const e=Object.keys(q).every(e=>!q[e]||!!J[e]),r=!N||!!J.consentCheckbox,s=e&&r,o=b(q,B);h.onChange({data:o,errors:G,valid:J,isValid:s})},[B,q]);const U=e=>r=>{z(s=>g(C({},s),{[e]:r.data})),K(s=>g(C({},s),{[e]:r.isValid})),H(s=>g(C({},s),{[e]:r.errors}))};return e("div",{ref:E,className:v({"adyen-checkout__open-invoice":!0,"adyen-checkout__open-invoice--loading":"loading"===Q})},e(y,null),q.companyDetails&&e(n,{data:h.data.companyDetails,label:"companyDetails",onChange:U("companyDetails"),setComponentRef:M.companyDetails,visibility:w.companyDetails}),q.personalDetails&&e(i,{data:h.data.personalDetails,requiredFields:h.personalDetailsRequiredFields,label:"personalDetails",onChange:U("personalDetails"),setComponentRef:M.personalDetails,visibility:w.personalDetails}),q.bankAccount&&e(p,{holderName:!0,label:"ach.bankAccount",data:B.bankAccount,onChange:U("bankAccount"),ref:M.bankAccount}),q.billingAddress&&e(a,{allowedCountries:null!==(k=null==h||null===(D=h.billingAddressSpecification)||void 0===D?void 0:D.allowedCountries)&&void 0!==k?k:h.allowedCountries,countryCode:x,requiredFields:h.billingAddressRequiredFields,specifications:h.billingAddressSpecification,data:B.billingAddress,label:"billingAddress",onChange:U("billingAddress"),setComponentRef:M.billingAddress,visibility:w.billingAddress}),L&&e(m,{classNameModifiers:["separateDeliveryAddress","consentCheckbox"],name:"separateDeliveryAddress",useLabelElement:!1,showErrorElement:!1},e(l,{label:F.get("separateDeliveryAddress"),checked:q.deliveryAddress,classNameModifiers:["separateDeliveryAddress"],name:"separateDeliveryAddress",onChange:()=>{V(e=>g(C({},e),{deliveryAddress:!q.deliveryAddress}))}})),q.deliveryAddress&&e(a,{allowedCountries:null!==(j=null==h||null===(O=h.deliveryAddressSpecification)||void 0===O?void 0:O.allowedCountries)&&void 0!==j?j:h.allowedCountries,countryCode:x,requiredFields:h.deliveryAddressRequiredFields,specifications:h.deliveryAddressSpecification,data:B.deliveryAddress,label:"deliveryAddress",onChange:U("deliveryAddress"),setComponentRef:M.deliveryAddress,visibility:w.deliveryAddress}),N&&e(d,{data:B,errorMessage:!!G.consentCheckbox,label:h.consentCheckboxLabel,onChange:e=>{const{checked:r}=e.target;z(e=>g(C({},e),{consentCheckbox:r})),K(e=>g(C({},e),{consentCheckbox:r})),H(e=>C({},e,{consentCheckbox:r?null:A}))},i18n:F}),h.showPayButton&&h.payButton({status:Q,classNameModifiers:[..._?["standalone"]:[]],label:F.get("confirmPurchase")}))}export{k as default};
2
2
  //# sourceMappingURL=OpenInvoice.js.map