@adyen/adyen-web 6.40.2 → 6.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) 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 +49 -41
  4. package/dist/es/components/ANCV/ANCV.js +1 -1
  5. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  6. package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
  7. package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
  8. package/dist/es/components/Card/Card.js +1 -1
  9. package/dist/es/components/Card/Card.js.map +1 -1
  10. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  11. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  12. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  13. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  14. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  15. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  16. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  17. package/dist/es/components/Dropin/Dropin.js +1 -1
  18. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  19. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  20. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  21. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  22. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  23. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  24. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  25. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  26. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  27. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  28. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  29. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  30. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  31. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  32. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  33. package/dist/es/components/Giftcard/components/GiftcardPinField.js +1 -1
  34. package/dist/es/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  35. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  36. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  37. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  38. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  39. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  40. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  41. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  42. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  43. package/dist/es/components/internal/Button/Button.js +1 -1
  44. package/dist/es/components/internal/Button/Button.js.map +1 -1
  45. package/dist/es/components/internal/Button/CopyButton.js +1 -1
  46. package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
  47. package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
  48. package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
  49. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  50. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  51. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  52. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  53. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  54. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  55. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  56. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  57. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  58. package/dist/es/components/internal/Modal/Modal.js +1 -1
  59. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  60. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  61. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  62. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  63. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  64. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  65. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  66. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  67. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  68. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  69. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  70. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  71. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  72. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  73. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  74. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  75. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  76. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  77. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  78. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  79. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  80. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  81. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  82. package/dist/es/core/config.js +1 -1
  83. package/dist/es/index.d.ts +49 -41
  84. package/dist/es/utils/commonUtils.js +1 -1
  85. package/dist/es/utils/commonUtils.js.map +1 -1
  86. package/dist/es/utils/promiseTimeout.js.map +1 -1
  87. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  88. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  89. package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
  90. package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
  91. package/dist/es-legacy/components/Card/Card.js +1 -1
  92. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  93. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  94. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  95. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  96. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  97. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  98. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  99. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  100. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  101. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  102. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  103. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  104. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  105. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  106. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  107. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  108. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  109. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  110. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  111. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  112. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  113. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  114. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  115. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  116. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js +1 -1
  117. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  118. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  119. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  120. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  121. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  122. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  123. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  124. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  125. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  126. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  127. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  128. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  129. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  130. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  131. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  132. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  133. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  134. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  135. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  136. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  137. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  138. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  139. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  140. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  141. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  142. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  143. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  144. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  145. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  146. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  147. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  148. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  149. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  150. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  151. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  152. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  153. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  154. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  155. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  156. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  157. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  158. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  159. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  160. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  161. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  162. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  163. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  164. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  165. package/dist/es-legacy/core/config.js +1 -1
  166. package/dist/es-legacy/utils/commonUtils.js +1 -1
  167. package/dist/es-legacy/utils/commonUtils.js.map +1 -1
  168. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  169. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h, TargetedMouseEvent } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps, ButtonState } from './types';\nimport './Button.scss';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static readonly defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self'\n };\n\n public onClick = (e: TargetedMouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick?.(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1_000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n private readonly buttonStatusSRLabel = (status: string): string => {\n const srLabels: Record<string, string> = {\n loading: 'loading',\n redirect: 'payButton.redirecting'\n };\n\n return srLabels[status] || '';\n };\n\n render() {\n const {\n id,\n classNameModifiers = [],\n disabled,\n href,\n icon,\n onClickCompletedIcon,\n inline,\n label,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ariaExpanded,\n ariaControls,\n status,\n variant,\n buttonRef,\n onClickCompletedLabel,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyPress\n }: ButtonProps = this.props;\n const { completed } = this.state;\n const { i18n } = useCoreContext();\n\n const buttonIcon =\n onClickCompletedIcon || icon ? (\n <img\n className=\"adyen-checkout__button__icon\"\n src={this.state.completed ? (onClickCompletedIcon ?? icon) : icon}\n alt=\"\"\n aria-hidden=\"true\"\n />\n ) : (\n ''\n );\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant === 'primary' ? [] : [variant]),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n </span>\n ),\n redirect: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{this.state.completed ? (onClickCompletedLabel ?? label) : label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a\n className={buttonClasses}\n href={href}\n target={this.props.target}\n rel={this.props.rel}\n aria-disabled={disabled}\n onClick={(e: TargetedMouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n e.preventDefault();\n }\n }}\n >\n {buttonText}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n id={id}\n className={buttonClasses}\n type=\"button\"\n disabled={disabled}\n onClick={this.onClick}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyPress={onKeyPress}\n >\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n <span role=\"status\" aria-live=\"polite\" className=\"adyen-checkout__button__text--sr-only\">\n {i18n.get(this.buttonStatusSRLabel(status))}\n </span>\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","render","id","classNameModifiers","disabled","href","icon","onClickCompletedIcon","inline","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaExpanded","ariaControls","status","variant","buttonRef","onClickCompletedLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","onKeyDown","onKeyPress","this","props","completed","state","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","redirect","get","default","buttonText","a","target","rel","aria-disabled","onClick","e","preventDefault","button","ref","type","aria-label","aria-labelledby","aria-describedby","aria-expanded","aria-controls","children","role","aria-live","buttonStatusSRLabel","super","args","_define_property","_this_props_onClick","_this_props","call","complete","delay","setState","setTimeout","defaultProps"],"mappings":"qWAOA,MAAMA,UAAeC,EAkCjBC,MAAAA,GACI,MAAMC,GACFA,EAAEC,mBACFA,EAAqB,GAAEC,SACvBA,EAAQC,KACRA,EAAIC,KACJA,EAAIC,qBACJA,EAAoBC,OACpBA,EAAMC,MACNA,EAAKC,UACLA,EAASC,eACTA,EAAcC,gBACdA,EAAeC,aACfA,EAAYC,aACZA,EAAYC,OACZA,EAAMC,QACNA,EAAOC,UACPA,EAASC,sBACTA,EAAqBC,aACrBA,EAAYC,aACZA,EAAYC,QACZA,EAAOC,OACPA,EAAMC,UACNA,EAASC,WACTA,GACaC,KAAKC,OAChBC,UAAEA,GAAcF,KAAKG,OACrBC,KAAEA,GAASC,IAEXC,EACFxB,GAAwBD,EACpB0B,EAACC,MAAAA,CACGC,UAAU,+BACVC,IAAKV,KAAKG,MAAMD,WAAapB,QAAAA,EAAgCD,EAC7D8B,IAAI,GACJC,cAAY,SAGhB,GAGFC,EAAY,IACXnC,KACa,YAAZa,EAAwB,GAAK,CAACA,MAC9BR,EAAS,CAAC,UAAY,MACtBmB,EAAY,CAAC,aAAe,MACjB,YAAXZ,GAAmC,aAAXA,EAAwB,CAAC,WAAa,IAGhEwB,EAAgBC,EAAW,CAAC,4BAA6BF,EAAUG,IAAIC,GAAK,2BAA2BA,OAEvGC,EAAe,CACjBC,QACIZ,EAACa,OAAAA,CAAKR,cAAY,OAAOH,UAAU,mCAC/BF,EAACc,EAAAA,CAAQC,KAAK,SAASvC,QAAAA,KAG/BwC,SACIhB,EAACa,OAAAA,CAAKR,cAAY,OAAOH,UAAU,mCAC/BF,EAACc,EAAAA,CAAQC,KAAK,SAASvC,QAAAA,IACtBqB,EAAKoB,IAAI,0BAGlBC,QACIlB,EAACa,OAAAA,CAAKX,UAAU,mCACXH,EACDC,EAACa,OAAAA,CAAKX,UAAU,gCAAgCT,KAAKG,MAAMD,WAAaT,QAAAA,EAAkCT,KAKhH0C,EAAaR,EAAa5B,IAAW4B,EAAaO,QAExD,OAAI7C,EAEI2B,EAACoB,IAAAA,CACGlB,UAAWK,EACXlC,KAAMA,EACNgD,OAAQ5B,KAAKC,MAAM2B,OACnBC,IAAK7B,KAAKC,MAAM4B,IAChBC,gBAAenD,EACfoD,QAAUC,IACFrD,GACAqD,EAAEC,mBAITP,GAMTnB,EAAC2B,SAAAA,CACGC,IAAK3C,EACLf,GAAIA,EACJgC,UAAWK,EACXsB,KAAK,SACLzD,SAAUA,EACVoD,QAAS/B,KAAK+B,QACdM,aAAYpD,EACZqD,kBAAiBpD,EACjBqD,mBAAkBpD,EAClBqD,gBAAepD,EACfqD,gBAAepD,EACfK,aAAcA,EACdC,aAAcA,EACdG,UAAWA,EACXF,QAASA,EACTC,OAAQA,EACRE,WAAYA,GAEX2B,EACW,YAAXpC,GAAmC,aAAXA,GAAyBU,KAAKC,MAAMyC,SAC7DnC,EAACa,OAAAA,CAAKuB,KAAK,SAASC,YAAU,SAASnC,UAAU,yCAC5CL,EAAKoB,IAAIxB,KAAK6C,oBAAoBvD,KAInD,mBAzJJwD,SAAAC,GAUIC,EAAAhD,KAAO+B,UAAWC,QAIViB,EAAAC,GAHJlB,EAAEC,iBAEGjC,KAAKC,MAAMtB,YACM,QAAlBsE,GAAAC,EAAAlD,KAAKC,OAAM8B,eAAX,IAAAkB,GAAAA,EAAAE,KAAAD,EAAqBlB,EAAG,CAAEoB,SAAUpD,KAAKoD,cAIjDJ,EAAAhD,KAAOoD,WAAW,CAACC,EAAQ,OACvBrD,KAAKsD,SAAS,CAAEpD,WAAW,IAC3BqD,WAAW,KACPvD,KAAKsD,SAAS,CAAEpD,WAAW,KAC5BmD,KAGPL,EAAAhD,KAAiB6C,sBAAuBvD,IACK,CACrC6B,QAAS,UACTI,SAAU,yBAGEjC,IAAW,MA9B/B0D,EADE1E,EACqBkF,eAAe,CAClClE,OAAQ,UACRC,QAAS,UACTZ,UAAU,EACVK,MAAO,GACPD,QAAQ,EACR6C,OAAQ"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h, TargetedMouseEvent } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps, ButtonState } from './types';\nimport './Button.scss';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static readonly defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self'\n };\n\n public onClick = (e: TargetedMouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick?.(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1_000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n private readonly buttonStatusSRLabel = (status: string): string => {\n const srLabels: Record<string, string> = {\n loading: 'loading',\n redirect: 'payButton.redirecting'\n };\n\n return srLabels[status] || '';\n };\n\n render() {\n const {\n id,\n classNameModifiers = [],\n disabled,\n href,\n icon,\n onClickCompletedIcon,\n inline,\n label,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ariaExpanded,\n ariaControls,\n status,\n variant,\n buttonRef,\n onClickCompletedLabel,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown\n }: ButtonProps = this.props;\n const { completed } = this.state;\n const { i18n } = useCoreContext();\n\n const buttonIcon =\n onClickCompletedIcon || icon ? (\n <img\n className=\"adyen-checkout__button__icon\"\n src={this.state.completed ? (onClickCompletedIcon ?? icon) : icon}\n alt=\"\"\n aria-hidden=\"true\"\n />\n ) : (\n ''\n );\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant === 'primary' ? [] : [variant]),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n </span>\n ),\n redirect: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{this.state.completed ? (onClickCompletedLabel ?? label) : label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a\n className={buttonClasses}\n href={href}\n target={this.props.target}\n rel={this.props.rel}\n aria-disabled={disabled}\n onClick={(e: TargetedMouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n e.preventDefault();\n }\n }}\n >\n {buttonText}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n id={id}\n className={buttonClasses}\n type=\"button\"\n disabled={disabled}\n onClick={this.onClick}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n >\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n <span role=\"status\" aria-live=\"polite\" className=\"adyen-checkout__button__text--sr-only\">\n {i18n.get(this.buttonStatusSRLabel(status))}\n </span>\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","render","id","classNameModifiers","disabled","href","icon","onClickCompletedIcon","inline","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaExpanded","ariaControls","status","variant","buttonRef","onClickCompletedLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","onKeyDown","this","props","completed","state","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","redirect","get","default","buttonText","a","target","rel","aria-disabled","onClick","e","preventDefault","button","ref","type","aria-label","aria-labelledby","aria-describedby","aria-expanded","aria-controls","children","role","aria-live","buttonStatusSRLabel","super","args","_define_property","_this_props_onClick","_this_props","call","complete","delay","setState","setTimeout","defaultProps"],"mappings":"qWAOA,MAAMA,UAAeC,EAkCjBC,MAAAA,GACI,MAAMC,GACFA,EAAEC,mBACFA,EAAqB,GAAEC,SACvBA,EAAQC,KACRA,EAAIC,KACJA,EAAIC,qBACJA,EAAoBC,OACpBA,EAAMC,MACNA,EAAKC,UACLA,EAASC,eACTA,EAAcC,gBACdA,EAAeC,aACfA,EAAYC,aACZA,EAAYC,OACZA,EAAMC,QACNA,EAAOC,UACPA,EAASC,sBACTA,EAAqBC,aACrBA,EAAYC,aACZA,EAAYC,QACZA,EAAOC,OACPA,EAAMC,UACNA,GACaC,KAAKC,OAChBC,UAAEA,GAAcF,KAAKG,OACrBC,KAAEA,GAASC,IAEXC,EACFvB,GAAwBD,EACpByB,EAACC,MAAAA,CACGC,UAAU,+BACVC,IAAKV,KAAKG,MAAMD,WAAanB,QAAAA,EAAgCD,EAC7D6B,IAAI,GACJC,cAAY,SAGhB,GAGFC,EAAY,IACXlC,KACa,YAAZa,EAAwB,GAAK,CAACA,MAC9BR,EAAS,CAAC,UAAY,MACtBkB,EAAY,CAAC,aAAe,MACjB,YAAXX,GAAmC,aAAXA,EAAwB,CAAC,WAAa,IAGhEuB,EAAgBC,EAAW,CAAC,4BAA6BF,EAAUG,IAAIC,GAAK,2BAA2BA,OAEvGC,EAAe,CACjBC,QACIZ,EAACa,OAAAA,CAAKR,cAAY,OAAOH,UAAU,mCAC/BF,EAACc,EAAAA,CAAQC,KAAK,SAAStC,QAAAA,KAG/BuC,SACIhB,EAACa,OAAAA,CAAKR,cAAY,OAAOH,UAAU,mCAC/BF,EAACc,EAAAA,CAAQC,KAAK,SAAStC,QAAAA,IACtBoB,EAAKoB,IAAI,0BAGlBC,QACIlB,EAACa,OAAAA,CAAKX,UAAU,mCACXH,EACDC,EAACa,OAAAA,CAAKX,UAAU,gCAAgCT,KAAKG,MAAMD,WAAaR,QAAAA,EAAkCT,KAKhHyC,EAAaR,EAAa3B,IAAW2B,EAAaO,QAExD,OAAI5C,EAEI0B,EAACoB,IAAAA,CACGlB,UAAWK,EACXjC,KAAMA,EACN+C,OAAQ5B,KAAKC,MAAM2B,OACnBC,IAAK7B,KAAKC,MAAM4B,IAChBC,gBAAelD,EACfmD,QAAUC,IACFpD,GACAoD,EAAEC,mBAITP,GAMTnB,EAAC2B,SAAAA,CACGC,IAAK1C,EACLf,GAAIA,EACJ+B,UAAWK,EACXsB,KAAK,SACLxD,SAAUA,EACVmD,QAAS/B,KAAK+B,QACdM,aAAYnD,EACZoD,kBAAiBnD,EACjBoD,mBAAkBnD,EAClBoD,gBAAenD,EACfoD,gBAAenD,EACfK,aAAcA,EACdC,aAAcA,EACdG,UAAWA,EACXF,QAASA,EACTC,OAAQA,GAEP4B,EACW,YAAXnC,GAAmC,aAAXA,GAAyBS,KAAKC,MAAMyC,SAC7DnC,EAACa,OAAAA,CAAKuB,KAAK,SAASC,YAAU,SAASnC,UAAU,yCAC5CL,EAAKoB,IAAIxB,KAAK6C,oBAAoBtD,KAInD,mBAvJJuD,SAAAC,GAUIC,EAAAhD,KAAO+B,UAAWC,QAIViB,EAAAC,GAHJlB,EAAEC,iBAEGjC,KAAKC,MAAMrB,YACM,QAAlBqE,GAAAC,EAAAlD,KAAKC,OAAM8B,eAAX,IAAAkB,GAAAA,EAAAE,KAAAD,EAAqBlB,EAAG,CAAEoB,SAAUpD,KAAKoD,cAIjDJ,EAAAhD,KAAOoD,WAAW,CAACC,EAAQ,OACvBrD,KAAKsD,SAAS,CAAEpD,WAAW,IAC3BqD,WAAW,KACPvD,KAAKsD,SAAS,CAAEpD,WAAW,KAC5BmD,KAGPL,EAAAhD,KAAiB6C,sBAAuBtD,IACK,CACrC4B,QAAS,UACTI,SAAU,yBAGEhC,IAAW,MA9B/ByD,EADEzE,EACqBiF,eAAe,CAClCjE,OAAQ,UACRC,QAAS,UACTZ,UAAU,EACVK,MAAO,GACPD,QAAQ,EACR4C,OAAQ"}
@@ -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 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};
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};
2
2
  //# sourceMappingURL=CopyButton.js.map
@@ -1 +1 @@
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
+ {"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,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 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};
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};
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 './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
+ {"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 +1 @@
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
+ {"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,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"),onKeyPress: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"),onKeyDown: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 } 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
+ {"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,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: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};
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};
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 } 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
+ {"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,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 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};
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};
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 } 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
+ {"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,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 u(u){let{setRef:c}=u,s=i(u,["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]),P=t(e=>{(null==s?void 0:s.onKeyPress)&&s.onKeyPress(e)},[null==s?void 0:s.onKeyPress]),w=t(e=>{(null==s?void 0:s.onKeyUp)&&s.onKeyUp(e)},[null==s?void 0:s.onKeyUp]),I=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]),k=t(e=>{var t;null==s||null===(t=s.onFocusHandler)||void 0===t||t.call(s,e)},[s.onFocusHandler]),_=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:x,uniqueId:E,isInvalid:K,isValid:B,addContextualElement:C,"aria-describedby":N,autocomplete:S}=s,q=i(s,["classNameModifiers","uniqueId","isInvalid","isValid","addContextualElement","aria-describedby","autocomplete"]),R=["string"==typeof N&&N?N: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},q),{autocomplete:S,"aria-required":q.required,type:m,className:_,readOnly:b,spellcheck:O,autoCorrect:p,"aria-describedby":R,"aria-invalid":y,onInput:h,onBlur:I,onFocus:k,onKeyUp:w,onKeyPress:P,disabled:v,ref:c}))}u.defaultProps={type:"text",classNameModifiers:[]};export{u 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";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};
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 /**\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 (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 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","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,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,EAMAA,EANAA,iBAAAA,EAAAA,EAAO0B,qBAAP1B,IAAAA,GAAAA,EAAAA,KAAAA,EAAuBmB,GAEnBnB,EAAM2B,aACLR,EAAMS,OAA4BC,MAAQV,EAAOS,OAA4BC,MAAMC,QAGxF9B,SAAa,QAAbA,EAAAA,EAAO+B,cAAP/B,IAAAA,GAAAA,OAAAA,EAAgBmB,IAEpB,CAACnB,EAAM+B,OAAQ/B,EAAM0B,gBAGnBM,EAAcd,EACfC,IACGnB,IAAAA,EAAAA,iBAAAA,EAAAA,EAAOiC,sBAAPjC,IAAAA,GAAAA,EAAAA,KAAAA,EAAwBmB,IAE5B,CAACnB,EAAMiC,iBAGLC,EAAkBC,EACpB,wBACA,CAAC,0BAA0B5B,KAC3BG,EACA,CACI,iCAAkCP,EAClC,+BAAgCC,GAEpCF,EAAmBkC,IAAIC,GAAK,0BAA0BA,OAKtDnC,mBAAoBoC,EACpB9B,SAAU+B,EACVpC,UAAWqC,EACXpC,QAASqC,EACTC,qBAAsBC,EACtB,mBAAoBC,EAAmBC,aACvCA,GAEA7C,EADG8C,EAAAA,EACH9C,EAAAA,8EAHA,oCAOE+C,EAAwB,CAD0B,iBAAxBH,GAAoCA,EAAsBA,EAAsB,KADpFpC,EAAW,GAAGA,IAAWL,EAAY6C,EAAoBC,IAAwB,MAEvCC,OAAOC,SAASC,KAAK,MAAQ,KAEnG,OACIC,EAACC,QAAAA,oUAAAA,CAAAA,CACGC,GAAI/C,GACAsC,GAAAA,CAEJD,aAAcA,EACdW,gBAAeV,EAAUW,SACzBlD,KAAMA,EACNG,UAAWwB,EACXwB,SAAUrD,EAEVC,WAAYA,EACZL,YAAaA,EACb0D,mBAAkBZ,EAClBa,eAAczD,EACdiB,QAASH,EACTc,OAAQN,EACRoC,QAAS7B,EACTR,QAASD,EACTD,WAAYD,EACZZ,SAAUA,EACVqD,IAAK/D,IAGjB,CAEAF,EAAUkE,aAAe,CACrBxD,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 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,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 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};
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};
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 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
+ {"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,2 +1,2 @@
1
- import{Component as t}from"../../../../external/preact/dist/preact.js";import{getFields as e,validFieldsReducer as s,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import n from"../lib/CSF/initCSF.js";import r from"./SecuredFieldsProviderHandlers.js";import d from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as a,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,DATE_POLICY_REQUIRED as p,CVC_POLICY_REQUIRED as c}from"../lib/constants.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as m}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as f}from"../../../../core/Errors/constants.js";import{TxVariants as y}from"../../../tx-variants.js";function O(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function C(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),i.forEach(function(e){O(t,e,s[e])})}return t}function F(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e}(Object(e)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))}),t}class b extends t{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const t=e(this.rootNode),i=t.reduce(s,{});this.setState({valid:i}),t.forEach(t=>{this.numCharsInField[t]=0}),this.numDateFields=t.filter(t=>t.match(/Expiry/)).length,t.length?(this.destroy(),this.initializeCSF(this.rootNode)):(this.props.componentType===y.customCard&&console.debug('You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a "data-cse" attribute e.g. <div data-cse="encryptedCardNumber"></div>'),this.handleOnNoDataRequired())}componentDidUpdate(){var t,e;this.checkForKCPFields(),null===(t=(e=this.props).onStateUpdate)||void 0===t||t.call(e,this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(t){var e;let s=this.props.loadingContext;const i={rootNode:t,type:this.props.type,componentType:this.props.componentType,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:s,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,onSubmitAnalytics:this.props.onSubmitAnalytics,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyPressed:this.handleKeyPressed},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:null!==(e=this.props.placeholders)&&void 0!==e?e:{},showContextualElement:this.props.showContextualElement};this.csf=n(i),this.csfLoadFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new u("ERROR","secured field iframes have failed to load")))},this.csfLoadFailTimeoutMS)}checkForKCPFields(){let t=!1;if(this.props.koreanAuthenticationRequired&&(t=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!t){const t=t=>({data:F(C({},t.data),{[a]:void 0}),valid:F(C({},t.valid),{[a]:!1}),errors:F(C({},t.errors),{[a]:null}),hasKoreanFields:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(a),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&t){const t=t=>({valid:F(C({},t.valid),{[a]:!1}),hasKoreanFields:!0,isSfpValid:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(a),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(t){const e=!!t.error;return e&&this.setState({detectedUnsupportedBrands:t.detectedBrands}),t.rootNode=this.rootNode,this.handleOnError(t,e),this.csf&&this.csf.hasUnsupportedCard(h,t.error),e}setFocusOn(t){this.csf&&this.csf.setFocusOnFrame(t)}updateStyles(t){this.csf&&this.csf.updateStyles(t)}sfIsOptionalOrHidden(t){return this.csf.sfIsOptionalOrHidden(t)}destroy(){this.csf&&this.csf.destroy()}getRootNode(){return this.rootNode}showValidation(){const{numDateFields:t,state:e}=this;Object.keys(e.valid).reduce(i(t,e),[]).forEach(t=>{const s=o(t,this.rootNode,e);this.handleOnError(s,!!e.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(t,s.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((t,e)=>{const s=this.state.errors[e];return t[e]=s?C({isValid:!1,errorMessage:m(s,f),errorI18n:this.props.i18n.get(s),error:s,rootNode:this.rootNode},this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}):null,t},{})}processBinLookupResponse(t,e){var s;if(this.state.detectedUnsupportedBrands&&(this.setState(t=>({errors:F(C({},t.errors),{[h]:null}),detectedUnsupportedBrands:null})),this.csf&&t)){const t={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(t)}this.issuingCountryCode=null==t||null===(s=t.issuingCountryCode)||void 0===s?void 0:s.toLowerCase();const i=(null==e?void 0:e.brand)&&l.includes(e.brand);i&&this.setState(e,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(t,i?e:null)}render(t,e){return t.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},e)}constructor(t){super(t),O(this,"csfLoadFailTimeout",void 0),O(this,"csfLoadFailTimeoutMS",void 0),O(this,"csfConfigFailTimeout",void 0),O(this,"csfConfigFailTimeoutMS",void 0),O(this,"numCharsInField",void 0),O(this,"rootNode",void 0),O(this,"numDateFields",void 0),O(this,"csf",void 0),O(this,"handleOnLoad",void 0),O(this,"handleOnConfigSuccess",void 0),O(this,"handleOnFieldValid",void 0),O(this,"handleOnAllValid",void 0),O(this,"handleOnBrand",void 0),O(this,"handleFocus",void 0),O(this,"handleOnError",void 0),O(this,"handleOnAutoComplete",void 0),O(this,"handleOnNoDataRequired",void 0),O(this,"handleOnTouchstartIOS",void 0),O(this,"handleKeyPressed",void 0),O(this,"state",void 0),O(this,"props",void 0),O(this,"issuingCountryCode",void 0),O(this,"setRootNode",t=>{this.rootNode=t});const e={status:"loading",brand:t.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:t.hasKoreanFields};this.state=e,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=r.handleOnLoad.bind(this),this.handleOnConfigSuccess=r.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=r.handleOnFieldValid.bind(this),this.handleOnAllValid=r.handleOnAllValid.bind(this),this.handleOnBrand=r.handleOnBrand.bind(this),this.handleFocus=r.handleFocus.bind(this),this.handleOnError=r.handleOnError.bind(this),this.handleOnNoDataRequired=r.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=r.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=r.handleOnTouchstartIOS.bind(this),this.handleKeyPressed=r.handleKeyPressed.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}O(b,"defaultProps",d);export{b as default};
1
+ import{Component as t}from"../../../../external/preact/dist/preact.js";import{getFields as e,validFieldsReducer as s,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import n from"../lib/CSF/initCSF.js";import r from"./SecuredFieldsProviderHandlers.js";import a from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as d,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,DATE_POLICY_REQUIRED as p,CVC_POLICY_REQUIRED as c}from"../lib/constants.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as m}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as f}from"../../../../core/Errors/constants.js";import{TxVariants as y}from"../../../tx-variants.js";function O(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function C(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),i.forEach(function(e){O(t,e,s[e])})}return t}function F(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e}(Object(e)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))}),t}class b extends t{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const t=e(this.rootNode),i=t.reduce(s,{});this.setState({valid:i}),t.forEach(t=>{this.numCharsInField[t]=0}),this.numDateFields=t.filter(t=>t.match(/Expiry/)).length,t.length?(this.destroy(),this.initializeCSF(this.rootNode)):(this.props.componentType===y.customCard&&console.debug('You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a "data-cse" attribute e.g. <div data-cse="encryptedCardNumber"></div>'),this.handleOnNoDataRequired())}componentDidUpdate(){var t,e;this.checkForKCPFields(),null===(t=(e=this.props).onStateUpdate)||void 0===t||t.call(e,this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(t){var e;let s=this.props.loadingContext;const i={rootNode:t,type:this.props.type,componentType:this.props.componentType,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:s,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,onSubmitAnalytics:this.props.onSubmitAnalytics,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyDown:this.handleKeyDown},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:null!==(e=this.props.placeholders)&&void 0!==e?e:{},showContextualElement:this.props.showContextualElement};this.csf=n(i),this.csfLoadFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new u("ERROR","secured field iframes have failed to load")))},this.csfLoadFailTimeoutMS)}checkForKCPFields(){let t=!1;if(this.props.koreanAuthenticationRequired&&(t=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!t){const t=t=>({data:F(C({},t.data),{[d]:void 0}),valid:F(C({},t.valid),{[d]:!1}),errors:F(C({},t.errors),{[d]:null}),hasKoreanFields:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(d),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&t){const t=t=>({valid:F(C({},t.valid),{[d]:!1}),hasKoreanFields:!0,isSfpValid:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(d),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(t){const e=!!t.error;return e&&this.setState({detectedUnsupportedBrands:t.detectedBrands}),t.rootNode=this.rootNode,this.handleOnError(t,e),this.csf&&this.csf.hasUnsupportedCard(h,t.error),e}setFocusOn(t){this.csf&&this.csf.setFocusOnFrame(t)}updateStyles(t){this.csf&&this.csf.updateStyles(t)}sfIsOptionalOrHidden(t){return this.csf.sfIsOptionalOrHidden(t)}destroy(){this.csf&&this.csf.destroy()}getRootNode(){return this.rootNode}showValidation(){const{numDateFields:t,state:e}=this;Object.keys(e.valid).reduce(i(t,e),[]).forEach(t=>{const s=o(t,this.rootNode,e);this.handleOnError(s,!!e.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(t,s.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((t,e)=>{const s=this.state.errors[e];return t[e]=s?C({isValid:!1,errorMessage:m(s,f),errorI18n:this.props.i18n.get(s),error:s,rootNode:this.rootNode},this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}):null,t},{})}processBinLookupResponse(t,e){var s;if(this.state.detectedUnsupportedBrands&&(this.setState(t=>({errors:F(C({},t.errors),{[h]:null}),detectedUnsupportedBrands:null})),this.csf&&t)){const t={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(t)}this.issuingCountryCode=null==t||null===(s=t.issuingCountryCode)||void 0===s?void 0:s.toLowerCase();const i=(null==e?void 0:e.brand)&&l.includes(e.brand);i&&this.setState(e,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(t,i?e:null)}render(t,e){return t.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},e)}constructor(t){super(t),O(this,"csfLoadFailTimeout",void 0),O(this,"csfLoadFailTimeoutMS",void 0),O(this,"csfConfigFailTimeout",void 0),O(this,"csfConfigFailTimeoutMS",void 0),O(this,"numCharsInField",void 0),O(this,"rootNode",void 0),O(this,"numDateFields",void 0),O(this,"csf",void 0),O(this,"handleOnLoad",void 0),O(this,"handleOnConfigSuccess",void 0),O(this,"handleOnFieldValid",void 0),O(this,"handleOnAllValid",void 0),O(this,"handleOnBrand",void 0),O(this,"handleFocus",void 0),O(this,"handleOnError",void 0),O(this,"handleOnAutoComplete",void 0),O(this,"handleOnNoDataRequired",void 0),O(this,"handleOnTouchstartIOS",void 0),O(this,"handleKeyDown",void 0),O(this,"state",void 0),O(this,"props",void 0),O(this,"issuingCountryCode",void 0),O(this,"setRootNode",t=>{this.rootNode=t});const e={status:"loading",brand:t.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:t.hasKoreanFields};this.state=e,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=r.handleOnLoad.bind(this),this.handleOnConfigSuccess=r.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=r.handleOnFieldValid.bind(this),this.handleOnAllValid=r.handleOnAllValid.bind(this),this.handleOnBrand=r.handleOnBrand.bind(this),this.handleFocus=r.handleFocus.bind(this),this.handleOnError=r.handleOnError.bind(this),this.handleOnNoDataRequired=r.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=r.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=r.handleOnTouchstartIOS.bind(this),this.handleKeyDown=r.handleKeyDown.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}O(b,"defaultProps",a);export{b as default};
2
2
  //# sourceMappingURL=SecuredFieldsProvider.js.map