@adyen/adyen-web 6.33.0 → 6.34.1

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 (410) hide show
  1. package/dist/cjs/adyen.css +6 -5
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +219 -114
  6. package/dist/es/adyen.css +6 -5
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Ach/Ach.js.map +1 -1
  9. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  10. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  11. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  12. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  13. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  14. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  15. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  16. package/dist/es/components/AmazonPay/components/ChangePaymentDetailsButton.js +1 -1
  17. package/dist/es/components/AmazonPay/components/ChangePaymentDetailsButton.js.map +1 -1
  18. package/dist/es/components/AmazonPay/components/SignOutButton.js +1 -1
  19. package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
  20. package/dist/es/components/AmazonPay/defaultProps.js +1 -1
  21. package/dist/es/components/AmazonPay/defaultProps.js.map +1 -1
  22. package/dist/es/components/AmazonPay/services.js.map +1 -1
  23. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  24. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  25. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  26. package/dist/es/components/Boleto/Boleto.js +1 -1
  27. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  28. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  29. package/dist/es/components/Card/Card.js +1 -1
  30. package/dist/es/components/Card/Card.js.map +1 -1
  31. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  32. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  33. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  34. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  35. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  36. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  37. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  38. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  39. package/dist/es/components/Card/components/CardInput/defaultProps.js +1 -1
  40. package/dist/es/components/Card/components/CardInput/defaultProps.js.map +1 -1
  41. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  42. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  43. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  44. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  45. package/dist/es/components/Card/components/CardInput/validate.js +1 -1
  46. package/dist/es/components/Card/components/CardInput/validate.js.map +1 -1
  47. package/dist/es/components/Card/components/Fastlane/FastlaneSignup.js.map +1 -1
  48. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  49. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  50. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  51. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  52. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  53. package/dist/es/components/Doku/Doku.js +1 -1
  54. package/dist/es/components/Doku/Doku.js.map +1 -1
  55. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  56. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  57. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  58. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  59. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  60. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  61. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  62. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  63. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js +2 -0
  64. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js.map +1 -0
  65. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  66. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  67. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  68. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  69. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  70. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  71. package/dist/es/components/Econtext/Econtext.js +1 -1
  72. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  73. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  74. package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  75. package/dist/es/components/Iris/Iris.js +1 -1
  76. package/dist/es/components/Iris/Iris.js.map +1 -1
  77. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  78. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  79. package/dist/es/components/Multibanco/components/MultibancoVoucherResult/MultibancoVoucherResult.js.map +1 -1
  80. package/dist/es/components/Oxxo/Oxxo.js +1 -1
  81. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  82. package/dist/es/components/Oxxo/components/OxxoVoucherResult/OxxoVoucherResult.js.map +1 -1
  83. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  84. package/dist/es/components/PayPal/Paypal.js +1 -1
  85. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  86. package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
  87. package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
  88. package/dist/es/components/PayPal/components/PaypalComponent.js +1 -1
  89. package/dist/es/components/PayPal/components/PaypalComponent.js.map +1 -1
  90. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  91. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  92. package/dist/es/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  93. package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
  94. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  95. package/dist/es/components/Pix/Pix.js +1 -1
  96. package/dist/es/components/Pix/Pix.js.map +1 -1
  97. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  98. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  99. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  100. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  101. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  102. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  103. package/dist/es/components/UPI/UPI.js +1 -1
  104. package/dist/es/components/UPI/UPI.js.map +1 -1
  105. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  106. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  107. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  108. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  109. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  110. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  111. package/dist/es/components/UPI/components/UPIMandate/UPIMandate.js.map +1 -1
  112. package/dist/es/components/UPI/constants.js +1 -1
  113. package/dist/es/components/UPI/constants.js.map +1 -1
  114. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  115. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  116. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  117. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  118. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  119. package/dist/es/components/internal/BrandIcons/BrandIcons.js +2 -0
  120. package/dist/es/components/internal/BrandIcons/BrandIcons.js.map +1 -0
  121. package/dist/es/components/internal/BrandIcons/BrandIcons.module.scss.js +2 -0
  122. package/dist/es/components/internal/BrandIcons/BrandIcons.module.scss.js.map +1 -0
  123. package/dist/es/components/internal/{Brand/Brand.js → BrandImage/BrandImage.js} +2 -2
  124. package/dist/es/components/internal/BrandImage/BrandImage.js.map +1 -0
  125. package/dist/es/components/internal/Button/Button.js +1 -1
  126. package/dist/es/components/internal/Button/Button.js.map +1 -1
  127. package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
  128. package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  129. package/dist/es/components/internal/FormFields/InputDate/utils.js +1 -1
  130. package/dist/es/components/internal/FormFields/InputDate/utils.js.map +1 -1
  131. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  132. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  133. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  134. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  135. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  136. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  137. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  138. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  139. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  140. package/dist/es/components/internal/SecuredFields/lib/CSF/initCSF.js.map +1 -1
  141. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  142. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  143. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  144. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  145. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  146. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  147. package/dist/es/components/internal/Tooltip/Tooltip.js.map +1 -1
  148. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  149. package/dist/es/core/Analytics/Analytics.js +1 -1
  150. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  151. package/dist/es/core/Analytics/AnalyticsEventQueue.js +1 -1
  152. package/dist/es/core/Analytics/AnalyticsEventQueue.js.map +1 -1
  153. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  154. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  155. package/dist/es/core/config.js +1 -1
  156. package/dist/es/core/config.js.map +1 -1
  157. package/dist/es/core/core.js +1 -1
  158. package/dist/es/core/core.js.map +1 -1
  159. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  160. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  161. package/dist/es/external/preact/dist/preact.js +1 -1
  162. package/dist/es/external/preact/dist/preact.js.map +1 -1
  163. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  164. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  165. package/dist/es/index.d.ts +219 -114
  166. package/dist/es/language/Language.js +1 -1
  167. package/dist/es/language/Language.js.map +1 -1
  168. package/dist/es/language/LanguageService.js +2 -0
  169. package/dist/es/language/LanguageService.js.map +1 -0
  170. package/dist/es/language/constants.js +1 -1
  171. package/dist/es/language/constants.js.map +1 -1
  172. package/dist/es/language/utils.js +1 -1
  173. package/dist/es/language/utils.js.map +1 -1
  174. package/dist/es/packages/server/translations/en-US.json.js +2 -0
  175. package/dist/es/packages/server/translations/en-US.json.js.map +1 -0
  176. package/dist/es/utils/Script.js.map +1 -1
  177. package/dist/es/utils/debounce.js.map +1 -1
  178. package/dist/es/utils/getErrorMessage.js +1 -1
  179. package/dist/es/utils/getErrorMessage.js.map +1 -1
  180. package/dist/es/utils/hookUtils.js.map +1 -1
  181. package/dist/es/utils/promiseTimeout.js.map +1 -1
  182. package/dist/es-legacy/adyen.css +6 -5
  183. package/dist/es-legacy/adyen.css.map +1 -1
  184. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  185. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  186. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  187. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  188. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  189. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  190. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  191. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  192. package/dist/es-legacy/components/AmazonPay/components/ChangePaymentDetailsButton.js +1 -1
  193. package/dist/es-legacy/components/AmazonPay/components/ChangePaymentDetailsButton.js.map +1 -1
  194. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js +1 -1
  195. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
  196. package/dist/es-legacy/components/AmazonPay/defaultProps.js +1 -1
  197. package/dist/es-legacy/components/AmazonPay/defaultProps.js.map +1 -1
  198. package/dist/es-legacy/components/AmazonPay/services.js.map +1 -1
  199. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  200. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  201. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
  202. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  203. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  204. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
  205. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
  206. package/dist/es-legacy/components/Boleto/Boleto.js +1 -1
  207. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  208. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  209. package/dist/es-legacy/components/Card/Card.js +1 -1
  210. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  211. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  212. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  213. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  214. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  215. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  216. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  217. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  218. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  219. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js +1 -1
  220. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js.map +1 -1
  221. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  222. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  223. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  224. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  225. package/dist/es-legacy/components/Card/components/CardInput/validate.js +1 -1
  226. package/dist/es-legacy/components/Card/components/CardInput/validate.js.map +1 -1
  227. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  228. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  229. package/dist/es-legacy/components/Card/components/Fastlane/FastlaneSignup.js.map +1 -1
  230. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  231. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  232. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  233. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  234. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  235. package/dist/es-legacy/components/Doku/Doku.js +1 -1
  236. package/dist/es-legacy/components/Doku/Doku.js.map +1 -1
  237. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  238. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  239. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  240. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  241. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  242. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  243. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  244. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  245. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js +2 -0
  246. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js.map +1 -0
  247. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  248. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  249. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  250. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  251. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  252. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  253. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  254. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  255. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  256. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  257. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  258. package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  259. package/dist/es-legacy/components/GooglePay/requests.js +1 -1
  260. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  261. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  262. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  263. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  264. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  265. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
  266. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  267. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  268. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  269. package/dist/es-legacy/components/Multibanco/components/MultibancoVoucherResult/MultibancoVoucherResult.js.map +1 -1
  270. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  271. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  272. package/dist/es-legacy/components/Oxxo/components/OxxoVoucherResult/OxxoVoucherResult.js.map +1 -1
  273. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  274. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  275. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  276. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  277. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  278. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  279. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  280. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  281. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  282. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  283. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  284. package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  285. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
  286. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  287. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  288. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  289. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  290. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  291. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  292. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  293. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  294. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  295. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  296. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  297. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  298. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  299. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  300. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  301. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  302. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  303. package/dist/es-legacy/components/UPI/components/UPIMandate/UPIMandate.js.map +1 -1
  304. package/dist/es-legacy/components/UPI/constants.js +1 -1
  305. package/dist/es-legacy/components/UPI/constants.js.map +1 -1
  306. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  307. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  308. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  309. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  310. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  311. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js +2 -0
  312. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js.map +1 -0
  313. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.module.scss.js +2 -0
  314. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.module.scss.js.map +1 -0
  315. package/dist/es-legacy/components/internal/{Brand/Brand.js → BrandImage/BrandImage.js} +2 -2
  316. package/dist/es-legacy/components/internal/BrandImage/BrandImage.js.map +1 -0
  317. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  318. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  319. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
  320. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  321. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  322. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  323. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
  324. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
  325. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  326. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  327. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js +1 -1
  328. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js.map +1 -1
  329. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  330. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  331. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
  332. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  333. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  334. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  335. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  336. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  337. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  338. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  339. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  340. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  341. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  342. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  343. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  344. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  345. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
  346. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  347. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  348. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  349. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  350. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  351. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  352. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  353. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  354. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  355. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  356. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  357. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  358. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/initCSF.js.map +1 -1
  359. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  360. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  361. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  362. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  363. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  364. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  365. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
  366. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
  367. package/dist/es-legacy/components/internal/Tooltip/Tooltip.js.map +1 -1
  368. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  369. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  370. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  371. package/dist/es-legacy/core/Analytics/AnalyticsEventQueue.js +1 -1
  372. package/dist/es-legacy/core/Analytics/AnalyticsEventQueue.js.map +1 -1
  373. package/dist/es-legacy/core/Context/Resources.js +1 -1
  374. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  375. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  376. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  377. package/dist/es-legacy/core/config.js +1 -1
  378. package/dist/es-legacy/core/config.js.map +1 -1
  379. package/dist/es-legacy/core/core.js +1 -1
  380. package/dist/es-legacy/core/core.js.map +1 -1
  381. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  382. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  383. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  384. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  385. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  386. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  387. package/dist/es-legacy/language/Language.js +1 -1
  388. package/dist/es-legacy/language/Language.js.map +1 -1
  389. package/dist/es-legacy/language/LanguageService.js +2 -0
  390. package/dist/es-legacy/language/LanguageService.js.map +1 -0
  391. package/dist/es-legacy/language/constants.js +1 -1
  392. package/dist/es-legacy/language/constants.js.map +1 -1
  393. package/dist/es-legacy/language/utils.js +1 -1
  394. package/dist/es-legacy/language/utils.js.map +1 -1
  395. package/dist/es-legacy/packages/server/translations/en-US.json.js +2 -0
  396. package/dist/es-legacy/packages/server/translations/en-US.json.js.map +1 -0
  397. package/dist/es-legacy/utils/Script.js.map +1 -1
  398. package/dist/es-legacy/utils/debounce.js.map +1 -1
  399. package/dist/es-legacy/utils/getErrorMessage.js +1 -1
  400. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  401. package/dist/es-legacy/utils/hookUtils.js.map +1 -1
  402. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  403. package/package.json +30 -29
  404. package/styles/adyen.css +6 -5
  405. package/dist/es/components/internal/Brand/Brand.js.map +0 -1
  406. package/dist/es/core/Services/get-translations.js +0 -2
  407. package/dist/es/core/Services/get-translations.js.map +0 -1
  408. package/dist/es-legacy/components/internal/Brand/Brand.js.map +0 -1
  409. package/dist/es-legacy/core/Services/get-translations.js +0 -2
  410. package/dist/es-legacy/core/Services/get-translations.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SelectButton.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport cx from 'classnames';\nimport { SelectButtonProps } from '../types';\nimport Img from '../../../Img';\nimport { useMemo } from 'preact/hooks';\nimport classnames from 'classnames';\n\nfunction SelectButtonElement({ filterable, toggleButtonRef, ...props }) {\n if (filterable) {\n // Even if passed, we can't add an id to this div since it is not allowed to associate a div with a label element\n const { id, ...strippedProps } = props;\n return <div {...strippedProps} ref={toggleButtonRef} />;\n }\n\n return <button id={props.id} aria-expanded={props.showList} aria-disabled={props.readonly} aria-describedby={props.ariaDescribedBy} type={'button'} {...props} ref={toggleButtonRef} />;\n}\n\nfunction SelectButton(props: Readonly<SelectButtonProps>) {\n const { active, selected, inputText, readonly, showList, required } = props;\n\n const isShowingPlaceholder = useMemo(() => {\n const displayText = selected.selectedOptionName || selected.name;\n const isValidValue = typeof displayText === 'string' && displayText.trim() !== '';\n return isValidValue !== true;\n }, [selected, props.placeholder]);\n\n // display fallback order\n const displayText = selected.selectedOptionName || selected.name || props.placeholder || '';\n // displayInputText only used for the text input for the filter\n // display the \"typed\" filter text when showing the dropdown,\n // hide it and show the \"selected\" value when collapsed\n const displayInputText = showList ? inputText : displayText;\n\n const setFocus = (e: Event) => {\n e.preventDefault();\n if (document.activeElement === props.filterInputRef.current) {\n if (!props.showList) {\n props.toggleList(e);\n }\n } else if (props.filterInputRef.current) props.filterInputRef.current.focus();\n };\n\n // 1. If readonly we ignore the click action\n // 2. If filterable we want to show the list and focus on the input\n // 3. Otherwise we just toggle the list\n const onClickHandler = readonly ? null : props.filterable ? setFocus : props.toggleList;\n\n\n // check COWEB-1301 [Investigate] Drop-in Accessibility - ADA Compliance questions\n const currentSelectedItemId = active.id ? `listItem-${active.id}` : '';\n\n return (\n <SelectButtonElement\n className={cx({\n 'adyen-checkout__dropdown__button': true,\n 'adyen-checkout__dropdown__button--readonly': readonly,\n 'adyen-checkout__dropdown__button--active': showList,\n 'adyen-checkout__dropdown__button--invalid': props.isInvalid,\n 'adyen-checkout__dropdown__button--valid': props.isValid,\n 'adyen-checkout__dropdown__button--disabled': selected.disabled\n })}\n disabled={props.disabled}\n filterable={props.filterable}\n onClick={onClickHandler}\n onKeyDown={!readonly ? props.onButtonKeyDown : null}\n toggleButtonRef={props.toggleButtonRef}\n id={props.id}\n >\n {!props.filterable ? (\n <Fragment>\n {selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <span\n className={classnames('adyen-checkout__dropdown__button__text', {\n 'adyen-checkout__dropdown__button__text-placeholder': isShowingPlaceholder\n })}\n >\n {displayText}\n </span>\n {selected.secondaryText && <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>}\n </Fragment>\n ) : (\n <Fragment>\n {!showList && selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <input\n value={displayInputText}\n aria-autocomplete=\"list\"\n aria-controls={props.selectListId}\n aria-expanded={showList}\n aria-owns={props.selectListId}\n autoComplete=\"off\"\n className=\"adyen-checkout__filter-input\"\n onInput={props.onInput}\n ref={props.filterInputRef}\n role=\"combobox\"\n aria-activedescendant={currentSelectedItemId}\n type=\"text\"\n readOnly={props.readonly}\n aria-disabled={props.readonly}\n id={props.id}\n aria-describedby={props.ariaDescribedBy}\n required={required}\n />\n {!showList && selected.secondaryText && (\n <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>\n )}\n </Fragment>\n )}\n </SelectButtonElement>\n );\n}\n\nexport default SelectButton;\n"],"names":["SelectButtonElement","_0","filterable","toggleButtonRef","props","id","strippedProps","h","div","ref","button","aria-expanded","showList","aria-disabled","readonly","aria-describedby","ariaDescribedBy","type","SelectButton","active","selected","inputText","required","isShowingPlaceholder","useMemo","displayText","selectedOptionName","name","trim","placeholder","displayInputText","onClickHandler","e","preventDefault","document","activeElement","filterInputRef","current","toggleList","focus","currentSelectedItemId","className","cx","isInvalid","isValid","disabled","onClick","onKeyDown","onButtonKeyDown","Fragment","icon","Img","src","alt","input","value","aria-autocomplete","aria-controls","selectListId","aria-owns","autoComplete","onInput","role","aria-activedescendant","readOnly","secondaryText","span","classnames"],"mappings":"spDAOA,SAASA,EAAoBC,GAAA,IAAAC,WAAEA,EAAUC,gBAAEA,GAA2BF,EAAPG,EAAAA,EAAAA,EAAAA,kCAC3D,GAAIF,EAAY,CAEZ,MAAMG,GAAEA,GAAyBD,EAAlBE,EAAAA,EAAkBF,EAAAA,QACjC,OAAOG,EAACC,MAAAA,EAAAA,EAAAA,CAAAA,EAAQF,GAAAA,CAAeG,IAAKN,IACxC,CAEA,OAAOI,EAACG,SAAAA,EAAAA,EAAAA,CAAOL,GAAID,EAAMC,GAAIM,gBAAeP,EAAMQ,SAAUC,gBAAeT,EAAMU,SAAUC,mBAAkBX,EAAMY,gBAAiBC,KAAM,UAAcb,GAAAA,CAAOK,IAAKN,IACxK,CAEA,SAASe,EAAad,GAClB,MAAMe,OAAEA,EAAMC,SAAEA,EAAQC,UAAEA,EAASP,SAAEA,EAAQF,SAAEA,EAAQU,SAAEA,GAAalB,EAEhEmB,EAAuBC,EAAQ,KACjC,MAAMC,EAAcL,EAASM,oBAAsBN,EAASO,KAE5D,OAAwB,KADoB,iBAAhBF,GAAmD,KAAvBA,EAAYG,SAErE,CAACR,EAAUhB,EAAMyB,cAGdJ,EAAcL,EAASM,oBAAsBN,EAASO,MAAQvB,EAAMyB,aAAe,GAInFC,EAAmBlB,EAAWS,EAAYI,EAc1CM,EAAiBjB,EAAW,KAAOV,EAAMF,WAZ7B8B,IACdA,EAAEC,iBACEC,SAASC,gBAAkB/B,EAAMgC,eAAeC,QAC3CjC,EAAMQ,UACPR,EAAMkC,WAAWN,GAEd5B,EAAMgC,eAAeC,SAASjC,EAAMgC,eAAeC,QAAQE,SAMHnC,EAAMkC,WAIvEE,EAAwBrB,EAAOd,GAAK,YAAYc,EAAOd,KAAO,GAEpE,OACIE,EAACP,EAAAA,CACGyC,UAAWC,EAAG,CACV,oCAAoC,EACpC,6CAA8C5B,EAC9C,2CAA4CF,EAC5C,4CAA6CR,EAAMuC,UACnD,0CAA2CvC,EAAMwC,QACjD,6CAA8CxB,EAASyB,WAE3DA,SAAUzC,EAAMyC,SAChB3C,WAAYE,EAAMF,WAClB4C,QAASf,EACTgB,UAAYjC,EAAmC,KAAxBV,EAAM4C,gBAC7B7C,gBAAiBC,EAAMD,gBACvBE,GAAID,EAAMC,IAERD,EAAMF,WAaJK,EAAC0C,EAAAA,MACKrC,GAAYQ,EAAS8B,MAAQ3C,EAAC4C,EAAAA,CAAIV,UAAU,yCAAyCW,IAAKhC,EAAS8B,KAAMG,IAAKjC,EAASO,OACzHpB,EAAC+C,QAAAA,CACGC,MAAOzB,EACP0B,oBAAkB,OAClBC,gBAAerD,EAAMsD,aACrB/C,gBAAeC,EACf+C,YAAWvD,EAAMsD,aACjBE,aAAa,MACbnB,UAAU,+BACVoB,QAASzD,EAAMyD,QACfpD,IAAKL,EAAMgC,eACX0B,KAAK,WACLC,wBAAuBvB,EACvBvB,KAAK,OACL+C,SAAU5D,EAAMU,SAChBD,gBAAeT,EAAMU,SACrBT,GAAID,EAAMC,GACVU,mBAAkBX,EAAMY,gBACxBM,SAAUA,KAEZV,GAAYQ,EAAS6C,eACnB1D,EAAC2D,OAAAA,CAAKzB,UAAU,oDAAoDrB,EAAS6C,gBAlCrF1D,EAAC0C,OACI7B,EAAS8B,MAAQ3C,EAAC4C,EAAAA,CAAIV,UAAU,yCAAyCW,IAAKhC,EAAS8B,KAAMG,IAAKjC,EAASO,OAC5GpB,EAAC2D,OAAAA,CACGzB,UAAW0B,EAAW,yCAA0C,CAC5D,qDAAsD5C,KAGzDE,GAEJL,EAAS6C,eAAiB1D,EAAC2D,OAAAA,CAAKzB,UAAU,oDAAoDrB,EAAS6C,gBA+B5H"}
1
+ {"version":3,"file":"SelectButton.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport cx from 'classnames';\nimport { SelectButtonProps } from '../types';\nimport Img from '../../../Img';\nimport { useMemo } from 'preact/hooks';\nimport classnames from 'classnames';\n\nfunction SelectButtonElement({ filterable, toggleButtonRef, ...props }) {\n if (filterable) {\n // Even if passed, we can't add an id to this div since it is not allowed to associate a div with a label element\n const { id, ...strippedProps } = props;\n return <div {...strippedProps} ref={toggleButtonRef} />;\n }\n\n return <button id={props.id} aria-expanded={props.showList} aria-disabled={props.readonly} aria-describedby={props.ariaDescribedBy} type={'button'} {...props} ref={toggleButtonRef} />;\n}\n\nfunction SelectButton(props: Readonly<SelectButtonProps>) {\n const { active, selected, inputText, readonly, showList, required } = props;\n\n const isShowingPlaceholder = useMemo(() => {\n const displayText = selected.selectedOptionName || selected.name;\n const isValidValue = typeof displayText === 'string' && displayText.trim() !== '';\n return isValidValue !== true;\n }, [selected, props.placeholder]);\n\n // display fallback order\n const displayText = selected.selectedOptionName || selected.name || props.placeholder || '';\n // displayInputText only used for the text input for the filter\n // display the \"typed\" filter text when showing the dropdown,\n // hide it and show the \"selected\" value when collapsed\n const displayInputText = showList ? inputText : displayText;\n\n const setFocus = (e: Event) => {\n e.preventDefault();\n if (document.activeElement === props.filterInputRef.current) {\n if (!props.showList) {\n props.toggleList(e);\n }\n } else if (props.filterInputRef.current) props.filterInputRef.current.focus();\n };\n\n // 1. If readonly we ignore the click action\n // 2. If filterable we want to show the list and focus on the input\n // 3. Otherwise we just toggle the list\n const onClickHandler = readonly ? null : props.filterable ? setFocus : props.toggleList;\n\n\n // check COWEB-1301 [Investigate] Drop-in Accessibility - ADA Compliance questions\n const currentSelectedItemId = active.id ? `listItem-${active.id}` : '';\n\n return (\n <SelectButtonElement\n className={cx({\n 'adyen-checkout__dropdown__button': true,\n 'adyen-checkout__dropdown__button--readonly': readonly,\n 'adyen-checkout__dropdown__button--active': showList,\n 'adyen-checkout__dropdown__button--invalid': props.isInvalid,\n 'adyen-checkout__dropdown__button--valid': props.isValid,\n 'adyen-checkout__dropdown__button--disabled': selected.disabled\n })}\n disabled={props.disabled}\n filterable={props.filterable}\n onClick={onClickHandler}\n onKeyDown={!readonly ? props.onButtonKeyDown : null}\n toggleButtonRef={props.toggleButtonRef}\n id={props.id}\n >\n {!props.filterable ? (\n <Fragment>\n {selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <span\n className={classnames('adyen-checkout__dropdown__button__text', {\n 'adyen-checkout__dropdown__button__text-placeholder': isShowingPlaceholder\n })}\n >\n {displayText}\n </span>\n {selected.secondaryText && <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>}\n </Fragment>\n ) : (\n <Fragment>\n {!showList && selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <input\n value={displayInputText}\n aria-autocomplete=\"list\"\n aria-controls={props.selectListId}\n aria-expanded={showList}\n aria-owns={props.selectListId}\n autoComplete=\"off\"\n className=\"adyen-checkout__filter-input\"\n onInput={props.onInput}\n ref={props.filterInputRef}\n role=\"combobox\"\n aria-activedescendant={currentSelectedItemId}\n type=\"text\"\n readOnly={props.readonly}\n aria-disabled={props.readonly}\n id={props.id}\n aria-describedby={props.ariaDescribedBy}\n required={required}\n />\n {!showList && selected.secondaryText && (\n <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>\n )}\n </Fragment>\n )}\n </SelectButtonElement>\n );\n}\n\nexport default SelectButton;\n"],"names":["SelectButtonElement","_0","filterable","toggleButtonRef","props","id","strippedProps","h","div","ref","button","aria-expanded","showList","aria-disabled","readonly","aria-describedby","ariaDescribedBy","type","SelectButton","active","selected","inputText","required","isShowingPlaceholder","useMemo","displayText","selectedOptionName","name","trim","placeholder","displayInputText","onClickHandler","e","preventDefault","document","activeElement","filterInputRef","current","toggleList","focus","currentSelectedItemId","className","cx","isInvalid","isValid","disabled","onClick","onKeyDown","onButtonKeyDown","Fragment","icon","Img","src","alt","input","value","aria-autocomplete","aria-controls","selectListId","aria-owns","autoComplete","onInput","role","aria-activedescendant","readOnly","secondaryText","span","classnames"],"mappings":"8pDAOA,SAASA,EAAoBC,GAAA,IAAAC,WAAEA,EAAUC,gBAAEA,GAA2BF,EAAPG,EAAAA,EAAAA,EAAAA,kCAC3D,GAAIF,EAAY,CAEZ,MAAMG,GAAEA,GAAyBD,EAAlBE,EAAAA,EAAkBF,EAAAA,QACjC,OAAOG,EAACC,MAAAA,EAAAA,EAAAA,CAAAA,EAAQF,GAAAA,CAAeG,IAAKN,IACxC,CAEA,OAAOI,EAACG,SAAAA,EAAAA,EAAAA,CAAOL,GAAID,EAAMC,GAAIM,gBAAeP,EAAMQ,SAAUC,gBAAeT,EAAMU,SAAUC,mBAAkBX,EAAMY,gBAAiBC,KAAM,UAAcb,GAAAA,CAAOK,IAAKN,IACxK,CAEA,SAASe,EAAad,GAClB,MAAMe,OAAEA,EAAMC,SAAEA,EAAQC,UAAEA,EAASP,SAAEA,EAAQF,SAAEA,EAAQU,SAAEA,GAAalB,EAEhEmB,EAAuBC,EAAQ,KACjC,MAAMC,EAAcL,EAASM,oBAAsBN,EAASO,KAE5D,OAAwB,KADoB,iBAAhBF,GAAmD,KAAvBA,EAAYG,SAErE,CAACR,EAAUhB,EAAMyB,cAGdJ,EAAcL,EAASM,oBAAsBN,EAASO,MAAQvB,EAAMyB,aAAe,GAInFC,EAAmBlB,EAAWS,EAAYI,EAc1CM,EAAiBjB,EAAW,KAAOV,EAAMF,WAZ7B8B,IACdA,EAAEC,iBACEC,SAASC,gBAAkB/B,EAAMgC,eAAeC,QAC3CjC,EAAMQ,UACPR,EAAMkC,WAAWN,GAEd5B,EAAMgC,eAAeC,SAASjC,EAAMgC,eAAeC,QAAQE,SAMHnC,EAAMkC,WAIvEE,EAAwBrB,EAAOd,GAAK,YAAYc,EAAOd,KAAO,GAEpE,OACIE,EAACP,EAAAA,CACGyC,UAAWC,EAAG,CACV,oCAAoC,EACpC,6CAA8C5B,EAC9C,2CAA4CF,EAC5C,4CAA6CR,EAAMuC,UACnD,0CAA2CvC,EAAMwC,QACjD,6CAA8CxB,EAASyB,WAE3DA,SAAUzC,EAAMyC,SAChB3C,WAAYE,EAAMF,WAClB4C,QAASf,EACTgB,UAAYjC,EAAmC,KAAxBV,EAAM4C,gBAC7B7C,gBAAiBC,EAAMD,gBACvBE,GAAID,EAAMC,IAERD,EAAMF,WAaJK,EAAC0C,EAAAA,MACKrC,GAAYQ,EAAS8B,MAAQ3C,EAAC4C,EAAAA,CAAIV,UAAU,yCAAyCW,IAAKhC,EAAS8B,KAAMG,IAAKjC,EAASO,OACzHpB,EAAC+C,QAAAA,CACGC,MAAOzB,EACP0B,oBAAkB,OAClBC,gBAAerD,EAAMsD,aACrB/C,gBAAeC,EACf+C,YAAWvD,EAAMsD,aACjBE,aAAa,MACbnB,UAAU,+BACVoB,QAASzD,EAAMyD,QACfpD,IAAKL,EAAMgC,eACX0B,KAAK,WACLC,wBAAuBvB,EACvBvB,KAAK,OACL+C,SAAU5D,EAAMU,SAChBD,gBAAeT,EAAMU,SACrBT,GAAID,EAAMC,GACVU,mBAAkBX,EAAMY,gBACxBM,SAAUA,KAEZV,GAAYQ,EAAS6C,eACnB1D,EAAC2D,OAAAA,CAAKzB,UAAU,oDAAoDrB,EAAS6C,gBAlCrF1D,EAAC0C,OACI7B,EAAS8B,MAAQ3C,EAAC4C,EAAAA,CAAIV,UAAU,yCAAyCW,IAAKhC,EAAS8B,KAAMG,IAAKjC,EAASO,OAC5GpB,EAAC2D,OAAAA,CACGzB,UAAW0B,EAAW,yCAA0C,CAC5D,qDAAsD5C,KAGzDE,GAEJL,EAAS6C,eAAiB1D,EAAC2D,OAAAA,CAAKzB,UAAU,oDAAoDrB,EAAS6C,gBA+B5H"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./SelectListItem.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";function n(e,t){if(null==e)return{};var o,r,n,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(e),n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var o,r,n={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)o=l[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o]);return n}(e,t),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}function l(l){let{selected:i,active:c,filteredItems:s,showList:d}=l,a=n(l,["selected","active","filteredItems","showList"]);const{i18n:p}=r();return e("ul",{className:t({"adyen-checkout__dropdown__list":!0,"adyen-checkout__dropdown__list--active":d}),id:a.selectListId,ref:a.selectListRef,role:"listbox"},s.length?s.map(t=>e(o,{active:t.id===c.id,item:t,key:t.id,onSelect:a.onSelect,onHover:a.onHover,selected:t.id===i.id})):e("div",{className:"adyen-checkout__dropdown__element adyen-checkout__dropdown__element--no-options"},p.get("select.noOptionsFound")))}export{l as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./SelectListItem.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";function n(e,t){if(null==e)return{};var o,r,n,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(Object(e)),n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var o,r,n={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)o=l[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o]);return n}(e,t),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}function l(l){let{selected:c,active:i,filteredItems:s,showList:d}=l,a=n(l,["selected","active","filteredItems","showList"]);const{i18n:p}=r();return e("ul",{className:t({"adyen-checkout__dropdown__list":!0,"adyen-checkout__dropdown__list--active":d}),id:a.selectListId,ref:a.selectListRef,role:"listbox"},s.length?s.map(t=>e(o,{active:t.id===i.id,item:t,key:t.id,onSelect:a.onSelect,onHover:a.onHover,selected:t.id===c.id})):e("div",{className:"adyen-checkout__dropdown__element adyen-checkout__dropdown__element--no-options"},p.get("select.noOptionsFound")))}export{l as default};
2
2
  //# sourceMappingURL=SelectList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectList.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectList.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport SelectListItem from './SelectListItem';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { SelectListProps } from '../types';\n\nfunction SelectList({ selected, active, filteredItems, showList, ...props }: Readonly<SelectListProps>) {\n const { i18n } = useCoreContext();\n\n return (\n /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n <ul\n className={cx({\n 'adyen-checkout__dropdown__list': true,\n 'adyen-checkout__dropdown__list--active': showList\n })}\n id={props.selectListId}\n ref={props.selectListRef}\n role=\"listbox\"\n >\n {filteredItems.length ? (\n filteredItems.map(item => (\n <SelectListItem\n active={item.id === active.id}\n item={item}\n key={item.id}\n onSelect={props.onSelect}\n onHover={props.onHover}\n selected={item.id === selected.id}\n />\n ))\n ) : (\n <div className=\"adyen-checkout__dropdown__element adyen-checkout__dropdown__element--no-options\">\n {i18n.get('select.noOptionsFound')}\n </div>\n )}\n </ul>\n );\n}\n\nexport default SelectList;\n"],"names":["SelectList","_0","selected","active","filteredItems","showList","props","i18n","useCoreContext","h","ul","className","cx","id","selectListId","ref","selectListRef","role","length","map","item","SelectListItem","key","onSelect","onHover","div","get"],"mappings":"+1BAMA,SAASA,EAAWC,OAAAC,SAAEA,EAAQC,OAAEA,EAAMC,cAAEA,EAAaC,SAAEA,GAA+CJ,EAAlCK,EAAAA,EAAAA,EAAAA,kDAChE,MAAMC,KAAEA,GAASC,IAEjB,OAEIC,EAACC,KAAAA,CACGC,UAAWC,EAAG,CACV,kCAAkC,EAClC,yCAA0CP,IAE9CQ,GAAIP,EAAMQ,aACVC,IAAKT,EAAMU,cACXC,KAAK,WAEJb,EAAcc,OACXd,EAAce,IAAIC,GACdX,EAACY,EAAAA,CACGlB,OAAQiB,EAAKP,KAAOV,EAAOU,GAC3BO,KAAMA,EACNE,IAAKF,EAAKP,GACVU,SAAUjB,EAAMiB,SAChBC,QAASlB,EAAMkB,QACftB,SAAUkB,EAAKP,KAAOX,EAASW,MAIvCJ,EAACgB,MAAAA,CAAId,UAAU,mFACVJ,EAAKmB,IAAI,0BAK9B"}
1
+ {"version":3,"file":"SelectList.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectList.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport SelectListItem from './SelectListItem';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { SelectListProps } from '../types';\n\nfunction SelectList({ selected, active, filteredItems, showList, ...props }: Readonly<SelectListProps>) {\n const { i18n } = useCoreContext();\n\n return (\n /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n <ul\n className={cx({\n 'adyen-checkout__dropdown__list': true,\n 'adyen-checkout__dropdown__list--active': showList\n })}\n id={props.selectListId}\n ref={props.selectListRef}\n role=\"listbox\"\n >\n {filteredItems.length ? (\n filteredItems.map(item => (\n <SelectListItem\n active={item.id === active.id}\n item={item}\n key={item.id}\n onSelect={props.onSelect}\n onHover={props.onHover}\n selected={item.id === selected.id}\n />\n ))\n ) : (\n <div className=\"adyen-checkout__dropdown__element adyen-checkout__dropdown__element--no-options\">\n {i18n.get('select.noOptionsFound')}\n </div>\n )}\n </ul>\n );\n}\n\nexport default SelectList;\n"],"names":["SelectList","_0","selected","active","filteredItems","showList","props","i18n","useCoreContext","h","ul","className","cx","id","selectListId","ref","selectListRef","role","length","map","item","SelectListItem","key","onSelect","onHover","div","get"],"mappings":"u2BAMA,SAASA,EAAWC,OAAAC,SAAEA,EAAQC,OAAEA,EAAMC,cAAEA,EAAaC,SAAEA,GAA+CJ,EAAlCK,EAAAA,EAAAA,EAAAA,kDAChE,MAAMC,KAAEA,GAASC,IAEjB,OAEIC,EAACC,KAAAA,CACGC,UAAWC,EAAG,CACV,kCAAkC,EAClC,yCAA0CP,IAE9CQ,GAAIP,EAAMQ,aACVC,IAAKT,EAAMU,cACXC,KAAK,WAEJb,EAAcc,OACXd,EAAce,IAAIC,GACdX,EAACY,EAAAA,CACGlB,OAAQiB,EAAKP,KAAOV,EAAOU,GAC3BO,KAAMA,EACNE,IAAKF,EAAKP,GACVU,SAAUjB,EAAMiB,SAChBC,QAASlB,EAAMkB,QACftB,SAAUkB,EAAKP,KAAOX,EAASW,MAIvCJ,EAACgB,MAAAA,CAAId,UAAU,mFACVJ,EAAKmB,IAAI,0BAK9B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import n from"../../../Img/Img.js";import o from"../../../Icon/Icon.js";import{PREFIX as r}from"../../../Icon/constants.js";function a(e,t){if(null==e)return{};var n,o,r,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}if(a=function(e,t){if(null==e)return{};var n,o,r={},a=Object.getOwnPropertyNames(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}const c=c=>{let{item:l,active:d,selected:s}=c,i=a(c,["item","active","selected"]);return e("li",{"aria-disabled":!!l.disabled,"aria-selected":s,className:t(["adyen-checkout__dropdown__element",{"adyen-checkout__dropdown__element--active":d,"adyen-checkout__dropdown__element--disabled":!!l.disabled}]),"data-disabled":!0===l.disabled||null,"data-value":l.id,onClick:i.onSelect,onMouseEnter:i.onHover,role:"option",id:`listItem-${l.id}`},l.icon&&e(n,{className:"adyen-checkout__dropdown__element__icon",alt:l.name,src:l.icon}),e("span",{className:"adyen-checkout__dropdown__element__text"},l.name),l.secondaryText&&e("span",{className:"adyen-checkout__dropdown__element__secondary-text"},l.secondaryText),s&&e(o,{type:`${r}checkmark_black`,height:14,width:14}))};export{c as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import n from"../../../Img/Img.js";import o from"../../../Icon/Icon.js";import{PREFIX as r}from"../../../Icon/constants.js";function a(e,t){if(null==e)return{};var n,o,r,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}if(a=function(e,t){if(null==e)return{};var n,o,r={},a=Object.getOwnPropertyNames(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}const c=c=>{let{item:l,active:d,selected:s}=c,i=a(c,["item","active","selected"]);return e("li",{"aria-disabled":!!l.disabled,"aria-selected":s,className:t(["adyen-checkout__dropdown__element",{"adyen-checkout__dropdown__element--active":d,"adyen-checkout__dropdown__element--disabled":!!l.disabled}]),"data-disabled":!0===l.disabled||null,"data-value":l.id,onClick:i.onSelect,onMouseEnter:i.onHover,role:"option",id:`listItem-${l.id}`},l.icon&&e(n,{className:"adyen-checkout__dropdown__element__icon",alt:l.name,src:l.icon}),e("span",{className:"adyen-checkout__dropdown__element__text"},l.name),l.secondaryText&&e("span",{className:"adyen-checkout__dropdown__element__secondary-text"},l.secondaryText),s&&e(o,{type:`${r}checkmark_black`,height:14,width:14}))};export{c as default};
2
2
  //# sourceMappingURL=SelectListItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectListItem.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectListItem.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport { SelectItemProps } from '../types';\nimport Img from '../../../Img';\nimport Icon from '../../../Icon';\nimport { PREFIX } from '../../../Icon/constants';\n\nconst SelectListItem = ({ item, active, selected, ...props }: Readonly<SelectItemProps>) => {\n return (\n /* eslint-disable jsx-a11y/click-events-have-key-events */\n <li\n aria-disabled={!!item.disabled}\n aria-selected={selected}\n className={cx([\n 'adyen-checkout__dropdown__element',\n {\n 'adyen-checkout__dropdown__element--active': active,\n 'adyen-checkout__dropdown__element--disabled': !!item.disabled\n }\n ])}\n // A change in Preact v10.11.1 means that all falsy values are assessed and set on data attributes.\n // In the case of data-disabled we only ever want it set if item.disabled is actually true, since the presence of the data-disabled attr,\n // regardless of its value, will disable the select list item\n data-disabled={item.disabled === true ? true : null}\n data-value={item.id}\n onClick={props.onSelect}\n onMouseEnter={props.onHover}\n /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role */\n role=\"option\"\n //tabIndex={-1}\n id={`listItem-${item.id}`}\n >\n {item.icon && <Img className=\"adyen-checkout__dropdown__element__icon\" alt={item.name} src={item.icon} />}\n <span className=\"adyen-checkout__dropdown__element__text\">{item.name}</span>\n {item.secondaryText && <span className=\"adyen-checkout__dropdown__element__secondary-text\">{item.secondaryText}</span>}\n {selected && <Icon type={`${PREFIX}checkmark_black`} height={14} width={14} />}\n </li>\n );\n};\n\nexport default SelectListItem;\n"],"names":["SelectListItem","_0","item","active","selected","props","h","li","aria-disabled","disabled","aria-selected","className","cx","data-disabled","data-value","id","onClick","onSelect","onMouseEnter","onHover","role","icon","Img","alt","name","src","span","secondaryText","Icon","type","PREFIX","height","width"],"mappings":"22BAOA,MAAMA,EAAiBC,IAAC,IAAAC,KAAEA,EAAIC,OAAEA,EAAMC,SAAEA,GAA+CH,EAAlCI,EAAAA,EAAAA,EAAAA,8BACjD,OAEIC,EAACC,KAAAA,CACGC,kBAAiBN,EAAKO,SACtBC,gBAAeN,EACfO,UAAWC,EAAG,CACV,oCACA,CACI,4CAA6CT,EAC7C,gDAAiDD,EAAKO,YAM9DI,iBAAiC,IAAlBX,EAAKO,UAA2B,KAC/CK,aAAYZ,EAAKa,GACjBC,QAASX,EAAMY,SACfC,aAAcb,EAAMc,QAEpBC,KAAK,SAELL,GAAI,YAAYb,EAAKa,MAEpBb,EAAKmB,MAAQf,EAACgB,EAAAA,CAAIX,UAAU,0CAA0CY,IAAKrB,EAAKsB,KAAMC,IAAKvB,EAAKmB,OACjGf,EAACoB,OAAAA,CAAKf,UAAU,2CAA2CT,EAAKsB,MAC/DtB,EAAKyB,eAAiBrB,EAACoB,OAAAA,CAAKf,UAAU,qDAAqDT,EAAKyB,eAChGvB,GAAYE,EAACsB,EAAAA,CAAKC,KAAM,GAAGC,mBAAyBC,OAAQ,GAAIC,MAAO"}
1
+ {"version":3,"file":"SelectListItem.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectListItem.tsx"],"sourcesContent":["import { h } from 'preact';\nimport cx from 'classnames';\nimport { SelectItemProps } from '../types';\nimport Img from '../../../Img';\nimport Icon from '../../../Icon';\nimport { PREFIX } from '../../../Icon/constants';\n\nconst SelectListItem = ({ item, active, selected, ...props }: Readonly<SelectItemProps>) => {\n return (\n /* eslint-disable jsx-a11y/click-events-have-key-events */\n <li\n aria-disabled={!!item.disabled}\n aria-selected={selected}\n className={cx([\n 'adyen-checkout__dropdown__element',\n {\n 'adyen-checkout__dropdown__element--active': active,\n 'adyen-checkout__dropdown__element--disabled': !!item.disabled\n }\n ])}\n // A change in Preact v10.11.1 means that all falsy values are assessed and set on data attributes.\n // In the case of data-disabled we only ever want it set if item.disabled is actually true, since the presence of the data-disabled attr,\n // regardless of its value, will disable the select list item\n data-disabled={item.disabled === true ? true : null}\n data-value={item.id}\n onClick={props.onSelect}\n onMouseEnter={props.onHover}\n /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role */\n role=\"option\"\n //tabIndex={-1}\n id={`listItem-${item.id}`}\n >\n {item.icon && <Img className=\"adyen-checkout__dropdown__element__icon\" alt={item.name} src={item.icon} />}\n <span className=\"adyen-checkout__dropdown__element__text\">{item.name}</span>\n {item.secondaryText && <span className=\"adyen-checkout__dropdown__element__secondary-text\">{item.secondaryText}</span>}\n {selected && <Icon type={`${PREFIX}checkmark_black`} height={14} width={14} />}\n </li>\n );\n};\n\nexport default SelectListItem;\n"],"names":["SelectListItem","_0","item","active","selected","props","h","li","aria-disabled","disabled","aria-selected","className","cx","data-disabled","data-value","id","onClick","onSelect","onMouseEnter","onHover","role","icon","Img","alt","name","src","span","secondaryText","Icon","type","PREFIX","height","width"],"mappings":"m3BAOA,MAAMA,EAAiBC,IAAC,IAAAC,KAAEA,EAAIC,OAAEA,EAAMC,SAAEA,GAA+CH,EAAlCI,EAAAA,EAAAA,EAAAA,8BACjD,OAEIC,EAACC,KAAAA,CACGC,kBAAiBN,EAAKO,SACtBC,gBAAeN,EACfO,UAAWC,EAAG,CACV,oCACA,CACI,4CAA6CT,EAC7C,gDAAiDD,EAAKO,YAM9DI,iBAAiC,IAAlBX,EAAKO,UAA2B,KAC/CK,aAAYZ,EAAKa,GACjBC,QAASX,EAAMY,SACfC,aAAcb,EAAMc,QAEpBC,KAAK,SAELL,GAAI,YAAYb,EAAKa,MAEpBb,EAAKmB,MAAQf,EAACgB,EAAAA,CAAIX,UAAU,0CAA0CY,IAAKrB,EAAKsB,KAAMC,IAAKvB,EAAKmB,OACjGf,EAACoB,OAAAA,CAAKf,UAAU,2CAA2CT,EAAKsB,MAC/DtB,EAAKyB,eAAiBrB,EAACoB,OAAAA,CAAKf,UAAU,qDAAqDT,EAAKyB,eAChGvB,GAAYE,EAACsB,EAAAA,CAAKC,KAAM,GAAGC,mBAAyBC,OAAQ,GAAIC,MAAO"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useState as s,useRef as r,useCallback as o,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../../../utils/useForm/useForm.js";import l from"../FormFields/Field/Field.js";import a from"./IssuerButtonGroup/IssuerButtonGroup.js";import u from"../ContentSeparator/ContentSeparator.js";import{useCoreContext as c}from"../../../core/Context/CoreProvider.js";import m from"../../../core/Errors/useSRPanelContext.js";import{ERROR_ACTION_FOCUS_FIELD as d}from"../../../core/Errors/constants.js";import{setFocusOnField as p}from"../../../utils/setFocus.js";import f from"../DisclaimerMessage/DisclaimerMessage.js";import g from"../FormFields/Select/Select.js";import{ANALYTICS_SEARCH_DEBOUNCE_TIME as h}from"../../../core/Analytics/constants.js";import{debounce as y}from"../../../utils/debounce.js";import{AnalyticsInfoEvent as b,UiTarget as j,InfoEventType as v}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";function O(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function x(e,t){if(null==e)return{};var s,r,o,n={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(s=Reflect.ownKeys(e),o=0;o<s.length;o++)r=s[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}if(n=function(e,t){if(null==e)return{};var s,r,o={},n=Object.getOwnPropertyNames(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(o[s]=e[s]);return o}(e,t),Object.getOwnPropertySymbols)for(s=Object.getOwnPropertySymbols(e),o=0;o<s.length;o++)r=s[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}const C=({issuer:e,items:t},s)=>{var r;const o=null===(r=t.find(t=>t.id===e))||void 0===r?void 0:r.name;return e&&o?`${s.get("continueTo")} ${o}`:s.get("continue")},S=["issuer"],w={issuer:{validate:e=>!!e&&e.length>0,errorMessage:"issuerList.selectField.contextualText",modes:["blur"]}};function F(F){let{items:I,placeholder:E,issuer:A,highlightedIds:P=[],showContextualElement:_,contextualText:M,selectFieldLabel:k}=F,R=x(F,["items","placeholder","issuer","highlightedIds","showContextualElement","contextualText","selectFieldLabel"]);const{i18n:T}=c(),{handleChangeFor:V,triggerValidation:L,data:N,valid:B,errors:D,isValid:K}=i({schema:S,defaultData:{issuer:A},rules:w}),[G,$]=s("ready"),[q,z]=s(1),{setSRMessagesFromObjects:H,shouldMoveFocusSR:J}=m(),Q=null==H?void 0:H({}),U=r(null);this.setStatus=e=>{$(e)};const W=o(e=>t=>{const s=1===e?j.list:j.featuredIssuer,r=I.find(e=>e.id===t.target.value),o=new b({component:R.type,type:v.selected,target:s,issuer:r.name});R.onSubmitAnalytics(o),z(e),V("issuer")(t)},[V,R.type]),X=o(e=>{if(e){const e=new b({component:R.type,type:v.displayed,target:j.list});R.onSubmitAnalytics(e)}},[R.type,R.onSubmitAnalytics]),Y=r(y(R.onSubmitAnalytics,h)),Z=o(()=>{Y.current({type:v.input,target:j.listSearch})},[]);n(()=>{R.onChange({data:N,valid:B,errors:D,isValid:K});const e=null==Q?void 0:Q({errors:D,isValidating:!0});(null==e?void 0:e.action)===d&&J&&p(U.current,"issuer-list")},[N,B,D,K]),this.showValidation=()=>{L()};const{highlightedItems:ee}=I.reduce((e,t)=>(P.includes(t.id)&&e.highlightedItems.push(function(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},r=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),r.forEach(function(t){O(e,t,s[t])})}return e}({},t)),e),{highlightedItems:[]});return e("div",{ref:U,className:"adyen-checkout__issuer-list"},!!ee.length&&e(t,null,e(a,{selectedIssuerId:0===q?N.issuer:null,items:ee,onChange:W(0)}),e(u,null)),e(l,{label:null!=k?k:T.get("issuerList.selectField.label"),errorMessage:(te=D.issuer,te&&te.errorMessage?T.get(te.errorMessage):!!te),classNameModifiers:["issuer-list"],name:"issuer",showContextualElement:_,contextualText:M},e(g,{items:I,selectedValue:1===q?N.issuer:null,placeholder:E,name:"issuer",className:"adyen-checkout__issuer-list__dropdown",onChange:W(1),onListToggle:X,onInput:Z})),R.termsAndConditions&&e("div",{className:"adyen-checkout__issuer-list__termsAndConditions"},e(f,{message:T.get(R.termsAndConditions.translationKey),urls:R.termsAndConditions.urls})),R.showPayButton&&R.payButton({status:G,label:C({issuer:N.issuer,items:[...I,...ee]},T)}));var te}F.defaultProps={onChange:()=>{}};export{F as default};
1
+ import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useState as s,useRef as r,useCallback as o,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../../../utils/useForm/useForm.js";import l from"../FormFields/Field/Field.js";import a from"./IssuerButtonGroup/IssuerButtonGroup.js";import u from"../ContentSeparator/ContentSeparator.js";import{useCoreContext as c}from"../../../core/Context/CoreProvider.js";import m from"../../../core/Errors/useSRPanelContext.js";import{ERROR_ACTION_FOCUS_FIELD as d}from"../../../core/Errors/constants.js";import{setFocusOnField as p}from"../../../utils/setFocus.js";import f from"../DisclaimerMessage/DisclaimerMessage.js";import g from"../FormFields/Select/Select.js";import{ANALYTICS_SEARCH_DEBOUNCE_TIME as h}from"../../../core/Analytics/constants.js";import{debounce as y}from"../../../utils/debounce.js";import{AnalyticsInfoEvent as b,UiTarget as j,InfoEventType as v}from"../../../core/Analytics/events/AnalyticsInfoEvent.js";function O(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function x(e,t){if(null==e)return{};var s,r,o,n={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(s=Reflect.ownKeys(Object(e)),o=0;o<s.length;o++)r=s[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}if(n=function(e,t){if(null==e)return{};var s,r,o={},n=Object.getOwnPropertyNames(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(o[s]=e[s]);return o}(e,t),Object.getOwnPropertySymbols)for(s=Object.getOwnPropertySymbols(e),o=0;o<s.length;o++)r=s[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}const C=({issuer:e,items:t},s)=>{var r;const o=null===(r=t.find(t=>t.id===e))||void 0===r?void 0:r.name;return e&&o?`${s.get("continueTo")} ${o}`:s.get("continue")},S=["issuer"],w={issuer:{validate:e=>!!e&&e.length>0,errorMessage:"issuerList.selectField.contextualText",modes:["blur"]}};function F(F){let{items:I,placeholder:E,issuer:A,highlightedIds:P=[],showContextualElement:_,contextualText:M,selectFieldLabel:k}=F,R=x(F,["items","placeholder","issuer","highlightedIds","showContextualElement","contextualText","selectFieldLabel"]);const{i18n:T}=c(),{handleChangeFor:V,triggerValidation:L,data:N,valid:B,errors:D,isValid:K}=i({schema:S,defaultData:{issuer:A},rules:w}),[G,$]=s("ready"),[q,z]=s(1),{setSRMessagesFromObjects:H,shouldMoveFocusSR:J}=m(),Q=null==H?void 0:H({}),U=r(null);this.setStatus=e=>{$(e)};const W=o(e=>t=>{const s=1===e?j.list:j.featuredIssuer,r=I.find(e=>e.id===t.target.value),o=new b({component:R.type,type:v.selected,target:s,issuer:r.name});R.onSubmitAnalytics(o),z(e),V("issuer")(t)},[V,R.type]),X=o(e=>{if(e){const e=new b({component:R.type,type:v.displayed,target:j.list});R.onSubmitAnalytics(e)}},[R.type,R.onSubmitAnalytics]),Y=r(y(R.onSubmitAnalytics,h)),Z=o(()=>{Y.current({type:v.input,target:j.listSearch})},[]);n(()=>{R.onChange({data:N,valid:B,errors:D,isValid:K});const e=null==Q?void 0:Q({errors:D,isValidating:!0});(null==e?void 0:e.action)===d&&J&&p(U.current,"issuer-list")},[N,B,D,K]),this.showValidation=()=>{L()};const{highlightedItems:ee}=I.reduce((e,t)=>(P.includes(t.id)&&e.highlightedItems.push(function(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},r=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),r.forEach(function(t){O(e,t,s[t])})}return e}({},t)),e),{highlightedItems:[]});return e("div",{ref:U,className:"adyen-checkout__issuer-list"},!!ee.length&&e(t,null,e(a,{selectedIssuerId:0===q?N.issuer:null,items:ee,onChange:W(0)}),e(u,null)),e(l,{label:null!=k?k:T.get("issuerList.selectField.label"),errorMessage:(te=D.issuer,te&&te.errorMessage?T.get(te.errorMessage):!!te),classNameModifiers:["issuer-list"],name:"issuer",showContextualElement:_,contextualText:M},e(g,{items:I,selectedValue:1===q?N.issuer:null,placeholder:E,name:"issuer",className:"adyen-checkout__issuer-list__dropdown",onChange:W(1),onListToggle:X,onInput:Z})),R.termsAndConditions&&e("div",{className:"adyen-checkout__issuer-list__termsAndConditions"},e(f,{message:T.get(R.termsAndConditions.translationKey),urls:R.termsAndConditions.urls})),R.showPayButton&&R.payButton({status:G,label:C({issuer:N.issuer,items:[...I,...ee]},T)}));var te}F.defaultProps={onChange:()=>{}};export{F as default};
2
2
  //# sourceMappingURL=IssuerList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IssuerList.js","sources":["../../../../../src/components/internal/IssuerList/IssuerList.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useState, useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport Field from '../FormFields/Field';\nimport IssuerButtonGroup from './IssuerButtonGroup';\nimport ContentSeparator from '../ContentSeparator';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ValidatorRules } from '../../../utils/Validator/types';\nimport { IssuerListProps } from './types';\nimport './IssuerList.scss';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport DisclaimerMessage from '../DisclaimerMessage';\nimport Select from '../FormFields/Select';\nimport { SelectTargetObject } from '../FormFields/Select/types';\nimport { ANALYTICS_SEARCH_DEBOUNCE_TIME } from '../../../core/Analytics/constants';\nimport { debounce } from '../../../utils/debounce';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\n\nconst payButtonLabel = ({ issuer, items }, i18n): string => {\n const issuerName = items.find(i => i.id === issuer)?.name;\n if (!issuer || !issuerName) return i18n.get('continue');\n return `${i18n.get('continueTo')} ${issuerName}`;\n};\n\nconst schema = ['issuer'];\nconst validationRules: ValidatorRules = {\n issuer: {\n validate: issuer => !!issuer && issuer.length > 0,\n errorMessage: 'issuerList.selectField.contextualText',\n modes: ['blur']\n }\n};\n\nenum IssuerListInputTypes {\n ButtonGroup,\n Dropdown\n}\n\nfunction IssuerList({\n items,\n placeholder,\n issuer,\n highlightedIds = [],\n showContextualElement,\n contextualText,\n selectFieldLabel,\n ...props\n}: Readonly<IssuerListProps>) {\n const { i18n } = useCoreContext();\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm({\n schema,\n defaultData: { issuer },\n rules: validationRules\n });\n const [status, setStatus] = useState('ready');\n const [inputType, setInputType] = useState<IssuerListInputTypes>(IssuerListInputTypes.Dropdown);\n\n const { setSRMessagesFromObjects, shouldMoveFocusSR } = useSRPanelContext();\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({});\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const getErrorMessage = error => (error && error.errorMessage ? i18n.get(error.errorMessage) : !!error);\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const handleInputChange = useCallback(\n (type: IssuerListInputTypes) => (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n const target = type === IssuerListInputTypes.Dropdown ? UiTarget.list : UiTarget.featuredIssuer;\n const issuerObj = items.find(issuer => issuer.id === (event.target as SelectTargetObject).value);\n\n const analyticsEvent = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target,\n issuer: issuerObj.name\n });\n props.onSubmitAnalytics(analyticsEvent);\n\n setInputType(type);\n handleChangeFor('issuer')(event);\n },\n [handleChangeFor, props.type]\n );\n\n const handleListToggle = useCallback(\n (isOpen: boolean) => {\n if (isOpen) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.list\n });\n props.onSubmitAnalytics(event);\n }\n },\n [props.type, props.onSubmitAnalytics]\n );\n\n const debounceSearchAnalytics = useRef(debounce(props.onSubmitAnalytics, ANALYTICS_SEARCH_DEBOUNCE_TIME));\n\n const handleSearch = useCallback(() => {\n debounceSearchAnalytics.current({ type: InfoEventType.input, target: UiTarget.listSearch });\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({ errors, isValidating: true });\n if (srPanelResp?.action === ERROR_ACTION_FOCUS_FIELD) {\n // Focus field in error, if required\n if (shouldMoveFocusSR) setFocusOnField(containerRef.current, 'issuer-list');\n }\n }, [data, valid, errors, isValid]);\n\n this.showValidation = () => {\n triggerValidation();\n };\n\n const { highlightedItems } = items.reduce(\n (memo, item) => {\n if (highlightedIds.includes(item.id)) memo.highlightedItems.push({ ...item });\n return memo;\n },\n { highlightedItems: [] }\n );\n\n return (\n <div ref={containerRef} className=\"adyen-checkout__issuer-list\">\n {!!highlightedItems.length && (\n <Fragment>\n <IssuerButtonGroup\n selectedIssuerId={inputType === IssuerListInputTypes.ButtonGroup ? data['issuer'] : null}\n items={highlightedItems}\n onChange={handleInputChange(IssuerListInputTypes.ButtonGroup)}\n />\n <ContentSeparator />\n </Fragment>\n )}\n\n <Field\n label={selectFieldLabel ?? i18n.get('issuerList.selectField.label')}\n errorMessage={getErrorMessage(errors.issuer)}\n classNameModifiers={['issuer-list']}\n name={'issuer'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n items={items}\n selectedValue={inputType === IssuerListInputTypes.Dropdown ? data['issuer'] : null}\n placeholder={placeholder}\n name={'issuer'}\n className={'adyen-checkout__issuer-list__dropdown'}\n onChange={handleInputChange(IssuerListInputTypes.Dropdown)}\n onListToggle={handleListToggle}\n onInput={handleSearch}\n />\n </Field>\n\n {props.termsAndConditions && (\n <div className=\"adyen-checkout__issuer-list__termsAndConditions\">\n <DisclaimerMessage message={i18n.get(props.termsAndConditions.translationKey)} urls={props.termsAndConditions.urls} />\n </div>\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n label: payButtonLabel({ issuer: data['issuer'], items: [...items, ...highlightedItems] }, i18n)\n })}\n </div>\n );\n}\n\nIssuerList.defaultProps = {\n onChange: () => {}\n};\n\nexport default IssuerList;\n"],"names":["payButtonLabel","issuer","items","i18n","issuerName","find","i","id","name","get","schema","validationRules","validate","length","errorMessage","modes","IssuerList","_0","placeholder","highlightedIds","showContextualElement","contextualText","selectFieldLabel","props","useCoreContext","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","defaultData","rules","status","setStatus","useState","inputType","setInputType","setSRMessagesFromObjects","shouldMoveFocusSR","useSRPanelContext","setSRMessages","containerRef","useRef","this","newStatus","handleInputChange","useCallback","type","event","target","UiTarget","list","featuredIssuer","issuerObj","value","analyticsEvent","AnalyticsInfoEvent","component","InfoEventType","selected","onSubmitAnalytics","handleListToggle","isOpen","displayed","debounceSearchAnalytics","debounce","ANALYTICS_SEARCH_DEBOUNCE_TIME","handleSearch","current","input","listSearch","useEffect","onChange","srPanelResp","isValidating","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnField","showValidation","highlightedItems","reduce","memo","item","includes","push","_object_spread","h","div","ref","className","Fragment","IssuerButtonGroup","selectedIssuerId","ContentSeparator","Field","label","error","classNameModifiers","Select","selectedValue","onListToggle","onInput","termsAndConditions","DisclaimerMessage","message","translationKey","urls","showPayButton","payButton","defaultProps"],"mappings":"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"}
1
+ {"version":3,"file":"IssuerList.js","sources":["../../../../../src/components/internal/IssuerList/IssuerList.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useState, useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport Field from '../FormFields/Field';\nimport IssuerButtonGroup from './IssuerButtonGroup';\nimport ContentSeparator from '../ContentSeparator';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ValidatorRules } from '../../../utils/Validator/types';\nimport { IssuerListProps } from './types';\nimport './IssuerList.scss';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport DisclaimerMessage from '../DisclaimerMessage';\nimport Select from '../FormFields/Select';\nimport { SelectTargetObject } from '../FormFields/Select/types';\nimport { ANALYTICS_SEARCH_DEBOUNCE_TIME } from '../../../core/Analytics/constants';\nimport { debounce } from '../../../utils/debounce';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\n\nconst payButtonLabel = ({ issuer, items }, i18n): string => {\n const issuerName = items.find(i => i.id === issuer)?.name;\n if (!issuer || !issuerName) return i18n.get('continue');\n return `${i18n.get('continueTo')} ${issuerName}`;\n};\n\nconst schema = ['issuer'];\nconst validationRules: ValidatorRules = {\n issuer: {\n validate: issuer => !!issuer && issuer.length > 0,\n errorMessage: 'issuerList.selectField.contextualText',\n modes: ['blur']\n }\n};\n\nenum IssuerListInputTypes {\n ButtonGroup,\n Dropdown\n}\n\nfunction IssuerList({\n items,\n placeholder,\n issuer,\n highlightedIds = [],\n showContextualElement,\n contextualText,\n selectFieldLabel,\n ...props\n}: Readonly<IssuerListProps>) {\n const { i18n } = useCoreContext();\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm({\n schema,\n defaultData: { issuer },\n rules: validationRules\n });\n const [status, setStatus] = useState('ready');\n const [inputType, setInputType] = useState<IssuerListInputTypes>(IssuerListInputTypes.Dropdown);\n\n const { setSRMessagesFromObjects, shouldMoveFocusSR } = useSRPanelContext();\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({});\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const getErrorMessage = error => (error && error.errorMessage ? i18n.get(error.errorMessage) : !!error);\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const handleInputChange = useCallback(\n (type: IssuerListInputTypes) => (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n const target = type === IssuerListInputTypes.Dropdown ? UiTarget.list : UiTarget.featuredIssuer;\n const issuerObj = items.find(issuer => issuer.id === (event.target as SelectTargetObject).value);\n\n const analyticsEvent = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target,\n issuer: issuerObj.name\n });\n props.onSubmitAnalytics(analyticsEvent);\n\n setInputType(type);\n handleChangeFor('issuer')(event);\n },\n [handleChangeFor, props.type]\n );\n\n const handleListToggle = useCallback(\n (isOpen: boolean) => {\n if (isOpen) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.list\n });\n props.onSubmitAnalytics(event);\n }\n },\n [props.type, props.onSubmitAnalytics]\n );\n\n const debounceSearchAnalytics = useRef(debounce(props.onSubmitAnalytics, ANALYTICS_SEARCH_DEBOUNCE_TIME));\n\n const handleSearch = useCallback(() => {\n debounceSearchAnalytics.current({ type: InfoEventType.input, target: UiTarget.listSearch });\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({ errors, isValidating: true });\n if (srPanelResp?.action === ERROR_ACTION_FOCUS_FIELD) {\n // Focus field in error, if required\n if (shouldMoveFocusSR) setFocusOnField(containerRef.current, 'issuer-list');\n }\n }, [data, valid, errors, isValid]);\n\n this.showValidation = () => {\n triggerValidation();\n };\n\n const { highlightedItems } = items.reduce(\n (memo, item) => {\n if (highlightedIds.includes(item.id)) memo.highlightedItems.push({ ...item });\n return memo;\n },\n { highlightedItems: [] }\n );\n\n return (\n <div ref={containerRef} className=\"adyen-checkout__issuer-list\">\n {!!highlightedItems.length && (\n <Fragment>\n <IssuerButtonGroup\n selectedIssuerId={inputType === IssuerListInputTypes.ButtonGroup ? data['issuer'] : null}\n items={highlightedItems}\n onChange={handleInputChange(IssuerListInputTypes.ButtonGroup)}\n />\n <ContentSeparator />\n </Fragment>\n )}\n\n <Field\n label={selectFieldLabel ?? i18n.get('issuerList.selectField.label')}\n errorMessage={getErrorMessage(errors.issuer)}\n classNameModifiers={['issuer-list']}\n name={'issuer'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n items={items}\n selectedValue={inputType === IssuerListInputTypes.Dropdown ? data['issuer'] : null}\n placeholder={placeholder}\n name={'issuer'}\n className={'adyen-checkout__issuer-list__dropdown'}\n onChange={handleInputChange(IssuerListInputTypes.Dropdown)}\n onListToggle={handleListToggle}\n onInput={handleSearch}\n />\n </Field>\n\n {props.termsAndConditions && (\n <div className=\"adyen-checkout__issuer-list__termsAndConditions\">\n <DisclaimerMessage message={i18n.get(props.termsAndConditions.translationKey)} urls={props.termsAndConditions.urls} />\n </div>\n )}\n\n {props.showPayButton &&\n props.payButton({\n status,\n label: payButtonLabel({ issuer: data['issuer'], items: [...items, ...highlightedItems] }, i18n)\n })}\n </div>\n );\n}\n\nIssuerList.defaultProps = {\n onChange: () => {}\n};\n\nexport default IssuerList;\n"],"names":["payButtonLabel","issuer","items","i18n","issuerName","find","i","id","name","get","schema","validationRules","validate","length","errorMessage","modes","IssuerList","_0","placeholder","highlightedIds","showContextualElement","contextualText","selectFieldLabel","props","useCoreContext","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","defaultData","rules","status","setStatus","useState","inputType","setInputType","setSRMessagesFromObjects","shouldMoveFocusSR","useSRPanelContext","setSRMessages","containerRef","useRef","this","newStatus","handleInputChange","useCallback","type","event","target","UiTarget","list","featuredIssuer","issuerObj","value","analyticsEvent","AnalyticsInfoEvent","component","InfoEventType","selected","onSubmitAnalytics","handleListToggle","isOpen","displayed","debounceSearchAnalytics","debounce","ANALYTICS_SEARCH_DEBOUNCE_TIME","handleSearch","current","input","listSearch","useEffect","onChange","srPanelResp","isValidating","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnField","showValidation","highlightedItems","reduce","memo","item","includes","push","_object_spread","h","div","ref","className","Fragment","IssuerButtonGroup","selectedIssuerId","ContentSeparator","Field","label","error","classNameModifiers","Select","selectedValue","onListToggle","onInput","termsAndConditions","DisclaimerMessage","message","translationKey","urls","showPayButton","payButton","defaultProps"],"mappings":"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"}
@@ -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(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 i=i=>{let{children:a,classNameModifiers:c=[],isOpen:u,onClose:f,isDismissible:p=!0,labelledBy:d,describedBy:m,focusFirst:y,focusAfterClose:b}=i,O=l(i,["children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose"]);const h=r(),{closeModal:j,handleClickOutside:g}=n({modalElement:h.current,isOpen:u,isDismissible:p,focusFirst:y,focusAfterClose:b,onClose:f});return t(()=>{if(!h.current)return;const e=e=>{"Enter"!==e.key&&"Enter"!==e.code||e.stopPropagation()};return h.current.addEventListener("keypress",e,{capture:!0}),()=>{h.current.removeEventListener("keypress",e)}},[h.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",c.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:h},a({onCloseModal:j})))};export{i as Modal};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../_virtual/index.js";import{useModal as n}from"./useModal.js";function s(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){if(null==e)return{};var t,o,n,s={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(t=Reflect.ownKeys(Object(e)),n=0;n<t.length;n++)o=t[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o]);return s}if(s=function(e,r){if(null==e)return{};var t,o,n={},s=Object.getOwnPropertyNames(e);for(o=0;o<s.length;o++)t=s[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t]);return n}(e,r),Object.getOwnPropertySymbols)for(t=Object.getOwnPropertySymbols(e),n=0;n<t.length;n++)o=t[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o]);return s}const c=c=>{let{children:i,classNameModifiers:a=[],isOpen:u,onClose:f,isDismissible:p=!0,labelledBy:d,describedBy:m,focusFirst:y,focusAfterClose:b}=c,O=l(c,["children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose"]);const j=r(),{closeModal:h,handleClickOutside:g}=n({modalElement:j.current,isOpen:u,isDismissible:p,focusFirst:y,focusAfterClose:b,onClose:f});return t(()=>{if(!j.current)return;const e=e=>{"Enter"!==e.key&&"Enter"!==e.code||e.stopPropagation()};return j.current.addEventListener("keypress",e,{capture:!0}),()=>{j.current.removeEventListener("keypress",e)}},[j.current]),e("div",function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){s(e,r,t[r])})}return e}({className:o("adyen-checkout__modal-wrapper",a.map(e=>`adyen-checkout__modal-wrapper--${e}`),{"adyen-checkout__modal-wrapper--open":u}),role:"dialog","aria-labelledby":d,"aria-describedby":m,"aria-modal":"true","aria-hidden":!u,onClick:g},O),e("div",{className:"adyen-checkout__modal",ref:j},i({onCloseModal:h})))};export{c as Modal};
2
2
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../../src/components/internal/Modal/Modal.tsx"],"sourcesContent":["import { ComponentChildren, h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport cx from 'classnames';\nimport './Modal.scss';\nimport { useModal } from './useModal';\n\ntype ModalRenderFnProps = {\n /**\n * Function used to properly trigger the Modal close mechanism. It takes into account the element that the Modal needs\n * to set focus when it is dismissed.\n */\n onCloseModal(): void;\n};\n\ntype ModalProps = {\n children: ({ onCloseModal }: ModalRenderFnProps) => ComponentChildren;\n classNameModifiers?: string[];\n onClose(): void;\n isOpen: boolean;\n isDismissible?: boolean;\n labelledBy: string;\n describedBy: string;\n /**\n * Reference to the element that should be focused when the modal is opened\n */\n focusFirst: HTMLElement;\n /**\n * Reference to the element that should be focused when the modal is closed\n */\n focusAfterClose: HTMLElement;\n};\n\nconst Modal = ({\n children,\n classNameModifiers = [],\n isOpen,\n onClose,\n isDismissible = true,\n labelledBy,\n describedBy,\n focusFirst,\n focusAfterClose,\n ...props\n}: Readonly<ModalProps>) => {\n const modalContainerRef = useRef<HTMLDivElement>();\n const { closeModal, handleClickOutside } = useModal({\n modalElement: modalContainerRef.current,\n isOpen,\n isDismissible,\n focusFirst,\n focusAfterClose,\n onClose\n });\n\n /**\n * It shouldn't propagate ENTER key event to the parent component. This effect suppress the event propagation\n * (e.g. ENTER key press might trigger the payment flow for Card)\n */\n useEffect(() => {\n if (!modalContainerRef.current) return;\n\n const 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":"y9BAgCA,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 suppressKeyPress = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.code === 'Enter') event.stopPropagation();\n };\n\n modalContainerRef.current.addEventListener('keypress', suppressKeyPress, { capture: true });\n return () => {\n modalContainerRef.current.removeEventListener('keypress', suppressKeyPress);\n };\n }, [modalContainerRef.current]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions\n <div\n className={cx(\n 'adyen-checkout__modal-wrapper',\n classNameModifiers.map(m => `adyen-checkout__modal-wrapper--${m}`),\n { 'adyen-checkout__modal-wrapper--open': isOpen }\n )}\n role=\"dialog\"\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-modal=\"true\"\n aria-hidden={!isOpen}\n onClick={handleClickOutside}\n {...props}\n >\n <div className=\"adyen-checkout__modal\" ref={modalContainerRef}>\n {children({ onCloseModal: closeModal })}\n </div>\n </div>\n );\n};\n\nexport { Modal };\n"],"names":["Modal","_0","children","classNameModifiers","isOpen","onClose","isDismissible","labelledBy","describedBy","focusFirst","focusAfterClose","props","modalContainerRef","useRef","closeModal","handleClickOutside","useModal","modalElement","current","useEffect","suppressKeyPress","event","key","code","stopPropagation","addEventListener","capture","removeEventListener","h","div","className","cx","map","m","role","aria-labelledby","aria-describedby","aria-modal","aria-hidden","onClick","ref","onCloseModal"],"mappings":"i+BAgCA,MAAMA,EAAQC,QAACC,SACXA,EAAQC,mBACRA,EAAqB,GAAEC,OACvBA,EAAMC,QACNA,EAAOC,cACPA,GAAgB,EAAIC,WACpBA,EAAUC,YACVA,EAAWC,WACXA,EAAUC,gBACVA,GAEmBT,EADhBU,EAAAA,EAAAA,EAAAA,gIAEH,MAAMC,EAAoBC,KACpBC,WAAEA,EAAUC,mBAAEA,GAAuBC,EAAS,CAChDC,aAAcL,EAAkBM,QAChCd,SACAE,gBACAG,aACAC,kBACAL,YAoBJ,OAbAc,EAAU,KACN,IAAKP,EAAkBM,QAAS,OAEhC,MAAME,EAAoBC,IACJ,UAAdA,EAAMC,KAAkC,UAAfD,EAAME,MAAkBF,EAAMG,mBAI/D,OADAZ,EAAkBM,QAAQO,iBAAiB,WAAYL,EAAkB,CAAEM,SAAS,IAC7E,KACHd,EAAkBM,QAAQS,oBAAoB,WAAYP,KAE/D,CAACR,EAAkBM,UAIlBU,EAACC,wUAAAA,CAAAA,CACGC,UAAWC,EACP,gCACA5B,EAAmB6B,IAAIC,GAAK,kCAAkCA,KAC9D,CAAE,sCAAuC7B,IAE7C8B,KAAK,SACLC,kBAAiB5B,EACjB6B,mBAAkB5B,EAClB6B,aAAW,OACXC,eAAclC,EACdmC,QAASxB,GACLJ,GAEJiB,EAACC,MAAAA,CAAIC,UAAU,wBAAwBU,IAAK5B,GACvCV,EAAS,CAAEuC,aAAc3B"}
@@ -1,2 +1,2 @@
1
- import{useState as e,useMemo as r,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{enhanceErrorObjectKeys as t}from"../../../core/Errors/utils.js";import{COMPANY_DETAILS_SCHEMA as s}from"../CompanyDetails/CompanyDetails.js";import{PERSONAL_DETAILS_SCHEMA as l}from"../PersonalDetails/PersonalDetails.js";import{ERROR_ACTION_BLUR_SCENARIO as n,ERROR_ACTION_FOCUS_FIELD as i}from"../../../core/Errors/constants.js";import c from"../../../core/Errors/useSRPanelContext.js";import a from"../Address/Specifications.js";import{setFocusOnField as d}from"../../../utils/setFocus.js";import{usePrevious as u}from"../../../utils/hookUtils.js";import{getArrayDifferences as f}from"../../../utils/arrayUtils.js";import{mapFieldKey as p}from"./utils.js";function y(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function m(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),t.forEach(function(r){y(e,r,o[r])})}return e}function b(e,r){if(null==e)return{};var o,t,s,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(e),s=0;s<o.length;s++)t=o[s],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t]);return l}if(l=function(e,r){if(null==e)return{};var o,t,s={},l=Object.getOwnPropertyNames(e);for(t=0;t<l.length;t++)o=l[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o]);return s}(e,r),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),s=0;s<o.length;s++)t=o[s],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t]);return l}const v=({errors:y,data:v,props:g,isValidating:j})=>{const[O,h]=e(null),A=u(O),{setSRMessagesFromObjects:F,setSRMessagesFromStrings:S,clearSRPanel:w,shouldMoveFocusSR:k}=c(),P=null==F?void 0:F({fieldTypeMappingFn:p}),D=r(()=>new a,[]),E=r(()=>new a(g.deliveryAddressSpecification),[]);o(()=>{try{var e,r,o,c,a;const u="deliveryAddress:",p="billingAddress:",{companyDetails:O,personalDetails:F,bankAccount:C,billingAddress:R,deliveryAddress:x}=y,T=b(y,["companyDetails","personalDetails","bankAccount","billingAddress","deliveryAddress"]),M=t(R,p),$=t(x,u),L=m({},"object"==typeof O&&O,"object"==typeof F&&F,"object"==typeof C&&C,"object"==typeof M&&M,"object"==typeof $&&$,T),_=s,I=null!==(e=g.personalDetailsRequiredFields)&&void 0!==e?e:l,K=l.filter(e=>null==I?void 0:I.includes(e)),U=["holder","iban"],V=D.getAddressSchemaForCountryFlat(null===(r=v.billingAddress)||void 0===r?void 0:r.country).map(e=>`${p}${e}`),q=E.getAddressSchemaForCountryFlat(null===(o=v.deliveryAddress)||void 0===o?void 0:o.country).map(e=>`${u}${e}`),B=_.concat(K,U,V,q,["consentCheckbox"]),N=D.getAddressLabelsForCountry(null===(c=v.billingAddress)||void 0===c?void 0:c.country),z=E.getAddressLabelsForCountry(null===(a=v.deliveryAddress)||void 0===a?void 0:a.country),G=null==P?void 0:P({errors:L,isValidating:j.current,layout:B,countrySpecificLabels:m({},N,z)}),H=null==G?void 0:G.currentErrorsSortedByLayout;switch(h(H),null==G?void 0:G.action){case i:{const e=G.fieldToFocus.includes(":")?G.fieldToFocus.split(":")[1]:G.fieldToFocus;let r="";const o=G.fieldToFocus.includes(":")?G.fieldToFocus.split(":")[0]:"";o.length&&(r=`.adyen-checkout__fieldset--${o} `),k&&d(".adyen-checkout__open-invoice",e,r),setTimeout(()=>{j.current=!1},300);break}case n:{const e=f(H,A,"field"),r=null==e?void 0:e[0];if(r){const e="shopperEmail"===r.field&&"field.error.invalid"===r.errorCode?r.errorMessage:null;S(e)}else w();break}}}catch(e){}},[y,v])};export{v as default};
1
+ import{useState as e,useMemo as r,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{enhanceErrorObjectKeys as t}from"../../../core/Errors/utils.js";import{COMPANY_DETAILS_SCHEMA as s}from"../CompanyDetails/CompanyDetails.js";import{PERSONAL_DETAILS_SCHEMA as l}from"../PersonalDetails/PersonalDetails.js";import{ERROR_ACTION_BLUR_SCENARIO as n,ERROR_ACTION_FOCUS_FIELD as i}from"../../../core/Errors/constants.js";import c from"../../../core/Errors/useSRPanelContext.js";import a from"../Address/Specifications.js";import{setFocusOnField as d}from"../../../utils/setFocus.js";import{usePrevious as u}from"../../../utils/hookUtils.js";import{getArrayDifferences as f}from"../../../utils/arrayUtils.js";import{mapFieldKey as p}from"./utils.js";function y(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function m(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{},t=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),t.forEach(function(r){y(e,r,o[r])})}return e}function b(e,r){if(null==e)return{};var o,t,s,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(Object(e)),s=0;s<o.length;s++)t=o[s],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t]);return l}if(l=function(e,r){if(null==e)return{};var o,t,s={},l=Object.getOwnPropertyNames(e);for(t=0;t<l.length;t++)o=l[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o]);return s}(e,r),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),s=0;s<o.length;s++)t=o[s],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(l[t]=e[t]);return l}const v=({errors:y,data:v,props:j,isValidating:g})=>{const[O,h]=e(null),A=u(O),{setSRMessagesFromObjects:F,setSRMessagesFromStrings:S,clearSRPanel:w,shouldMoveFocusSR:k}=c(),P=null==F?void 0:F({fieldTypeMappingFn:p}),D=r(()=>new a,[]),E=r(()=>new a(j.deliveryAddressSpecification),[]);o(()=>{try{var e,r,o,c,a;const u="deliveryAddress:",p="billingAddress:",{companyDetails:O,personalDetails:F,bankAccount:C,billingAddress:R,deliveryAddress:x}=y,T=b(y,["companyDetails","personalDetails","bankAccount","billingAddress","deliveryAddress"]),M=t(R,p),$=t(x,u),L=m({},"object"==typeof O&&O,"object"==typeof F&&F,"object"==typeof C&&C,"object"==typeof M&&M,"object"==typeof $&&$,T),_=s,I=null!==(e=j.personalDetailsRequiredFields)&&void 0!==e?e:l,K=l.filter(e=>null==I?void 0:I.includes(e)),U=["holder","iban"],V=D.getAddressSchemaForCountryFlat(null===(r=v.billingAddress)||void 0===r?void 0:r.country).map(e=>`${p}${e}`),q=E.getAddressSchemaForCountryFlat(null===(o=v.deliveryAddress)||void 0===o?void 0:o.country).map(e=>`${u}${e}`),B=_.concat(K,U,V,q,["consentCheckbox"]),N=D.getAddressLabelsForCountry(null===(c=v.billingAddress)||void 0===c?void 0:c.country),z=E.getAddressLabelsForCountry(null===(a=v.deliveryAddress)||void 0===a?void 0:a.country),G=null==P?void 0:P({errors:L,isValidating:g.current,layout:B,countrySpecificLabels:m({},N,z)}),H=null==G?void 0:G.currentErrorsSortedByLayout;switch(h(H),null==G?void 0:G.action){case i:{const e=G.fieldToFocus.includes(":")?G.fieldToFocus.split(":")[1]:G.fieldToFocus;let r="";const o=G.fieldToFocus.includes(":")?G.fieldToFocus.split(":")[0]:"";o.length&&(r=`.adyen-checkout__fieldset--${o} `),k&&d(".adyen-checkout__open-invoice",e,r),setTimeout(()=>{g.current=!1},300);break}case n:{const e=f(H,A,"field"),r=null==e?void 0:e[0];if(r){const e="shopperEmail"===r.field&&"field.error.invalid"===r.errorCode?r.errorMessage:null;S(e)}else w();break}}}catch(e){}},[y,v])};export{v as default};
2
2
  //# sourceMappingURL=useSRPanelForOpenInvoiceErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD: {\n /**\n * For prefixed fields (ones that can occur twice but in different contexts i.e. billingAddress & deliveryAddress) - consider the prefix...\n */\n // ...Firstly strip it to gain a \"clean\" reference to the field...\n const fieldToFocus = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[1] : srPanelResp.fieldToFocus; // country, street etc\n\n // ...Secondly use the prefix to add context for when we try to select it\n let focusContextSelector = '';\n const focusContext = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[0] : ''; // 'billingAddress' | 'deliveryAddress'\n if (focusContext.length) {\n focusContextSelector = `.adyen-checkout__fieldset--${focusContext} `;\n }\n\n // Focus first field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__open-invoice', fieldToFocus, focusContextSelector);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n }\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.field === 'shopperEmail' && latestErrorMsg.errorCode === 'field.error.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","_object_spread","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","split","focusContextSelector","focusContext","length","setFocusOnField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","field","errorCode","errorMessage","_"],"mappings":"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"}
1
+ {"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD: {\n /**\n * For prefixed fields (ones that can occur twice but in different contexts i.e. billingAddress & deliveryAddress) - consider the prefix...\n */\n // ...Firstly strip it to gain a \"clean\" reference to the field...\n const fieldToFocus = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[1] : srPanelResp.fieldToFocus; // country, street etc\n\n // ...Secondly use the prefix to add context for when we try to select it\n let focusContextSelector = '';\n const focusContext = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[0] : ''; // 'billingAddress' | 'deliveryAddress'\n if (focusContext.length) {\n focusContextSelector = `.adyen-checkout__fieldset--${focusContext} `;\n }\n\n // Focus first field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__open-invoice', fieldToFocus, focusContextSelector);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n }\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.field === 'shopperEmail' && latestErrorMsg.errorCode === 'field.error.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","_object_spread","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","split","focusContextSelector","focusContext","length","setFocusOnField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","field","errorCode","errorMessage","_"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{createButtonLabel as o,createSecondaryLabel as n}from"./utils.js";import c from"./components/SecondaryButtonLabel.js";import{useAmount as l,useSecondaryAmount as i}from"../../../core/Context/AmountProvider.js";import{isAmountValid as s}from"../../../utils/amount-util.js";function u(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 p(e,t){if(null==e)return{};var r,o,n,c={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(c[o]=e[o]);return c}if(c=function(e,t){if(null==e)return{};var r,o,n={},c=Object.getOwnPropertyNames(e);for(o=0;o<c.length;o++)r=c[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(c[o]=e[o]);return c}const f=f=>{let{customAmount:b,classNameModifiers:m=[],label:y}=f,O=p(f,["customAmount","classNameModifiers","label"]);const{amount:j,isZeroAuth:d}=l(),{secondaryAmount:g}=i(),{i18n:P}=r(),w=o(P,y,j,d,b,g),v=n(P,g,s(j),d,y),h=O.disabled||"loading"===O.status;return e(t,a(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){u(e,t,r[t])})}return e}({},O),{disabled:h,classNameModifiers:[...m,"pay"],label:w}),v&&e(c,{label:v}))};export{f as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../Button/Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{createButtonLabel as o,createSecondaryLabel as n}from"./utils.js";import c from"./components/SecondaryButtonLabel.js";import{useAmount as l,useSecondaryAmount as i}from"../../../core/Context/AmountProvider.js";import{isAmountValid as s}from"../../../utils/amount-util.js";function u(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 p(e,t){if(null==e)return{};var r,o,n,c={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(c[o]=e[o]);return c}if(c=function(e,t){if(null==e)return{};var r,o,n={},c=Object.getOwnPropertyNames(e);for(o=0;o<c.length;o++)r=c[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(c[o]=e[o]);return c}const f=f=>{let{customAmount:b,classNameModifiers:m=[],label:y}=f,O=p(f,["customAmount","classNameModifiers","label"]);const{amount:j,isZeroAuth:d}=l(),{secondaryAmount:g}=i(),{i18n:P}=r(),w=o(P,y,j,d,b,g),v=n(P,g,s(j),d,y),h=O.disabled||"loading"===O.status;return e(t,a(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){u(e,t,r[t])})}return e}({},O),{disabled:h,classNameModifiers:[...m,"pay"],label:w}),v&&e(c,{label:v}))};export{f as default};
2
2
  //# sourceMappingURL=PayButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { createButtonLabel, createSecondaryLabel } from './utils';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\nimport { useAmount, useSecondaryAmount } from '../../../core/Context/AmountProvider';\nimport type { PaymentAmount } from '../../../types';\nimport { isAmountValid } from '../../../utils/amount-util';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n /**\n * Custom amount that can be passed to the button.\n * This is useful when the amount is not available in the amount provider, such as Giftcard scenario where\n * we need to display the remaining amount\n */\n customAmount?: PaymentAmount;\n label?: string;\n status?: string;\n disabled?: boolean;\n icon?: string;\n}\n\nconst PayButton = ({ customAmount, classNameModifiers = [], label, ...props }: Readonly<PayButtonProps>) => {\n const { amount, isZeroAuth } = useAmount();\n const { secondaryAmount } = useSecondaryAmount();\n const { i18n } = useCoreContext();\n\n const buttonLabel = createButtonLabel(i18n, label, amount, isZeroAuth, customAmount, secondaryAmount);\n const secondaryAmountLabel = createSecondaryLabel(i18n, secondaryAmount, isAmountValid(amount), isZeroAuth, label);\n\n const isDisabled = props.disabled || props.status === 'loading';\n\n return (\n <Button {...props} disabled={isDisabled} classNameModifiers={[...classNameModifiers, 'pay']} label={buttonLabel}>\n {secondaryAmountLabel && <SecondaryButtonLabel label={secondaryAmountLabel} />}\n </Button>\n );\n};\n\nexport default PayButton;\n"],"names":["PayButton","_0","customAmount","classNameModifiers","label","props","amount","isZeroAuth","useAmount","secondaryAmount","useSecondaryAmount","i18n","useCoreContext","buttonLabel","createButtonLabel","secondaryAmountLabel","createSecondaryLabel","isAmountValid","isDisabled","disabled","status","h","Button","SecondaryButtonLabel"],"mappings":"+hDA2BA,MAAMA,EAAYC,IAAC,IAAAC,aAAEA,EAAYC,mBAAEA,EAAqB,GAAEC,MAAEA,GAA2CH,EAAjCI,EAAAA,EAAAA,EAAAA,+CAClE,MAAMC,OAAEA,EAAMC,WAAEA,GAAeC,KACzBC,gBAAEA,GAAoBC,KACtBC,KAAEA,GAASC,IAEXC,EAAcC,EAAkBH,EAAMP,EAAOE,EAAQC,EAAYL,EAAcO,GAC/EM,EAAuBC,EAAqBL,EAAMF,EAAiBQ,EAAcX,GAASC,EAAYH,GAEtGc,EAAab,EAAMc,UAA6B,YAAjBd,EAAMe,OAE3C,OACIC,EAACC,EAAAA,oUAAAA,CAAAA,CAAAA,EAAWjB,GAAAA,CAAOc,SAAUD,EAAYf,mBAAoB,IAAIA,EAAoB,OAAQC,MAAOS,IAC/FE,GAAwBM,EAACE,EAAAA,CAAqBnB,MAAOW"}
1
+ {"version":3,"file":"PayButton.js","sources":["../../../../../src/components/internal/PayButton/PayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Button from '../Button';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps } from '../Button/types';\nimport { createButtonLabel, createSecondaryLabel } from './utils';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\nimport { useAmount, useSecondaryAmount } from '../../../core/Context/AmountProvider';\nimport type { PaymentAmount } from '../../../types';\nimport { isAmountValid } from '../../../utils/amount-util';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n /**\n * Custom amount that can be passed to the button.\n * This is useful when the amount is not available in the amount provider, such as Giftcard scenario where\n * we need to display the remaining amount\n */\n customAmount?: PaymentAmount;\n label?: string;\n status?: string;\n disabled?: boolean;\n icon?: string;\n}\n\nconst PayButton = ({ customAmount, classNameModifiers = [], label, ...props }: Readonly<PayButtonProps>) => {\n const { amount, isZeroAuth } = useAmount();\n const { secondaryAmount } = useSecondaryAmount();\n const { i18n } = useCoreContext();\n\n const buttonLabel = createButtonLabel(i18n, label, amount, isZeroAuth, customAmount, secondaryAmount);\n const secondaryAmountLabel = createSecondaryLabel(i18n, secondaryAmount, isAmountValid(amount), isZeroAuth, label);\n\n const isDisabled = props.disabled || props.status === 'loading';\n\n return (\n <Button {...props} disabled={isDisabled} classNameModifiers={[...classNameModifiers, 'pay']} label={buttonLabel}>\n {secondaryAmountLabel && <SecondaryButtonLabel label={secondaryAmountLabel} />}\n </Button>\n );\n};\n\nexport default PayButton;\n"],"names":["PayButton","_0","customAmount","classNameModifiers","label","props","amount","isZeroAuth","useAmount","secondaryAmount","useSecondaryAmount","i18n","useCoreContext","buttonLabel","createButtonLabel","secondaryAmountLabel","createSecondaryLabel","isAmountValid","isDisabled","disabled","status","h","Button","SecondaryButtonLabel"],"mappings":"uiDA2BA,MAAMA,EAAYC,IAAC,IAAAC,aAAEA,EAAYC,mBAAEA,EAAqB,GAAEC,MAAEA,GAA2CH,EAAjCI,EAAAA,EAAAA,EAAAA,+CAClE,MAAMC,OAAEA,EAAMC,WAAEA,GAAeC,KACzBC,gBAAEA,GAAoBC,KACtBC,KAAEA,GAASC,IAEXC,EAAcC,EAAkBH,EAAMP,EAAOE,EAAQC,EAAYL,EAAcO,GAC/EM,EAAuBC,EAAqBL,EAAMF,EAAiBQ,EAAcX,GAASC,EAAYH,GAEtGc,EAAab,EAAMc,UAA6B,YAAjBd,EAAMe,OAE3C,OACIC,EAACC,EAAAA,oUAAAA,CAAAA,CAAAA,EAAWjB,GAAAA,CAAOc,SAAUD,EAAYf,mBAAoB,IAAIA,EAAoB,OAAQC,MAAOS,IAC/FE,GAAwBM,EAACE,EAAAA,CAAqBnB,MAAOW"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as r}from"../../../external/preact/dist/preact.js";import{useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../FormFields/Field/Field.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import l from"../FormFields/Select/Select.js";import p from"../FormFields/InputText.js";function i(e,r){if(null==e)return{};var o,n,t,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(e),t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,r){if(null==e)return{};var o,n,t={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)o=l[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(t[o]=e[o]);return t}(e,r),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function a(a){let{getError:u,showNumber:c,showPrefix:m,form:h,canSelectPrefix:s=!0}=a,d=i(a,["getError","showNumber","showPrefix","form","canSelectPrefix"]);var f,b,y;const{i18n:x}=t(),{handleChangeFor:N,data:g,valid:P}=h;return o(()=>{g.phoneNumber&&N("phoneNumber","blur")(g.phoneNumber)},[g.phonePrefix]),e(r,null,m&&e(n,{className:"adyen-checkout-field--phone-prefix",label:x.get("telephonePrefix"),errorMessage:u("phonePrefix"),showValidIcon:!1,isValid:P.phonePrefix,dir:"ltr",i18n:x,name:"phonePrefix"},e(l,{readonly:!s,className:"adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector",name:"phonePrefix",items:d.items,onChange:N("phonePrefix"),placeholder:null==d||null===(f=d.placeholders)||void 0===f?void 0:f.phonePrefix,selectedValue:g.phonePrefix})),c&&e(n,{className:"adyen-checkout-field--phone-number",label:d.phoneNumberKey?x.get(d.phoneNumberKey):x.get("telephoneNumber"),errorMessage:u("phoneNumber"),isValid:P.phoneNumber,filled:(null==g||null===(b=g.phoneNumber)||void 0===b?void 0:b.length)>0,dir:"ltr",i18n:x,name:"phoneNumber"},e(p,{className:"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number",type:"tel",name:"phoneNumber",value:g.phoneNumber,onInput:N("phoneNumber","input"),onBlur:N("phoneNumber","blur"),placeholder:null==d||null===(y=d.placeholders)||void 0===y?void 0:y.phoneNumber,autoCorrect:"off",required:!0})))}export{a as default};
1
+ import{createElement as e,Fragment as r}from"../../../external/preact/dist/preact.js";import{useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../FormFields/Field/Field.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import l from"../FormFields/Select/Select.js";import p from"../FormFields/InputText.js";function i(e,r){if(null==e)return{};var o,n,t,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(Object(e)),t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,r){if(null==e)return{};var o,n,t={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)o=l[n],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(t[o]=e[o]);return t}(e,r),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function a(a){let{getError:u,showNumber:c,showPrefix:m,form:h,canSelectPrefix:s=!0}=a,d=i(a,["getError","showNumber","showPrefix","form","canSelectPrefix"]);var f,b,y;const{i18n:x}=t(),{handleChangeFor:N,data:g,valid:P}=h;return o(()=>{g.phoneNumber&&N("phoneNumber","blur")(g.phoneNumber)},[g.phonePrefix]),e(r,null,m&&e(n,{className:"adyen-checkout-field--phone-prefix",label:x.get("telephonePrefix"),errorMessage:u("phonePrefix"),showValidIcon:!1,isValid:P.phonePrefix,dir:"ltr",i18n:x,name:"phonePrefix"},e(l,{readonly:!s,className:"adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector",name:"phonePrefix",items:d.items,onChange:N("phonePrefix"),placeholder:null==d||null===(f=d.placeholders)||void 0===f?void 0:f.phonePrefix,selectedValue:g.phonePrefix})),c&&e(n,{className:"adyen-checkout-field--phone-number",label:d.phoneNumberKey?x.get(d.phoneNumberKey):x.get("telephoneNumber"),errorMessage:u("phoneNumber"),isValid:P.phoneNumber,filled:(null==g||null===(b=g.phoneNumber)||void 0===b?void 0:b.length)>0,dir:"ltr",i18n:x,name:"phoneNumber"},e(p,{className:"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number",type:"tel",name:"phoneNumber",value:g.phoneNumber,onInput:N("phoneNumber","input"),onBlur:N("phoneNumber","blur"),placeholder:null==d||null===(y=d.placeholders)||void 0===y?void 0:y.phoneNumber,autoCorrect:"off",required:!0})))}export{a as default};
2
2
  //# sourceMappingURL=PhoneInputFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({\n getError,\n showNumber,\n showPrefix,\n form,\n canSelectPrefix = true,\n ...props\n}: Readonly<PhoneInputFieldProps>) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","_0","getError","showNumber","showPrefix","form","canSelectPrefix","props","data","i18n","useCoreContext","handleChangeFor","valid","useEffect","phoneNumber","phonePrefix","h","Fragment","Field","className","label","get","errorMessage","showValidIcon","isValid","dir","name","Select","readonly","items","onChange","placeholder","placeholders","selectedValue","phoneNumberKey","filled","length","InputText","type","value","onInput","onBlur","autoCorrect","required"],"mappings":"29BA6Be,SAASA,EAAiBC,OAAAC,SACrCA,EAAQC,WACRA,EAAUC,WACVA,EAAUC,KACVA,EAAIC,gBACJA,GAAkB,GAEWL,EAD1BM,EAAAA,EAAAA,EAAAA,iEAgC8BA,IAAAA,EAYTC,EAYSD,EAtDjC,MAAME,KAAEA,GAASC,KAEXC,gBAAEA,EAAeH,KAAEA,EAAII,MAAEA,GAAUP,EASzC,OANAQ,EAAU,KACFL,EAAKM,aACLH,EAAgB,cAAe,OAA/BA,CAAuCH,EAAKM,cAEjD,CAACN,EAAKO,cAGLC,EAACC,EAAAA,KACIb,GACGY,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOX,EAAKY,IAAI,mBAChBC,aAAcpB,EAAS,eACvBqB,eAAe,EACfC,QAASZ,EAAMG,YACfU,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACW,EAAAA,CACGC,UAAWtB,EACXa,UAAW,wEACXO,KAAM,cACNG,MAAOtB,EAAMsB,MACbC,SAAUnB,EAAgB,eAC1BoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBQ,YAClCkB,cAAezB,EAAKO,eAK/BZ,GACGa,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOb,EAAM2B,eAAiBzB,EAAKY,IAAId,EAAM2B,gBAAkBzB,EAAKY,IAAI,mBACxEC,aAAcpB,EAAS,eACvBsB,QAASZ,EAAME,YACfqB,QAAQ3B,SAAiB,QAAjBA,EAAAA,EAAMM,mBAANN,IAAAA,OAAAA,EAAAA,EAAmB4B,QAAS,EACpCX,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACqB,EAAAA,CACGlB,UAAU,gFACVmB,KAAK,MACLZ,KAAK,cACLa,MAAO/B,EAAKM,YACZ0B,QAAS7B,EAAgB,cAAe,SACxC8B,OAAQ9B,EAAgB,cAAe,QACvCoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBO,YAClC4B,YAAY,MACZC,UAAU,KAMlC"}
1
+ {"version":3,"file":"PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({\n getError,\n showNumber,\n showPrefix,\n form,\n canSelectPrefix = true,\n ...props\n}: Readonly<PhoneInputFieldProps>) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","_0","getError","showNumber","showPrefix","form","canSelectPrefix","props","data","i18n","useCoreContext","handleChangeFor","valid","useEffect","phoneNumber","phonePrefix","h","Fragment","Field","className","label","get","errorMessage","showValidIcon","isValid","dir","name","Select","readonly","items","onChange","placeholder","placeholders","selectedValue","phoneNumberKey","filled","length","InputText","type","value","onInput","onBlur","autoCorrect","required"],"mappings":"m+BA6Be,SAASA,EAAiBC,OAAAC,SACrCA,EAAQC,WACRA,EAAUC,WACVA,EAAUC,KACVA,EAAIC,gBACJA,GAAkB,GAEWL,EAD1BM,EAAAA,EAAAA,EAAAA,iEAgC8BA,IAAAA,EAYTC,EAYSD,EAtDjC,MAAME,KAAEA,GAASC,KAEXC,gBAAEA,EAAeH,KAAEA,EAAII,MAAEA,GAAUP,EASzC,OANAQ,EAAU,KACFL,EAAKM,aACLH,EAAgB,cAAe,OAA/BA,CAAuCH,EAAKM,cAEjD,CAACN,EAAKO,cAGLC,EAACC,EAAAA,KACIb,GACGY,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOX,EAAKY,IAAI,mBAChBC,aAAcpB,EAAS,eACvBqB,eAAe,EACfC,QAASZ,EAAMG,YACfU,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACW,EAAAA,CACGC,UAAWtB,EACXa,UAAW,wEACXO,KAAM,cACNG,MAAOtB,EAAMsB,MACbC,SAAUnB,EAAgB,eAC1BoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBQ,YAClCkB,cAAezB,EAAKO,eAK/BZ,GACGa,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOb,EAAM2B,eAAiBzB,EAAKY,IAAId,EAAM2B,gBAAkBzB,EAAKY,IAAI,mBACxEC,aAAcpB,EAAS,eACvBsB,QAASZ,EAAME,YACfqB,QAAQ3B,SAAiB,QAAjBA,EAAAA,EAAMM,mBAANN,IAAAA,OAAAA,EAAAA,EAAmB4B,QAAS,EACpCX,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACqB,EAAAA,CACGlB,UAAU,gFACVmB,KAAK,MACLZ,KAAK,cACLa,MAAO/B,EAAKM,YACZ0B,QAAS7B,EAAgB,cAAe,SACxC8B,OAAQ9B,EAAgB,cAAe,QACvCoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBO,YAClC4B,YAAY,MACZC,UAAU,KAMlC"}
@@ -1,2 +1,2 @@
1
- import{createContext as e,createElement as t}from"../../../external/preact/dist/preact.js";import{useContext as r}from"../../../external/preact/hooks/dist/hooks.js";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}function l(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(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}const c=e(void 0),i=e=>{let{children:r}=e,n=l(e,["children"]);return t(c.Provider,{value:o({},n)},r)},a=()=>{const e=r(c);if(void 0===e)throw new Error('"useQRLoaderDetails" must be used within a QRLoaderDetailsContext');return e};export{i as QRLoaderDetailsProvider,a as useQRLoaderDetails};
1
+ import{createContext as e,createElement as t}from"../../../external/preact/dist/preact.js";import{useContext as r}from"../../../external/preact/hooks/dist/hooks.js";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}function l(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}const c=e(void 0),i=e=>{let{children:r}=e,n=l(e,["children"]);return t(c.Provider,{value:o({},n)},r)},a=()=>{const e=r(c);if(void 0===e)throw new Error('"useQRLoaderDetails" must be used within a QRLoaderDetailsContext');return e};export{i as QRLoaderDetailsProvider,a as useQRLoaderDetails};
2
2
  //# sourceMappingURL=QRLoaderDetailsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n type: string;\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: Readonly<QRLoaderDetailsProviderProps>) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","_0","children","props","h","Provider","value","_object_spread","useQRLoaderDetails","context","useContext","Error"],"mappings":"ktCAuBA,MAAMA,EAAyBC,OAAuDC,GAEhFC,EAA0BC,QAACC,SAAEA,GAA4DD,EAA/CE,EAAAA,EAAAA,EAAAA,cAC5C,OAAOC,EAACP,EAAuBQ,SAAQ,CAACC,MAAOC,EAAA,CAAA,EAAKJ,IAAUD,IAG5DM,EAAqB,KACvB,MAAMC,EAAUC,EAAWb,GAE3B,QAAgBE,IAAZU,EACA,MAAM,IAAIE,MAAM,qEAGpB,OAAOF"}
1
+ {"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n type: string;\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: Readonly<QRLoaderDetailsProviderProps>) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","_0","children","props","h","Provider","value","_object_spread","useQRLoaderDetails","context","useContext","Error"],"mappings":"0tCAuBA,MAAMA,EAAyBC,OAAuDC,GAEhFC,EAA0BC,QAACC,SAAEA,GAA4DD,EAA/CE,EAAAA,EAAAA,EAAAA,cAC5C,OAAOC,EAACP,EAAuBQ,SAAQ,CAACC,MAAOC,EAAA,CAAA,EAAKJ,IAAUD,IAG5DM,EAAqB,KACvB,MAAMC,EAAUC,EAAWb,GAE3B,QAAgBE,IAAZU,EACA,MAAM,IAAIE,MAAM,qEAGpB,OAAOF"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{useState as n}from"../../../external/preact/hooks/dist/hooks.js";import{useAmount as o}from"../../../core/Context/AmountProvider.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 c(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 a(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(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 i(i){let{label:u=null,icon:s=null,payButton:p,onSubmit:f,name:b,showPayButton:y}=i,O=a(i,["label","icon","payButton","onSubmit","name","showPayButton"]);const{i18n:m}=r(),[j,g]=n("ready"),{amount:P}=o();this.setStatus=e=>{g(e)};if(y)return e(t,null,p(c(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}({},O),{status:j,icon:s,classNameModifiers:["standalone"],label:u||(P&&{}.hasOwnProperty.call(P,"value")&&0===P.value?`${m.get("preauthorizeWith")} ${b}`:`${m.get("continueTo")} ${b}`),onClick:f})))}export{i as default};
1
+ import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{useState as n}from"../../../external/preact/hooks/dist/hooks.js";import{useAmount as o}from"../../../core/Context/AmountProvider.js";function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(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 a(e,t){if(null==e)return{};var r,n,o,c={};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)&&(c[n]=e[n]);return c}if(c=function(e,t){if(null==e)return{};var r,n,o={},c=Object.getOwnPropertyNames(e);for(n=0;n<c.length;n++)r=c[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)&&(c[n]=e[n]);return c}function i(i){let{label:u=null,icon:s=null,payButton:p,onSubmit:f,name:b,showPayButton:y}=i,O=a(i,["label","icon","payButton","onSubmit","name","showPayButton"]);const{i18n:m}=r(),[j,g]=n("ready"),{amount:P}=o();this.setStatus=e=>{g(e)};if(y)return e(t,null,p(l(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){c(e,t,r[t])})}return e}({},O),{status:j,icon:s,classNameModifiers:["standalone"],label:u||(P&&{}.hasOwnProperty.call(P,"value")&&0===P.value?`${m.get("preauthorizeWith")} ${b}`:`${m.get("continueTo")} ${b}`),onClick:f})))}export{i as default};
2
2
  //# sourceMappingURL=RedirectButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n name: string;\n showPayButton: boolean;\n ref?: any;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, name, showPayButton, ...props }: Readonly<RedirectButtonProps>) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { amount } = useAmount();\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","_0","label","icon","payButton","onSubmit","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","amount","useAmount","this","newStatus","h","Fragment","_object_spread_props","_object_spread","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"+3CAiBA,SAASA,EAAeC,GAAA,IAAAC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,KAAEA,EAAIC,cAAEA,GAAwDN,EAAtCO,EAAAA,EAAAA,EAAAA,gEAC9F,MAAMC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,OAAEA,GAAWC,IAEnBC,KAAKJ,UAAYK,IACbL,EAAUK,IASd,GAAKV,EAIL,OACIW,EAACC,EAAAA,KACIf,EAAUgB,oUAAAC,CAAA,GACJb,GAAAA,CACHG,SACAR,OACAmB,mBAAoB,CAAC,cACrBpB,MAAOA,IAhBIY,GAAU,CAAC,EAAES,eAAeC,KAAKV,EAAQ,UAA6B,IAAjBA,EAAOW,MACxD,GAAGhB,EAAKiB,IAAI,uBAAuBpB,IACnD,GAAGG,EAAKiB,IAAI,iBAAiBpB,KAe5BqB,QAAStB,KAIzB"}
1
+ {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment, Ref } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n name: string;\n showPayButton: boolean;\n ref?: Ref<typeof RedirectButton>;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, name, showPayButton, ...props }: Readonly<RedirectButtonProps>) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { amount } = useAmount();\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","_0","label","icon","payButton","onSubmit","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","amount","useAmount","this","newStatus","h","Fragment","_object_spread_props","_object_spread","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"u4CAiBA,SAASA,EAAeC,GAAA,IAAAC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,KAAEA,EAAIC,cAAEA,GAAwDN,EAAtCO,EAAAA,EAAAA,EAAAA,gEAC9F,MAAMC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,OAAEA,GAAWC,IAEnBC,KAAKJ,UAAYK,IACbL,EAAUK,IASd,GAAKV,EAIL,OACIW,EAACC,EAAAA,KACIf,EAAUgB,oUAAAC,CAAA,GACJb,GAAAA,CACHG,SACAR,OACAmB,mBAAoB,CAAC,cACrBpB,MAAOA,IAhBIY,GAAU,CAAC,EAAES,eAAeC,KAAKV,EAAQ,UAA6B,IAAjBA,EAAOW,MACxD,GAAGhB,EAAKiB,IAAI,uBAAuBpB,IACnD,GAAGG,EAAKiB,IAAI,iBAAiBpB,KAe5BqB,QAAStB,KAIzB"}