@adyen/adyen-web 6.45.0 → 6.45.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 (232) hide show
  1. package/dist/cjs/adyen.css +12 -12
  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 +1983 -1924
  6. package/dist/es/adyen.css +12 -12
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
  9. package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
  10. package/dist/es/components/Ach/Ach.js +1 -1
  11. package/dist/es/components/Ach/Ach.js.map +1 -1
  12. package/dist/es/components/Ach/components/AchComponent.js +1 -1
  13. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  14. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  15. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  16. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  17. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  18. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  19. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  20. package/dist/es/components/BankTransfer/BankTransfer.js +1 -1
  21. package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
  22. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  23. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  24. package/dist/es/components/Blik/Blik.js +1 -1
  25. package/dist/es/components/Blik/Blik.js.map +1 -1
  26. package/dist/es/components/Blik/components/BlikInput.js +1 -1
  27. package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
  28. package/dist/es/components/Card/Card.js +1 -1
  29. package/dist/es/components/Card/Card.js.map +1 -1
  30. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  31. package/dist/es/components/Card/components/ClickToPayHolder.js.map +1 -1
  32. package/dist/es/components/Card/components/ClickToPayWrapper.js +1 -1
  33. package/dist/es/components/Card/components/ClickToPayWrapper.js.map +1 -1
  34. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  35. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  36. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  37. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  38. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  39. package/dist/es/components/Donation/Donation.js +1 -1
  40. package/dist/es/components/Donation/Donation.js.map +1 -1
  41. package/dist/es/components/Donation/components/DonationComponent.js +1 -1
  42. package/dist/es/components/Donation/components/DonationComponent.js.map +1 -1
  43. package/dist/es/components/Dropin/Dropin.js +1 -1
  44. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  45. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  46. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  47. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  48. package/dist/es/components/Giropay/Giropay.js +1 -1
  49. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  50. package/dist/es/components/MBWay/MBWay.js +1 -1
  51. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  52. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  53. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  54. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  55. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  56. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  57. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  58. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  59. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  60. package/dist/es/components/PayTo/components/BSBInput.js +1 -1
  61. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
  62. package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
  63. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  64. package/dist/es/components/PayTo/components/PayToPhone.js +1 -1
  65. package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -1
  66. package/dist/es/components/Pix/Pix.js +1 -1
  67. package/dist/es/components/Pix/Pix.js.map +1 -1
  68. package/dist/es/components/Pix/components/PixInput/PixInput.js +1 -1
  69. package/dist/es/components/Pix/components/PixInput/PixInput.js.map +1 -1
  70. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  71. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  72. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  73. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  74. package/dist/es/components/Redirect/Redirect.js +1 -1
  75. package/dist/es/components/Redirect/Redirect.js.map +1 -1
  76. package/dist/es/components/Sepa/Sepa.js.map +1 -1
  77. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  78. package/dist/es/components/Trustly/Trustly.js +1 -1
  79. package/dist/es/components/Trustly/Trustly.js.map +1 -1
  80. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  81. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  82. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  83. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  84. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  85. package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
  86. package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
  87. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  88. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  89. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  90. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  91. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  92. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  93. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  94. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  95. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  96. package/dist/es/components/internal/IbanInput/validate.js +1 -1
  97. package/dist/es/components/internal/IbanInput/validate.js.map +1 -1
  98. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  99. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  100. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  101. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  102. package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
  103. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  104. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  105. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  106. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  107. package/dist/es/components/internal/UIElement/utils.js +1 -1
  108. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  109. package/dist/es/core/config.js +1 -1
  110. package/dist/es/index.d.ts +1983 -1924
  111. package/dist/es/utils/Validator/Validator.js +1 -1
  112. package/dist/es/utils/Validator/Validator.js.map +1 -1
  113. package/dist/es/utils/useForm/reducer.js +1 -1
  114. package/dist/es/utils/useForm/reducer.js.map +1 -1
  115. package/dist/es/utils/useForm/useForm.js +1 -1
  116. package/dist/es/utils/useForm/useForm.js.map +1 -1
  117. package/dist/es/utils/useForm/useFormWithA11y.js +1 -1
  118. package/dist/es/utils/useForm/useFormWithA11y.js.map +1 -1
  119. package/dist/es-legacy/adyen.css +12 -12
  120. package/dist/es-legacy/adyen.css.map +1 -1
  121. package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
  122. package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
  123. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  124. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  125. package/dist/es-legacy/components/Ach/components/AchComponent.js +1 -1
  126. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  127. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  128. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  129. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  130. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  131. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  132. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  133. package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
  134. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  135. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  136. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  137. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  138. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  139. package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
  140. package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
  141. package/dist/es-legacy/components/Card/Card.js +1 -1
  142. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  143. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  144. package/dist/es-legacy/components/Card/components/ClickToPayHolder.js.map +1 -1
  145. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  146. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  147. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  148. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  149. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  150. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  151. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  152. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  153. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  154. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  155. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  156. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  157. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  158. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  159. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  160. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  161. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  162. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  163. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  164. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  165. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  166. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  167. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  168. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  169. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  170. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  171. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  172. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  173. package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
  174. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
  175. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
  176. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  177. package/dist/es-legacy/components/PayTo/components/PayToPhone.js +1 -1
  178. package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -1
  179. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  180. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  181. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js +1 -1
  182. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js.map +1 -1
  183. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  184. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  185. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  186. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  187. package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
  188. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  189. package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
  190. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  191. package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
  192. package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
  193. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  194. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  195. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  196. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  197. package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
  198. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
  199. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
  200. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  201. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  202. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  203. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  204. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  205. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  206. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  207. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  208. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  209. package/dist/es-legacy/components/internal/IbanInput/validate.js +1 -1
  210. package/dist/es-legacy/components/internal/IbanInput/validate.js.map +1 -1
  211. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  212. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  213. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  214. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  215. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  216. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  217. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  218. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  219. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  220. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  221. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  222. package/dist/es-legacy/core/config.js +1 -1
  223. package/dist/es-legacy/utils/Validator/Validator.js +1 -1
  224. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  225. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  226. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  227. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  228. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  229. package/dist/es-legacy/utils/useForm/useFormWithA11y.js +1 -1
  230. package/dist/es-legacy/utils/useForm/useFormWithA11y.js.map +1 -1
  231. package/package.json +10 -10
  232. package/styles/adyen.css +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"PreAuthorizedDebitCanada.js","sources":["../../../../src/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { TxVariants } from '../tx-variants';\nimport PreAuthorizedDebitCanadaComponent from './components/PreAuthorizedDebitCanadaComponent';\nimport { SettlementInfo } from './components/SettlementInfo';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\n\nimport type { PreAuthorizedDebitCanadaConfiguration } from './types';\n\nexport class PreAuthorizedDebitCanada extends UIElement<PreAuthorizedDebitCanadaConfiguration> {\n public static readonly type = TxVariants.eft_directdebit_CA;\n\n public override formatData() {\n const recurringPayment = !!this.props.storedPaymentMethodId;\n\n if (recurringPayment) {\n return {\n paymentMethod: {\n type: PreAuthorizedDebitCanada.type,\n storedPaymentMethodId: this.props.storedPaymentMethodId\n }\n };\n }\n\n return {\n paymentMethod: {\n type: PreAuthorizedDebitCanada.type,\n ownerName: this.state.data.ownerName,\n bankAccountNumber: this.state.data.bankAccountNumber,\n bankCode: this.state.data.bankCode,\n bankLocationId: this.state.data.bankLocationId\n },\n ...(this.state.storePaymentMethod && { storePaymentMethod: this.state.storePaymentMethod })\n };\n }\n\n public override formatProps(props: PreAuthorizedDebitCanadaConfiguration): PreAuthorizedDebitCanadaConfiguration {\n return {\n enableStoreDetails: props.session?.configuration?.enableStoreDetails ?? props.enableStoreDetails,\n ...props\n };\n }\n\n public override get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n public override get displayName(): string {\n if (this.props.storedPaymentMethodId && this.props.lastFour) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name;\n }\n\n public override get additionalInfo(): string {\n return this.props.storedPaymentMethodId ? this.props.label : '';\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <Fragment>\n <SettlementInfo />\n <RedirectButton\n showPayButton={this.props.showPayButton}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`bento_lock`)}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n name={this.displayName}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n </Fragment>\n ) : (\n <PreAuthorizedDebitCanadaComponent\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n placeholders={this.props.placeholders}\n setComponentRef={this.setComponentRef}\n showContextualElement={this.props.showContextualElement}\n enableStoreDetails={this.props.enableStoreDetails}\n />\n );\n }\n}\n\nexport default PreAuthorizedDebitCanada;\n"],"names":["PreAuthorizedDebitCanada","UIElement","formatData","this","props","storedPaymentMethodId","paymentMethod","type","_object_spread","ownerName","state","data","bankAccountNumber","bankCode","bankLocationId","storePaymentMethod","formatProps","enableStoreDetails","_ref","session","configuration","isValid","displayName","lastFour","name","additionalInfo","label","componentToRender","_this_resources","h","Fragment","SettlementInfo","RedirectButton","showPayButton","icon","resources","getImage","imageFolder","payAmountLabel","i18n","amount","payButton","onSubmit","submit","ref","componentRef","PreAuthorizedDebitCanadaComponent","onChange","setState","placeholders","setComponentRef","showContextualElement","_define_property","TxVariants","eft_directdebit_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KAAMpC,KAAKC,MAAMoC,QAClDhB,KAAMrB,KAAKmB,YACXmB,UAAWtC,KAAKsC,UAChBC,SAAUvC,KAAKwC,OACfC,IAAKA,IACDzC,KAAK0C,aAAeD,MAKhCf,EAACiB,EAAAA,CACGC,SAAU5C,KAAK6C,SACfP,UAAWtC,KAAKsC,UAChBR,cAAe9B,KAAKC,MAAM6B,cAC1BgB,aAAc9C,KAAKC,MAAM6C,aACzBC,gBAAiB/C,KAAK+C,gBACtBC,sBAAuBhD,KAAKC,MAAM+C,sBAClClC,mBAAoBd,KAAKC,MAAMa,oBAG3C,EAhFAmC,EADSpD,EACcO,OAAO8C,EAAWC"}
1
+ {"version":3,"file":"PreAuthorizedDebitCanada.js","sources":["../../../../src/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { TxVariants } from '../tx-variants';\nimport PreAuthorizedDebitCanadaComponent from './components/PreAuthorizedDebitCanadaComponent';\nimport { SettlementInfo } from './components/SettlementInfo';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\n\nimport type { PreAuthorizedDebitCanadaConfiguration } from './types';\n\nexport class PreAuthorizedDebitCanada extends UIElement<PreAuthorizedDebitCanadaConfiguration> {\n public static readonly type = TxVariants.eft_directdebit_CA;\n\n public override formatData() {\n const recurringPayment = !!this.props.storedPaymentMethodId;\n\n if (recurringPayment) {\n return {\n paymentMethod: {\n type: PreAuthorizedDebitCanada.type,\n storedPaymentMethodId: this.props.storedPaymentMethodId\n }\n };\n }\n\n return {\n paymentMethod: {\n type: PreAuthorizedDebitCanada.type,\n ownerName: this.state.data.ownerName,\n bankAccountNumber: this.state.data.bankAccountNumber,\n bankCode: this.state.data.bankCode,\n bankLocationId: this.state.data.bankLocationId\n },\n ...(this.state.storePaymentMethod && { storePaymentMethod: this.state.storePaymentMethod })\n };\n }\n\n public override formatProps(props: PreAuthorizedDebitCanadaConfiguration): PreAuthorizedDebitCanadaConfiguration {\n return {\n enableStoreDetails: props.session?.configuration?.enableStoreDetails ?? props.enableStoreDetails,\n ...props\n };\n }\n\n public override get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n public override get displayName(): string {\n if (this.props.storedPaymentMethodId && this.props.lastFour) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name;\n }\n\n public override get additionalInfo(): string {\n return this.props.storedPaymentMethodId ? this.props.label : '';\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <Fragment>\n <SettlementInfo />\n <RedirectButton\n showPayButton={this.props.showPayButton}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`bento_lock`)}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n name={this.displayName}\n payButton={this.payButton}\n onSubmit={this.submit}\n setComponentRef={this.setComponentRef}\n />\n </Fragment>\n ) : (\n <PreAuthorizedDebitCanadaComponent\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n placeholders={this.props.placeholders}\n setComponentRef={this.setComponentRef}\n showContextualElement={this.props.showContextualElement}\n enableStoreDetails={this.props.enableStoreDetails}\n />\n );\n }\n}\n\nexport default PreAuthorizedDebitCanada;\n"],"names":["PreAuthorizedDebitCanada","UIElement","formatData","this","props","storedPaymentMethodId","paymentMethod","type","_object_spread","ownerName","state","data","bankAccountNumber","bankCode","bankLocationId","storePaymentMethod","formatProps","enableStoreDetails","_ref","session","configuration","isValid","displayName","lastFour","name","additionalInfo","label","componentToRender","_this_resources","h","Fragment","SettlementInfo","RedirectButton","showPayButton","icon","resources","getImage","imageFolder","payAmountLabel","i18n","amount","payButton","onSubmit","submit","setComponentRef","PreAuthorizedDebitCanadaComponent","onChange","setState","placeholders","showContextualElement","_define_property","TxVariants","eft_directdebit_CA"],"mappings":"03BAUO,MAAMA,UAAiCC,EAG1BC,UAAAA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YACXmB,UAAWtC,KAAKsC,UAChBC,SAAUvC,KAAKwC,OACfC,gBAAiBzC,KAAKyC,mBAI9Bf,EAACgB,EAAAA,CACGC,SAAU3C,KAAK4C,SACfN,UAAWtC,KAAKsC,UAChBR,cAAe9B,KAAKC,MAAM6B,cAC1Be,aAAc7C,KAAKC,MAAM4C,aACzBJ,gBAAiBzC,KAAKyC,gBACtBK,sBAAuB9C,KAAKC,MAAM6C,sBAClChC,mBAAoBd,KAAKC,MAAMa,oBAG3C,EA9EAiC,EADSlD,EACcO,OAAO4C,EAAWC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as a,useRef as t,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import l from"../../internal/FormInstruction/FormInstruction.js";import i from"../../../utils/useForm/useForm.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import u from"../../internal/FormFields/Field/Field.js";import s from"../../internal/FormFields/InputText.js";import{preAuthorizedDebitCanadaValidationRules as d,preAuthorizedDebitCanadaFormatters as m}from"./validate.js";import c from"../../internal/StoreDetails/StoreDetails.js";import b from"../../../core/Context/useImage.js";import{SettlementInfo as p}from"./SettlementInfo.js";function k({onChange:k,payButton:f,showPayButton:g,placeholders:N,setComponentRef:x,enableStoreDetails:h,showContextualElement:C=!0}){const I=b(),{i18n:F}=o(),[w,v]=a("ready"),{handleChangeFor:j,triggerValidation:A,data:M,errors:L,valid:S,isValid:V}=i({schema:["ownerName","bankAccountNumber","bankCode","bankLocationId"],rules:d,formatters:m}),[T,y]=a(!1),B="loading"===w,E=t({setStatus:v,showValidation:()=>{A()}});return n(()=>{x(E.current)},[x,E.current]),n(()=>{k({data:M,valid:S,errors:L,isValid:V,storePaymentMethod:T})},[k,M,S,L,V,T]),e("div",{className:"adyen-checkout__eftpad-canada"},e(l,null),e(r,null,e(u,{label:F.get("eftpad-canada.input.accountHolderName.label"),errorMessage:!!L.ownerName&&F.get(L.ownerName.errorMessage),isValid:!!S.ownerName,name:"ownerName"},e(s,{disabled:B,name:"ownerName",placeholder:null==N?void 0:N.ownerName,value:M.ownerName,onInput:j("ownerName","input"),onBlur:j("ownerName","blur"),required:!0,"data-testid":"owner-name",autocomplete:"name"})),e(u,{label:F.get("eftpad-canada.input.accountNumber.label"),errorMessage:!!L.bankAccountNumber&&F.get(L.bankAccountNumber.errorMessage),name:"bankAccountNumber",isValid:!!S.bankAccountNumber,showContextualElement:C,contextualText:F.get("eftpad-canada.input.accountNumber.contextualText")},e(s,{disabled:B,name:"bankAccountNumber",placeholder:null==N?void 0:N.bankAccountNumber,value:M.bankAccountNumber,onInput:j("bankAccountNumber","input"),onBlur:j("bankAccountNumber","blur"),required:!0,maxlength:12,autocomplete:void 0})),e(u,{label:F.get("eftpad-canada.input.institutionNumber.label"),classNameModifiers:["col-50"],errorMessage:!!L.bankCode&&F.get(L.bankCode.errorMessage),isValid:!!S.bankCode,name:"bankCode",showContextualElement:C,contextualText:F.get("eftpad-canada.input.institutionNumber.contextualText")},e(s,{disabled:B,name:"bankCode",placeholder:null==N?void 0:N.bankCode,value:M.bankCode,onInput:j("bankCode","input"),onBlur:j("bankCode","blur"),required:!0,maxlength:3,autocomplete:void 0})),e(u,{label:F.get("eftpad-canada.input.transitNumber.label"),classNameModifiers:["col-50"],errorMessage:!!L.bankLocationId&&F.get(L.bankLocationId.errorMessage),name:"bankLocationId",isValid:!!S.bankLocationId,showContextualElement:C,contextualText:F.get("eftpad-canada.input.transitNumber.contextualText")},e(s,{disabled:B,name:"bankLocationId",placeholder:null==N?void 0:N.bankLocationId,value:M.bankLocationId,onInput:j("bankLocationId","input"),onBlur:j("bankLocationId","blur"),required:!0,maxlength:5,autocomplete:void 0}))),h&&e(c,{className:"adyen-checkout_eftpad-canada-store-details",disabled:B,onChange:y}),e(p,null),g&&f({status:w,icon:I({imageFolder:"components/"})("bento_lock")}))}export{k as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as a,useRef as t,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as n}from"../../../core/Context/CoreProvider.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import l from"../../internal/FormInstruction/FormInstruction.js";import i from"../../../utils/useForm/useForm.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import s from"../../internal/FormFields/Field/Field.js";import u from"../../internal/FormFields/InputText.js";import{preAuthorizedDebitCanadaValidationRules as d,preAuthorizedDebitCanadaFormatters as m}from"./validate.js";import c from"../../internal/StoreDetails/StoreDetails.js";import b from"../../../core/Context/useImage.js";import{SettlementInfo as p}from"./SettlementInfo.js";function g({onChange:g,payButton:f,showPayButton:k,placeholders:N,setComponentRef:v,enableStoreDetails:x,showContextualElement:h=!0}){var C,I,F,w;const M=b(),{i18n:j}=n(),[A,y]=a("ready"),{handleChangeFor:L,triggerValidation:S,data:V,errors:T,valid:B,isValid:E}=i({schema:["ownerName","bankAccountNumber","bankCode","bankLocationId"],rules:d,formatters:m}),[q,_]=a(!1),D="loading"===A,P=t({setStatus:y,showValidation:()=>{S()}});return o(()=>{v(P.current)},[v,P.current]),o(()=>{g({data:V,valid:B,errors:T,isValid:E,storePaymentMethod:q})},[g,V,B,T,E,q]),e("div",{className:"adyen-checkout__eftpad-canada"},e(l,null),e(r,null,e(s,{label:j.get("eftpad-canada.input.accountHolderName.label"),errorMessage:"string"==typeof(null===(C=T.ownerName)||void 0===C?void 0:C.errorMessage)?j.get(T.ownerName.errorMessage):null,isValid:!!B.ownerName,name:"ownerName"},e(u,{disabled:D,name:"ownerName",placeholder:null==N?void 0:N.ownerName,value:V.ownerName,onInput:L("ownerName","input"),onBlur:L("ownerName","blur"),required:!0,"data-testid":"owner-name",autocomplete:"name"})),e(s,{label:j.get("eftpad-canada.input.accountNumber.label"),errorMessage:"string"==typeof(null===(I=T.bankAccountNumber)||void 0===I?void 0:I.errorMessage)?j.get(T.bankAccountNumber.errorMessage):null,name:"bankAccountNumber",isValid:!!B.bankAccountNumber,showContextualElement:h,contextualText:j.get("eftpad-canada.input.accountNumber.contextualText")},e(u,{disabled:D,name:"bankAccountNumber",placeholder:null==N?void 0:N.bankAccountNumber,value:V.bankAccountNumber,onInput:L("bankAccountNumber","input"),onBlur:L("bankAccountNumber","blur"),required:!0,maxlength:12,autocomplete:void 0})),e(s,{label:j.get("eftpad-canada.input.institutionNumber.label"),classNameModifiers:["col-50"],errorMessage:"string"==typeof(null===(F=T.bankCode)||void 0===F?void 0:F.errorMessage)?j.get(T.bankCode.errorMessage):null,isValid:!!B.bankCode,name:"bankCode",showContextualElement:h,contextualText:j.get("eftpad-canada.input.institutionNumber.contextualText")},e(u,{disabled:D,name:"bankCode",placeholder:null==N?void 0:N.bankCode,value:V.bankCode,onInput:L("bankCode","input"),onBlur:L("bankCode","blur"),required:!0,maxlength:3,autocomplete:void 0})),e(s,{label:j.get("eftpad-canada.input.transitNumber.label"),classNameModifiers:["col-50"],errorMessage:"string"==typeof(null===(w=T.bankLocationId)||void 0===w?void 0:w.errorMessage)?j.get(T.bankLocationId.errorMessage):null,name:"bankLocationId",isValid:!!B.bankLocationId,showContextualElement:h,contextualText:j.get("eftpad-canada.input.transitNumber.contextualText")},e(u,{disabled:D,name:"bankLocationId",placeholder:null==N?void 0:N.bankLocationId,value:V.bankLocationId,onInput:L("bankLocationId","input"),onBlur:L("bankLocationId","blur"),required:!0,maxlength:5,autocomplete:void 0}))),x&&e(c,{className:"adyen-checkout_eftpad-canada-store-details",disabled:D,onChange:_}),e(p,null),k&&f({status:A,icon:M({imageFolder:"components/"})("bento_lock")}))}export{g as default};
2
2
  //# sourceMappingURL=PreAuthorizedDebitCanadaComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PreAuthorizedDebitCanadaComponent.js","sources":["../../../../../src/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport FormInstruction from '../../internal/FormInstruction';\nimport useForm from '../../../utils/useForm';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\nimport { preAuthorizedDebitCanadaFormatters, preAuthorizedDebitCanadaValidationRules } from './validate';\nimport StoreDetails from '../../internal/StoreDetails';\nimport useImage from '../../../core/Context/useImage';\nimport { SettlementInfo } from './SettlementInfo';\n\nimport type { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport type { ComponentMethodsRef } from '../../internal/UIElement/types';\nimport type { PreAuthorizedDebitCanadaPlaceholders } from '../types';\n\nimport './PreAuthorizedDebitCanada.scss';\nimport { ValidationRuleResult } from '../../../utils/Validator/ValidationRuleResult';\n\ninterface PreAuthorizedDebitCanadaForm {\n ownerName: string;\n bankAccountNumber: string;\n bankCode: string;\n bankLocationId: string;\n}\n\ninterface PreAuthorizedDebitCanadaComponentProps {\n onChange({\n data,\n valid,\n errors,\n isValid,\n storePaymentMethod\n }: {\n data: PreAuthorizedDebitCanadaForm;\n valid: { [key: string]: boolean };\n errors: { [key: string]: ValidationRuleResult };\n isValid: boolean;\n storePaymentMethod: boolean;\n }): void;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n showPayButton: boolean;\n enableStoreDetails: boolean;\n showContextualElement?: boolean;\n placeholders?: PreAuthorizedDebitCanadaPlaceholders;\n}\n\nfunction PreAuthorizedDebitCanadaComponent({\n onChange,\n payButton,\n showPayButton,\n placeholders,\n setComponentRef,\n enableStoreDetails,\n showContextualElement = true\n}: Readonly<PreAuthorizedDebitCanadaComponentProps>) {\n const getImage = useImage();\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = useForm<PreAuthorizedDebitCanadaForm>({\n schema: ['ownerName', 'bankAccountNumber', 'bankCode', 'bankLocationId'],\n rules: preAuthorizedDebitCanadaValidationRules,\n formatters: preAuthorizedDebitCanadaFormatters\n });\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n\n const isFormDisabled = status === 'loading';\n\n const componentRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n triggerValidation();\n }\n });\n\n useEffect(() => {\n setComponentRef(componentRef.current);\n }, [setComponentRef, componentRef.current]);\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid, storePaymentMethod });\n }, [onChange, data, valid, errors, isValid, storePaymentMethod]);\n\n return (\n <div className=\"adyen-checkout__eftpad-canada\">\n <FormInstruction />\n\n <Fieldset>\n <Field\n label={i18n.get('eftpad-canada.input.accountHolderName.label')}\n errorMessage={!!errors.ownerName && i18n.get(errors.ownerName.errorMessage)}\n isValid={!!valid.ownerName}\n name={'ownerName'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'ownerName'}\n placeholder={placeholders?.ownerName}\n value={data.ownerName}\n onInput={handleChangeFor('ownerName', 'input')}\n onBlur={handleChangeFor('ownerName', 'blur')}\n required={true}\n data-testid={'owner-name'}\n autocomplete=\"name\"\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.accountNumber.label')}\n errorMessage={!!errors.bankAccountNumber && i18n.get(errors.bankAccountNumber.errorMessage)}\n name={'bankAccountNumber'}\n isValid={!!valid.bankAccountNumber}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.accountNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankAccountNumber'}\n placeholder={placeholders?.bankAccountNumber}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n required={true}\n maxlength={12}\n autocomplete={undefined}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.institutionNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={!!errors.bankCode && i18n.get(errors.bankCode.errorMessage)}\n isValid={!!valid.bankCode}\n name={'bankCode'}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.institutionNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankCode'}\n placeholder={placeholders?.bankCode}\n value={data.bankCode}\n onInput={handleChangeFor('bankCode', 'input')}\n onBlur={handleChangeFor('bankCode', 'blur')}\n required={true}\n maxlength={3}\n autocomplete={undefined}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.transitNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={!!errors.bankLocationId && i18n.get(errors.bankLocationId.errorMessage)}\n name={'bankLocationId'}\n isValid={!!valid.bankLocationId}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.transitNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankLocationId'}\n placeholder={placeholders?.bankLocationId}\n value={data.bankLocationId}\n onInput={handleChangeFor('bankLocationId', 'input')}\n onBlur={handleChangeFor('bankLocationId', 'blur')}\n required={true}\n maxlength={5}\n autocomplete={undefined}\n />\n </Field>\n </Fieldset>\n\n {enableStoreDetails && (\n <StoreDetails className={'adyen-checkout_eftpad-canada-store-details'} disabled={isFormDisabled} onChange={setStorePaymentMethod} />\n )}\n\n <SettlementInfo />\n\n {showPayButton && payButton({ status, icon: getImage({ imageFolder: 'components/' })('bento_lock') })}\n </div>\n );\n}\n\nexport default PreAuthorizedDebitCanadaComponent;\n"],"names":["PreAuthorizedDebitCanadaComponent","onChange","payButton","showPayButton","placeholders","setComponentRef","enableStoreDetails","showContextualElement","getImage","useImage","i18n","useCoreContext","status","setStatus","useState","handleChangeFor","triggerValidation","data","errors","valid","isValid","useForm","schema","rules","preAuthorizedDebitCanadaValidationRules","formatters","preAuthorizedDebitCanadaFormatters","storePaymentMethod","setStorePaymentMethod","isFormDisabled","componentRef","useRef","showValidation","useEffect","current","h","div","className","FormInstruction","Fieldset","Field","label","get","errorMessage","ownerName","name","InputText","disabled","placeholder","value","onInput","onBlur","required","data-testid","autocomplete","bankAccountNumber","contextualText","maxlength","undefined","classNameModifiers","bankCode","bankLocationId","StoreDetails","SettlementInfo","icon","imageFolder"],"mappings":"i2BAiDA,SAASA,GAAkCC,SACvCA,EAAQC,UACRA,EAASC,cACTA,EAAaC,aACbA,EAAYC,gBACZA,EAAeC,mBACfA,EAAkBC,sBAClBA,GAAwB,IAExB,MAAMC,EAAWC,KACXC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,GAAYC,EAAsC,CAC/GC,OAAQ,CAAC,YAAa,oBAAqB,WAAY,kBACvDC,MAAOC,EACPC,WAAYC,KAETC,EAAoBC,GAAyBd,GAAS,GAEvDe,EAA4B,YAAXjB,EAEjBkB,EAAeC,EAA4B,CAC7ClB,UAAWA,EACXmB,eAAgB,KACZhB,OAYR,OARAiB,EAAU,KACN5B,EAAgByB,EAAaI,UAC9B,CAAC7B,EAAiByB,EAAaI,UAElCD,EAAU,KACNhC,EAAS,CAAEgB,OAAME,QAAOD,SAAQE,UAASO,wBAC1C,CAAC1B,EAAUgB,EAAME,EAAOD,EAAQE,EAASO,IAGxCQ,EAACC,MAAAA,CAAIC,UAAU,iCACXF,EAACG,EAAAA,MAEDH,EAACI,EAAAA,KACGJ,EAACK,EAAAA,CACGC,MAAO/B,EAAKgC,IAAI,+CAChBC,eAAgBzB,EAAO0B,WAAalC,EAAKgC,IAAIxB,EAAO0B,UAAUD,cAC9DvB,UAAWD,EAAMyB,UACjBC,KAAM,aAENV,EAACW,EAAAA,CACGC,SAAUlB,EACVgB,KAAM,YACNG,YAAa5C,aAAAA,EAAAA,EAAcwC,UAC3BK,MAAOhC,EAAK2B,UACZM,QAASnC,EAAgB,YAAa,SACtCoC,OAAQpC,EAAgB,YAAa,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cyD,eAC3BZ,MAAOhC,EAAK4C,eACZX,QAASnC,EAAgB,iBAAkB,SAC3CoC,OAAQpC,EAAgB,iBAAkB,QAC1CqC,UAAU,EACVK,UAAW,EACXH,kBAAcI,MAKzBpD,GACG6B,EAAC2B,EAAAA,CAAazB,UAAW,6CAA8CU,SAAUlB,EAAgB5B,SAAU2B,IAG/GO,EAAC4B,EAAAA,MAEA5D,GAAiBD,EAAU,CAAEU,SAAQoD,KAAMxD,EAAS,CAAEyD,YAAa,eAAxBzD,CAAyC,gBAGjG"}
1
+ {"version":3,"file":"PreAuthorizedDebitCanadaComponent.js","sources":["../../../../../src/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport FormInstruction from '../../internal/FormInstruction';\nimport useForm from '../../../utils/useForm';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\nimport { preAuthorizedDebitCanadaFormatters, preAuthorizedDebitCanadaValidationRules } from './validate';\nimport StoreDetails from '../../internal/StoreDetails';\nimport useImage from '../../../core/Context/useImage';\nimport { SettlementInfo } from './SettlementInfo';\n\nimport type { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport type { ComponentMethodsRef } from '../../internal/UIElement/types';\nimport type { PreAuthorizedDebitCanadaPlaceholders } from '../types';\n\nimport './PreAuthorizedDebitCanada.scss';\nimport { ValidationRuleResult } from '../../../utils/Validator/ValidationRuleResult';\n\ninterface PreAuthorizedDebitCanadaForm {\n ownerName: string;\n bankAccountNumber: string;\n bankCode: string;\n bankLocationId: string;\n}\n\ninterface PreAuthorizedDebitCanadaComponentProps {\n onChange({\n data,\n valid,\n errors,\n isValid,\n storePaymentMethod\n }: {\n data: PreAuthorizedDebitCanadaForm;\n valid: { [key: string]: boolean };\n errors: { [key: string]: ValidationRuleResult };\n isValid: boolean;\n storePaymentMethod: boolean;\n }): void;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n showPayButton: boolean;\n enableStoreDetails: boolean;\n showContextualElement?: boolean;\n placeholders?: PreAuthorizedDebitCanadaPlaceholders;\n}\n\nfunction PreAuthorizedDebitCanadaComponent({\n onChange,\n payButton,\n showPayButton,\n placeholders,\n setComponentRef,\n enableStoreDetails,\n showContextualElement = true\n}: Readonly<PreAuthorizedDebitCanadaComponentProps>) {\n const getImage = useImage();\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = useForm<PreAuthorizedDebitCanadaForm>({\n schema: ['ownerName', 'bankAccountNumber', 'bankCode', 'bankLocationId'],\n rules: preAuthorizedDebitCanadaValidationRules,\n formatters: preAuthorizedDebitCanadaFormatters\n });\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n\n const isFormDisabled = status === 'loading';\n\n const componentRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n triggerValidation();\n }\n });\n\n useEffect(() => {\n setComponentRef(componentRef.current);\n }, [setComponentRef, componentRef.current]);\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid, storePaymentMethod });\n }, [onChange, data, valid, errors, isValid, storePaymentMethod]);\n\n return (\n <div className=\"adyen-checkout__eftpad-canada\">\n <FormInstruction />\n\n <Fieldset>\n <Field\n label={i18n.get('eftpad-canada.input.accountHolderName.label')}\n errorMessage={typeof errors.ownerName?.errorMessage === 'string' ? i18n.get(errors.ownerName.errorMessage) : null}\n isValid={!!valid.ownerName}\n name={'ownerName'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'ownerName'}\n placeholder={placeholders?.ownerName}\n value={data.ownerName}\n onInput={handleChangeFor('ownerName', 'input')}\n onBlur={handleChangeFor('ownerName', 'blur')}\n required={true}\n data-testid={'owner-name'}\n autocomplete=\"name\"\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.accountNumber.label')}\n errorMessage={typeof errors.bankAccountNumber?.errorMessage === 'string' ? i18n.get(errors.bankAccountNumber.errorMessage) : null}\n name={'bankAccountNumber'}\n isValid={!!valid.bankAccountNumber}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.accountNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankAccountNumber'}\n placeholder={placeholders?.bankAccountNumber}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n required={true}\n maxlength={12}\n autocomplete={undefined}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.institutionNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={typeof errors.bankCode?.errorMessage === 'string' ? i18n.get(errors.bankCode.errorMessage) : null}\n isValid={!!valid.bankCode}\n name={'bankCode'}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.institutionNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankCode'}\n placeholder={placeholders?.bankCode}\n value={data.bankCode}\n onInput={handleChangeFor('bankCode', 'input')}\n onBlur={handleChangeFor('bankCode', 'blur')}\n required={true}\n maxlength={3}\n autocomplete={undefined}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.transitNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={typeof errors.bankLocationId?.errorMessage === 'string' ? i18n.get(errors.bankLocationId.errorMessage) : null}\n name={'bankLocationId'}\n isValid={!!valid.bankLocationId}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.transitNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankLocationId'}\n placeholder={placeholders?.bankLocationId}\n value={data.bankLocationId}\n onInput={handleChangeFor('bankLocationId', 'input')}\n onBlur={handleChangeFor('bankLocationId', 'blur')}\n required={true}\n maxlength={5}\n autocomplete={undefined}\n />\n </Field>\n </Fieldset>\n\n {enableStoreDetails && (\n <StoreDetails className={'adyen-checkout_eftpad-canada-store-details'} disabled={isFormDisabled} onChange={setStorePaymentMethod} />\n )}\n\n <SettlementInfo />\n\n {showPayButton && payButton({ status, icon: getImage({ imageFolder: 'components/' })('bento_lock') })}\n </div>\n );\n}\n\nexport default PreAuthorizedDebitCanadaComponent;\n"],"names":["PreAuthorizedDebitCanadaComponent","onChange","payButton","showPayButton","placeholders","setComponentRef","enableStoreDetails","showContextualElement","errors","getImage","useImage","i18n","useCoreContext","status","setStatus","useState","handleChangeFor","triggerValidation","data","valid","isValid","useForm","schema","rules","preAuthorizedDebitCanadaValidationRules","formatters","preAuthorizedDebitCanadaFormatters","storePaymentMethod","setStorePaymentMethod","isFormDisabled","componentRef","useRef","showValidation","useEffect","current","h","div","className","FormInstruction","Fieldset","Field","label","get","errorMessage","ownerName","name","InputText","disabled","placeholder","value","onInput","onBlur","required","data-testid","autocomplete","bankAccountNumber","contextualText","maxlength","undefined","classNameModifiers","bankCode","bankLocationId","StoreDetails","SettlementInfo","icon","imageFolder"],"mappings":"i2BAiDA,SAASA,GAAkCC,SACvCA,EAAQC,UACRA,EAASC,cACTA,EAAaC,aACbA,EAAYC,gBACZA,EAAeC,mBACfA,EAAkBC,sBAClBA,GAAwB,IAoCaC,IAAAA,EAmBAA,EAsBAA,EAsBAA,EAjGrC,MAAMC,EAAWC,KACXC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIV,OAAEA,EAAMW,MAAEA,EAAKC,QAAEA,GAAYC,EAAsC,CAC/GC,OAAQ,CAAC,YAAa,oBAAqB,WAAY,kBACvDC,MAAOC,EACPC,WAAYC,KAETC,EAAoBC,GAAyBb,GAAS,GAEvDc,EAA4B,YAAXhB,EAEjBiB,EAAeC,EAA4B,CAC7CjB,UAAWA,EACXkB,eAAgB,KACZf,O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B,mBAAoB,CAAC,UACrBhB,aAAuD,iBAAnB,QAAfnC,EAAAA,EAAOoD,oBAAPpD,SAAAA,EAAiBmC,cAA4BhC,EAAK+B,IAAIlC,EAAOoD,SAASjB,cAAgB,KAC3GvB,UAAWD,EAAMyC,SACjBf,KAAM,WACNtC,sBAAuBA,EACvBiD,eAAgB7C,EAAK+B,IAAI,yDAEzBP,EAACW,EAAAA,CACGC,SAAUlB,EACVgB,KAAM,WACNG,YAAa5C,aAAAA,EAAAA,EAAcwD,SAC3BX,MAAO/B,EAAK0C,SACZV,QAASlC,EAAgB,WAAY,SACrCmC,OAAQnC,EAAgB,WAAY,QACpCoC,UAAU,EACVK,UAAW,EACXH,kBAAcI,KAItBvB,EAACK,EAAAA,CACGC,MAAO9B,EAAK+B,IAAI,2CAChBiB,mBAAoB,CAAC,UACrBhB,aAA6D,iBAAnB,QAArBnC,EAAAA,EAAOqD,0BAAPrD,SAAAA,EAAuBmC,cAA4BhC,EAAK+B,IAAIlC,EAAOqD,eAAelB,cAAgB,KACvHE,KAAM,iBACNzB,UAAWD,EAAM0C,eACjBtD,sBAAuBA,EACvBiD,eAAgB7C,EAAK+B,IAAI,qDAEzBP,EAACW,EAAAA,CACGC,SAAUlB,EACVgB,KAAM,iBACNG,YAAa5C,aAAAA,EAAAA,EAAcyD,eAC3BZ,MAAO/B,EAAK2C,eACZX,QAASlC,EAAgB,iBAAkB,SAC3CmC,OAAQnC,EAAgB,iBAAkB,QAC1CoC,UAAU,EACVK,UAAW,EACXH,kBAAcI,MAKzBpD,GACG6B,EAAC2B,EAAAA,CAAazB,UAAW,6CAA8CU,SAAUlB,EAAgB5B,SAAU2B,IAG/GO,EAAC4B,EAAAA,MAEA5D,GAAiBD,EAAU,CAAEW,SAAQmD,KAAMvD,EAAS,CAAEwD,YAAa,eAAxBxD,CAAyC,gBAGjG"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/RedirectShopper/RedirectShopper.js";import o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as n}from"../tx-variants.js";import s from"../../utils/browserInfo.js";import{AnalyticsErrorEvent as i,ErrorEventCode as p,ErrorEventType as c}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){a(t,e,r[e])})}return t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class m extends e{formatData(){return{paymentMethod:{type:this.type},browserInfo:this.browserInfo}}get isRedirecting(){return!!this.props.url&&!!this.props.method}get isValid(){return!0}get browserInfo(){return s()}componentToRender(){return this.isRedirecting?t(r,l(u({url:this.props.url},this.props),{onActionHandled:this.onActionHandled,onRedirectError:this.handleRedirectError})):this.props.showPayButton?t(o,l(u({},this.props),{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}})):null}constructor(...t){super(...t),a(this,"handleRedirectError",()=>{const t=new i({component:this.props.paymentMethodType,errorType:c.redirect,code:p.REDIRECT});super.submitAnalytics(t)})}}a(m,"type",n.redirect),a(m,"defaultProps",{type:m.type});export{m as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/RedirectShopper/RedirectShopper.js";import o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as n}from"../tx-variants.js";import s from"../../utils/browserInfo.js";import{AnalyticsErrorEvent as i,ErrorEventCode as p,ErrorEventType as c}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){a(t,e,r[e])})}return t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class m extends e{formatData(){return{paymentMethod:{type:this.type},browserInfo:this.browserInfo}}get isRedirecting(){return!!this.props.url&&!!this.props.method}get isValid(){return!0}get browserInfo(){return s()}componentToRender(){return this.isRedirecting?t(r,l(u({url:this.props.url},this.props),{onActionHandled:this.onActionHandled,onRedirectError:this.handleRedirectError})):this.props.showPayButton?t(o,l(u({},this.props),{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef})):null}constructor(...t){super(...t),a(this,"handleRedirectError",()=>{const t=new i({component:this.props.paymentMethodType,errorType:c.redirect,code:p.REDIRECT});super.submitAnalytics(t)})}}a(m,"type",n.redirect),a(m,"defaultProps",{type:m.type});export{m as default};
2
2
  //# sourceMappingURL=Redirect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Redirect.js","sources":["../../../../src/components/Redirect/Redirect.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport RedirectShopper from './components/RedirectShopper';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport { RedirectConfiguration } from './types';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass RedirectElement extends UIElement<RedirectConfiguration> {\n public static readonly type: TxVariants = TxVariants.redirect;\n\n public static readonly defaultProps = {\n type: RedirectElement.type\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type\n },\n browserInfo: this.browserInfo\n };\n }\n\n private handleRedirectError = () => {\n const event = new AnalyticsErrorEvent({\n component: this.props.paymentMethodType,\n errorType: ErrorEventType.redirect,\n code: ErrorEventCode.REDIRECT\n });\n super.submitAnalytics(event);\n };\n\n get isRedirecting() {\n return !!this.props.url && !!this.props.method;\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.isRedirecting) {\n return (\n <RedirectShopper\n url={this.props.url}\n {...this.props}\n onActionHandled={this.onActionHandled}\n onRedirectError={this.handleRedirectError}\n />\n );\n }\n\n if (this.props.showPayButton) {\n return (\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default RedirectElement;\n"],"names":["RedirectElement","UIElement","formatData","paymentMethod","type","this","browserInfo","isRedirecting","props","url","method","isValid","collectBrowserInfo","componentToRender","h","RedirectShopper","onActionHandled","onRedirectError","handleRedirectError","showPayButton","RedirectButton","name","displayName","onSubmit","submit","payButton","ref","componentRef","super","args","_define_property","event","AnalyticsErrorEvent","component","paymentMethodType","errorType","ErrorEventType","redirect","code","ErrorEventCode","REDIRECT","submitAnalytics","TxVariants","defaultProps"],"mappings":"kwCASA,MAAMA,UAAwBC,EAO1BC,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,MAEfE,YAAaD,KAAKC,YAE1B,CAWA,iBAAIC,GACA,QAASF,KAAKG,MAAMC,OAASJ,KAAKG,MAAME,MAC5C,CAEA,WAAIC,GACA,OAAO,CACX,CAEA,eAAIL,GACA,OAAOM,GACX,CAEmBC,iBAAAA,GACf,OAAIR,KAAKE,cAEDO,EAACC,EAAAA,EAAAA,EAAAA,CACGN,IAAKJ,KAAKG,MAAMC,KACZJ,KAAKG,OAAK,CACdQ,gBAAiBX,KAAKW,gBACtBC,gBAAiBZ,KAAKa,uBAK9Bb,KAAKG,MAAMW,cAEPL,EAACM,EAAAA,EAAAA,EAAAA,GACOf,KAAKG,OAAK,CACdW,cAAed,KAAKG,MAAMW,cAC1BE,KAAMhB,KAAKiB,YACXC,SAAUlB,KAAKmB,OACfC,UAAWpB,KAAKoB,UAChBC,IAAKA,IACDrB,KAAKsB,aAAeD,MAM7B,IACX,mBAjEJE,SAAAC,GAgBIC,OAAQZ,sBAAsB,KAC1B,MAAMa,EAAQ,IAAIC,EAAoB,CAClCC,UAAW5B,KAAKG,MAAM0B,kBACtBC,UAAWC,EAAeC,SAC1BC,KAAMC,EAAeC,WAEzBZ,MAAMa,gBAAgBV,MArB1BD,EADE9B,EACqBI,OAAmBsC,EAAWL,UAErDP,EAHE9B,EAGqB2C,eAAe,CAClCvC,KAAMJ,EAAgBI"}
1
+ {"version":3,"file":"Redirect.js","sources":["../../../../src/components/Redirect/Redirect.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport RedirectShopper from './components/RedirectShopper';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport { RedirectConfiguration } from './types';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass RedirectElement extends UIElement<RedirectConfiguration> {\n public static readonly type: TxVariants = TxVariants.redirect;\n\n public static readonly defaultProps = {\n type: RedirectElement.type\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type\n },\n browserInfo: this.browserInfo\n };\n }\n\n private handleRedirectError = () => {\n const event = new AnalyticsErrorEvent({\n component: this.props.paymentMethodType,\n errorType: ErrorEventType.redirect,\n code: ErrorEventCode.REDIRECT\n });\n super.submitAnalytics(event);\n };\n\n get isRedirecting() {\n return !!this.props.url && !!this.props.method;\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.isRedirecting) {\n return (\n <RedirectShopper\n url={this.props.url}\n {...this.props}\n onActionHandled={this.onActionHandled}\n onRedirectError={this.handleRedirectError}\n />\n );\n }\n\n if (this.props.showPayButton) {\n return (\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default RedirectElement;\n"],"names":["RedirectElement","UIElement","formatData","paymentMethod","type","this","browserInfo","isRedirecting","props","url","method","isValid","collectBrowserInfo","componentToRender","h","RedirectShopper","onActionHandled","onRedirectError","handleRedirectError","showPayButton","RedirectButton","name","displayName","onSubmit","submit","payButton","setComponentRef","super","args","_define_property","event","AnalyticsErrorEvent","component","paymentMethodType","errorType","ErrorEventType","redirect","code","ErrorEventCode","REDIRECT","submitAnalytics","TxVariants","defaultProps"],"mappings":"kwCASA,MAAMA,UAAwBC,EAO1BC,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,MAEfE,YAAaD,KAAKC,YAE1B,CAWA,iBAAIC,GACA,QAASF,KAAKG,MAAMC,OAASJ,KAAKG,MAAME,MAC5C,CAEA,WAAIC,GACA,OAAO,CACX,CAEA,eAAIL,GACA,OAAOM,GACX,CAEmBC,iBAAAA,GACf,OAAIR,KAAKE,cAEDO,EAACC,EAAAA,EAAAA,EAAAA,CACGN,IAAKJ,KAAKG,MAAMC,KACZJ,KAAKG,OAAK,CACdQ,gBAAiBX,KAAKW,gBACtBC,gBAAiBZ,KAAKa,uBAK9Bb,KAAKG,MAAMW,cAEPL,EAACM,EAAAA,EAAAA,EAAAA,GACOf,KAAKG,OAAK,CACdW,cAAed,KAAKG,MAAMW,cAC1BE,KAAMhB,KAAKiB,YACXC,SAAUlB,KAAKmB,OACfC,UAAWpB,KAAKoB,UAChBC,gBAAiBrB,KAAKqB,mBAK3B,IACX,mBA/DJC,SAAAC,GAgBIC,OAAQX,sBAAsB,KAC1B,MAAMY,EAAQ,IAAIC,EAAoB,CAClCC,UAAW3B,KAAKG,MAAMyB,kBACtBC,UAAWC,EAAeC,SAC1BC,KAAMC,EAAeC,WAEzBZ,MAAMa,gBAAgBV,MArB1BD,EADE7B,EACqBI,OAAmBqC,EAAWL,UAErDP,EAHE7B,EAGqB0C,eAAe,CAClCtC,KAAMJ,EAAgBI"}
@@ -1 +1 @@
1
- {"version":3,"file":"Sepa.js","sources":["../../../../src/components/Sepa/Sepa.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport IbanInput from '../internal/IbanInput';\nimport { SepaElementData, SepaConfiguration } from './types';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport type { ICore } from '../../core/types';\n\nclass SepaElement extends UIElement<SepaConfiguration> {\n public static readonly type = TxVariants.sepadirectdebit;\n\n constructor(checkout: ICore, props?: SepaConfiguration) {\n super(checkout, props);\n this.state = { ...this.state, ...{ data: { ibanNumber: '', ownerName: '' } } };\n }\n\n /**\n * Formats props on construction time\n */\n formatProps(props) {\n return {\n holderName: true,\n ...props\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): SepaElementData {\n return {\n paymentMethod: {\n type: SepaElement.type,\n iban: this.state.data['ibanNumber'],\n ownerName: this.state.data['ownerName']\n }\n };\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n return !!this.state.isValid;\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <Fragment>\n <FormInstruction />\n\n {/* @ts-ignore TODO: add props */}\n <IbanInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onChange={this.setState}\n // onSubmit={this.submit}\n payButton={this.payButton}\n />\n </Fragment>\n );\n }\n}\n\nexport default SepaElement;\n"],"names":["SepaElement","UIElement","formatProps","props","_object_spread","holderName","formatData","paymentMethod","type","iban","this","state","data","ownerName","isValid","componentToRender","h","Fragment","FormInstruction","IbanInput","ref","componentRef","onChange","setState","payButton","constructor","checkout","super","ibanNumber","_define_property","TxVariants","sepadirectdebit"],"mappings":"0lCAQA,MAAMA,UAAoBC,EAWtBC,WAAAA,CAAYC,GACR,OAAOC,EAAA,CACHC,YAAY,GACTF,EAEX,CAKAG,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMR,EAAYQ,KAClBC,KAAMC,KAAKC,MAAMC,KAAK,WACtBC,UAAWH,KAAKC,MAAMC,KAAK,WAGvC,CAKA,WAAIE,GACA,QAASJ,KAAKC,MAAMG,OACxB,CAEmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,KACGD,EAACE,EAAAA,MAGDF,EAACG,EAAAA,EAAAA,EAAAA,CACGC,IAAKA,IACDV,KAAKW,aAAeD,IAEpBV,KAAKP,OAAK,CACdmB,SAAUZ,KAAKa,SAEfC,UAAWd,KAAKc,aAIhC,CApDA,WAAAC,CAAYC,EAAiBvB,GACzBwB,MAAMD,EAAUvB,GAChBO,KAAKC,MAAQP,KAAKM,KAAKC,MAAU,CAAEC,KAAM,CAAEgB,WAAY,GAAIf,UAAW,KAC1E,EALAgB,EADE7B,EACqBQ,OAAOsB,EAAWC"}
1
+ {"version":3,"file":"Sepa.js","sources":["../../../../src/components/Sepa/Sepa.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport IbanInput from '../internal/IbanInput';\nimport { SepaElementData, SepaConfiguration } from './types';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport type { ICore } from '../../core/types';\n\nclass SepaElement extends UIElement<SepaConfiguration> {\n public static readonly type = TxVariants.sepadirectdebit;\n\n constructor(checkout: ICore, props?: SepaConfiguration) {\n super(checkout, props);\n this.state = { ...this.state, ...{ data: { ibanNumber: '', ownerName: '' } } };\n }\n\n /**\n * Formats props on construction time\n */\n formatProps(props: SepaConfiguration): SepaConfiguration & { holderName: boolean } {\n return {\n holderName: true,\n ...props\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): SepaElementData {\n return {\n paymentMethod: {\n type: SepaElement.type,\n iban: this.state.data['ibanNumber'],\n ownerName: this.state.data['ownerName']\n }\n };\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n return !!this.state.isValid;\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <Fragment>\n <FormInstruction />\n\n <IbanInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onChange={this.setState}\n payButton={this.payButton}\n />\n </Fragment>\n );\n }\n}\n\nexport default SepaElement;\n"],"names":["SepaElement","UIElement","formatProps","props","_object_spread","holderName","formatData","paymentMethod","type","iban","this","state","data","ownerName","isValid","componentToRender","h","Fragment","FormInstruction","IbanInput","ref","componentRef","onChange","setState","payButton","constructor","checkout","super","ibanNumber","_define_property","TxVariants","sepadirectdebit"],"mappings":"0lCAQA,MAAMA,UAAoBC,EAWtBC,WAAAA,CAAYC,GACR,OAAOC,EAAA,CACHC,YAAY,GACTF,EAEX,CAKAG,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMR,EAAYQ,KAClBC,KAAMC,KAAKC,MAAMC,KAAK,WACtBC,UAAWH,KAAKC,MAAMC,KAAK,WAGvC,CAKA,WAAIE,GACA,QAASJ,KAAKC,MAAMG,OACxB,CAEmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,KACGD,EAACE,EAAAA,MAEDF,EAACG,EAAAA,EAAAA,EAAAA,CACGC,IAAKA,IACDV,KAAKW,aAAeD,IAEpBV,KAAKP,OAAK,CACdmB,SAAUZ,KAAKa,SACfC,UAAWd,KAAKc,aAIhC,CAlDA,WAAAC,CAAYC,EAAiBvB,GACzBwB,MAAMD,EAAUvB,GAChBO,KAAKC,MAAQP,KAAKM,KAAKC,MAAU,CAAEC,KAAM,CAAEgB,WAAY,GAAIf,UAAW,KAC1E,EALAgB,EADE7B,EACqBQ,OAAOsB,EAAWC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData, ThreeDS2DeviceFingerprintConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR } from './constants';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {\n public static readonly type = TxVariants.threeDS2Fingerprint;\n\n public static readonly defaultProps = {\n dataKey: 'fingerprintResult',\n type: THREEDS2_FINGERPRINT\n };\n\n private callSubmit3DS2Fingerprint = callSubmit3DS2Fingerprint.bind(this); // New 3DS2 flow\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2DeviceFingerprint - it will have the same timestamp as the \"threeDSMethodData sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Can be called directly from PrepareFingerprint (MDFlow) or after the call to /submitThreeDS2Fingerprint endpoint (native flow)\n */\n onComplete(state: FingerprintResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back fingerprinting calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n /**\n * In the regular components (aka \"native\") flow we can't proceed because something has gone wrong with the payment if paymentData is missing from the threeDS2 action.\n * In the MDFlow the paymentData is always present (albeit an empty string, which is why we use 'existy' since we should be allowed to proceed with this)\n */\n if (!existy(this.props.paymentData)) {\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No paymentData received. 3DS2 Fingerprint cannot proceed`));\n\n // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n /**\n * this.props.isMDFlow indicates the action to create this component came from the 3DS2InMDFlow process and upon completion should call the\n * passed onComplete callback (as defined in the 3DS2InMDFlow) instead of the /submitThreeDS2Fingerprint endpoint for the regular, \"native\" flow\n */\n return (\n <PrepareFingerprint\n {...this.props}\n // For MDFlow will bypass the /submitThreeDS2Fingerprint endpoint\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","_this_props_on3DS2RedirectFlowComplete","_this_props","this","props","isMDFlow","on3DS2RedirectFlowComplete","call","elementRef","super","unmount","componentToRender","existy","paymentData","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_FINGERPRINT_ERROR","submitAnalytics","h","PrepareFingerprint","callSubmit3DS2Fingerprint","onSubmitAnalytics","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"4tCAaA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAkBAC,UAAAA,CAAWC,OAEHC,EAAAC,EADAC,KAAKC,MAAMC,SAC0B,QAArCJ,GAAAC,EAAAC,KAAKC,OAAME,kCAAX,IAAAL,GAAAA,EAAAM,KAAAL,EAAwCF,EAAOG,KAAKK,YAEpDC,MAAMV,WAAWC,GAGrBG,KAAKO,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAOT,KAAKC,MAAMS,aAAc,CACjCV,KAAKC,MAAMU,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWhB,KAAKiB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAzB,KAAK0B,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,oUAAAA,CAAAA,GACO5B,KAAKC,OAAK,CAEdL,WAAYI,KAAKC,MAAMC,SAAWF,KAAKJ,WAAaI,KAAK6B,0BACzDC,kBAAmB9B,KAAK0B,gBACxBK,gBAAiB/B,KAAK+B,kBAGlC,mBA1EJzB,SAAA0B,GAQIC,OAAQJ,4BAA4BA,EAA0BK,KAAKlC,OAMnEiC,EAAAjC,KAAU+B,kBAAmBI,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWhB,KAAKiB,KAChBA,KAAMoB,EAAad,SACnBe,QAASC,EAAgBC,wBACzBhB,QAASW,EAAOM,oBAGpBzC,KAAK0B,gBAAgBZ,GAErBR,MAAMyB,gBAAgBI,MAvB1BF,EADExC,EACqBwB,OAAOyB,EAAWC,qBAEzCV,EAHExC,EAGqBmD,eAAe,CAClCC,QAAS,oBACT5B,KAAM6B"}
1
+ {"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData, ThreeDS2DeviceFingerprintConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR } from './constants';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AdditionalDetailsData } from '../../types';\n\nclass ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {\n public static readonly type = TxVariants.threeDS2Fingerprint;\n\n public static readonly defaultProps = {\n dataKey: 'fingerprintResult',\n type: THREEDS2_FINGERPRINT\n };\n\n private readonly callSubmit3DS2Fingerprint = callSubmit3DS2Fingerprint.bind(this); // New 3DS2 flow\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2DeviceFingerprint - it will have the same timestamp as the \"threeDSMethodData sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Can be called directly from PrepareFingerprint (MDFlow) or after the call to /submitThreeDS2Fingerprint endpoint (native flow)\n */\n onComplete(state: FingerprintResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state as AdditionalDetailsData);\n }\n\n this.unmount(); // re. fixing issue around back to back fingerprinting calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n /**\n * In the regular components (aka \"native\") flow we can't proceed because something has gone wrong with the payment if paymentData is missing from the threeDS2 action.\n * In the MDFlow the paymentData is always present (albeit an empty string, which is why we use 'existy' since we should be allowed to proceed with this)\n */\n if (!existy(this.props.paymentData)) {\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No paymentData received. 3DS2 Fingerprint cannot proceed`));\n\n // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n /**\n * this.props.isMDFlow indicates the action to create this component came from the 3DS2InMDFlow process and upon completion should call the\n * passed onComplete callback (as defined in the 3DS2InMDFlow) instead of the /submitThreeDS2Fingerprint endpoint for the regular, \"native\" flow\n */\n return (\n <PrepareFingerprint\n {...this.props}\n // For MDFlow will bypass the /submitThreeDS2Fingerprint endpoint\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","_this_props_on3DS2RedirectFlowComplete","_this_props","this","props","isMDFlow","on3DS2RedirectFlowComplete","call","elementRef","super","unmount","componentToRender","existy","paymentData","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_FINGERPRINT_ERROR","submitAnalytics","h","PrepareFingerprint","callSubmit3DS2Fingerprint","onSubmitAnalytics","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"4tCAcA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAkBAC,UAAAA,CAAWC,OAEHC,EAAAC,EADAC,KAAKC,MAAMC,SAC0B,QAArCJ,GAAAC,EAAAC,KAAKC,OAAME,kCAAX,IAAAL,GAAAA,EAAAM,KAAAL,EAAwCF,EAAOG,KAAKK,YAEpDC,MAAMV,WAAWC,GAGrBG,KAAKO,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAOT,KAAKC,MAAMS,aAAc,CACjCV,KAAKC,MAAMU,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWhB,KAAKiB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAzB,KAAK0B,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,oUAAAA,CAAAA,GACO5B,KAAKC,OAAK,CAEdL,WAAYI,KAAKC,MAAMC,SAAWF,KAAKJ,WAAaI,KAAK6B,0BACzDC,kBAAmB9B,KAAK0B,gBACxBK,gBAAiB/B,KAAK+B,kBAGlC,mBA1EJzB,SAAA0B,GAQIC,OAAiBJ,4BAA4BA,EAA0BK,KAAKlC,OAM5EiC,EAAAjC,KAAU+B,kBAAmBI,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWhB,KAAKiB,KAChBA,KAAMoB,EAAad,SACnBe,QAASC,EAAgBC,wBACzBhB,QAASW,EAAOM,oBAGpBzC,KAAK0B,gBAAgBZ,GAErBR,MAAMyB,gBAAgBI,MAvB1BF,EADExC,EACqBwB,OAAOyB,EAAWC,qBAEzCV,EAHExC,EAGqBmD,eAAe,CAClCC,QAAS,oBACT5B,KAAM6B"}
@@ -1,2 +1,2 @@
1
- import{createElement as t,Fragment as e}from"../../external/preact/dist/preact.js";import r from"../Redirect/Redirect.js";import n from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as o}from"../tx-variants.js";function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class c extends r{get displayName(){return this.props.name||this.constructor.type}componentToRender(){return t(e,null,t("div",{className:"adyen-checkout-trustly"},t("p",{className:"adyen-checkout-trustly__descriptor"},this.props.i18n.get("trustly.descriptor")),t("ul",{className:"adyen-checkout-trustly__description-list"},t("li",null,this.props.i18n.get("trustly.description1")),t("li",null,this.props.i18n.get("trustly.description2")))),this.props.showPayButton&&t(n,i(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){s(t,e,r[e])})}return t}({},this.props),{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}})))}}s(c,"type",o.trustly);export{c as default};
1
+ import{createElement as t,Fragment as e}from"../../external/preact/dist/preact.js";import r from"../Redirect/Redirect.js";import n from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as o}from"../tx-variants.js";function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class c extends r{get displayName(){return this.props.name||this.constructor.type}componentToRender(){return t(e,null,t("div",{className:"adyen-checkout-trustly"},t("p",{className:"adyen-checkout-trustly__descriptor"},this.props.i18n.get("trustly.descriptor")),t("ul",{className:"adyen-checkout-trustly__description-list"},t("li",null,this.props.i18n.get("trustly.description1")),t("li",null,this.props.i18n.get("trustly.description2")))),this.props.showPayButton&&t(n,i(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){s(t,e,r[e])})}return t}({},this.props),{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef})))}}s(c,"type",o.trustly);export{c as default};
2
2
  //# sourceMappingURL=Trustly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Trustly.js","sources":["../../../../src/components/Trustly/Trustly.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport RedirectElement from '../Redirect';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport './Trustly.scss';\n\nclass TrustlyElement extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.trustly;\n\n override get displayName() {\n return this.props.name || this.constructor['type'];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <Fragment>\n <div className=\"adyen-checkout-trustly\">\n <p className=\"adyen-checkout-trustly__descriptor\">{this.props.i18n.get('trustly.descriptor')}</p>\n <ul className=\"adyen-checkout-trustly__description-list\">\n <li>{this.props.i18n.get('trustly.description1')}</li>\n <li>{this.props.i18n.get('trustly.description2')}</li>\n </ul>\n </div>\n\n {this.props.showPayButton && (\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n )}\n </Fragment>\n );\n }\n}\n\nexport default TrustlyElement;\n"],"names":["TrustlyElement","RedirectElement","displayName","this","props","name","constructor","componentToRender","h","Fragment","div","className","p","i18n","get","ul","li","showPayButton","RedirectButton","onSubmit","submit","payButton","ref","componentRef","_define_property","type","TxVariants","trustly"],"mappings":"0sBAMA,MAAMA,UAAuBC,EAGzB,eAAaC,GACT,OAAOC,KAAKC,MAAMC,MAAQF,KAAKG,YAAY,IAC/C,CAEmBC,iBAAAA,GACf,OACIC,EAACC,OACGD,EAACE,MAAAA,CAAIC,UAAU,0BACXH,EAACI,IAAAA,CAAED,UAAU,sCAAsCR,KAAKC,MAAMS,KAAKC,IAAI,uBACvEN,EAACO,KAAAA,CAAGJ,UAAU,4CACVH,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,yBACzBN,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,2BAIhCX,KAAKC,MAAMa,eACRT,EAACU,EAAAA,oUAAAA,CAAAA,CAAAA,EACOf,KAAKC,OAAK,CACda,cAAed,KAAKC,MAAMa,cAC1BZ,KAAMF,KAAKD,YACXiB,SAAUhB,KAAKiB,OACfC,UAAWlB,KAAKkB,UAChBC,IAAKA,IACDnB,KAAKoB,aAAeD,MAM5C,EA/BAE,EADExB,EAC8ByB,OAAmBC,EAAWC"}
1
+ {"version":3,"file":"Trustly.js","sources":["../../../../src/components/Trustly/Trustly.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport RedirectElement from '../Redirect';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport './Trustly.scss';\n\nclass TrustlyElement extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.trustly;\n\n override get displayName() {\n return this.props.name || this.constructor['type'];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <Fragment>\n <div className=\"adyen-checkout-trustly\">\n <p className=\"adyen-checkout-trustly__descriptor\">{this.props.i18n.get('trustly.descriptor')}</p>\n <ul className=\"adyen-checkout-trustly__description-list\">\n <li>{this.props.i18n.get('trustly.description1')}</li>\n <li>{this.props.i18n.get('trustly.description2')}</li>\n </ul>\n </div>\n\n {this.props.showPayButton && (\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n )}\n </Fragment>\n );\n }\n}\n\nexport default TrustlyElement;\n"],"names":["TrustlyElement","RedirectElement","displayName","this","props","name","constructor","componentToRender","h","Fragment","div","className","p","i18n","get","ul","li","showPayButton","RedirectButton","onSubmit","submit","payButton","setComponentRef","_define_property","type","TxVariants","trustly"],"mappings":"0sBAMA,MAAMA,UAAuBC,EAGzB,eAAaC,GACT,OAAOC,KAAKC,MAAMC,MAAQF,KAAKG,YAAY,IAC/C,CAEmBC,iBAAAA,GACf,OACIC,EAACC,OACGD,EAACE,MAAAA,CAAIC,UAAU,0BACXH,EAACI,IAAAA,CAAED,UAAU,sCAAsCR,KAAKC,MAAMS,KAAKC,IAAI,uBACvEN,EAACO,KAAAA,CAAGJ,UAAU,4CACVH,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,yBACzBN,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,2BAIhCX,KAAKC,MAAMa,eACRT,EAACU,EAAAA,oUAAAA,CAAAA,CAAAA,EACOf,KAAKC,OAAK,CACda,cAAed,KAAKC,MAAMa,cAC1BZ,KAAMF,KAAKD,YACXiB,SAAUhB,KAAKiB,OACfC,UAAWlB,KAAKkB,UAChBC,gBAAiBnB,KAAKmB,mBAK1C,EA7BAC,EADEvB,EAC8BwB,OAAmBC,EAAWC"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import s from"../../internal/IssuerList/IssuerList.js";import r from"../../../utils/get-issuer-image.js";import{FALLBACK_CONTEXT as o}from"../../../core/config.js";import i from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function p(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},r=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),r.forEach(function(e){n(t,e,s[e])})}return t}function a(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e}(Object(e)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))}),t}class u extends e{formatProps(t){var e,s;const r=(null==t||null===(e=t.details)||void 0===e?void 0:e.length)&&(null===(s=t.details.find(t=>"issuer"===t.key))||void 0===s?void 0:s.items)||t.issuers||[];return a(p({},t),{issuers:r})}formatData(){var t,e;return{paymentMethod:{type:this.type,issuer:null===(e=this.state)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.issuer}}}get isValid(){var t;return 0===this.props.issuers.length||Boolean(null===(t=this.state)||void 0===t?void 0:t.isValid)}get brands(){return this.props.showPaymentMethodItemImages?this.props.issuers.map(t=>({icon:t.icon,name:t.id})):[]}componentToRender(){return this.props.issuers.length>0?t(s,a(p({items:this.props.issuers,highlightedIds:this.props.highlightedIssuers},this.props,this.state),{setComponentRef:this.setComponentRef,showImage:this.props.showImage,type:this.constructor.type,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton,contextualText:this.props.i18n.get("issuerList.selectField.contextualText"),onSubmitAnalytics:this.submitAnalytics})):t(i,a(p({showPayButton:this.props.showPayButton,name:this.props.name},this.props),{onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}}))}constructor(t,e){super(t,e);const s=t=>this.resources.getImage(t);if(this.props.showImage){const t=r({loadingContext:this.props.loadingContext},this.constructor.type,s);this.props.issuers=this.props.issuers.map(e=>a(p({},e),{icon:t(e.id)}))}}}n(u,"defaultProps",{showImage:!0,issuers:[],highlightedIssuers:[],loadingContext:o,showPaymentMethodItemImages:!1});export{u as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import s from"../../internal/IssuerList/IssuerList.js";import r from"../../../utils/get-issuer-image.js";import{FALLBACK_CONTEXT as o}from"../../../core/config.js";import i from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function p(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},r=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),r.forEach(function(e){n(t,e,s[e])})}return t}function a(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e}(Object(e)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))}),t}class u extends e{formatProps(t){var e,s;const r=(null==t||null===(e=t.details)||void 0===e?void 0:e.length)&&(null===(s=t.details.find(t=>"issuer"===t.key))||void 0===s?void 0:s.items)||t.issuers||[];return a(p({},t),{issuers:r})}formatData(){var t,e;return{paymentMethod:{type:this.type,issuer:null===(e=this.state)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.issuer}}}get isValid(){var t;return 0===this.props.issuers.length||Boolean(null===(t=this.state)||void 0===t?void 0:t.isValid)}get brands(){return this.props.showPaymentMethodItemImages?this.props.issuers.map(t=>({icon:t.icon,name:t.id})):[]}componentToRender(){return this.props.issuers.length>0?t(s,a(p({items:this.props.issuers,highlightedIds:this.props.highlightedIssuers},this.props,this.state),{setComponentRef:this.setComponentRef,showImage:this.props.showImage,type:this.constructor.type,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton,contextualText:this.props.i18n.get("issuerList.selectField.contextualText"),onSubmitAnalytics:this.submitAnalytics})):t(i,a(p({showPayButton:this.props.showPayButton,name:this.props.name},this.props),{onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef}))}constructor(t,e){super(t,e);const s=t=>this.resources.getImage(t);if(this.props.showImage){const t=r({loadingContext:this.props.loadingContext},this.constructor.type,s);this.props.issuers=this.props.issuers.map(e=>a(p({},e),{icon:t(e.id)}))}}}n(u,"defaultProps",{showImage:!0,issuers:[],highlightedIssuers:[],loadingContext:o,showPaymentMethodItemImages:!1});export{u as default};
2
2
  //# sourceMappingURL=IssuerListContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IssuerListContainer.js","sources":["../../../../../src/components/helpers/IssuerListContainer/IssuerListContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport IssuerList from '../../internal/IssuerList';\nimport getIssuerImageUrl from '../../../utils/get-issuer-image';\nimport { FALLBACK_CONTEXT } from '../../../core/config';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { IssuerListConfiguration, IssuerListData } from './types';\nimport type { ICore } from '../../../core/types';\nimport { PaymentMethodBrand } from '../../../types/global-types';\nimport { ImageOptions } from '../../../core/Context/Resources';\n\nclass IssuerListContainer<TProps extends IssuerListConfiguration = IssuerListConfiguration, TData = IssuerListData> extends UIElement<TProps> {\n protected static readonly defaultProps = {\n showImage: true,\n issuers: [],\n highlightedIssuers: [],\n loadingContext: FALLBACK_CONTEXT,\n showPaymentMethodItemImages: false\n };\n\n constructor(checkout: ICore, props?: TProps) {\n super(checkout, props);\n\n const getImage = (props: ImageOptions) => this.resources.getImage(props);\n\n if (this.props.showImage) {\n const getIssuerIcon = getIssuerImageUrl({ loadingContext: this.props.loadingContext }, this.constructor['type'], getImage);\n\n this.props.issuers = this.props.issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }));\n }\n }\n\n formatProps(props: TProps): TProps {\n const issuers =\n // @ts-expect-error - details is not in the props type but we need it for backward compatibility\n (props?.details?.length && props.details.find((d: Record<string, unknown>) => d.key === 'issuer')?.items) || props.issuers || [];\n return { ...props, issuers };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): TData {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n } as TData;\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n if (this.props.issuers.length === 0) {\n return true;\n }\n return Boolean(this.state?.isValid);\n }\n\n /**\n * Returns brands array (similar to card) depending on showPaymentMethodItemImages\n * This is used to show the brands in the PaymentMethodItem\n * Requires brands icons to be loaded in the payment method\n */\n get brands(): PaymentMethodBrand[] {\n if (this.props.showPaymentMethodItemImages) {\n return this.props.issuers.map(brand => {\n const brandIcon = brand.icon;\n return { icon: brandIcon, name: brand.id };\n });\n }\n\n return [];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.issuers.length > 0 ? (\n <IssuerList\n items={this.props.issuers}\n highlightedIds={this.props.highlightedIssuers}\n {...this.props}\n {...this.state}\n setComponentRef={this.setComponentRef}\n showImage={this.props.showImage}\n type={this.constructor['type']}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n contextualText={this.props.i18n.get('issuerList.selectField.contextualText')}\n onSubmitAnalytics={this.submitAnalytics}\n />\n ) : (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.props.name}\n {...this.props}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n );\n }\n}\n\nexport default IssuerListContainer;\n"],"names":["IssuerListContainer","UIElement","formatProps","props","issuers","details","length","find","d","key","items","_object_spread_props","_object_spread","formatData","_this_state_data","_this_state","paymentMethod","type","this","issuer","state","data","isValid","Boolean","brands","showPaymentMethodItemImages","map","brand","icon","name","id","componentToRender","h","IssuerList","highlightedIds","highlightedIssuers","setComponentRef","showImage","constructor","onChange","setState","onSubmit","submit","payButton","contextualText","i18n","get","onSubmitAnalytics","submitAnalytics","RedirectButton","showPayButton","ref","componentRef","checkout","super","getImage","resources","getIssuerIcon","getIssuerImageUrl","loadingContext","item","_define_property","defaultProps","FALLBACK_CONTEXT"],"mappings":"spCAWA,MAAMA,UAAsHC,EAwBxHC,WAAAA,CAAYC,OAGHA,EAA0BA,EAF/B,MAAMC,GAEDD,SAAc,QAAdA,EAAA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AKf,OAAK,CACdsC,SAAUvB,KAAKwB,OACfC,UAAWzB,KAAKyB,UAChBQ,IAAKA,IACDjC,KAAKkC,aAAeD,KAIpC,CAxFA,WAAAb,CAAYe,EAAiBlD,GACzBmD,MAAMD,EAAUlD,GAEhB,MAAMoD,EAAYpD,GAAwBe,KAAKsC,UAAUD,SAASpD,GAElE,GAAIe,KAAKf,MAAMkC,UAAW,CACtB,MAAMoB,EAAgBC,EAAkB,CAAEC,eAAgBzC,KAAKf,MAAMwD,gBAAkBzC,KAAKoB,iBAAqBiB,GAEjHrC,KAAKf,MAAMC,QAAUc,KAAKf,MAAMC,QAAQsB,IAAIkC,GAASjD,EAAAC,EAAA,CAAA,EAC9CgD,GAAAA,CACHhC,KAAM6B,EAAcG,EAAK9B,MAEjC,CACJ,EArBA+B,EADE7D,EACwB8D,eAAe,CACrCzB,WAAW,EACXjC,QAAS,GACT+B,mBAAoB,GACpBwB,eAAgBI,EAChBtC,6BAA6B"}
1
+ {"version":3,"file":"IssuerListContainer.js","sources":["../../../../../src/components/helpers/IssuerListContainer/IssuerListContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport IssuerList from '../../internal/IssuerList';\nimport getIssuerImageUrl from '../../../utils/get-issuer-image';\nimport { FALLBACK_CONTEXT } from '../../../core/config';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { IssuerListConfiguration, IssuerListData } from './types';\nimport type { ICore } from '../../../core/types';\nimport { PaymentData, PaymentMethodBrand } from '../../../types/global-types';\nimport { ImageOptions } from '../../../core/Context/Resources';\n\nclass IssuerListContainer<\n TProps extends IssuerListConfiguration = IssuerListConfiguration,\n TData extends PaymentData = IssuerListData\n> extends UIElement<TProps> {\n protected static readonly defaultProps = {\n showImage: true,\n issuers: [],\n highlightedIssuers: [],\n loadingContext: FALLBACK_CONTEXT,\n showPaymentMethodItemImages: false\n };\n\n constructor(checkout: ICore, props?: TProps) {\n super(checkout, props);\n\n const getImage = (props: ImageOptions) => this.resources.getImage(props);\n\n if (this.props.showImage) {\n const getIssuerIcon = getIssuerImageUrl({ loadingContext: this.props.loadingContext }, this.constructor['type'], getImage);\n\n this.props.issuers = this.props.issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }));\n }\n }\n\n formatProps(props: TProps): TProps {\n const issuers =\n // @ts-expect-error - details is not in the props type but we need it for backward compatibility\n (props?.details?.length && props.details.find((d: Record<string, unknown>) => d.key === 'issuer')?.items) || props.issuers || [];\n return { ...props, issuers };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): TData {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n } as unknown as TData;\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n if (this.props.issuers.length === 0) {\n return true;\n }\n return Boolean(this.state?.isValid);\n }\n\n /**\n * Returns brands array (similar to card) depending on showPaymentMethodItemImages\n * This is used to show the brands in the PaymentMethodItem\n * Requires brands icons to be loaded in the payment method\n */\n get brands(): PaymentMethodBrand[] {\n if (this.props.showPaymentMethodItemImages) {\n return this.props.issuers.map(brand => {\n const brandIcon = brand.icon;\n return { icon: brandIcon, name: brand.id };\n });\n }\n\n return [];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.issuers.length > 0 ? (\n <IssuerList\n items={this.props.issuers}\n highlightedIds={this.props.highlightedIssuers}\n {...this.props}\n {...this.state}\n setComponentRef={this.setComponentRef}\n showImage={this.props.showImage}\n type={this.constructor['type']}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n contextualText={this.props.i18n.get('issuerList.selectField.contextualText')}\n onSubmitAnalytics={this.submitAnalytics}\n />\n ) : (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.props.name}\n {...this.props}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n\nexport default IssuerListContainer;\n"],"names":["IssuerListContainer","UIElement","formatProps","props","issuers","details","length","find","d","key","items","_object_spread_props","_object_spread","formatData","_this_state_data","_this_state","paymentMethod","type","this","issuer","state","data","isValid","Boolean","brands","showPaymentMethodItemImages","map","brand","icon","name","id","componentToRender","h","IssuerList","highlightedIds","highlightedIssuers","setComponentRef","showImage","constructor","onChange","setState","onSubmit","submit","payButton","contextualText","i18n","get","onSubmitAnalytics","submitAnalytics","RedirectButton","showPayButton","checkout","super","getImage","resources","getIssuerIcon","getIssuerImageUrl","loadingContext","item","_define_property","defaultProps","FALLBACK_CONTEXT"],"mappings":"spCAWA,MAAMA,UAGIC,EAwBNC,WAAAA,CAAYC,OAGHA,EAA0BA,EAF/B,MAAMC,GAEDD,SAAc,QAAdA,EAAAA,EAAOE,eAAPF,IAAAA,OAAAA,EAAAA,EAAgBG,UAAuE,QAA7DH,EAAAA,EAAME,QAAQE,KAAMC,GAAyC,WAAVA,EAAEC,YAArDN,IAAAA,SAAAA,EAAwEO,QAAUP,EAAMC,SAAW,GAClI,OAAOO,EAAAC,EAAA,CAAA,EAAKT,GAAAA,CAAOC,WACvB,CAKAS,UAAAA,OAIoBC,EAAAC,EAHhB,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,KACXE,OAAkB,QAAVJ,EAAAG,KAAKE,iBAALL,GAAgB,QAAhBD,EAAAC,EAAYM,YAAZ,IAAAP,OAAA,EAAAA,EAAkBK,QAGtC,CAKA,WAAIG,GAIe,IAAAP,EAHf,OAAkC,IAA9BG,KAAKf,MAAMC,QAAQE,QAGhBiB,QAAkB,QAAVR,EAAAG,KAAKE,aAAL,IAAAL,SAAAA,EAAYO,QAC/B,CAOA,UAAIE,GACA,OAAIN,KAAKf,MAAMsB,4BACJP,KAAKf,MAAMC,QAAQsB,IAAIC,IAEnB,CAAEC,KADSD,EAAMC,KACEC,KAAMF,EAAMG,MAIvC,EACX,CAEmBC,iBAAAA,GACf,OAAOb,KAAKf,MAAMC,QAAQE,OAAS,EAC/B0B,EAACC,EAAAA,EAAAA,EAAAA,CACGvB,MAAOQ,KAAKf,MAAMC,QAClB8B,eAAgBhB,KAAKf,MAAMgC,oBACvBjB,KAAKf,MACLe,KAAKE,OAAK,CACdgB,gBAAiBlB,KAAKkB,gBACtBC,UAAWnB,KAAKf,MAAMkC,UACtBpB,KAAMC,KAAKoB,YAAY,KACvBC,SAAUrB,KAAKsB,SACfC,SAAUvB,KAAKwB,OACfC,UAAWzB,KAAKyB,UAChBC,eAAgB1B,KAAKf,MAAM0C,KAAKC,IAAI,yCACpCC,kBAAmB7B,KAAK8B,mBAG5BhB,EAACiB,EAAAA,EAAAA,EAAAA,CACGC,cAAehC,KAAKf,MAAM+C,cAC1BrB,KAAMX,KAAKf,MAAM0B,MACbX,KAAKf,OAAK,CACdsC,SAAUvB,KAAKwB,OACfC,UAAWzB,KAAKyB,UAChBP,gBAAiBlB,KAAKkB,kBAGlC,CAtFA,WAAAE,CAAYa,EAAiBhD,GACzBiD,MAAMD,EAAUhD,GAEhB,MAAMkD,EAAYlD,GAAwBe,KAAKoC,UAAUD,SAASlD,GAElE,GAAIe,KAAKf,MAAMkC,UAAW,CACtB,MAAMkB,EAAgBC,EAAkB,CAAEC,eAAgBvC,KAAKf,MAAMsD,gBAAkBvC,KAAKoB,iBAAqBe,GAEjHnC,KAAKf,MAAMC,QAAUc,KAAKf,MAAMC,QAAQsB,IAAIgC,GAAS/C,EAAAC,EAAA,CAAA,EAC9C8C,GAAAA,CACH9B,KAAM2B,EAAcG,EAAK5B,MAEjC,CACJ,EArBA6B,EAJE3D,EAIwB4D,eAAe,CACrCvB,WAAW,EACXjC,QAAS,GACT+B,mBAAoB,GACpBsB,eAAgBI,EAChBpC,6BAA6B"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import{QRLoader as r}from"../../internal/QRLoader/QRLoader.js";import"../../../core/Context/CoreProvider.js";import"../../../external/preact/hooks/dist/hooks.js";import"../../../core/Errors/SRPanelContext.js";import"../../internal/Button/Button.js";import"../../internal/QRLoader/QRLoaderDetailsProvider.js";import o from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){n(t,e,r[e])})}return t}function s(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class a extends e{formatData(){return{paymentMethod:i({type:this.type},this.state.data)}}get isValid(){return!0}renderQRCode(){return t(r,s(i({},this.props),{delay:this.props.delay,countdownTime:this.props.countdownTime,instructions:this.props.instructions,type:this.constructor.type,brandLogo:this.props.brandLogo||this.icon,onComplete:this.onComplete,onActionHandled:this.onActionHandled,brandName:this.displayName,onSubmitAnalytics:this.submitAnalytics}))}componentToRender(){return this.props.paymentData?this.renderQRCode():this.props.showPayButton?t(o,{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}}):null}}n(a,"defaultProps",{qrCodeImage:"",amount:null,paymentData:null,onError:()=>{}});export{a as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import{QRLoader as r}from"../../internal/QRLoader/QRLoader.js";import"../../../core/Context/CoreProvider.js";import"../../../external/preact/hooks/dist/hooks.js";import"../../../core/Errors/SRPanelContext.js";import"../../internal/Button/Button.js";import"../../internal/QRLoader/QRLoaderDetailsProvider.js";import o from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){n(t,e,r[e])})}return t}function s(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class a extends e{formatData(){return{paymentMethod:i({type:this.type},this.state.data)}}get isValid(){return!0}renderQRCode(){return t(r,s(i({},this.props),{delay:this.props.delay,countdownTime:this.props.countdownTime,instructions:this.props.instructions,type:this.constructor.type,brandLogo:this.props.brandLogo||this.icon,onComplete:this.onComplete,onActionHandled:this.onActionHandled,brandName:this.displayName,onSubmitAnalytics:this.submitAnalytics}))}componentToRender(){return this.props.paymentData?this.renderQRCode():this.props.showPayButton?t(o,{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef}):null}}n(a,"defaultProps",{qrCodeImage:"",amount:null,paymentData:null,onError:()=>{}});export{a as default};
2
2
  //# sourceMappingURL=QRLoaderContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport { QRLoader } from '../../internal/QRLoader';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static readonly defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <QRLoader\n {...this.props}\n delay={this.props.delay}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","_object_spread","type","this","state","data","isValid","renderQRCode","h","QRLoader","props","delay","countdownTime","instructions","constructor","brandLogo","icon","onComplete","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","componentToRender","paymentData","showPayButton","RedirectButton","name","onSubmit","submit","payButton","ref","componentRef","_define_property","defaultProps","qrCodeImage","amount","onError"],"mappings":"syCAMA,MAAMA,UAAmFC,EASrFC,UAAAA,GACI,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMC,KAAKD,MACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,EAAAA,EAAAA,GACON,KAAKO,OAAK,CACdC,MAAOR,KAAKO,MAAMC,MAClBC,cAAeT,KAAKO,MAAME,cAC1BC,aAAcV,KAAKO,MAAMG,aACzBX,KAAMC,KAAKW,YAAY,KACvBC,UAAWZ,KAAKO,MAAMK,WAAaZ,KAAKa,KACxCC,WAAYd,KAAKc,WACjBC,gBAAiBf,KAAKe,gBACtBC,UAAWhB,KAAKiB,YAChBC,kBAAmBlB,KAAKmB,kBAGpC,CAEmBC,iBAAAA,GACf,OAAIpB,KAAKO,MAAMc,YACJrB,KAAKI,eAGZJ,KAAKO,MAAMe,cAEPjB,EAACkB,EAAAA,CACGD,cAAetB,KAAKO,MAAMe,cAC1BE,KAAMxB,KAAKiB,YACXQ,SAAUzB,KAAK0B,OACfC,UAAW3B,KAAK2B,UAChBC,IAAKA,IACD5B,KAAK6B,aAAeD,KAM7B,IACX,EA1DAE,EAFEpC,EAEwBqC,eAAe,CACrCC,YAAa,GACbC,OAAQ,KACRZ,YAAa,KACba,QAAS"}
1
+ {"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport { QRLoader } from '../../internal/QRLoader';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static readonly defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <QRLoader\n {...this.props}\n delay={this.props.delay}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","_object_spread","type","this","state","data","isValid","renderQRCode","h","QRLoader","props","delay","countdownTime","instructions","constructor","brandLogo","icon","onComplete","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","componentToRender","paymentData","showPayButton","RedirectButton","name","onSubmit","submit","payButton","setComponentRef","_define_property","defaultProps","qrCodeImage","amount","onError"],"mappings":"syCAMA,MAAMA,UAAmFC,EASrFC,UAAAA,GACI,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMC,KAAKD,MACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,EAAAA,EAAAA,GACON,KAAKO,OAAK,CACdC,MAAOR,KAAKO,MAAMC,MAClBC,cAAeT,KAAKO,MAAME,cAC1BC,aAAcV,KAAKO,MAAMG,aACzBX,KAAMC,KAAKW,YAAY,KACvBC,UAAWZ,KAAKO,MAAMK,WAAaZ,KAAKa,KACxCC,WAAYd,KAAKc,WACjBC,gBAAiBf,KAAKe,gBACtBC,UAAWhB,KAAKiB,YAChBC,kBAAmBlB,KAAKmB,kBAGpC,CAEmBC,iBAAAA,GACf,OAAIpB,KAAKO,MAAMc,YACJrB,KAAKI,eAGZJ,KAAKO,MAAMe,cAEPjB,EAACkB,EAAAA,CACGD,cAAetB,KAAKO,MAAMe,cAC1BE,KAAMxB,KAAKiB,YACXQ,SAAUzB,KAAK0B,OACfC,UAAW3B,KAAK2B,UAChBC,gBAAiB5B,KAAK4B,kBAK3B,IACX,EAxDAC,EAFEnC,EAEwBoC,eAAe,CACrCC,YAAa,GACbC,OAAQ,KACRX,YAAa,KACbY,QAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"Specifications.js","sources":["../../../../../src/components/internal/Address/Specifications.ts"],"sourcesContent":["import { AddressSchema, AddressSpecifications, StringObject } from './types';\nimport { ADDRESS_SPECIFICATIONS } from './constants';\nimport { AddressField } from '../../../types/global-types';\n\nconst SCHEMA_MAX_DEPTH = 2;\n\nclass Specifications {\n private specifications: AddressSpecifications;\n\n constructor(specifications?) {\n this.specifications = { ...ADDRESS_SPECIFICATIONS, ...specifications };\n }\n\n /**\n * Checks if a certain country has a dataset.\n * @param country - The selected country\n * @returns Boolean\n */\n countryHasDataset(country: string): boolean {\n return !!this.specifications?.[country]?.hasDataset;\n }\n\n /**\n * Checks if a certain country has the passed field in their optional fields array.\n * @param country - The selected country\n * @param fieldName - The field to be checked\n * @returns Boolean\n */\n countryHasOptionalField(country: string, fieldName: string): boolean {\n return !!this.specifications?.[country]?.optionalFields?.includes(fieldName as any);\n }\n\n /**\n * Returns the address schema of the selected country or the default address schema.\n * @param country - The selected country\n * @returns AddressSchema\n */\n getAddressSchemaForCountry(country: string): AddressSchema {\n return this.specifications?.[country]?.schema || this.specifications.default.schema;\n }\n\n /**\n * Returns the address labels of the selected country or the default address labels.\n * @param country - The selected country\n * @returns StringObject\n */\n getAddressLabelsForCountry(country: string): StringObject {\n return this.specifications?.[country]?.labels || this.specifications.default.labels;\n }\n\n /**\n * Returns the optional fields of the selected country or the default optional fields.\n * @param country - The selected country\n * @returns Optional fields array\n */\n getOptionalFieldsForCountry(country: string): string[] {\n return this.specifications?.[country]?.optionalFields || this.specifications.default?.optionalFields || [];\n }\n\n /**\n * Returns the key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.labels?.[fieldName] || this.specifications?.default?.labels?.[fieldName] || fieldName;\n }\n\n /**\n * Returns the placeholder key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getPlaceholderKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.placeholders?.[fieldName] || this.specifications?.default?.placeholders?.[fieldName];\n }\n\n /**\n * Returns an array with the address schema of the selected country or the default address schema\n * Flat version of getAddressSchemaForCountry\n * @param country - The selected country\n * @returns Array\n */\n getAddressSchemaForCountryFlat(country: string): AddressField[] {\n return this.getAddressSchemaForCountry(country)\n .flat(SCHEMA_MAX_DEPTH)\n .filter((element): element is AddressField => typeof element === 'string');\n }\n}\n\nexport default Specifications;\n"],"names":["Specifications","countryHasDataset","country","_this_specifications_country","_this_specifications","this","specifications","hasDataset","countryHasOptionalField","fieldName","_this_specifications_country_optionalFields","optionalFields","includes","getAddressSchemaForCountry","schema","default","getAddressLabelsForCountry","labels","getOptionalFieldsForCountry","_this_specifications_default","getKeyForField","_this_specifications_country_labels","_this_specifications_default_labels","_this_specifications1","getPlaceholderKeyForField","_this_specifications_country_placeholders","_this_specifications_default_placeholders","placeholders","getAddressSchemaForCountryFlat","flat","filter","element","constructor","_define_property","_object_spread","ADDRESS_SPECIFICATIONS"],"mappings":"gLAMA,MAAMA,EAYFC,iBAAAA,CAAkBC,OACLC,EAAAC,EAAT,SAA4B,QAAnBA,EAAAC,KAAKC,sBAAL,IAAAF,GAA8B,QAA9BD,EAAAC,EAAsBF,cAAtBC,OAAA,EAAAA,EAAgCI,WAC7C,CAQAC,uBAAAA,CAAwBN,EAAiBO,GAC5B,IAAAC,EAAAP,EAAAC,EAAT,SAA4B,QAAnBA,EAAAC,KAAKC,0BAALF,GAA8B,QAA9BD,EAAAC,EAAsBF,cAAtBC,GAA8C,QAA9CO,EAAAP,EAAgCQ,sBAAhC,IAAAD,SAAAA,EAAgDE,SAASH,GACtE,CAOAI,0BAAAA,CAA2BX,OAChBC,EAAAC,EAAP,O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EAAAI,EAAqBR,eAArB,IAAAI,WAAAO,EAAAP,EAA8BQ,oBAA9B,IAAAD,OAAA,EAAAA,EAA6CjB,GACrH,CAQAmB,8BAAAA,CAA+B1B,GAC3B,OAAOG,KAAKQ,2BAA2BX,GAClC2B,KAjFY,GAkFZC,OAAQC,GAAwD,iBAAZA,EAC7D,CA9EA,WAAAC,CAAY1B,GAFZ2B,EAAA5B,KAAQC,yBAGJD,KAAKC,iVAAiB4B,CAAA,CAAA,EAAKC,EAA2B7B,EAC1D"}
1
+ {"version":3,"file":"Specifications.js","sources":["../../../../../src/components/internal/Address/Specifications.ts"],"sourcesContent":["import { AddressSchema, AddressSpecifications, StringObject } from './types';\nimport { ADDRESS_SPECIFICATIONS } from './constants';\nimport { AddressField } from '../../../types/global-types';\n\nconst SCHEMA_MAX_DEPTH = 2;\n\nclass Specifications {\n private specifications: AddressSpecifications;\n\n constructor(specifications?) {\n this.specifications = { ...ADDRESS_SPECIFICATIONS, ...specifications };\n }\n\n /**\n * Checks if a certain country has a dataset.\n * @param country - The selected country\n * @returns Boolean\n */\n countryHasDataset(country: string): boolean {\n return !!this.specifications?.[country]?.hasDataset;\n }\n\n /**\n * Checks if a certain country has the passed field in their optional fields array.\n * @param country - The selected country\n * @param fieldName - The field to be checked\n * @returns Boolean\n */\n countryHasOptionalField(country: string, fieldName: AddressField): boolean {\n return !!this.specifications?.[country]?.optionalFields?.includes(fieldName);\n }\n\n /**\n * Returns the address schema of the selected country or the default address schema.\n * @param country - The selected country\n * @returns AddressSchema\n */\n getAddressSchemaForCountry(country: string): AddressSchema {\n return this.specifications?.[country]?.schema || this.specifications.default.schema;\n }\n\n /**\n * Returns the address labels of the selected country or the default address labels.\n * @param country - The selected country\n * @returns StringObject\n */\n getAddressLabelsForCountry(country: string): StringObject {\n return this.specifications?.[country]?.labels || this.specifications.default.labels;\n }\n\n /**\n * Returns the optional fields of the selected country or the default optional fields.\n * @param country - The selected country\n * @returns Optional fields array\n */\n getOptionalFieldsForCountry(country: string): string[] {\n return this.specifications?.[country]?.optionalFields || this.specifications.default?.optionalFields || [];\n }\n\n /**\n * Returns the key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.labels?.[fieldName] || this.specifications?.default?.labels?.[fieldName] || fieldName;\n }\n\n /**\n * Returns the placeholder key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getPlaceholderKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.placeholders?.[fieldName] || this.specifications?.default?.placeholders?.[fieldName];\n }\n\n /**\n * Returns an array with the address schema of the selected country or the default address schema\n * Flat version of getAddressSchemaForCountry\n * @param country - The selected country\n * @returns Array\n */\n getAddressSchemaForCountryFlat(country: string): AddressField[] {\n return this.getAddressSchemaForCountry(country)\n .flat(SCHEMA_MAX_DEPTH)\n .filter((element): element is AddressField => typeof element === 'string');\n }\n}\n\nexport default Specifications;\n"],"names":["Specifications","countryHasDataset","country","_this_specifications_country","_this_specifications","this","specifications","hasDataset","countryHasOptionalField","fieldName","_this_specifications_country_optionalFields","optionalFields","includes","getAddressSchemaForCountry","schema","default","getAddressLabelsForCountry","labels","getOptionalFieldsForCountry","_this_specifications_default","getKeyForField","_this_specifications_country_labels","_this_specifications_default_labels","_this_specifications1","getPlaceholderKeyForField","_this_specifications_country_placeholders","_this_specifications_default_placeholders","placeholders","getAddressSchemaForCountryFlat","flat","filter","element","constructor","_define_property","_object_spread","ADDRESS_SPECIFICATIONS"],"mappings":"gLAMA,MAAMA,EAYFC,iBAAAA,CAAkBC,OACLC,EAAAC,EAAT,SAA4B,QAAnBA,EAAAC,KAAKC,sBAAL,IAAAF,GAA8B,QAA9BD,EAAAC,EAAsBF,cAAtBC,OAAA,EAAAA,EAAgCI,WAC7C,CAQAC,uBAAAA,CAAwBN,EAAiBO,GAC5B,IAAAC,EAAAP,EAAAC,EAAT,SAA4B,QAAnB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AAnBnB,EAAAC,KAAKC,0BAALF,WAAAD,EAAAC,EAAsBF,UAAtB,IAAAC,GAA4C,QAA5CsB,EAAAtB,EAAgCwB,wBAAhCF,SAAAA,EAA+ChB,MAAiC,QAAnBc,EAAAlB,KAAKC,0BAALiB,GAA4B,QAA5BJ,EAAAI,EAAqBR,eAArB,IAAAI,WAAAO,EAAAP,EAA8BQ,oBAA9B,IAAAD,OAAA,EAAAA,EAA6CjB,GACrH,CAQAmB,8BAAAA,CAA+B1B,GAC3B,OAAOG,KAAKQ,2BAA2BX,GAClC2B,KAjFY,GAkFZC,OAAQC,GAAwD,iBAAZA,EAC7D,CA9EA,WAAAC,CAAY1B,GAFZ2B,EAAA5B,KAAQC,yBAGJD,KAAKC,iVAAiB4B,CAAA,CAAA,EAAKC,EAA2B7B,EAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"AddressSearch.js","sources":["../../../../../../src/components/internal/Address/components/AddressSearch.tsx"],"sourcesContent":["import Field from '../../FormFields/Field';\nimport { h } from 'preact';\nimport { AddressLookupItem } from '../types';\nimport { useCallback, useEffect, useState, useMemo } from 'preact/hooks';\nimport './AddressSearch.scss';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { debounce } from '../../../../utils/debounce';\nimport Select from '../../FormFields/Select';\nimport { AddressData } from '../../../../types';\n\nexport type OnAddressLookupType = (\n value: string,\n actions: {\n resolve: (value: Array<AddressLookupItem>) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\nexport type OnAddressSelectedType = (\n value: AddressLookupItem,\n actions: {\n resolve: (value: AddressLookupItem) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\ninterface AddressSearchProps {\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n onSelect: (addressItem: AddressData) => void;\n onManualAddress: any;\n externalErrorMessage: string;\n hideManualButton: boolean;\n showContextualElement?: boolean;\n contextualText?: string;\n placeholder?: string;\n addressSearchDebounceMs?: number;\n}\n\ninterface RejectionReason {\n errorMessage: string;\n}\n\nexport default function AddressSearch({\n onAddressLookup,\n onAddressSelected,\n onSelect,\n onManualAddress,\n externalErrorMessage,\n hideManualButton,\n showContextualElement,\n contextualText,\n placeholder,\n addressSearchDebounceMs\n}: Readonly<AddressSearchProps>) {\n const [formattedData, setFormattedData] = useState<AddressLookupItem[]>([]);\n const [originalData, setOriginalData] = useState<AddressLookupItem[]>([]);\n\n const [errorMessage, setErrorMessage] = useState('');\n\n const { i18n } = useCoreContext();\n const mapDataToSelect = data => data.map(({ id, name }) => ({ id, name }));\n\n const handlePromiseReject = useCallback((reason: RejectionReason) => {\n if (reason?.errorMessage) {\n setErrorMessage(reason.errorMessage);\n }\n }, []);\n\n const onTextInput = useCallback(\n (inputValue: string) => {\n new Promise<Array<AddressLookupItem>>((resolve, reject) => {\n void onAddressLookup(inputValue, { resolve, reject });\n })\n .then(searchArray => {\n setOriginalData(searchArray);\n setFormattedData(mapDataToSelect(searchArray));\n setErrorMessage('');\n })\n .catch(reason => handlePromiseReject(reason));\n },\n [onAddressLookup]\n );\n\n // update error message when there's a new one\n useEffect(() => {\n setErrorMessage(externalErrorMessage);\n }, [externalErrorMessage]);\n\n const onSelectItem = event => {\n if (!event.target.value) {\n setErrorMessage(i18n.get('address.errors.incomplete'));\n return;\n }\n const value = originalData.find(item => item.id === event.target.value);\n\n // 1. in case we don't get a function just select item\n if (typeof onAddressSelected !== 'function') {\n onSelect(value);\n setFormattedData([]);\n return;\n }\n\n // 2. in case callback is provided, create and call onAddressSelected\n new Promise<AddressLookupItem>((resolve, reject) => {\n void onAddressSelected(value, { resolve, reject });\n })\n .then(fullData => {\n onSelect(fullData);\n setFormattedData([]);\n })\n .catch(reason => handlePromiseReject(reason));\n };\n\n const debounceInputHandler = useMemo(() => debounce(onTextInput, addressSearchDebounceMs), []);\n\n return (\n // The search field is intentionally rendered before the manual entry button in the DOM.\n // See: ../a11y.md\n <div className={'adyen-checkout__address-search adyen-checkout__field-group'}>\n <Field\n label={i18n.get('address')}\n classNameModifiers={['address-search']}\n errorMessage={errorMessage}\n name={'address-search'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n name={'address-search'}\n className={'adyen-checkout__address-search__dropdown'}\n placeholder={placeholder}\n onInput={debounceInputHandler}\n items={formattedData}\n onChange={onSelectItem}\n disableTextFilter={true}\n blurOnClose={true}\n />\n </Field>\n {!hideManualButton && (\n <span className=\"adyen-checkout__address-search__manual-add\">\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link adyen-checkout__address-search__manual-add__button\"\n onClick={onManualAddress}\n >\n {'+ ' + i18n.get('address.enterManually')}\n </button>\n </span>\n )}\n </div>\n );\n}\n"],"names":["AddressSearch","onAddressLookup","onAddressSelected","onSelect","onManualAddress","externalErrorMessage","hideManualButton","showContextualElement","contextualText","placeholder","addressSearchDebounceMs","formattedData","setFormattedData","useState","originalData","setOriginalData","errorMessage","setErrorMessage","i18n","useCoreContext","handlePromiseReject","useCallback","reason","onTextInput","inputValue","Promise","resolve","reject","then","searchArray","map","id","name","catch","useEffect","debounceInputHandler","useMemo","debounce","h","div","className","Field","label","get","classNameModifiers","Select","onInput","items","onChange","event","target","value","find","item","fullData","disableTextFilter","blurOnClose","span","button","type","onClick"],"mappings":"saA2Ce,SAASA,GAAcC,gBAClCA,EAAeC,kBACfA,EAAiBC,SACjBA,EAAQC,gBACRA,EAAeC,qBACfA,EAAoBC,iBACpBA,EAAgBC,sBAChBA,EAAqBC,eACrBA,EAAcC,YACdA,EAAWC,wBACXA,IAEA,MAAOC,EAAeC,GAAoBC,EAA8B,KACjEC,EAAcC,GAAmBF,EAA8B,KAE/DG,EAAcC,GAAmBJ,EAAS,KAE3CK,KAAEA,GAASC,IAGXC,EAAsBC,EAAaC,KACjCA,aAAAA,EAAAA,EAAQN,eACRC,EAAgBK,EAAON,eAE5B,IAEGO,EAAcF,EACfG,IACG,IAAIC,QAAkC,CAACC,EAASC,KACvC1B,EAAgBuB,EAAY,CAAEE,UAASC,aAE3CC,KAAKC,IACFd,EAAgBc,GAChBjB,EAAiCiB,EAfZC,IAAI,EAAGC,KAAIC,WAAM,CAAQD,KAAIC,WAgBlDf,EAAgB,MAEnBgB,MAAMX,GAAUF,EAAoBE,KAE7C,CAACrB,IAILiC,EAAU,KACNjB,EAAgBZ,IACjB,CAACA,IAEJ,MAyBM8B,EAAuBC,EAAQ,IAAMC,EAASd,EAAab,GAA0B,IAE3F,OAGI4B,EAACC,MAAAA,CAAIC,UAAW,8DACZF,EAACG,EAAAA,CACGC,MAAOxB,EAAKyB,IAAI,WAChBC,mBAAoB,CAAC,kBACrB5B,aAAcA,EACdgB,KAAM,iBACNzB,sBAAuBA,EACvBC,eAAgBA,GAEhB8B,EAACO,EAAAA,CACGb,KAAM,iBACNQ,UAAW,2CACX/B,YAAaA,EACbqC,QAASX,EACTY,MAAOpC,EACPqC,SA7CKC,IACjB,IAAKA,EAAMC,OAAOC,MAEd,YADAlC,EAAgBC,EAAKyB,IAAI,8BAG7B,MAAMQ,EAAQrC,EAAasC,KAAKC,GAAQA,EAAKtB,KAAOkB,EAAMC,OAAOC,OAGjE,GAAiC,mBAAtBjD,EAGP,OAFAC,EAASgD,QACTvC,EAAiB,IAKrB,IAAIa,QAA2B,CAACC,EAASC,KAChCzB,EAAkBiD,EAAO,CAAEzB,UAASC,aAExCC,KAAK0B,IACFnD,EAASmD,GACT1C,EAAiB,MAEpBqB,MAAMX,GAAUF,EAAoBE,KAwB7BiC,mBAAmB,EACnBC,aAAa,MAGnBlD,GACEgC,EAACmB,OAAAA,CAAKjB,UAAU,8CACZF,EAACoB,SAAAA,CACGC,KAAK,SACLnB,UAAU,wIACVoB,QAASxD,GAER,KAAOc,EAAKyB,IAAI,2BAMzC"}
1
+ {"version":3,"file":"AddressSearch.js","sources":["../../../../../../src/components/internal/Address/components/AddressSearch.tsx"],"sourcesContent":["import Field from '../../FormFields/Field';\nimport { h } from 'preact';\nimport { AddressLookupItem } from '../types';\nimport { useCallback, useEffect, useState, useMemo } from 'preact/hooks';\nimport './AddressSearch.scss';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { debounce } from '../../../../utils/debounce';\nimport Select from '../../FormFields/Select';\nimport { AddressData } from '../../../../types';\n\nexport type OnAddressLookupType = (\n value: string,\n actions: {\n resolve: (value: Array<AddressLookupItem>) => void;\n reject: (reason?: RejectionReason) => void;\n }\n) => Promise<void>;\n\nexport type OnAddressSelectedType = (\n value: AddressLookupItem,\n actions: {\n resolve: (value: AddressLookupItem) => void;\n reject: (reason?: RejectionReason) => void;\n }\n) => Promise<void>;\n\ninterface AddressSearchProps {\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n onSelect: (addressItem: AddressData) => void;\n onManualAddress: () => void;\n externalErrorMessage: string;\n hideManualButton: boolean;\n showContextualElement?: boolean;\n contextualText?: string;\n placeholder?: string;\n addressSearchDebounceMs?: number;\n}\n\ninterface RejectionReason {\n errorMessage: string;\n}\n\nexport default function AddressSearch({\n onAddressLookup,\n onAddressSelected,\n onSelect,\n onManualAddress,\n externalErrorMessage,\n hideManualButton,\n showContextualElement,\n contextualText,\n placeholder,\n addressSearchDebounceMs\n}: Readonly<AddressSearchProps>) {\n const [formattedData, setFormattedData] = useState<AddressLookupItem[]>([]);\n const [originalData, setOriginalData] = useState<AddressLookupItem[]>([]);\n\n const [errorMessage, setErrorMessage] = useState('');\n\n const { i18n } = useCoreContext();\n const mapDataToSelect = data => data.map(({ id, name }) => ({ id, name }));\n\n const handlePromiseReject = useCallback((reason: RejectionReason) => {\n if (reason?.errorMessage) {\n setErrorMessage(reason.errorMessage);\n }\n }, []);\n\n const onTextInput = useCallback(\n (inputValue: string) => {\n new Promise<Array<AddressLookupItem>>((resolve, reject) => {\n void onAddressLookup(inputValue, { resolve, reject });\n })\n .then(searchArray => {\n setOriginalData(searchArray);\n setFormattedData(mapDataToSelect(searchArray));\n setErrorMessage('');\n })\n .catch(reason => handlePromiseReject(reason));\n },\n [onAddressLookup]\n );\n\n // update error message when there's a new one\n useEffect(() => {\n setErrorMessage(externalErrorMessage);\n }, [externalErrorMessage]);\n\n const onSelectItem = event => {\n if (!event.target.value) {\n setErrorMessage(i18n.get('address.errors.incomplete'));\n return;\n }\n const value = originalData.find(item => item.id === event.target.value);\n\n // 1. in case we don't get a function just select item\n if (typeof onAddressSelected !== 'function') {\n onSelect(value);\n setFormattedData([]);\n return;\n }\n\n // 2. in case callback is provided, create and call onAddressSelected\n new Promise<AddressLookupItem>((resolve, reject) => {\n void onAddressSelected(value, { resolve, reject });\n })\n .then(fullData => {\n onSelect(fullData);\n setFormattedData([]);\n })\n .catch(reason => handlePromiseReject(reason));\n };\n\n const debounceInputHandler = useMemo(() => debounce(onTextInput, addressSearchDebounceMs), []);\n\n return (\n // The search field is intentionally rendered before the manual entry button in the DOM.\n // See: ../a11y.md\n <div className={'adyen-checkout__address-search adyen-checkout__field-group'}>\n <Field\n label={i18n.get('address')}\n classNameModifiers={['address-search']}\n errorMessage={errorMessage}\n name={'address-search'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n name={'address-search'}\n className={'adyen-checkout__address-search__dropdown'}\n placeholder={placeholder}\n onInput={debounceInputHandler}\n items={formattedData}\n onChange={onSelectItem}\n disableTextFilter={true}\n blurOnClose={true}\n />\n </Field>\n {!hideManualButton && (\n <span className=\"adyen-checkout__address-search__manual-add\">\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link adyen-checkout__address-search__manual-add__button\"\n onClick={onManualAddress}\n >\n {'+ ' + i18n.get('address.enterManually')}\n </button>\n </span>\n )}\n </div>\n );\n}\n"],"names":["AddressSearch","onAddressLookup","onAddressSelected","onSelect","onManualAddress","externalErrorMessage","hideManualButton","showContextualElement","contextualText","placeholder","addressSearchDebounceMs","formattedData","setFormattedData","useState","originalData","setOriginalData","errorMessage","setErrorMessage","i18n","useCoreContext","handlePromiseReject","useCallback","reason","onTextInput","inputValue","Promise","resolve","reject","then","searchArray","map","id","name","catch","useEffect","debounceInputHandler","useMemo","debounce","h","div","className","Field","label","get","classNameModifiers","Select","onInput","items","onChange","event","target","value","find","item","fullData","disableTextFilter","blurOnClose","span","button","type","onClick"],"mappings":"saA2Ce,SAASA,GAAcC,gBAClCA,EAAeC,kBACfA,EAAiBC,SACjBA,EAAQC,gBACRA,EAAeC,qBACfA,EAAoBC,iBACpBA,EAAgBC,sBAChBA,EAAqBC,eACrBA,EAAcC,YACdA,EAAWC,wBACXA,IAEA,MAAOC,EAAeC,GAAoBC,EAA8B,KACjEC,EAAcC,GAAmBF,EAA8B,KAE/DG,EAAcC,GAAmBJ,EAAS,KAE3CK,KAAEA,GAASC,IAGXC,EAAsBC,EAAaC,KACjCA,aAAAA,EAAAA,EAAQN,eACRC,EAAgBK,EAAON,eAE5B,IAEGO,EAAcF,EACfG,IACG,IAAIC,QAAkC,CAACC,EAASC,KACvC1B,EAAgBuB,EAAY,CAAEE,UAASC,aAE3CC,KAAKC,IACFd,EAAgBc,GAChBjB,EAAiCiB,EAfZC,IAAI,EAAGC,KAAIC,WAAM,CAAQD,KAAIC,WAgBlDf,EAAgB,MAEnBgB,MAAMX,GAAUF,EAAoBE,KAE7C,CAACrB,IAILiC,EAAU,KACNjB,EAAgBZ,IACjB,CAACA,IAEJ,MAyBM8B,EAAuBC,EAAQ,IAAMC,EAASd,EAAab,GAA0B,IAE3F,OAGI4B,EAACC,MAAAA,CAAIC,UAAW,8DACZF,EAACG,EAAAA,CACGC,MAAOxB,EAAKyB,IAAI,WAChBC,mBAAoB,CAAC,kBACrB5B,aAAcA,EACdgB,KAAM,iBACNzB,sBAAuBA,EACvBC,eAAgBA,GAEhB8B,EAACO,EAAAA,CACGb,KAAM,iBACNQ,UAAW,2CACX/B,YAAaA,EACbqC,QAASX,EACTY,MAAOpC,EACPqC,SA7CKC,IACjB,IAAKA,EAAMC,OAAOC,MAEd,YADAlC,EAAgBC,EAAKyB,IAAI,8BAG7B,MAAMQ,EAAQrC,EAAasC,KAAKC,GAAQA,EAAKtB,KAAOkB,EAAMC,OAAOC,OAGjE,GAAiC,mBAAtBjD,EAGP,OAFAC,EAASgD,QACTvC,EAAiB,IAKrB,IAAIa,QAA2B,CAACC,EAASC,KAChCzB,EAAkBiD,EAAO,CAAEzB,UAASC,aAExCC,KAAK0B,IACFnD,EAASmD,GACT1C,EAAiB,MAEpBqB,MAAMX,GAAUF,EAAoBE,KAwB7BiC,mBAAmB,EACnBC,aAAa,MAGnBlD,GACEgC,EAACmB,OAAAA,CAAKjB,UAAU,8CACZF,EAACoB,SAAAA,CACGC,KAAK,SACLnB,UAAU,wIACVoB,QAASxD,GAER,KAAOc,EAAKyB,IAAI,2BAMzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldContainer.js","sources":["../../../../../../src/components/internal/Address/components/FieldContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../FormFields/Field';\nimport StateField from './StateField';\nimport CountryField from './CountryField';\nimport { AddressStateError, AddressType, FieldContainerProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Language from '../../../../language/Language';\nimport InputText from '../../FormFields/InputText';\nimport { AutocompleteValue } from '../../FormFields/types';\nimport { ADDRESS_FIELD_TOKEN_MAP } from '../constants';\n\nfunction getErrorMessage(errors: AddressStateError, fieldName: string, i18n: Language, label: string): string | boolean {\n if (typeof errors[fieldName]?.errorMessage === 'object') {\n const { translationKey, translationObject } = errors[fieldName].errorMessage;\n return i18n.get(translationKey, translationObject);\n }\n // Default error msg: Enter the [label name]\n const errorMsg = i18n.get(errors[fieldName]?.errorMessage, { values: { label: label.toLowerCase() } });\n return errorMsg || !!errors[fieldName];\n}\n\n/**\n * USAGE: Specifically defined as a util to provide a wrapper for fields created within the Address component\n *\n * NOT TO BE USED: if you just want to add a Country or State dropdown outside of an Address component\n * - then you should implement <CountryField> or <StateField> directly\n */\nfunction getAddressAutocomplete(fieldName: string, addressType: AddressType): AutocompleteValue {\n const token = ADDRESS_FIELD_TOKEN_MAP[fieldName];\n if (!token) return undefined;\n if (addressType === 'billingAddress') return `billing ${token}` as AutocompleteValue;\n if (addressType === 'deliveryAddress') return `shipping ${token}` as AutocompleteValue;\n // Fallback: bare token (no prefix) when address type is unspecified\n return token as AutocompleteValue;\n}\n\nfunction FieldContainer(props: Readonly<FieldContainerProps>) {\n const { i18n } = useCoreContext();\n const { classNameModifiers = [], data, errors, valid, fieldName, onInput, onBlur, trimOnBlur, maxLength, disabled, addressType } = props;\n\n const value: string = data[fieldName];\n const selectedCountry: string = data.country;\n const isOptional: boolean = props.specifications.countryHasOptionalField(selectedCountry, fieldName);\n const labelKey: string = props.specifications.getKeyForField(fieldName, selectedCountry);\n const optionalLabel = isOptional ? ` ${i18n.get('field.title.optional')}` : '';\n const label = `${i18n.get(labelKey)}${optionalLabel}`;\n const errorMessage = getErrorMessage(errors, fieldName, i18n, label);\n\n switch (fieldName) {\n case 'country':\n return (\n <CountryField\n allowedCountries={props.allowedCountries}\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n value={value}\n required={!isOptional}\n />\n );\n case 'stateOrProvince':\n return (\n <StateField\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n selectedCountry={selectedCountry}\n specifications={props.specifications}\n value={value}\n required={!isOptional}\n />\n );\n default:\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={errorMessage}\n isValid={valid[fieldName]}\n name={fieldName}\n i18n={i18n}\n onFocus={e => props.onFieldFocusAnalytics(fieldName, e)}\n onBlur={e => props.onFieldBlurAnalytics(fieldName, e)}\n >\n <InputText\n name={fieldName}\n classNameModifiers={classNameModifiers}\n value={value}\n onInput={onInput}\n onBlur={onBlur}\n maxlength={maxLength}\n trimOnBlur={trimOnBlur}\n disabled={disabled}\n required={!isOptional}\n autocomplete={getAddressAutocomplete(fieldName, addressType)}\n />\n </Field>\n );\n }\n}\n\nexport default FieldContainer;\n"],"names":["getAddressAutocomplete","fieldName","addressType","token","ADDRESS_FIELD_TOKEN_MAP","FieldContainer","props","i18n","useCoreContext","classNameModifiers","data","errors","valid","onInput","onBlur","trimOnBlur","maxLength","disabled","value","selectedCountry","country","isOptional","specifications","countryHasOptionalField","labelKey","getKeyForField","optionalLabel","get","label","errorMessage","translationKey","translationObject","values","toLowerCase","getErrorMessage","h","CountryField","allowedCountries","onDropdownChange","required","StateField","Field","isValid","name","onFocus","e","onFieldFocusAnalytics","onFieldBlurAnalytics","InputText","maxlength","autocomplete"],"mappings":"2WA2BA,SAASA,EAAuBC,EAAmBC,GAC/C,MAAMC,EAAQC,EAAwBH,GACtC,GAAKE,EACL,MAAoB,mBAAhBD,EAAyC,WAAWC,IACpC,oBAAhBD,EAA0C,YAAYC,IAEnDA,CACX,CAEA,SAASE,EAAeC,GACpB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,EAAqB,GAAEC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKX,UAAEA,EAASY,QAAEA,EAAOC,OAAEA,EAAMC,WAAEA,EAAUC,UAAEA,EAASC,SAAEA,EAAQf,YAAEA,GAAgBI,EAE7HY,EAAgBR,EAAKT,GACrBkB,EAA0BT,EAAKU,QAC/BC,EAAsBf,EAAMgB,eAAeC,wBAAwBJ,EAAiBlB,GACpFuB,EAAmBlB,EAAMgB,eAAeG,eAAexB,EAAWkB,GAClEO,EAAgBL,EAAa,IAAId,EAAKoB,IAAI,0BAA4B,GACtEC,EAAQ,GAAGrB,EAAKoB,IAAIH,KAAYE,IAChCG,EAnCV,SAAyBlB,EAA2BV,EAAmBM,EAAgBqB,OACxEjB,EAKeA,EAL1B,GAA+C,yBAApCA,EAAAA,EAAOV,UAAPU,IAAAA,OAAAA,EAAAA,EAAmBkB,cAA2B,CACrD,MAAMC,eAAEA,EAAcC,kBAAEA,GAAsBpB,EAAOV,GAAW4B,aAChE,OAAOtB,EAAKoB,IAAIG,EAAgBC,EACpC,CAGA,OADiBxB,EAAKoB,IAAqB,QAAjBhB,EAAAA,EAAOV,UAAPU,IAAAA,OAAAA,EAAAA,EAAmBkB,aAAc,CAAEG,OAAQ,CAAEJ,MAAOA,EAAMK,oBAC/DtB,EAAOV,EAChC,CA2ByBiC,CAAgBvB,EAAQV,EAAWM,EAAMqB,GAE9D,OAAQ3B,GACJ,IAAK,UACD,OACIkC,EAACC,EAAAA,CACGC,iBAAkB/B,EAAM+B,iBACxB5B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBpB,MAAOA,EACPqB,UAAWlB,IAGvB,IAAK,kBACD,OACIc,EAACK,EAAAA,CACG/B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBnB,gBAAiBA,EACjBG,eAAgBhB,EAAMgB,eACtBJ,MAAOA,EACPqB,UAAWlB,IAGvB,QACI,OACIc,EAACM,EAAAA,CACGb,MAAOA,EACPnB,mBAAoBA,EACpBoB,aAAcA,EACda,QAAS9B,EAAMX,GACf0C,KAAM1C,EACNM,KAAMA,EACNqC,QAASC,GAAKvC,EAAMwC,sBAAsB7C,EAAW4C,GACrD/B,OAAQ+B,GAAKvC,EAAMyC,qBAAqB9C,EAAW4C,IAEnDV,EAACa,EAAAA,CACGL,KAAM1C,EACNQ,mBAAoBA,EACpBS,MAAOA,EACPL,QAASA,EACTC,OAAQA,EACRmC,UAAWjC,EACXD,WAAYA,EACZE,SAAUA,EACVsB,UAAWlB,EACX6B,aAAclD,EAAuBC,EAAWC,MAKxE"}
1
+ {"version":3,"file":"FieldContainer.js","sources":["../../../../../../src/components/internal/Address/components/FieldContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../FormFields/Field';\nimport StateField from './StateField';\nimport CountryField from './CountryField';\nimport { AddressStateError, AddressType, FieldContainerProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Language from '../../../../language/Language';\nimport InputText from '../../FormFields/InputText';\nimport { AutocompleteValue } from '../../FormFields/types';\nimport { ADDRESS_FIELD_TOKEN_MAP } from '../constants';\nimport { AddressField } from '../../../../types';\n\nfunction getErrorMessage(errors: AddressStateError, fieldName: string, i18n: Language, label: string): string | boolean {\n if (typeof errors[fieldName]?.errorMessage === 'object') {\n const { translationKey, translationObject } = errors[fieldName].errorMessage;\n return i18n.get(translationKey, translationObject);\n }\n // Default error msg: Enter the [label name]\n const errorMsg = i18n.get(errors[fieldName]?.errorMessage, { values: { label: label.toLowerCase() } });\n return errorMsg || !!errors[fieldName];\n}\n\n/**\n * USAGE: Specifically defined as a util to provide a wrapper for fields created within the Address component\n *\n * NOT TO BE USED: if you just want to add a Country or State dropdown outside of an Address component\n * - then you should implement <CountryField> or <StateField> directly\n */\nfunction getAddressAutocomplete(fieldName: string, addressType: AddressType): AutocompleteValue {\n const token = ADDRESS_FIELD_TOKEN_MAP[fieldName];\n if (!token) return undefined;\n if (addressType === 'billingAddress') return `billing ${token}` as AutocompleteValue;\n if (addressType === 'deliveryAddress') return `shipping ${token}` as AutocompleteValue;\n // Fallback: bare token (no prefix) when address type is unspecified\n return token as AutocompleteValue;\n}\n\nfunction FieldContainer(props: Readonly<FieldContainerProps>) {\n const { i18n } = useCoreContext();\n const { classNameModifiers = [], data, errors, valid, fieldName, onInput, onBlur, trimOnBlur, maxLength, disabled, addressType } = props;\n\n const value: string = data[fieldName];\n const selectedCountry: string = data.country;\n const isOptional: boolean = props.specifications.countryHasOptionalField(selectedCountry, fieldName as AddressField);\n const labelKey: string = props.specifications.getKeyForField(fieldName, selectedCountry);\n const optionalLabel = isOptional ? ` ${i18n.get('field.title.optional')}` : '';\n const label = `${i18n.get(labelKey)}${optionalLabel}`;\n const errorMessage = getErrorMessage(errors, fieldName, i18n, label);\n\n switch (fieldName) {\n case 'country':\n return (\n <CountryField\n allowedCountries={props.allowedCountries}\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n value={value}\n required={!isOptional}\n />\n );\n case 'stateOrProvince':\n return (\n <StateField\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n selectedCountry={selectedCountry}\n specifications={props.specifications}\n value={value}\n required={!isOptional}\n />\n );\n default:\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={errorMessage}\n isValid={valid[fieldName]}\n name={fieldName}\n i18n={i18n}\n onFocus={e => props.onFieldFocusAnalytics(fieldName, e)}\n onBlur={e => props.onFieldBlurAnalytics(fieldName, e)}\n >\n <InputText\n name={fieldName}\n classNameModifiers={classNameModifiers}\n value={value}\n onInput={onInput}\n onBlur={onBlur}\n maxlength={maxLength}\n trimOnBlur={trimOnBlur}\n disabled={disabled}\n required={!isOptional}\n autocomplete={getAddressAutocomplete(fieldName, addressType)}\n />\n </Field>\n );\n }\n}\n\nexport default FieldContainer;\n"],"names":["getAddressAutocomplete","fieldName","addressType","token","ADDRESS_FIELD_TOKEN_MAP","FieldContainer","props","i18n","useCoreContext","classNameModifiers","data","errors","valid","onInput","onBlur","trimOnBlur","maxLength","disabled","value","selectedCountry","country","isOptional","specifications","countryHasOptionalField","labelKey","getKeyForField","optionalLabel","get","label","errorMessage","translationKey","translationObject","values","toLowerCase","getErrorMessage","h","CountryField","allowedCountries","onDropdownChange","required","StateField","Field","isValid","name","onFocus","e","onFieldFocusAnalytics","onFieldBlurAnalytics","InputText","maxlength","autocomplete"],"mappings":"2WA4BA,SAASA,EAAuBC,EAAmBC,GAC/C,MAAMC,EAAQC,EAAwBH,GACtC,GAAKE,EACL,MAAoB,mBAAhBD,EAAyC,WAAWC,IACpC,oBAAhBD,EAA0C,YAAYC,IAEnDA,CACX,CAEA,SAASE,EAAeC,GACpB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,EA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AGvB,QACI,OACIc,EAACM,EAAAA,CACGb,MAAOA,EACPnB,mBAAoBA,EACpBoB,aAAcA,EACda,QAAS9B,EAAMX,GACf0C,KAAM1C,EACNM,KAAMA,EACNqC,QAASC,GAAKvC,EAAMwC,sBAAsB7C,EAAW4C,GACrD/B,OAAQ+B,GAAKvC,EAAMyC,qBAAqB9C,EAAW4C,IAEnDV,EAACa,EAAAA,CACGL,KAAM1C,EACNQ,mBAAoBA,EACpBS,MAAOA,EACPL,QAASA,EACTC,OAAQA,EACRmC,UAAWjC,EACXD,WAAYA,EACZE,SAAUA,EACVsB,UAAWlB,EACX6B,aAAclD,EAAuBC,EAAWC,MAKxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.data;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","data","_this_core_modules_analytics_checkoutAttemptId","componentData","order","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","_object_spread_props","riskData","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"owCAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,GAAKH,KAAKI,yBAAgCL,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAI,GACI,MAAO,CAAA,CACX,CAEUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAEUC,aAAAA,CAAcC,GACpB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfX,KAAKY,MAAQT,KAAKH,KAAKY,MAAUD,EACrC,CAMA,QAAWE,GAKmB,IAAAC,EAFyDC,EAFnF,MAAMC,EAAQhB,KAAKY,MAAMI,OAAShB,KAAKC,MAAMe,MACvCD,EAAgBf,KAAKK,aACrBY,EAAuCC,QAAQC,EAAyD,QAA3BJ,EAAAA,EAAcK,qBAAdL,IAAAA,OAAAA,EAAAA,EAA6BM,OAC1GC,EAAatB,KAAKuB,KAAKC,QAAQC,KAAKZ,KACpCa,EAAiE,QAA7CZ,EAAAd,KAAKuB,KAAKC,QAAQG,UAAUD,6BAA5BZ,EAAAA,EAAiDc,EACrEC,EAAwBZ,EAAuCa,EAAwBC,OAASD,EAAwBE,QAExHC,EAAUC,EAAcR,EAAmBJ,EAAYO,GAS7D,OARId,EAAcK,eAAiBM,IAC/BX,EAAcK,cAAcM,kBAAoBA,GAGhDX,EAAcK,eAAiBa,IAC/BlB,EAAcK,cAAca,QAAUA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A9BL,EAASM,iBAEtF,CAe+BC,CAAqBP,GAE5C,IAAKI,EACD,MAAM,IAAII,EACN,uBACA,uCAAuC/D,KAAKI,YAAY,6DAIhEJ,KAAKuB,KAAOgC,EACZvD,KAAKF,kBAAkBG,GAEvBD,KAAKQ,cAAgBR,KAAKQ,cAAcwD,KAAKhE,KACjD,EAhBAwD,EAVW3D,EAUeoE,eAAe"}
1
+ {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, BaseElementState, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps, S extends BaseElementState = BaseElementState> implements IBaseElement<P> {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: S = {} as S;\n public _component: ComponentChild | undefined;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): PaymentData {\n return {} as PaymentData;\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: S): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.data;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {} as S;\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","data","_this_core_modules_analytics_checkoutAttemptId","componentData","order","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","_object_spread_props","riskData","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"owCAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,GAAKH,KAAKI,yBAAgCL,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAI,GACI,MAAO,CAAA,CACX,CAEUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAEUC,aAAAA,CAAcC,GACpB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfX,KAAKY,MAAQT,KAAKH,KAAKY,MAAUD,EACrC,CAMA,QAAWE,GAKmB,IAAAC,EAFyDC,EAFnF,MAAMC,EAAQhB,KAAKY,MAAMI,OAAShB,KAAKC,MAAMe,MACvCD,EAAgBf,KAAKK,aACrBY,EAAuCC,QAAQC,EAAyD,QAA3BJ,EAAAA,EAAcK,qBAAdL,IAAAA,OAAAA,EAAAA,EAA6BM,OAC1GC,EAAatB,KAAKuB,KAAKC,QAAQC,KAAKZ,KACpCa,EAAiE,QAA7CZ,EAAAd,KAAKuB,KAAKC,QAAQG,UAAUD,6BAA5BZ,EAAAA,EAAiDc,EACrEC,EAAwBZ,EAAuCa,EAAwBC,OAASD,EAAwBE,QAExHC,EAAUC,EAAcR,EAAmBJ,EAAYO,GAS7D,OARId,EAAcK,eAAiBM,IAC/BX,EAAcK,cAAcM,kBAAoBA,GAGhDX,EAAcK,eAAiBa,IAC/BlB,EAAcK,cAAca,QAAUA,GAGnCE,OACCb,GAAc,CAAEc,SAAU,CAAEd,eAC5BN,GAAS,CAAEA,MAAO,CAAEqB,UAAWrB,EAAMqB,UAAWC,aAActB,EAAMsB,eAC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uB,KAAOgC,EACZvD,KAAKF,kBAAkBG,GAEvBD,KAAKQ,cAAgBR,KAAKQ,cAAcwD,KAAKhE,KACjD,EAhBAwD,EAVW3D,EAUeoE,eAAe"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as l}from"../../../../../utils/setFocus.js";import p from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const m=m=>{const{i18n:d}=a(),c=r(null),{handleChangeFor:g,data:h,triggerValidation:f,valid:L,errors:F,isValid:v}=i({schema:["shopperLogin"],rules:n,formHolder:c}),j=r({validateInput:null,focusInput:null}),[I,b]=o(!1),E=s(()=>{b(!0),f()},[f]);t(()=>{c.current&&m.errorMessage&&l(c.current,"shopperLogin")},[m.errorMessage]),t(()=>{h.shopperLogin&&b(!0)},[h.shopperLogin]),t(()=>{j.current.validateInput=E,m.onSetInputHandlers(j.current)},[E,m.onSetInputHandlers]);const M=s(e=>{"Enter"===e.key&&m.onPressEnter()},[m.onPressEnter]);return t(()=>{m.onChange({data:h,valid:L,errors:F,isValid:v})},[h,L,F]),e("div",{ref:c},e(p,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:I?m.errorMessage||F.shopperLogin&&d.get(F.shopperLogin.errorMessage):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:h.shopperLogin,disabled:m.disabled,onInput:g("shopperLogin","input"),onBlur:g("shopperLogin","blur"),onKeyDown:M,autocomplete:"email"})))};export{m as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as l}from"../../../../../utils/setFocus.js";import p from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const d=d=>{var m;const{i18n:g}=a(),c=r(null),{handleChangeFor:h,data:f,triggerValidation:L,valid:v,errors:F,isValid:j}=i({schema:["shopperLogin"],rules:n,formHolder:c}),I=r({validateInput:null,focusInput:null}),[M,b]=o(!1),E=s(()=>{b(!0),L()},[L]);t(()=>{c.current&&d.errorMessage&&l(c.current,"shopperLogin")},[d.errorMessage]),t(()=>{f.shopperLogin&&b(!0)},[f.shopperLogin]),t(()=>{I.current.validateInput=E,d.onSetInputHandlers(I.current)},[E,d.onSetInputHandlers]);const k=s(e=>{"Enter"===e.key&&d.onPressEnter()},[d.onPressEnter]);return t(()=>{d.onChange({data:f,valid:v,errors:F,isValid:j})},[f,v,F]),e("div",{ref:c},e(p,{name:"shopperLogin",label:g.get("ctp.login.inputLabel"),errorMessage:M?d.errorMessage||(F.shopperLogin&&"string"==typeof(null===(m=F.shopperLogin)||void 0===m?void 0:m.errorMessage)?g.get(F.shopperLogin.errorMessage):null):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:f.shopperLogin,disabled:d.disabled,onInput:h("shopperLogin","input"),onBlur:h("shopperLogin","blur"),onKeyDown:k,autocomplete:"email"})))};export{d as default};
2
2
  //# sourceMappingURL=CtPLoginInput.js.map