@adyen/adyen-web 6.45.2 → 6.46.0-alpha.7c7199d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/dist/cjs/adyen.css +7 -7
  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 +2026 -1918
  6. package/dist/es/adyen.css +7 -7
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ANCV/ANCV.js +1 -1
  9. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  10. package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
  11. package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
  12. package/dist/es/components/Ach/Ach.js +1 -1
  13. package/dist/es/components/Ach/Ach.js.map +1 -1
  14. package/dist/es/components/Ach/components/AchComponent.js +1 -1
  15. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  16. package/dist/es/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
  17. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  18. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  19. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  20. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  21. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  22. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  23. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  24. package/dist/es/components/BankTransfer/BankTransfer.js +1 -1
  25. package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
  26. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  27. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  28. package/dist/es/components/Blik/Blik.js +1 -1
  29. package/dist/es/components/Blik/Blik.js.map +1 -1
  30. package/dist/es/components/Blik/components/BlikInput.js +1 -1
  31. package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
  32. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
  33. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  34. package/dist/es/components/Card/Card.js +1 -1
  35. package/dist/es/components/Card/Card.js.map +1 -1
  36. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  37. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  38. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  39. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  40. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  41. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  42. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  43. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  44. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  45. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  46. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  47. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  48. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  49. package/dist/es/components/Doku/components/DokuInput/DokuInput.js +1 -1
  50. package/dist/es/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  51. package/dist/es/components/Donation/Donation.js +1 -1
  52. package/dist/es/components/Donation/Donation.js.map +1 -1
  53. package/dist/es/components/Donation/components/DonationComponent.js +1 -1
  54. package/dist/es/components/Donation/components/DonationComponent.js.map +1 -1
  55. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  56. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  57. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  58. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  59. package/dist/es/components/Dropin/Dropin.js +1 -1
  60. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  61. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  62. package/dist/es/components/Econtext/Econtext.js +1 -1
  63. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  64. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  65. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  66. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  67. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  68. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  69. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  70. package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
  71. package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
  72. package/dist/es/components/Giropay/Giropay.js +1 -1
  73. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  74. package/dist/es/components/Iris/Iris.js +1 -1
  75. package/dist/es/components/Iris/Iris.js.map +1 -1
  76. package/dist/es/components/Iris/components/IrisComponent.js +1 -1
  77. package/dist/es/components/Iris/components/IrisComponent.js.map +1 -1
  78. package/dist/es/components/Iris/components/IrisGenerateQRCode.js +1 -1
  79. package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  80. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  81. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  82. package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  83. package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  84. package/dist/es/components/MBWay/MBWay.js +1 -1
  85. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  86. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  87. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  88. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  89. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  90. package/dist/es/components/Oxxo/Oxxo.js +1 -1
  91. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  92. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  93. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  94. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  95. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  96. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  97. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  98. package/dist/es/components/PayPal/Paypal.js +1 -1
  99. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  100. package/dist/es/components/PayPalFastlane/Fastlane.js +1 -1
  101. package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
  102. package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js +1 -1
  103. package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  104. package/dist/es/components/PayTo/PayTo.js +1 -1
  105. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  106. package/dist/es/components/PayTo/components/BSBInput.js +1 -1
  107. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
  108. package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
  109. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  110. package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
  111. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  112. package/dist/es/components/PayTo/components/PayToPhone.js +1 -1
  113. package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -1
  114. package/dist/es/components/Pix/Pix.js +1 -1
  115. package/dist/es/components/Pix/Pix.js.map +1 -1
  116. package/dist/es/components/Pix/components/PixInput/PixInput.js +1 -1
  117. package/dist/es/components/Pix/components/PixInput/PixInput.js.map +1 -1
  118. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  119. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  120. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  121. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  122. package/dist/es/components/Redirect/Redirect.js +1 -1
  123. package/dist/es/components/Redirect/Redirect.js.map +1 -1
  124. package/dist/es/components/Sepa/Sepa.js.map +1 -1
  125. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  126. package/dist/es/components/Trustly/Trustly.js +1 -1
  127. package/dist/es/components/Trustly/Trustly.js.map +1 -1
  128. package/dist/es/components/UPI/UPI.js +1 -1
  129. package/dist/es/components/UPI/UPI.js.map +1 -1
  130. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  131. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  132. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  133. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  134. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  135. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  136. package/dist/es/components/internal/Address/components/CountryField.js.map +1 -1
  137. package/dist/es/components/internal/Address/components/FieldContainer.js +1 -1
  138. package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
  139. package/dist/es/components/internal/Address/components/StateField.js.map +1 -1
  140. package/dist/es/components/internal/Address/constants.js +1 -1
  141. package/dist/es/components/internal/Address/constants.js.map +1 -1
  142. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  143. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  144. package/dist/es/components/internal/Address/validate.js +1 -1
  145. package/dist/es/components/internal/Address/validate.js.map +1 -1
  146. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  147. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  148. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  149. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  150. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  151. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  152. package/dist/es/components/internal/DisclaimerMessage/utils.js +2 -0
  153. package/dist/es/components/internal/DisclaimerMessage/utils.js.map +1 -0
  154. package/dist/es/components/internal/FormFields/utils.js +1 -1
  155. package/dist/es/components/internal/FormFields/utils.js.map +1 -1
  156. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  157. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  158. package/dist/es/components/internal/IbanInput/validate.js +1 -1
  159. package/dist/es/components/internal/IbanInput/validate.js.map +1 -1
  160. package/dist/es/components/internal/IssuerList/IssuerList.js +1 -1
  161. package/dist/es/components/internal/IssuerList/IssuerList.js.map +1 -1
  162. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  163. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  164. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  165. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  166. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  167. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  168. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  169. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  170. package/dist/es/components/internal/PhoneInput/usePhonePrefixes.js.map +1 -1
  171. package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
  172. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  173. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  174. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  175. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  176. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  177. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  178. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  179. package/dist/es/components/internal/UIElement/utils.js +1 -1
  180. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  181. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  182. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  183. package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
  184. package/dist/es/core/Errors/SRPanelProvider.js.map +1 -1
  185. package/dist/es/core/RiskModule/RiskModule.js +1 -1
  186. package/dist/es/core/RiskModule/RiskModule.js.map +1 -1
  187. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  188. package/dist/es/core/Services/get-dataset.js.map +1 -1
  189. package/dist/es/core/Services/http.js +1 -1
  190. package/dist/es/core/Services/http.js.map +1 -1
  191. package/dist/es/core/config.js +1 -1
  192. package/dist/es/core/config.js.map +1 -1
  193. package/dist/es/core/core.js.map +1 -1
  194. package/dist/es/core/core.registry.js +1 -1
  195. package/dist/es/core/core.registry.js.map +1 -1
  196. package/dist/es/core/utils.js +1 -1
  197. package/dist/es/core/utils.js.map +1 -1
  198. package/dist/es/index.d.ts +2026 -1918
  199. package/dist/es/packages/server/translations/en-US.json.js +1 -1
  200. package/dist/es/utils/Validator/Validator.js +1 -1
  201. package/dist/es/utils/Validator/Validator.js.map +1 -1
  202. package/dist/es/utils/useForm/reducer.js +1 -1
  203. package/dist/es/utils/useForm/reducer.js.map +1 -1
  204. package/dist/es/utils/useForm/useForm.js +1 -1
  205. package/dist/es/utils/useForm/useForm.js.map +1 -1
  206. package/dist/es/utils/useForm/useFormWithA11y.js +1 -1
  207. package/dist/es/utils/useForm/useFormWithA11y.js.map +1 -1
  208. package/dist/es-legacy/adyen.css +7 -7
  209. package/dist/es-legacy/adyen.css.map +1 -1
  210. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  211. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  212. package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
  213. package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
  214. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  215. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  216. package/dist/es-legacy/components/Ach/components/AchComponent.js +1 -1
  217. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  218. package/dist/es-legacy/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
  219. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  220. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  221. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  222. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  223. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  224. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  225. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  226. package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
  227. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  228. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  229. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  230. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  231. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  232. package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
  233. package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
  234. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
  235. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  236. package/dist/es-legacy/components/Card/Card.js +1 -1
  237. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  238. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  239. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  240. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  241. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  242. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  243. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  244. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  245. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  246. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  247. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  248. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  249. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  250. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  251. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js +1 -1
  252. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  253. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  254. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  255. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  256. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  257. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  258. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  259. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  260. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  261. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  262. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  263. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  264. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  265. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  266. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  267. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  268. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  269. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  270. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  271. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  272. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
  273. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
  274. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  275. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  276. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  277. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  278. package/dist/es-legacy/components/Iris/components/IrisComponent.js +1 -1
  279. package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -1
  280. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +1 -1
  281. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  282. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  283. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  284. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  285. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  286. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  287. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  288. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  289. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  290. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  291. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  292. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  293. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  294. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  295. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  296. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  297. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  298. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  299. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  300. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  301. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  302. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js +1 -1
  303. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
  304. package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js +1 -1
  305. package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  306. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  307. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  308. package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
  309. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
  310. package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
  311. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  312. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
  313. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  314. package/dist/es-legacy/components/PayTo/components/PayToPhone.js +1 -1
  315. package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -1
  316. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  317. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  318. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js +1 -1
  319. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js.map +1 -1
  320. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  321. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  322. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  323. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  324. package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
  325. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  326. package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
  327. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  328. package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
  329. package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
  330. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  331. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  332. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  333. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  334. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  335. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  336. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  337. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  338. package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
  339. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js +1 -1
  340. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
  341. package/dist/es-legacy/components/internal/Address/components/StateField.js.map +1 -1
  342. package/dist/es-legacy/components/internal/Address/constants.js +1 -1
  343. package/dist/es-legacy/components/internal/Address/constants.js.map +1 -1
  344. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  345. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  346. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  347. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  348. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  349. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  350. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  351. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  352. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  353. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  354. package/dist/es-legacy/components/internal/DisclaimerMessage/utils.js +2 -0
  355. package/dist/es-legacy/components/internal/DisclaimerMessage/utils.js.map +1 -0
  356. package/dist/es-legacy/components/internal/FormFields/utils.js +1 -1
  357. package/dist/es-legacy/components/internal/FormFields/utils.js.map +1 -1
  358. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  359. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  360. package/dist/es-legacy/components/internal/IbanInput/validate.js +1 -1
  361. package/dist/es-legacy/components/internal/IbanInput/validate.js.map +1 -1
  362. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  363. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  364. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  365. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  366. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  367. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  368. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  369. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  370. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  371. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  372. package/dist/es-legacy/components/internal/PhoneInput/usePhonePrefixes.js.map +1 -1
  373. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  374. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  375. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  376. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  377. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  378. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  379. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  380. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  381. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  382. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  383. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  384. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  385. package/dist/es-legacy/core/Errors/AdyenCheckoutError.js.map +1 -1
  386. package/dist/es-legacy/core/Errors/SRPanelProvider.js.map +1 -1
  387. package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
  388. package/dist/es-legacy/core/RiskModule/RiskModule.js.map +1 -1
  389. package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  390. package/dist/es-legacy/core/Services/get-dataset.js.map +1 -1
  391. package/dist/es-legacy/core/Services/http.js +1 -1
  392. package/dist/es-legacy/core/Services/http.js.map +1 -1
  393. package/dist/es-legacy/core/config.js +1 -1
  394. package/dist/es-legacy/core/config.js.map +1 -1
  395. package/dist/es-legacy/core/core.js.map +1 -1
  396. package/dist/es-legacy/core/core.registry.js +1 -1
  397. package/dist/es-legacy/core/core.registry.js.map +1 -1
  398. package/dist/es-legacy/core/utils.js +1 -1
  399. package/dist/es-legacy/core/utils.js.map +1 -1
  400. package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
  401. package/dist/es-legacy/utils/Validator/Validator.js +1 -1
  402. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  403. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  404. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  405. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  406. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  407. package/dist/es-legacy/utils/useForm/useFormWithA11y.js +1 -1
  408. package/dist/es-legacy/utils/useForm/useFormWithA11y.js.map +1 -1
  409. package/package.json +11 -11
  410. package/styles/adyen.css +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardFocusData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\nimport type { Form } from '../../../../utils/useForm/types';\nimport type { SecuredFieldsProviderRef } from '../../../internal/SecuredFields/SFP/types';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData | null;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: 'components' | 'custom';\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => void;\n onAdditionalSFRemoved?: () => void;\n onAllValid?: (o: CardAllValidData) => void;\n onAutoComplete?: (o: CardAutoCompleteData) => void;\n onBinValue?: (o: CardBinValueData) => void;\n onBlur?: (e) => void;\n onBrand?: (o: CardBrandData) => void;\n onConfigSuccess?: (O: CardConfigSuccessData) => void;\n onChange: (state) => void;\n onError?: () => void;\n onFieldValid?: (o: CardFieldValidData) => void;\n onFocus?: (e) => void;\n onLoad?: (o: CardLoadData) => void;\n onSubmitAnalytics: (event: AbstractAnalyticsEvent) => void;\n handleKeyDown?: (event: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: SecuredFieldsProviderRef;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n\nexport type CardSetFormData = Form<CardInputDataState>['setData'];\nexport type CardSetFormValid = Form<CardInputDataState>['setValid'];\nexport type CardSetFormErrors = Form<CardInputDataState>['setErrors'];\n\nexport type OnFieldFocus = (who: string, e: Event | CardFocusData) => void;\n"],"names":["AddressModeOptions"],"mappings":"AA+MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardFocusData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\nimport type { Form } from '../../../../utils/useForm/types';\nimport type { SecuredFieldsProviderRef } from '../../../internal/SecuredFields/SFP/types';\nimport { AdyenCheckoutError } from '../../../../types';\nimport { ValidationRuleResult } from '../../../../utils/Validator/ValidationRuleResult';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationRuleResult;\n billingAddress?: ValidationRuleResult;\n socialSecurityNumber?: ValidationRuleResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationRuleResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData | null;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey?: string;\n configuration: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: 'components' | 'custom';\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext?: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel?: SRPanel;\n analytics?: IAnalytics;\n risk?: RiskElement;\n resources?: Resources;\n };\n onAdditionalSFConfig?: () => void;\n onAdditionalSFRemoved?: () => void;\n onAllValid?: (o: CardAllValidData) => void;\n onAutoComplete?: (o: CardAutoCompleteData) => void;\n onBinValue?: (o: CardBinValueData) => void;\n onBlur?: (e) => void;\n onBrand?: (o: CardBrandData) => void;\n onConfigSuccess?: (O: CardConfigSuccessData) => void;\n onChange: (state) => void;\n onError?: (e: AdyenCheckoutError) => void;\n onFieldValid?: (o: CardFieldValidData) => void;\n onFocus?: (e) => void;\n onLoad?: (o: CardLoadData) => void;\n onSubmitAnalytics: (event: AbstractAnalyticsEvent) => void;\n handleKeyDown?: (event: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n onSubmit?: () => void;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: SecuredFieldsProviderRef;\n setFocusOn?: (field: string) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n\nexport type CardSetFormData = Form<CardInputDataState>['setData'];\nexport type CardSetFormValid = Form<CardInputDataState>['setValid'];\nexport type CardSetFormErrors = Form<CardInputDataState>['setErrors'];\n\nexport type OnFieldFocus = (who: string, e: Event | CardFocusData) => void;\n"],"names":["AddressModeOptions"],"mappings":"AA8MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
@@ -1,2 +1,2 @@
1
- import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as i,KCP_CARD_NAME_BOTTOM as r,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as l,CREDIT_CARD as a,KCP_CARD as s,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as c}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as u}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),g=e=>["revolving","bonus"].includes(null==e?void 0:e.plan)||(null==e?void 0:e.value)>1,h=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=a;const g=e.hasHolderName&&e.holderNameRequired;if(g&&(C=e.positionHolderNameOnTop?o:n),c&&(C=s,g&&(C=e.positionHolderNameOnTop?i:r)),u&&(C=d,g&&(C=e.positionHolderNameOnTop?t:l)),m){const i=m.flat(2).filter(e=>"number"!=typeof e);let r=i;p&&(r=i.filter(e=>p.includes(e))),C=a.concat(r),g&&(C=e.positionHolderNameOnTop?o.concat(r):n.concat(r))}return C},R=(e,o,n)=>{switch(e){case"socialSecurityNumber":return o.get(`boleto.${e}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return(null==n?void 0:n[e])?o.get(null==n?void 0:n[e]):o.get(e);default:return null}},y=e=>({billingAddressRequired:e.billingAddressRequired,billingAddressRequiredFields:e.billingAddressRequiredFields,billingAddressAllowedCountries:e.billingAddressAllowedCountries,brandsConfiguration:e.brandsConfiguration,showStoreDetailsCheckbox:e.showStoreDetailsCheckbox,hasCVC:e.hasCVC,hasHolderName:e.hasHolderName,holderNameRequired:e.holderNameRequired,installmentOptions:e.installmentOptions,placeholders:e.placeholders,positionHolderNameOnTop:e.positionHolderNameOnTop,showBrandIcon:e.showBrandIcon,showContextualElement:e.showContextualElement,lastFour:e.lastFour,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear,disclaimerMessage:e.disclaimerMessage}),O=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,countryCode:e.countryCode,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,maskSecurityCode:e.maskSecurityCode,exposeExpiryDate:e.exposeExpiryDate,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onConfigSuccess:e.onConfigSuccess,handleKeyDown:e.handleKeyDown,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),b=o=>o==e.partial?c:null;function f(e){return![p.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,p.ERROR_MSG_CARD_TOO_OLD,p.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,p.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(e)}function S(e){var o;return null!==(o=u[e])&&void 0!==o?o:e}const x={"cc.cvc.920":"cc.cvc.920.amex","cc.cvc.921":"cc.cvc.921.amex"};function A(e,o){return o&&x[e]||e}const v=(e,o)=>e.map(e=>{var n,i;const r=e.id,t=m(),l="card"===r?"nocard":r,a=null!==(n=null==o||null===(i=o[r])||void 0===i?void 0:i.icon)&&void 0!==n?n:C(l,t);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:a,altName:S(r)}}),E=(e,o,n)=>o.some(o=>e.includes(o[n])),N=({installmentOptions:e,fundingSource:o,amount:n})=>!(!e||0===Object.keys(e).length)&&(!(!n||0===n.value)&&(!o||"credit"===o));export{x as CVC_AMEX_ERROR_KEYS,y as extractPropsForCardFields,O as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,h as getLayout,b as handlePartialAddressMode,f as lookupBlurBasedErrors,v as mapDualBrandButtons,R as mapFieldKey,E as requiresDualBrandSelection,A as resolveCVCErrorKey,g as shouldIncludeInstallmentsInPaymentData,N as shouldShowInstallmentsComponent};
1
+ import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as i,KCP_CARD_NAME_BOTTOM as r,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as l,CREDIT_CARD as a,KCP_CARD as s,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as c}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as u}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),h=e=>["revolving","bonus"].includes(null==e?void 0:e.plan)||(null==e?void 0:e.value)>1,g=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=a;const h=e.hasHolderName&&e.holderNameRequired;if(h&&(C=e.positionHolderNameOnTop?o:n),c&&(C=s,h&&(C=e.positionHolderNameOnTop?i:r)),u&&(C=d,h&&(C=e.positionHolderNameOnTop?t:l)),m){const i=m.flat(2).filter(e=>"number"!=typeof e);let r=i;p&&(r=i.filter(e=>p.includes(e))),C=a.concat(r),h&&(C=e.positionHolderNameOnTop?o.concat(r):n.concat(r))}return C},R=(e,o,n)=>{switch(e){case"socialSecurityNumber":return o.get(`boleto.${e}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return(null==n?void 0:n[e])?o.get(null==n?void 0:n[e]):o.get(e);default:return null}},y=e=>({billingAddressRequired:e.billingAddressRequired,billingAddressRequiredFields:e.billingAddressRequiredFields,billingAddressAllowedCountries:e.billingAddressAllowedCountries,brandsConfiguration:e.brandsConfiguration,showStoreDetailsCheckbox:e.showStoreDetailsCheckbox,hasCVC:e.hasCVC,hasHolderName:e.hasHolderName,holderNameRequired:e.holderNameRequired,installmentOptions:e.installmentOptions,placeholders:e.placeholders,positionHolderNameOnTop:e.positionHolderNameOnTop,showBrandIcon:e.showBrandIcon,showContextualElement:e.showContextualElement,lastFour:e.lastFour,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear}),O=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,countryCode:e.countryCode,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,maskSecurityCode:e.maskSecurityCode,exposeExpiryDate:e.exposeExpiryDate,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onConfigSuccess:e.onConfigSuccess,handleKeyDown:e.handleKeyDown,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),b=o=>o==e.partial?c:null;function f(e){return![p.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,p.ERROR_MSG_CARD_TOO_OLD,p.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,p.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(e)}function S(e){var o;return null!==(o=u[e])&&void 0!==o?o:e}const x={"cc.cvc.920":"cc.cvc.920.amex","cc.cvc.921":"cc.cvc.921.amex"};function A(e,o){return o&&x[e]||e}const v=(e,o)=>e.map(e=>{var n,i;const r=e.id,t=m(),l="card"===r?"nocard":r,a=null!==(n=null==o||null===(i=o[r])||void 0===i?void 0:i.icon)&&void 0!==n?n:C(l,t);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:a,altName:S(r)}}),E=(e,o,n)=>o.some(o=>e.includes(o[n])),N=({installmentOptions:e,fundingSource:o,amount:n})=>!(!e||0===Object.keys(e).length)&&(!(!n||0===n.value)&&(!o||"credit"===o));export{x as CVC_AMEX_ERROR_KEYS,y as extractPropsForCardFields,O as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,g as getLayout,b as handlePartialAddressMode,f as lookupBlurBasedErrors,v as mapDualBrandButtons,R as mapFieldKey,E as requiresDualBrandSelection,A as resolveCVCErrorKey,h as shouldIncludeInstallmentsInPaymentData,N as shouldShowInstallmentsComponent};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport type { InstallmentOptions, InstallmentsState } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement, DualBrandButtons } from '../../types';\nimport { PaymentAmount } from '../../../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * 'installments' should be added to the payload if it has plan as revolving or bonus\n * or value greater than 1.\n *\n * More about it here: COWEB-1070\n */\nexport const shouldIncludeInstallmentsInPaymentData = (installment?: InstallmentsState): boolean => {\n return ['revolving', 'bonus'].includes(installment?.plan) || installment?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number');\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs hasCVC, installmentOptions)\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps): Pick<SFPProps, 'clientKey' | 'loadingContext'> & Partial<SFPProps> => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyDown: props.handleKeyDown,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n };\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand: string): string {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\n// CVC's format guidance (digit count/position) is brand-dependent, so the Amex variant of each CVC\n// error message is a distinct, fully-translated key rather than something composed at runtime.\n// Shared between CVC.tsx (on-screen error) and SecuredFieldsProvider.mapErrorsToValidationRuleResult\n// (SR-live-panel announcement & the public state.errors.<field>.errorI18n API), so both resolve the\n// same key for the same errorCode/brand combination.\nexport const CVC_AMEX_ERROR_KEYS: Record<string, string> = {\n 'cc.cvc.920': 'cc.cvc.920.amex',\n 'cc.cvc.921': 'cc.cvc.921.amex'\n};\n\n/**\n * Resolve the correct (brand-aware) translation key for a CVC error code.\n * @param errorCode - the raw, untranslated CVC error key (e.g. 'cc.cvc.920')\n * @param isAmex - whether the current/detected card brand is Amex\n */\nexport function resolveCVCErrorKey(errorCode: string, isAmex: boolean): string {\n return (isAmex && CVC_AMEX_ERROR_KEYS[errorCode]) || errorCode;\n}\n\nexport const mapDualBrandButtons = (\n dualBrandSelectElements: DualBrandSelectElement[],\n brandsConfiguration?: CardBrandsConfiguration\n): DualBrandButtons[] => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration?.[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Checks if any of the brands requiring a selection mechanism are present in the binLookup response.\n *\n * If the result from Array.some is true - then we are in a dual branding scenario that requires selection, i.e.\n * - Show the dualBranding selector UI\n * - Preselect a card brand\n */\nexport const requiresDualBrandSelection = (\n brandsRequiringSelection: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => brandsRequiringSelection.includes(item[key]));\n\n/**\n * Determines whether the Installments component should be rendered.\n *\n * Installments Component is displayed when:\n * - installmentOptions is provided and not empty\n * - amount is provided and not zero\n * - fundingSource is not provided or is 'credit'\n *\n * @param params.installmentOptions - The installment configuration options\n * @param params.fundingSource - The card funding source (e.g. 'credit', 'debit')\n * @param params.amount - The payment amount\n * @returns Whether the Installments component should be rendered\n */\nexport const shouldShowInstallmentsComponent = ({\n installmentOptions,\n fundingSource,\n amount\n}: {\n installmentOptions?: InstallmentOptions;\n fundingSource?: string;\n amount?: PaymentAmount;\n}): boolean => {\n if (!installmentOptions || Object.keys(installmentOptions).length === 0) return false;\n if (!amount || amount.value === 0) return false;\n if (fundingSource && fundingSource !== 'credit') return false;\n\n return true;\n};\n"],"names":["getCardImageUrl","brand","getImage","type","extension","shouldIncludeInstallmentsInPaymentData","installment","includes","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyDown","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","CVC_AMEX_ERROR_KEYS","resolveCVCErrorKey","isAmex","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","_ref","name","brandObject","localeBrand","altName","requiresDualBrandSelection","brandsRequiringSelection","returnedDualBrandingObjects","some","shouldShowInstallmentsComponent","fundingSource","amount","Object","keys","length"],"mappings":"ojBAuBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA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AAA,EAAP,OAAqC,QAA9BA,EAAAA,EAAwB7F,cAAxB6F,EAAAA,EAAkC7F,CAC7C,OAOa8F,EAA8C,CACvD,aAAc,kBACd,aAAc,mBAQX,SAASC,EAAmBT,EAAmBU,GAClD,OAAOA,GAAWF,EAAoBR,IAAeA,CACzD,CAEO,MAAMW,EAAsB,CAC/BC,EACAvD,IAEOuD,EAAwBC,IAAIpE,UAIdY,EAHjB,MAAM3C,EAAQ+B,EAAKqE,GACbnG,EAAWoG,IACXC,EAAsB,SAAVtG,EAAmB,SAAWA,EAC1CuG,EAA6C,QAA7CA,EAAW5D,SAA4B,QAA5BA,EAAAA,EAAsB3C,UAAtB2C,IAAAA,SAAAA,EAA8B6D,YAAI,IAAAC,EAAAA,EAAI1G,EAAgBuG,EAAWrG,GAIlF,MAAO,CACHmG,GAAIrE,EAAKqE,GACTM,KAAM3E,EAAK4E,YAAYC,aAAe7E,EAAK4E,YAAY3G,MACvDuG,WACAM,QAASjB,EAAiB5F,MAYzB8G,EAA6B,CACtCC,EACAC,EACA5E,IACC4E,EAA4BC,KAAKlF,GAAQgF,EAAyBzG,SAASyB,EAAKK,KAexE8E,EAAkC,EAC3CpE,qBACAqE,gBACAC,eAMKtE,GAAiE,IAA3CuE,OAAOC,KAAKxE,GAAoByE,aACtDH,GAA2B,IAAjBA,EAAO5G,UAClB2G,GAAmC,WAAlBA"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport type { InstallmentOptions, InstallmentsState } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement, DualBrandButtons } from '../../types';\nimport { PaymentAmount } from '../../../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * 'installments' should be added to the payload if it has plan as revolving or bonus\n * or value greater than 1.\n *\n * More about it here: COWEB-1070\n */\nexport const shouldIncludeInstallmentsInPaymentData = (installment?: InstallmentsState): boolean => {\n return ['revolving', 'bonus'].includes(installment?.plan) || installment?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number');\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs hasCVC, installmentOptions)\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps): Pick<SFPProps, 'clientKey' | 'loadingContext'> & Partial<SFPProps> => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyDown: props.handleKeyDown,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n };\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand: string): string {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\n// CVC's format guidance (digit count/position) is brand-dependent, so the Amex variant of each CVC\n// error message is a distinct, fully-translated key rather than something composed at runtime.\n// Shared between CVC.tsx (on-screen error) and SecuredFieldsProvider.mapErrorsToValidationRuleResult\n// (SR-live-panel announcement & the public state.errors.<field>.errorI18n API), so both resolve the\n// same key for the same errorCode/brand combination.\nexport const CVC_AMEX_ERROR_KEYS: Record<string, string> = {\n 'cc.cvc.920': 'cc.cvc.920.amex',\n 'cc.cvc.921': 'cc.cvc.921.amex'\n};\n\n/**\n * Resolve the correct (brand-aware) translation key for a CVC error code.\n * @param errorCode - the raw, untranslated CVC error key (e.g. 'cc.cvc.920')\n * @param isAmex - whether the current/detected card brand is Amex\n */\nexport function resolveCVCErrorKey(errorCode: string, isAmex: boolean): string {\n return (isAmex && CVC_AMEX_ERROR_KEYS[errorCode]) || errorCode;\n}\n\nexport const mapDualBrandButtons = (\n dualBrandSelectElements: DualBrandSelectElement[],\n brandsConfiguration?: CardBrandsConfiguration\n): DualBrandButtons[] => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration?.[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Checks if any of the brands requiring a selection mechanism are present in the binLookup response.\n *\n * If the result from Array.some is true - then we are in a dual branding scenario that requires selection, i.e.\n * - Show the dualBranding selector UI\n * - Preselect a card brand\n */\nexport const requiresDualBrandSelection = (\n brandsRequiringSelection: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => brandsRequiringSelection.includes(item[key]));\n\n/**\n * Determines whether the Installments component should be rendered.\n *\n * Installments Component is displayed when:\n * - installmentOptions is provided and not empty\n * - amount is provided and not zero\n * - fundingSource is not provided or is 'credit'\n *\n * @param params.installmentOptions - The installment configuration options\n * @param params.fundingSource - The card funding source (e.g. 'credit', 'debit')\n * @param params.amount - The payment amount\n * @returns Whether the Installments component should be rendered\n */\nexport const shouldShowInstallmentsComponent = ({\n installmentOptions,\n fundingSource,\n amount\n}: {\n installmentOptions?: InstallmentOptions;\n fundingSource?: string;\n amount?: PaymentAmount;\n}): boolean => {\n if (!installmentOptions || Object.keys(installmentOptions).length === 0) return false;\n if (!amount || amount.value === 0) return false;\n if (fundingSource && fundingSource !== 'credit') return false;\n\n return true;\n};\n"],"names":["getCardImageUrl","brand","getImage","type","extension","shouldIncludeInstallmentsInPaymentData","installment","includes","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyDown","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","CVC_AMEX_ERROR_KEYS","resolveCVCErrorKey","isAmex","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","_ref","name","brandObject","localeBrand","altName","requiresDualBrandSelection","brandsRequiringSelection","returnedDualBrandingObjects","some","shouldShowInstallmentsComponent","fundingSource","amount","Object","keys","length"],"mappings":"ojBAuBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GASrBI,EAA0CC,GAC5C,CAAC,YAAa,SAASC,SAASD,aAAAA,EAAAA,EAAaE,QAASF,eAAAA,EAAaG,OAAQ,EAGzEC,EAAY,EACrBC,QACAC,UACAC,mBACAC,yBAAyB,KACzBC,+BAA+B,SAE/B,IAAIC,EAASC,EACb,MAAMC,EAAwBP,EAAMQ,eAAiBR,EAAMS,mBAqB3D,GAnBIF,IACAF,EAASL,EAAMU,wBAA0BC,EAAuBC,GAGhEX,IACAI,EAASQ,EACLN,IACAF,EAASL,EAAMU,wBAA0BI,EAAoBC,IAIjEb,IACAG,EAASW,EACLT,IACAF,EAASL,EAAMU,wBAA0BO,EAAoBC,IAKjEf,EAAwB,CAExB,MAAMgB,EAAuChB,EAAuB,KAAQ,GAAGiB,OAAOC,GAAwB,iBAATA,GAErG,IAAIC,EAA4BH,EAE5Bf,IAEAkB,EAA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B,EAAiB3F,MAYzB6G,EAA6B,CACtCC,EACAC,EACA3E,IACC2E,EAA4BC,KAAKjF,GAAQ+E,EAAyBxG,SAASyB,EAAKK,KAexE6E,EAAkC,EAC3CnE,qBACAoE,gBACAC,eAMKrE,GAAiE,IAA3CsE,OAAOC,KAAKvE,GAAoBwE,aACtDH,GAA2B,IAAjBA,EAAO3G,UAClB0G,GAAmC,WAAlBA"}
@@ -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{CashAppComponent as r}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as s}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import{payAmountLabel as a}from"../internal/PayButton/utils.js";import{TxVariants as p}from"../tx-variants.js";import{PREFIX as h}from"../internal/Icon/constants.js";function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(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){c(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 u extends e{formatProps(t){var e,r;return l(d({},t),{enableStoreDetails:(null===(r=t.session)||void 0===r||null===(e=r.configuration)||void 0===e?void 0:e.enableStoreDetails)||t.enableStoreDetails})}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:r,cashTag:o,customerId:s}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:u.type,storedPaymentMethodId:i}};return d({paymentMethod:d({type:u.type},e&&{grantId:e},s&&{customerId:s},r&&o&&{onFileGrantId:r,cashtag:o})},a&&{storePaymentMethod:n||t})}get displayName(){return this.props.storedPaymentMethodId&&this.props.cashtag?this.props.cashtag:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?"Cash App Pay":""}get isValid(){return!0}componentToRender(){var e;return this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,label:a(this.props.i18n,this.props.amount),icon:null===(e=this.resources)||void 0===e?void 0:e.getImage({imageFolder:"components/"})(`${h}lock`),name:this.displayName,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(r,{setComponentRef:this.setComponentRef,enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize})}constructor(t,e){var r,n;if(super(t,e),c(this,"cashAppService",void 0),c(this,"submit",()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let r=!1;new Promise((e,r)=>t({resolve:e,reject:r})).catch(()=>{throw r=!0,new Error("onClick rejected")}).then(()=>this.cashAppService.createCustomerRequest(this.props.amount)).then(()=>{this.cashAppService.begin()}).catch(t=>{r||this.handleError(t)})}),c(this,"handleOnChangeStoreDetails",t=>{const e=l(d({},this.state.data),{shopperWantsToStore:t});this.setState({data:e})}),c(this,"handleAuthorize",t=>{const e=d({},this.state.data,t);this.setState({data:e,valid:{},errors:{},isValid:!0}),super.submit()}),this.props.enableStoreDetails&&this.props.storePaymentMethod&&console.warn("CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior."),this.props.storedPaymentMethodId)return;const i=new s({environment:this.props.environment,analytics:this.analytics});this.cashAppService=new o(i,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,redirectURL:this.props.redirectURL,clientId:null===(r=this.props.configuration)||void 0===r?void 0:r.clientId,scopeId:null===(n=this.props.configuration)||void 0===n?void 0:n.scopeId,button:this.props.button,referenceId:this.props.referenceId})}}c(u,"type",p.cashapp),c(u,"defaultProps",n);export{u as CashAppPay,u as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CashAppComponent as r}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as s}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import{payAmountLabel as a}from"../internal/PayButton/utils.js";import{TxVariants as p}from"../tx-variants.js";import{PREFIX as h}from"../internal/Icon/constants.js";function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(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){c(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{formatProps(t){var e,r;return l(d({},t),{enableStoreDetails:(null===(r=t.session)||void 0===r||null===(e=r.configuration)||void 0===e?void 0:e.enableStoreDetails)||t.enableStoreDetails})}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:r,cashTag:o,customerId:s}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:m.type,storedPaymentMethodId:i}};return d({paymentMethod:d({type:m.type},e&&{grantId:e},s&&{customerId:s},r&&o&&{onFileGrantId:r,cashtag:o})},a&&{storePaymentMethod:n||t})}get displayName(){return this.props.storedPaymentMethodId&&this.props.cashtag?this.props.cashtag:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?"Cash App Pay":""}get isValid(){return!0}componentToRender(){var e;return this.props.storedPaymentMethodId?t(i,{label:a(this.props.i18n,this.props.amount),icon:null===(e=this.resources)||void 0===e?void 0:e.getImage({imageFolder:"components/"})(`${h}lock`),name:this.displayName,payButton:this.payButton,onSubmit:this.submit,setComponentRef:this.setComponentRef}):t(r,{setComponentRef:this.setComponentRef,enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize})}constructor(t,e){var r,n;if(super(t,e),c(this,"cashAppService",void 0),c(this,"submit",()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let r=!1;new Promise((e,r)=>t({resolve:e,reject:r})).catch(()=>{throw r=!0,new Error("onClick rejected")}).then(()=>this.cashAppService.createCustomerRequest(this.props.amount)).then(()=>{this.cashAppService.begin()}).catch(t=>{r||this.handleError(t)})}),c(this,"handleOnChangeStoreDetails",t=>{const e=l(d({},this.state.data),{shopperWantsToStore:t});this.setState({data:e})}),c(this,"handleAuthorize",t=>{const e=d({},this.state.data,t);this.setState({data:e,valid:{},errors:{},isValid:!0}),super.submit()}),this.props.enableStoreDetails&&this.props.storePaymentMethod&&console.warn("CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior."),this.props.storedPaymentMethodId)return;const i=new s({environment:this.props.environment,analytics:this.analytics});this.cashAppService=new o(i,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,redirectURL:this.props.redirectURL,clientId:null===(r=this.props.configuration)||void 0===r?void 0:r.clientId,scopeId:null===(n=this.props.configuration)||void 0===n?void 0:n.scopeId,button:this.props.button,referenceId:this.props.referenceId})}}c(m,"type",p.cashapp),c(m,"defaultProps",n);export{m as CashAppPay,m as default};
2
2
  //# sourceMappingURL=CashAppPay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static readonly type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static readonly defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n const sdkLoader = new CashAppSdkLoader({\n environment: this.props.environment,\n analytics: this.analytics\n });\n\n this.cashAppService = new CashAppService(sdkLoader, {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw new Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest(this.props.amount);\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private readonly handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private readonly handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n setComponentRef={this.setComponentRef}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","_object_spread_props","_object_spread","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","_this_resources","h","RedirectButton","showPayButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","setComponentRef","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","_this_props_configuration","_this_props_configuration1","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","sdkLoader","CashAppSdkLoader","environment","analytics","CashAppService","useCashAppButtonUi","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"k2CAcO,MAAMA,UAAmBC,EAqCrBC,WAAAA,CAAYC,OAGSA,EAAAA,EAFxB,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,4BAAoBH,EAAAA,EAAMI,eAANJ,IAAAA,WAAAA,EAAAA,EAAeK,qBAAfL,IAAAA,SAAAA,EAA8BG,qBAAsBH,EAAMG,oBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAeC,KAAKC,MAAMC,MAAQ,CAAA,GACxFC,mBAAoBC,EAA+BC,sBAAEA,GAA0BL,KAAKZ,MAKtFkB,EAA4BN,KAAKZ,MAAMG,qBAAwBS,KAAKZ,MAAMI,SAAWY,EAE3F,GAAIC,EACA,MAAO,CACHE,cAAe,CACXC,KAAMvB,EAAWuB,KACjBH,0BAOZ,OAAOf,EAAA,CACHiB,cAAejB,EAAA,CACXkB,KAAMvB,EAAWuB,MACbZ,GAAW,CAAEA,WACbG,GAAc,CAAEA,cANMF,GAAiBC,GAOV,CAAED,gBAAeY,QAASX,KAE3DQ,GAA6B,CAAEH,mBAAoBC,GAAmCT,GAElG,CAEA,eAAIe,GACA,OAAIV,KAAKZ,MAAMiB,uBAAyBL,KAAKZ,MAAMqB,QACxCT,KAAKZ,MAAMqB,QAEfT,KAAKZ,MAAMuB,IACtB,CAEA,kBAAIC,GACA,OAAOZ,KAAKZ,MAAMiB,sBAAwB,eAAiB,EAC/D,CAgCA,WAAWQ,GACP,OAAO,CACX,CAamBC,iBAAAA,GAKD,IAAAC,EAJd,OAAOf,KAAKZ,MAAMiB,sBACdW,EAACC,EAAAA,CACGC,cAAelB,KAAKZ,MAAM8B,cAC1BC,MAAOC,EAAepB,KAAKZ,MAAMiC,KAAMrB,KAAKZ,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AS,CAAE1D,OAAM4D,MAAO,CAAA,EAAIC,OAAQ,CAAA,EAAIlD,SAAS,IACtDkC,MAAMjB,WAtHF9B,KAAKZ,MAAMG,oBAAsBS,KAAKZ,MAAMe,oBAC5C6D,QAAQC,KACJ,oJAIJjE,KAAKZ,MAAMiB,sBACX,OAGJ,MAAM6D,EAAY,IAAIC,EAAiB,CACnCC,YAAapE,KAAKZ,MAAMgF,YACxBC,UAAWrE,KAAKqE,YAGpBrE,KAAKmC,eAAiB,IAAImC,EAAeJ,EAAW,CAChD/D,mBAAoBH,KAAKZ,MAAMe,mBAC/BoE,mBAAoBvE,KAAKZ,MAAM8B,cAC/BkD,YAAapE,KAAKZ,MAAMgF,YACxBI,YAAaxE,KAAKZ,MAAMoF,YACxBC,SAAkC,QAAxB5B,EAAA7C,KAAKZ,MAAMK,qBAAX,IAAAoD,OAAA,EAAAA,EAA0B4B,SACpCC,QAAiC,QAAxB5B,EAAA9C,KAAKZ,MAAMK,qBAAX,IAAAqD,OAAA,EAAAA,EAA0B4B,QACnCC,OAAQ3E,KAAKZ,MAAMuF,OACnBC,YAAa5E,KAAKZ,MAAMwF,aAEhC,EAlCA5B,EADS/D,EACcuB,OAAOqE,EAAWC,SAIzC9B,EALS/D,EAKiB8F,eAAeA"}
1
+ {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static readonly type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static readonly defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n const sdkLoader = new CashAppSdkLoader({\n environment: this.props.environment,\n analytics: this.analytics\n });\n\n this.cashAppService = new CashAppService(sdkLoader, {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw new Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest(this.props.amount);\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private readonly handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private readonly handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n payButton={this.payButton}\n onSubmit={this.submit}\n setComponentRef={this.setComponentRef}\n />\n ) : (\n <CashAppComponent\n setComponentRef={this.setComponentRef}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","_object_spread_props","_object_spread","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","_this_resources","h","RedirectButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","setComponentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","_this_props_configuration","_this_props_configuration1","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","sdkLoader","CashAppSdkLoader","environment","analytics","CashAppService","useCashAppButtonUi","showPayButton","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"k2CAcO,MAAMA,UAAmBC,EAqCrBC,WAAAA,CAAYC,OAGSA,EAAAA,EAFxB,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,4BAAoBH,EAAAA,EAAMI,eAANJ,IAAAA,WAAAA,EAAAA,EAAeK,qBAAfL,IAAAA,SAAAA,EAA8BG,qBAAsBH,EAAMG,oBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAeC,KAAKC,MAAMC,MAAQ,CAAA,GACxFC,mBAAoBC,EAA+BC,sBAAEA,GAA0BL,KAAKZ,MAKtFkB,EAA4BN,KAAKZ,MAAMG,qBAAwBS,KAAKZ,MAAMI,SAAWY,EAE3F,GAAIC,EACA,MAAO,CACHE,cAAe,CACXC,KAAMvB,EAAWuB,KACjBH,0BAOZ,OAAOf,EAAA,CACHiB,cAAejB,EAAA,CACXkB,KAAMvB,EAAWuB,MACbZ,GAAW,CAAEA,WACbG,GAAc,CAAEA,cANMF,GA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version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../Card/constants';\n\nconst SELECTABLE_DUAL_BRANDED_SCENARIO = 'Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism';\nconst DISPLAY_ONLY_DUAL_BRANDED_SCENARIO = 'Dual Branded (Display-only): No selection mechanism required';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static readonly type = TxVariants.customCard;\n\n protected static readonly defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CardBinLookupData) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n\n // Check for dual branded scenario and, if so, discern which type\n let isDualBrandedScenario = false;\n let isSelectableDualBrandedScenario = false;\n\n if (obj.supportedBrandsRaw?.length > 1) {\n isDualBrandedScenario = true;\n isSelectableDualBrandedScenario = obj.detectedBrands.some(item =>\n (DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as readonly string[]).includes(item)\n );\n }\n\n // Set the dual branding type\n nuObj.dualBrandingType = null;\n\n if (isDualBrandedScenario) {\n nuObj.dualBrandingType = isSelectableDualBrandedScenario ? SELECTABLE_DUAL_BRANDED_SCENARIO : DISPLAY_ONLY_DUAL_BRANDED_SCENARIO;\n }\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyDown={this.handleKeyDown}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","_object_spread_props","_object_spread","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","_this_componentRef","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","_this_props_brandsConfiguration_item_brand","brandImageUrl","brandsConfiguration","icon","_ref","getCardImageUrl","resources","isDualBrandedScenario","isSelectableDualBrandedScenario","length","detectedBrands","some","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","includes","dualBrandingType","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyDown","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","_this_props_onFocus","_this_props","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","call","onEnterKeyPressed","activeElement","_this_props_onEnterKeyPressed","defaultProps"],"mappings":"+6CAgBO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,KAAMC,EAAWC,YAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAeT,EAAA,CACXC,KAAM,UACHK,KAAKC,M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,GAAAb,EAAAlE,KAAKR,OAAMqF,yBAAX,IAAAE,GAAAA,EAAAH,KAAAV,EAA+BY,EAAeT,MAlHlDP,EADSzE,EACcM,OAAOC,EAAWC,YAEzCiE,EAHSzE,EAGiB2F,eAAe,CACrC1D,YAAa,OACbW,oBAAqB,CAAA"}
1
+ {"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../Card/constants';\nimport type { CustomCardInputRef } from './CustomCardInput';\n\nconst SELECTABLE_DUAL_BRANDED_SCENARIO = 'Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism';\nconst DISPLAY_ONLY_DUAL_BRANDED_SCENARIO = 'Dual Branded (Display-only): No selection mechanism required';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static readonly type = TxVariants.customCard;\n\n declare protected componentRef: CustomCardInputRef | undefined;\n\n protected static readonly defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private readonly brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n const securedFieldsData = this.state.data as Record<string, string>;\n return {\n paymentMethod: {\n type: 'scheme',\n ...securedFieldsData,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CardBinLookupData) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n\n // Check for dual branded scenario and, if so, discern which type\n let isDualBrandedScenario = false;\n let isSelectableDualBrandedScenario = false;\n\n if (obj.supportedBrandsRaw?.length > 1) {\n isDualBrandedScenario = true;\n isSelectableDualBrandedScenario = obj.detectedBrands.some(item =>\n (DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as readonly string[]).includes(item)\n );\n }\n\n // Set the dual branding type\n nuObj.dualBrandingType = null;\n\n if (isDualBrandedScenario) {\n nuObj.dualBrandingType = isSelectableDualBrandedScenario ? SELECTABLE_DUAL_BRANDED_SCENARIO : DISPLAY_ONLY_DUAL_BRANDED_SCENARIO;\n }\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private readonly onFocus = (obj: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyDown={this.handleKeyDown}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","_object_spread_props","_object_spread","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","_this_componentRef","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","_this_props_brandsConfiguration_item_brand","brandImageUrl","brandsConfiguration","icon","_ref","getCardImageUrl","resources","isDualBrandedScenario","isSelectableDualBrandedScenario","length","detectedBrands","some","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","includes","dualBrandingType","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyDown","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","_this_props_onFocus","_this_props","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldT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AAWrE,KAAKL,KAChBA,MAAoB,IAAd4B,EAAI+C,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqBnD,EAAIoD,aAGrC3E,KAAK2D,gBAAgBQ,GAGH,QAAlBF,GAAAC,EAAAlE,KAAKR,OAAMiE,eAAX,IAAAQ,GAAAA,EAAAW,KAAAV,EAAqB3C,KAGzBuC,EAAA9D,KAAU6E,oBAAoB,CAACC,EAAwBT,SACnDU,EAAAb,EAA4B,QAA5Ba,GAAAb,EAAAlE,KAAKR,OAAMqF,yBAAX,IAAAE,GAAAA,EAAAH,KAAAV,EAA+BY,EAAeT,MArHlDP,EADSzE,EACcM,OAAOC,EAAWC,YAIzCiE,EALSzE,EAKiB2F,eAAe,CACrC1D,YAAa,OACbW,oBAAqB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCardInput.js","sources":["../../../../../src/components/CustomCard/CustomCardInput/CustomCardInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef, useMemo } from 'preact/hooks';\nimport Language from '../../../language/Language';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { SFPState } from '../../internal/SecuredFields/SFP/types';\nimport { BinLookupResponse, CardBrandsConfiguration, CardPlaceholders } from '../../Card/types';\nimport SFExtensions from '../../internal/SecuredFields/binLookup/extensions';\nimport { StylesObject } from '../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../core/Context/Resources';\nimport { SFError } from '../../Card/components/CardInput/types';\nimport { ValidationError } from '../types';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\n\ninterface SecuredFieldsProps {\n autoFocus?: boolean;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n clientKey: string;\n countryCode?: string;\n forceCompat?: boolean;\n i18n: Language;\n implementationType?: 'components' | 'custom';\n keypadFix?: boolean;\n loadingContext?: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: () => {};\n onAutoComplete?: () => {};\n onBinValue?: () => {};\n onBrand?: () => {};\n onConfigSuccess?: () => {};\n onChange: (data) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyDown?: (event: KeyboardEvent) => void;\n onError?: () => {};\n onFieldValid?: () => {};\n onFocus?: (e) => {};\n onLoad?: () => {};\n placeholders?: CardPlaceholders;\n rootNode: HTMLElement;\n resources: Resources;\n showWarnings?: boolean;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n}\n\nconst defaultProps = {\n onChange: () => {},\n onError: () => {},\n onValidationError: () => {}\n};\n\nfunction CustomCardInput(props: Readonly<SecuredFieldsProps>) {\n const sfp = useRef(null);\n\n const [errors, setErrors] = useState({});\n const [valid, setValid] = useState({});\n const [data, setData] = useState({});\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n\n const [issuingCountryCode, setIssuingCountryCode] = useState(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState('');\n\n const handleSecuredFieldsChange = (sfState: SFPState): void => {\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n SFExtensions(\n props,\n { sfp },\n { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode }\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPECTED METHODS ON SecuredFields.this\n */\n this.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n this.dualBrandingChangeHandler = extensions.handleDualBrandSelection;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n this.showValidation = sfp.current.showValidation;\n this.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n\n const mappedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors\n\n props.onChange({\n data,\n valid,\n errors: mappedErrors,\n isValid: isSfpValid,\n selectedBrandValue\n });\n\n // Create an array of Validation error objects and send to callback\n if (Object.keys(mappedErrors).length) {\n const validationErrors: ValidationError[] = Object.entries(mappedErrors).map(([fieldType, error]) => {\n const valErr: ValidationError = {\n fieldType,\n ...(error ? (error as SFError) : { error: '', rootNode: this.props.rootNode })\n };\n return valErr;\n });\n this.props.onValidationError?.(validationErrors);\n }\n }, [data, valid, errors, selectedBrandValue]);\n\n /**\n * RENDER\n */\n // prettier-ignore\n return (\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n type={props.brand}\n componentType={props.type}\n onChange={handleSecuredFieldsChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n exposeExpiryDate={false}\n disableIOSArrowKeys={null}\n render={() => null}\n />\n );\n}\n\nCustomCardInput.defaultProps = defaultProps;\n\nexport default CustomCardInput;\n\nconst extractPropsForSFP = (props: SecuredFieldsProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onBrand: props.onBrand,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyDown: props.handleKeyDown,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n rootNode: props.rootNode,\n showWarnings: props.showWarnings,\n styles: props.styles,\n trimTrailingSeparator: props.trimTrailingSeparator,\n resources: props.resources,\n maskSecurityCode: props.maskSecurityCode,\n placeholders: props.placeholders\n };\n};\n"],"names":["CustomCardInput","props","sfp","useRef","errors","setErrors","useState","valid","setValid","data","setData","isSfpValid","setIsSfpValid","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","extensions","useMemo","SFExtensions","this","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","dualBrandingChangeHandler","handleDualBrandSelection","useEffect","setFocusOn","current","updateStyles","showValidation","handleUnsupportedCard","destroy","sfStateErrorsObj","mapErrorsToValidationRuleResult","mappedErrors","_object_spread","onChange","isValid","Object","keys","length","_this_props_onValidationError","_this_props","validationErrors","entries","map","fieldType","error","rootNode","onValidationError","call","h","SecuredFieldsProvider","ref","extractPropsForSFP","type","brand","componentType","sfState","onSubmitAnalytics","exposeExpiryDate","disableIOSArrowKeys","render","defaultProps","onError","autoFocus","brands","brandsConfiguration","clientKey","forceCompat","i18n","implementationType","keypadFix","legacyInputMode","loadingContext","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onBrand","onConfigSuccess","handleKeyDown","onFieldValid","onFocus","onLoad","showWarnings","styles","trimTrailingSeparator","resources","maskSecurityCode","placeholders"],"mappings":"8mCAyDA,SAASA,EAAgBC,GACrB,MAAMC,EAAMC,EAAO,OAEZC,EAAQC,GAAaC,EAAS,CAAA,IAC9BC,EAAOC,GAAYF,EAAS,CAAA,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,KACrBnB,SAnF2BsB,IAC/BpD,EAAQ6B,EAAA,CAAA,EAAK9B,EAASqD,EAAQrD,OAC9BJ,EAAUkC,EAAA,CAAA,EAAKnC,EAAW0D,EAAQ1D,SAClCI,EAAS+B,EAAA,CAAA,EAAKhC,EAAUuD,EAAQvD,QAEhCK,EAAckD,EAAQnD,aA+ElBoD,kBAAmB9D,EAAM8D,kBACzBC,kBAAkB,EAClBC,oBAAqB,KACrBC,OAAQ,IAAM,OAG1B,CAEAlE,EAAgBmE,aAhHK,CACjB3B,SAAU,OACV4B,QAAS,OACTf,kBAAmB,QAiHvB,MAAMK,EAAsBzD,IACjB,CACHoE,UAAWpE,EAAMoE,UACjBC,OAAQrE,EAAMqE,OACdC,oBAAqBtE,EAAMsE,oBAC3BC,UAAWvE,EAAMuE,UACjBC,YAAaxE,EAAMwE,YACnBC,KAAMzE,EAAMyE,KACZC,mBAAoB1E,EAAM0E,mBAC1BC,UAAW3E,EAAM2E,UACjBC,gBAAiB5E,EAAM4E,gBACvBC,eAAgB7E,EAAM6E,eACtBC,kBAAmB9E,EAAM8E,kBACzBC,qBAAsB/E,EAAM+E,qBAC5BC,sBAAuBhF,EAAMgF,sBAC7BC,WAAYjF,EAAMiF,WAClBC,eAAgBlF,EAAMkF,eACtBC,WAAYnF,EAAMmF,WAClBC,QAASpF,EAAMoF,QACfC,gBAAiBrF,EAAMqF,gBACvBC,cAAetF,EAAMsF,cACrBnB,QAASnE,EAAMmE,QACfoB,aAAcvF,EAAMuF,aACpBC,QAASxF,EAAMwF,QACfC,OAAQzF,EAAMyF,OACdtC,SAAUnD,EAAMmD,SAChBuC,aAAc1F,EAAM0F,aACpBC,OAAQ3F,EAAM2F,OACdC,sBAAuB5F,EAAM4F,sBAC7BC,UAAW7F,EAAM6F,UACjBC,iBAAkB9F,EAAM8F,iBACxBC,aAAc/F,EAAM+F"}
1
+ {"version":3,"file":"CustomCardInput.js","sources":["../../../../../src/components/CustomCard/CustomCardInput/CustomCardInput.tsx"],"sourcesContent":["import { h, Ref } from 'preact';\nimport { useState, useEffect, useRef, useMemo } from 'preact/hooks';\nimport Language from '../../../language/Language';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { SFPState } from '../../internal/SecuredFields/SFP/types';\nimport { BinLookupResponse, CardBrandsConfiguration, CardPlaceholders } from '../../Card/types';\nimport SFExtensions from '../../internal/SecuredFields/binLookup/extensions';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardFocusData,\n CardLoadData,\n CardErrorData,\n SFFieldType,\n StylesObject\n} from '../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../core/Context/Resources';\nimport { SFError } from '../../Card/components/CardInput/types';\nimport { ValidationError } from '../types';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport type AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport type UIElement from '../../internal/UIElement';\nimport type { ComponentMethodsRef } from '../../internal/UIElement/types';\n\n/**\n * Methods that CustomCardInput exposes to the CustomCard element through the ref\n */\nexport interface CustomCardInputRef extends ComponentMethodsRef {\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset?: boolean): void;\n dualBrandingChangeHandler(event: Event | string): void;\n setFocusOn(frame: SFFieldType): void;\n updateStyles(stylesObj: StylesObject): void;\n handleUnsupportedCard(errObj: CardErrorData): boolean;\n}\n\ninterface SecuredFieldsProps {\n autoFocus?: boolean;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n clientKey?: string;\n countryCode?: string;\n forceCompat?: boolean;\n i18n?: Language;\n implementationType?: 'components' | 'custom';\n keypadFix?: boolean;\n loadingContext?: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n onAdditionalSFConfig?: () => void;\n onAdditionalSFRemoved?: () => void;\n onAllValid?: (data: CardAllValidData) => void;\n onAutoComplete?: (data: CardAutoCompleteData) => void;\n onBinValue?: (data: CardBinValueData) => void;\n onBrand?: (data: CardBrandData) => void;\n onConfigSuccess?: (data: CardConfigSuccessData) => void;\n onChange?: (data) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyDown?: (event: KeyboardEvent) => void;\n onError?: (error: AdyenCheckoutError, component?: UIElement) => void;\n onFieldValid?: (data: CardFieldValidData) => void;\n onFocus?: (data: CardFocusData) => void;\n onLoad?: (data: CardLoadData) => void;\n placeholders?: CardPlaceholders;\n rootNode?: HTMLElement;\n resources?: Resources;\n showWarnings?: boolean;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type?: string;\n maskSecurityCode?: boolean;\n ref?: Ref<CustomCardInputRef>;\n}\n\nconst defaultProps = {\n onChange: () => {},\n onError: () => {},\n onValidationError: () => {}\n};\n\nfunction CustomCardInput(props: Readonly<SecuredFieldsProps>) {\n const sfp = useRef(null);\n\n const [errors, setErrors] = useState({});\n const [valid, setValid] = useState({});\n const [data, setData] = useState({});\n\n const [isSfpValid, setIsSfpValid] = useState(false);\n\n const [issuingCountryCode, setIssuingCountryCode] = useState(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState('');\n\n const handleSecuredFieldsChange = (sfState: SFPState): void => {\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n SFExtensions(\n props,\n { sfp },\n { dualBrandSelectElements, setDualBrandSelectElements, setSelectedBrandValue, issuingCountryCode, setIssuingCountryCode }\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPECTED METHODS ON SecuredFields.this\n */\n this.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n this.dualBrandingChangeHandler = extensions.handleDualBrandSelection;\n\n useEffect(() => {\n this.setFocusOn = sfp.current.setFocusOn;\n this.updateStyles = sfp.current.updateStyles;\n this.showValidation = sfp.current.showValidation;\n this.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n useEffect(() => {\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n\n const mappedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors\n\n props.onChange({\n data,\n valid,\n errors: mappedErrors,\n isValid: isSfpValid,\n selectedBrandValue\n });\n\n // Create an array of Validation error objects and send to callback\n if (Object.keys(mappedErrors).length) {\n const validationErrors: ValidationError[] = Object.entries(mappedErrors).map(([fieldType, error]) => {\n const valErr: ValidationError = {\n fieldType,\n ...(error ? (error as SFError) : { error: '', rootNode: this.props.rootNode })\n };\n return valErr;\n });\n this.props.onValidationError?.(validationErrors);\n }\n }, [data, valid, errors, selectedBrandValue]);\n\n return (\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n type={props.brand}\n componentType={props.type}\n onChange={handleSecuredFieldsChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n exposeExpiryDate={false}\n disableIOSArrowKeys={null}\n render={() => null}\n />\n );\n}\n\nCustomCardInput.defaultProps = defaultProps;\n\nexport default CustomCardInput;\n\nconst extractPropsForSFP = (props: SecuredFieldsProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onBrand: props.onBrand,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyDown: props.handleKeyDown,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onFocus: props.onFocus,\n onLoad: props.onLoad,\n rootNode: props.rootNode,\n showWarnings: props.showWarnings,\n styles: props.styles,\n trimTrailingSeparator: props.trimTrailingSeparator,\n resources: props.resources,\n maskSecurityCode: props.maskSecurityCode,\n placeholders: props.placeholders\n };\n};\n"],"names":["CustomCardInput","props","sfp","useRef","errors","setErrors","useState","valid","setValid","data","setData","isSfpValid","setIsSfpValid","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","extensions","useMemo","SFExtensions","this","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","dualBrandingChangeHandler","handleDualBrandSelection","useEffect","setFocusOn","current","updateStyles","showValidation","handleUnsupportedCard","destroy","sfStateErrorsObj","mapErrorsToValidationRuleResult","mappedErrors","_object_spread","onChange","isValid","Object","keys","length","_this_props_onValidationError","_this_props","validationErrors","entries","map","fieldType","error","rootNode","onValidationError","call","h","SecuredFieldsProvider","ref","extractPropsForSFP","type","brand","componentType","sfState","onSubmitAnalytics","exposeExpiryDate","disableIOSArrowKeys","render","defaultProps","onError","autoFocus","brands","brandsConfiguration","clientKey","forceCompat","i18n","implementationType","keypadFix","legacyInputMode","loadingContext","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onBrand","onConfigSuccess","handleKeyDown","onFieldValid","onFocus","onLoad","showWarnings","styles","trimTrailingSeparator","resources","maskSecurityCode","placeholders"],"mappings":"8mCAoFA,SAASA,EAAgBC,GACrB,MAAMC,EAAMC,EAAO,OAEZC,EAAQC,GAAaC,EAAS,CAAA,IAC9BC,EAAOC,GAAYF,EAAS,CAAA,IAC5BG,EAAMC,GAAWJ,EAAS,CAAA,IAE1BK,EAAYC,GA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K9B,EAASqD,EAAQrD,OAC9BJ,EAAUkC,EAAA,CAAA,EAAKnC,EAAW0D,EAAQ1D,SAClCI,EAAS+B,EAAA,CAAA,EAAKhC,EAAUuD,EAAQvD,QAEhCK,EAAckD,EAAQnD,aAmElBoD,kBAAmB9D,EAAM8D,kBACzBC,kBAAkB,EAClBC,oBAAqB,KACrBC,OAAQ,IAAM,OAG1B,CAEAlE,EAAgBmE,aApGK,CACjB3B,SAAU,OACV4B,QAAS,OACTf,kBAAmB,QAqGvB,MAAMK,EAAsBzD,IACjB,CACHoE,UAAWpE,EAAMoE,UACjBC,OAAQrE,EAAMqE,OACdC,oBAAqBtE,EAAMsE,oBAC3BC,UAAWvE,EAAMuE,UACjBC,YAAaxE,EAAMwE,YACnBC,KAAMzE,EAAMyE,KACZC,mBAAoB1E,EAAM0E,mBAC1BC,UAAW3E,EAAM2E,UACjBC,gBAAiB5E,EAAM4E,gBACvBC,eAAgB7E,EAAM6E,eACtBC,kBAAmB9E,EAAM8E,kBACzBC,qBAAsB/E,EAAM+E,qBAC5BC,sBAAuBhF,EAAMgF,sBAC7BC,WAAYjF,EAAMiF,WAClBC,eAAgBlF,EAAMkF,eACtBC,WAAYnF,EAAMmF,WAClBC,QAASpF,EAAMoF,QACfC,gBAAiBrF,EAAMqF,gBACvBC,cAAetF,EAAMsF,cACrBnB,QAASnE,EAAMmE,QACfoB,aAAcvF,EAAMuF,aACpBC,QAASxF,EAAMwF,QACfC,OAAQzF,EAAMyF,OACdtC,SAAUnD,EAAMmD,SAChBuC,aAAc1F,EAAM0F,aACpBC,OAAQ3F,EAAM2F,OACdC,sBAAuB5F,EAAM4F,sBAC7BC,UAAW7F,EAAM6F,UACjBC,iBAAkB9F,EAAM8F,iBACxBC,aAAc/F,EAAM+F"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as t,useState as r}from"../../../../external/preact/hooks/dist/hooks.js";import o from"../../../internal/PersonalDetails/PersonalDetails.js";import{useCoreContext as a}from"../../../../core/Context/CoreProvider.js";import n from"../../../internal/FormInstruction/FormInstruction.js";function s(s){const i=t(null),{i18n:l}=a(),[u,c]=r("ready"),m=t({});var d;Object.keys(m.current).length||(null===(d=s.setComponentRef)||void 0===d||d.call(s,m.current));return m.current.showValidation=()=>{var e;null===(e=i.current)||void 0===e||e.showValidation()},m.current.setStatus=c,e("div",{className:"adyen-checkout__doku-input__field"},e(n,null),e(o,{data:s.data,requiredFields:["firstName","lastName","shopperEmail"],onChange:s.onChange,namePrefix:"doku",setComponentRef:e=>{i.current=e}}),s.showPayButton&&s.payButton({status:u,label:l.get("confirmPurchase")}))}export{s as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as t,useState as r}from"../../../../external/preact/hooks/dist/hooks.js";import a from"../../../internal/PersonalDetails/PersonalDetails.js";import{useCoreContext as n}from"../../../../core/Context/CoreProvider.js";import o from"../../../internal/FormInstruction/FormInstruction.js";function s(s){const i=t(null),{i18n:l}=n(),[u,c]=r("ready"),m=t({});var d;Object.keys(m.current).length||(null===(d=s.setComponentRef)||void 0===d||d.call(s,m.current));return m.current.showValidation=()=>{var e;null===(e=i.current)||void 0===e||e.showValidation()},m.current.setStatus=c,e("div",{className:"adyen-checkout__doku-input__field"},e(o,null),e(a,{data:s.data,requiredFields:["firstName","lastName","shopperEmail"],onChange:s.onChange,namePrefix:"doku",setComponentRef:e=>{i.current=e}}),s.payButton({status:u,label:l.get("confirmPurchase")}))}export{s as default};
2
2
  //# sourceMappingURL=DokuInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DokuInput.js","sources":["../../../../../../src/components/Doku/components/DokuInput/DokuInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useRef, useState } from 'preact/hooks';\nimport PersonalDetails from '../../../internal/PersonalDetails/PersonalDetails';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\n\nexport default function DokuInput(props) {\n const personalDetailsRef = useRef(null);\n const setPersonalDetailsRef = ref => {\n personalDetailsRef.current = ref;\n };\n\n const { i18n } = useCoreContext();\n\n const [status, setStatus] = useState('ready');\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const dokuRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(dokuRef.current).length) {\n props.setComponentRef?.(dokuRef.current);\n }\n\n dokuRef.current.showValidation = () => {\n personalDetailsRef.current?.showValidation();\n };\n\n dokuRef.current.setStatus = setStatus;\n\n return (\n <div className=\"adyen-checkout__doku-input__field\">\n <FormInstruction />\n\n <PersonalDetails\n data={props.data}\n requiredFields={['firstName', 'lastName', 'shopperEmail']}\n onChange={props.onChange}\n namePrefix=\"doku\"\n setComponentRef={setPersonalDetailsRef}\n />\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n"],"names":["DokuInput","props","personalDetailsRef","useRef","i18n","useCoreContext","status","setStatus","useState","dokuRef","Object","keys","current","length","setComponentRef","showValidation","h","div","className","FormInstruction","PersonalDetails","data","requiredFields","onChange","namePrefix","ref","showPayButton","payButton","label","get"],"mappings":"oXAOe,SAASA,EAAUC,GAC9B,MAAMC,EAAqBC,EAAO,OAK5BC,KAAEA,GAASC,KAEVC,EAAQC,GAAaC,EAAS,SAG/BC,EAAUN,EAA4B,IAGxCF,IAAAA,EADCS,OAAOC,KAAKF,EAAQG,SAASC,SACT,QAArBZ,EAAAA,EAAMa,2BAANb,GAAAA,EAAAA,KAAAA,EAAwBQ,EAAQG,UASpC,OANAH,EAAQG,QAAQG,eAAiB,KAC7Bb,IAAAA,EAA0B,QAA1BA,EAAAA,EAAmBU,mBAAnBV,GAAAA,EAA4Ba,kBAGhCN,EAAQG,QAAQL,UAAYA,EAGxBS,EAACC,MAAAA,CAAIC,UAAU,qCACXF,EAACG,QAEDH,EAACI,EAAAA,CACGC,KAAMpB,EAAMoB,KACZC,eAAgB,CAAC,YAAa,WAAY,gBAC1CC,SAAUtB,EAAMsB,SAChBC,WAAW,OACXV,gBA9BkBW,IAC1BvB,EAAmBU,QAAUa,KAgCxBxB,EAAMyB,eAAiBzB,EAAM0B,UAAU,CAAErB,SAAQsB,MAAOxB,EAAKyB,IAAI,qBAG9E"}
1
+ {"version":3,"file":"DokuInput.js","sources":["../../../../../../src/components/Doku/components/DokuInput/DokuInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useRef, useState } from 'preact/hooks';\nimport PersonalDetails from '../../../internal/PersonalDetails/PersonalDetails';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\n\nexport default function DokuInput(props) {\n const personalDetailsRef = useRef(null);\n const setPersonalDetailsRef = ref => {\n personalDetailsRef.current = ref;\n };\n\n const { i18n } = useCoreContext();\n\n const [status, setStatus] = useState('ready');\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const dokuRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(dokuRef.current).length) {\n props.setComponentRef?.(dokuRef.current);\n }\n\n dokuRef.current.showValidation = () => {\n personalDetailsRef.current?.showValidation();\n };\n\n dokuRef.current.setStatus = setStatus;\n\n return (\n <div className=\"adyen-checkout__doku-input__field\">\n <FormInstruction />\n\n <PersonalDetails\n data={props.data}\n requiredFields={['firstName', 'lastName', 'shopperEmail']}\n onChange={props.onChange}\n namePrefix=\"doku\"\n setComponentRef={setPersonalDetailsRef}\n />\n\n {props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n"],"names":["DokuInput","props","personalDetailsRef","useRef","i18n","useCoreContext","status","setStatus","useState","dokuRef","Object","keys","current","length","setComponentRef","showValidation","h","div","className","FormInstruction","PersonalDetails","data","requiredFields","onChange","namePrefix","ref","payButton","label","get"],"mappings":"oXAOe,SAASA,EAAUC,GAC9B,MAAMC,EAAqBC,EAAO,OAK5BC,KAAEA,GAASC,KAEVC,EAAQC,GAAaC,EAAS,SAG/BC,EAAUN,EAA4B,IAGxCF,IAAAA,EADCS,OAAOC,KAAKF,EAAQG,SAASC,SACT,QAArBZ,EAAAA,EAAMa,2BAANb,GAAAA,EAAAA,KAAAA,EAAwBQ,EAAQG,UASpC,OANAH,EAAQG,QAAQG,eAAiB,KAC7Bb,IAAAA,EAA0B,QAA1BA,EAAAA,EAAmBU,mBAAnBV,GAAAA,EAA4Ba,kBAGhCN,EAAQG,QAAQL,UAAYA,EAGxBS,EAACC,MAAAA,CAAIC,UAAU,qCACXF,EAACG,QAEDH,EAACI,EAAAA,CACGC,KAAMpB,EAAMoB,KACZC,eAAgB,CAAC,YAAa,WAAY,gBAC1CC,SAAUtB,EAAMsB,SAChBC,WAAW,OACXV,gBA9BkBW,IAC1BvB,EAAmBU,QAAUa,KAgCxBxB,EAAMyB,UAAU,CAAEpB,SAAQqB,MAAOvB,EAAKwB,IAAI,qBAGvD"}
@@ -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 n from"./components/DonationComponent.js";import{TxVariants as o}from"../tx-variants.js";import{AnalyticsLogEvent as i,LogEventSubtype as s,LogEventType as a}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsInfoEvent as r,UiTarget as c,InfoEventType as l}from"../../core/Analytics/events/AnalyticsInfoEvent.js";import d,{REPARENT_WITHOUT_AUTO_START_ERROR_MSG as p}from"./DonationCampaignService.js";function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),o.forEach(function(e){u(t,e,n[e])})}return t}function h(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 n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e}(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}class y extends e{static isServiceMode(t){return"rootNode"in t&&!!t.rootNode}async initialiseServiceMode(t,e){if(t.session)if(t.session.sessionsDonationInitiated)console.error(p);else{t.session.sessionsDonationInitiated=!0;try{const n=await new d(t,e).initialise();n&&(this.props=m({},this.props,n),this.mount(e.rootNode))}catch(e){var n,o;null===(o=t.options.donation)||void 0===o||null===(n=o.onDonationFailure)||void 0===n||n.call(o,e)}}}get data(){return this.state.data}get isValid(){return this.state.isValid}setState(t){this.state=m({},this.state,t)}donate(){const t=new i({component:y.type,type:a.submit,subType:s.donation,message:"Making donation"});this.core.modules.analytics.sendAnalytics(t);const{data:e,isValid:n}=this;this.props.onDonate({data:e,isValid:n},this)}cancel(){const t=new i({component:y.type,type:a.closed,subType:s.donation,message:"Opting to not make donation"});this.core.modules.analytics.sendAnalytics(t);const{data:e,isValid:n}=this;this.isInServiceMode&&this.unmount(),this.props.onCancel({data:e,isValid:n})}amountSelected(t){const e=new r({component:y.type,type:l.selected,selectedValue:JSON.stringify(t.data.amount),target:c.donationAmountButton});this.core.modules.analytics.sendAnalytics(e)}componentToRender(){return t(n,h(m({},this.props),{ref:t=>{this.componentRef=t},onChange:this.setState,onDonate:this.donate,onCancel:this.cancel,onAmountSelected:this.amountSelected}))}constructor(t,e){const n=y.isServiceMode(e);super(t,n?void 0:e),u(this,"isInServiceMode",!1),this.donate=this.donate.bind(this),this.cancel=this.cancel.bind(this),this.amountSelected=this.amountSelected.bind(this),this.isInServiceMode=n,t.session&&n&&this.initialiseServiceMode(t,e)}}u(y,"type",o.donation),u(y,"defaultProps",{onCancel:()=>{},onDonate:()=>{}});export{y as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import n from"./components/DonationComponent.js";import{TxVariants as o}from"../tx-variants.js";import{AnalyticsLogEvent as s,LogEventSubtype as i,LogEventType as a}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsInfoEvent as r,UiTarget as c,InfoEventType as l}from"../../core/Analytics/events/AnalyticsInfoEvent.js";import d,{REPARENT_WITHOUT_AUTO_START_ERROR_MSG as p}from"./DonationCampaignService.js";function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),o.forEach(function(e){u(t,e,n[e])})}return t}function h(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 n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e}(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}class y extends e{static isServiceMode(t){return"rootNode"in t&&!!t.rootNode}async initialiseServiceMode(t,e){if(t.session)if(t.session.sessionsDonationInitiated)console.error(p);else{t.session.sessionsDonationInitiated=!0;try{const n=await new d(t,e).initialise();n&&(this.props=m({},this.props,n),this.mount(e.rootNode))}catch(e){var n,o;null===(o=t.options.donation)||void 0===o||null===(n=o.onDonationFailure)||void 0===n||n.call(o,e)}}}get data(){return this.state.data}get isValid(){return this.state.isValid}setState(t){this.state=m({},this.state,t)}donate(){const t=new s({component:y.type,type:a.submit,subType:i.donation,message:"Making donation"});this.core.modules.analytics.sendAnalytics(t);const{data:e,isValid:n}=this;this.props.onDonate({data:e,isValid:n},this)}cancel(){const t=new s({component:y.type,type:a.closed,subType:i.donation,message:"Opting to not make donation"});this.core.modules.analytics.sendAnalytics(t);const{data:e,isValid:n}=this;this.isInServiceMode&&this.unmount(),this.props.onCancel({data:e,isValid:n})}amountSelected(t){const e=new r({component:y.type,type:l.selected,selectedValue:JSON.stringify(t.data.amount),target:c.donationAmountButton});this.core.modules.analytics.sendAnalytics(e)}componentToRender(){return t(n,h(m({},this.props),{setComponentRef:this.setComponentRef,onChange:this.setState,onDonate:this.donate,onCancel:this.cancel,onAmountSelected:this.amountSelected}))}constructor(t,e){const n=y.isServiceMode(e);super(t,n?void 0:e),u(this,"isInServiceMode",!1),this.donate=this.donate.bind(this),this.cancel=this.cancel.bind(this),this.amountSelected=this.amountSelected.bind(this),this.isInServiceMode=n,t.session&&n&&this.initialiseServiceMode(t,e)}}u(y,"type",o.donation),u(y,"defaultProps",{onCancel:()=>{},onDonate:()=>{}});export{y as default};
2
2
  //# sourceMappingURL=Donation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Donation.js","sources":["../../../../src/components/Donation/Donation.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport DonationComponent from './components/DonationComponent';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { DonationCampaignOptions, DonationConfiguration, DonationProps } from './types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { DonationPayload } from './components/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport DonationCampaignService, { REPARENT_WITHOUT_AUTO_START_ERROR_MSG } from './DonationCampaignService';\n\nclass DonationElement extends UIElement<DonationConfiguration> {\n public static readonly type = TxVariants.donation;\n\n private readonly isInServiceMode: boolean = false;\n\n constructor(checkout: ICore, props: DonationProps) {\n const isServiceMode = DonationElement.isServiceMode(props);\n const initialConfig = isServiceMode ? undefined : props;\n\n super(checkout, initialConfig);\n\n this.donate = this.donate.bind(this);\n this.cancel = this.cancel.bind(this);\n this.amountSelected = this.amountSelected.bind(this);\n\n this.isInServiceMode = isServiceMode;\n\n if (checkout.session && isServiceMode) {\n void this.initialiseServiceMode(checkout, props); // NOSONAR - async in constructor is intentional for fire-and-forget service mode initialization\n }\n }\n\n /**\n * Type guard to determine if props are for \"service\" mode.\n *\n * The \"service\" mode is used in the /sessions flow:\n * - if the /payments response mandates it, we consult the /sessions/donationCampaigns endpoint on behalf of the merchant, and mount any found Donation Campaigns.\n *\n * The opposite of this mode is the \"direct\" mode, used in the Advanced flow:\n * - the merchant makes their own call to the /donationCampaigns endpoint and provides the Donation Campaign directly to the component.\n */\n private static isServiceMode(props: DonationProps): props is DonationCampaignOptions {\n return 'rootNode' in props && !!props.rootNode;\n }\n\n public static readonly defaultProps = {\n onCancel: () => {},\n onDonate: () => {}\n };\n\n private async initialiseServiceMode(checkout: ICore, props: DonationCampaignOptions) {\n if (!checkout.session) {\n return;\n }\n\n if (checkout.session.sessionsDonationInitiated) {\n console.error(REPARENT_WITHOUT_AUTO_START_ERROR_MSG);\n return;\n }\n\n checkout.session.sessionsDonationInitiated = true;\n try {\n const donationCampaign = await new DonationCampaignService(checkout, props).initialise();\n if (donationCampaign) {\n this.props = { ...this.props, ...donationCampaign };\n this.mount(props.rootNode);\n }\n // If no campaigns found (response is null), don't mount - silently do nothing\n } catch (error: unknown) {\n // Call merchant defined callback\n // e.g. when the merchant wants to reparent the component and donation type = roundup but no commercialTxAmount has been set\n checkout.options.donation?.onDonationFailure?.(error);\n }\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n */\n get data() {\n return this.state.data;\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 setState(newState) {\n this.state = { ...this.state, ...newState };\n }\n\n donate() {\n // Send analytics\n const event = new AnalyticsLogEvent({\n component: DonationElement.type,\n type: LogEventType.submit,\n subType: LogEventSubtype.donation,\n message: 'Making donation'\n });\n this.core.modules.analytics.sendAnalytics(event);\n\n // Call callback\n const { data, isValid } = this;\n this.props.onDonate({ data, isValid }, this);\n }\n\n cancel() {\n // Send analytics\n const event = new AnalyticsLogEvent({\n component: DonationElement.type,\n type: LogEventType.closed,\n subType: LogEventSubtype.donation,\n message: 'Opting to not make donation'\n });\n this.core.modules.analytics.sendAnalytics(event);\n\n // Call callback\n const { data, isValid } = this;\n\n // If running in service mode, unmount the component\n if (this.isInServiceMode) {\n this.unmount();\n }\n\n this.props.onCancel({ data, isValid });\n }\n\n amountSelected(state: DonationPayload) {\n // Send analytics\n const event = new AnalyticsInfoEvent({\n component: DonationElement.type,\n type: InfoEventType.selected,\n selectedValue: JSON.stringify(state.data.amount),\n target: UiTarget.donationAmountButton\n });\n this.core.modules.analytics.sendAnalytics(event);\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <DonationComponent\n {...this.props}\n // @ts-ignore ref is internal from the Component\n ref={ref => {\n this.componentRef = ref;\n }}\n onChange={this.setState}\n onDonate={this.donate}\n onCancel={this.cancel}\n onAmountSelected={this.amountSelected}\n />\n );\n }\n}\n\nexport default DonationElement;\n"],"names":["DonationElement","UIElement","isServiceMode","props","rootNode","initialiseServiceMode","checkout","session","sessionsDonationInitiated","console","error","REPARENT_WITHOUT_AUTO_START_ERROR_MSG","donationCampaign","DonationCampaignService","initialise","this","_object_spread","mount","options","donation","onDonationFailure","data","state","isValid","setState","newState","donate","event","AnalyticsLogEvent","component","type","LogEventType","submit","subType","LogEventSubtype","message","core","modules","analytics","sendAnalytics","onDonate","cancel","closed","isInServiceMode","unmount","onCancel","amountSelected","AnalyticsInfoEvent","InfoEventType","selected","selectedValue","JSON","stringify","amount","target","UiTarget","donationAmountButton","componentToRender","h","DonationComponent","ref","componentRef","onChange","onAmountSelected","constructor","super","undefined","_define_property","bind","TxVariants","defaultProps"],"mappings":"y1CAWA,MAAMA,UAAwBC,EA+B1B,oBAAeC,CAAcC,GACzB,MAA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AChC,CAEAuB,cAAAA,CAAexB,GAEX,MAAMK,EAAQ,IAAIoB,EAAmB,CACjClB,UAAW7B,EAAgB8B,KAC3BA,KAAMkB,EAAcC,SACpBC,cAAeC,KAAKC,UAAU9B,EAAMD,KAAKgC,QACzCC,OAAQC,EAASC,uBAErBzC,KAAKqB,KAAKC,QAAQC,UAAUC,cAAcZ,EAC9C,CAEmB8B,iBAAAA,GACf,OACIC,EAACC,EAAAA,EAAAA,EAAAA,GACO5C,KAAKZ,OAAK,CAEdyD,IAAKA,IACD7C,KAAK8C,aAAeD,GAExBE,SAAU/C,KAAKS,SACfgB,SAAUzB,KAAKW,OACfmB,SAAU9B,KAAK0B,OACfsB,iBAAkBhD,KAAK+B,iBAGnC,CA3IA,WAAAkB,CAAY1D,EAAiBH,GACzB,MAAMD,EAAgBF,EAAgBE,cAAcC,GAGpD8D,MAAM3D,EAFgBJ,OAAgBgE,EAAY/D,GAJtDgE,EAAApD,KAAiB4B,mBAA2B,GAQxC5B,KAAKW,OAASX,KAAKW,OAAO0C,KAAKrD,MAC/BA,KAAK0B,OAAS1B,KAAK0B,OAAO2B,KAAKrD,MAC/BA,KAAK+B,eAAiB/B,KAAK+B,eAAesB,KAAKrD,MAE/CA,KAAK4B,gBAAkBzC,EAEnBI,EAASC,SAAWL,GACfa,KAAKV,sBAAsBC,EAAUH,EAElD,EAnBAgE,EADEnE,EACqB8B,OAAOuC,EAAWlD,UAkCzCgD,EAnCEnE,EAmCqBsE,eAAe,CAClCzB,SAAU,OACVL,SAAU"}
1
+ {"version":3,"file":"Donation.js","sources":["../../../../src/components/Donation/Donation.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport DonationComponent from './components/DonationComponent';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { DonationCampaignOptions, DonationConfiguration, DonationProps } from './types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { DonationPayload } from './components/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport DonationCampaignService, { REPARENT_WITHOUT_AUTO_START_ERROR_MSG } from './DonationCampaignService';\n\nclass DonationElement extends UIElement<DonationConfiguration> {\n public static readonly type = TxVariants.donation;\n\n private readonly isInServiceMode: boolean = false;\n\n constructor(checkout: ICore, props: DonationProps) {\n const isServiceMode = DonationElement.isServiceMode(props);\n const initialConfig = isServiceMode ? undefined : props;\n\n super(checkout, initialConfig);\n\n this.donate = this.donate.bind(this);\n this.cancel = this.cancel.bind(this);\n this.amountSelected = this.amountSelected.bind(this);\n\n this.isInServiceMode = isServiceMode;\n\n if (checkout.session && isServiceMode) {\n void this.initialiseServiceMode(checkout, props); // NOSONAR - async in constructor is intentional for fire-and-forget service mode initialization\n }\n }\n\n /**\n * Type guard to determine if props are for \"service\" mode.\n *\n * The \"service\" mode is used in the /sessions flow:\n * - if the /payments response mandates it, we consult the /sessions/donationCampaigns endpoint on behalf of the merchant, and mount any found Donation Campaigns.\n *\n * The opposite of this mode is the \"direct\" mode, used in the Advanced flow:\n * - the merchant makes their own call to the /donationCampaigns endpoint and provides the Donation Campaign directly to the component.\n */\n private static isServiceMode(props: DonationProps): props is DonationCampaignOptions {\n return 'rootNode' in props && !!props.rootNode;\n }\n\n public static readonly defaultProps = {\n onCancel: () => {},\n onDonate: () => {}\n };\n\n private async initialiseServiceMode(checkout: ICore, props: DonationCampaignOptions) {\n if (!checkout.session) {\n return;\n }\n\n if (checkout.session.sessionsDonationInitiated) {\n console.error(REPARENT_WITHOUT_AUTO_START_ERROR_MSG);\n return;\n }\n\n checkout.session.sessionsDonationInitiated = true;\n try {\n const donationCampaign = await new DonationCampaignService(checkout, props).initialise();\n if (donationCampaign) {\n this.props = { ...this.props, ...donationCampaign };\n this.mount(props.rootNode);\n }\n // If no campaigns found (response is null), don't mount - silently do nothing\n } catch (error: unknown) {\n // Call merchant defined callback\n // e.g. when the merchant wants to reparent the component and donation type = roundup but no commercialTxAmount has been set\n checkout.options.donation?.onDonationFailure?.(error);\n }\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n */\n get data() {\n return this.state.data;\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 setState(newState) {\n this.state = { ...this.state, ...newState };\n }\n\n donate() {\n // Send analytics\n const event = new AnalyticsLogEvent({\n component: DonationElement.type,\n type: LogEventType.submit,\n subType: LogEventSubtype.donation,\n message: 'Making donation'\n });\n this.core.modules.analytics.sendAnalytics(event);\n\n // Call callback\n const { data, isValid } = this;\n this.props.onDonate({ data, isValid }, this);\n }\n\n cancel() {\n // Send analytics\n const event = new AnalyticsLogEvent({\n component: DonationElement.type,\n type: LogEventType.closed,\n subType: LogEventSubtype.donation,\n message: 'Opting to not make donation'\n });\n this.core.modules.analytics.sendAnalytics(event);\n\n // Call callback\n const { data, isValid } = this;\n\n // If running in service mode, unmount the component\n if (this.isInServiceMode) {\n this.unmount();\n }\n\n this.props.onCancel({ data, isValid });\n }\n\n amountSelected(state: DonationPayload) {\n // Send analytics\n const event = new AnalyticsInfoEvent({\n component: DonationElement.type,\n type: InfoEventType.selected,\n selectedValue: JSON.stringify(state.data.amount),\n target: UiTarget.donationAmountButton\n });\n this.core.modules.analytics.sendAnalytics(event);\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <DonationComponent\n {...this.props}\n setComponentRef={this.setComponentRef}\n onChange={this.setState}\n onDonate={this.donate}\n onCancel={this.cancel}\n onAmountSelected={this.amountSelected}\n />\n );\n }\n}\n\nexport default DonationElement;\n"],"names":["DonationElement","UIElement","isServiceMode","props","rootNode","initialiseServiceMode","checkout","session","sessionsDonationInitiated","console","error","REPARENT_WITHOUT_AUTO_START_ERROR_MSG","donationCampaign","DonationCampaignService","initialise","this","_object_spread","mount","options","donation","onDonationFailure","data","state","isValid","setState","newState","donate","event","AnalyticsLogEvent","component","type","LogEventType","submit","subType","LogEventSubtype","message","core","modules","analytics","sendAnalytics","onDonate","cancel","closed","isInServiceMode","unmount","onCancel","amountSelected","AnalyticsInfoEvent","InfoEventType","selected","selectedValue","JSON","stringify","amount","target","UiTarget","donationAmountButton","componentToRender","h","DonationComponent","setComponentRef","onChange","onAmountSelected","constructor","super","undefined","_define_property","bind","TxVariants","defaultProps"],"mappings":"y1CAWA,MAAMA,UAAwBC,EA+B1B,oBAAeC,CAAcC,GACzB,MAAO,aAAcA,KAAWA,EAAMC,QAC1C,CAOA,2BAAcC,CAAsBC,EAAiBH,GACjD,GAAKG,EAASC,QAId,GAAID,EAASC,QAAQC,0BACjBC,QAAQC,MAAMC,OADlB,CAKAL,EAASC,QAAQC,2BAA4B,EAC7C,IACI,MAAMI,QAAyB,IAAIC,EAAwBP,EAAUH,GAAOW,aACxEF,IACAG,KAAKZ,MAAQa,KAAKD,KAAKZ,MAAUS,GACjCG,KAAKE,MAAMd,EAAMC,UAGzB,CAAE,MAAOM,OAGLJ,EAAAA,EAAyB,QAAzBA,EAAAA,EAASY,QAAQC,oBAAjBb,GAA4C,QAA5CA,EAAAA,EAA2Bc,yBAA3Bd,IAAAA,GAAAA,EAAAA,KAAAA,EAA+CI,EACnD,CAdA,CAeJ,CAKA,QAAIW,GACA,OAAON,KAAKO,MAAMD,IACtB,CAKA,WAAIE,GACA,OAAOR,KAAKO,MAAMC,OACtB,CAEAC,QAAAA,CAASC,GACLV,KAAKO,MAAQN,KAAKD,KAAKO,MAAUG,EACrC,CAEAC,MAAAA,GAEI,MAAMC,EAAQ,IAAIC,EAAkB,CAChCC,UAAW7B,EAAgB8B,KAC3BA,KAAMC,EAAaC,OACnBC,QAASC,EAAgBf,SACzBgB,QAAS,oBAEbpB,KAAKqB,KAAKC,QAAQC,UAAUC,cAAcZ,GAG1C,MAAMN,KAAEA,EAAIE,QAAEA,GAAYR,KAC1BA,KAAKZ,MAAMqC,SAAS,CAAEnB,OAAME,WAAWR,KAC3C,CAEA0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U"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as t,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import o from"./CampaignContent.js";import r from"../../internal/Button/Button.js";import a from"../../internal/Img/Img.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";import c from"../../internal/DisclaimerMessage/DisclaimerMessage.js";import u from"../../../core/Context/useImage.js";import i from"./FixedAmounts.js";import m from"./Roundup.js";import{getRoundupAmount as l,getAmountLabel as d,getRoundupAmountLabel as p}from"./utils.js";function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){g(e,t,n[t])})}return e}function f(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function _(g){const{donation:_,commercialTxAmount:h,onAmountSelected:j,onCancel:v,onDonate:b,showCancelButton:O=!0,termsAndConditionsUrl:k}=g,{i18n:C}=s(),w=u(),{currency:P,type:x}=_,A="roundup"===x,[D,N]=t("ready"),[S,B]=t(A),[F,E]=t({currency:P,value:A?l(_.maxRoundupAmount,h):null});this.setStatus=e=>{N(e)};const I=()=>{N("loading"),b({data:{amount:F}})};return n(()=>{g.onChange({data:{amount:F},isValid:S})},[F,S]),"error"===D?e("div",{className:"adyen-checkout__adyen-giving"},e(a,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:w({imageFolder:"components/"})("error"),alt:C.get("error.message.unknown")}),e("div",{className:"adyen-checkout__status__text"},C.get("error.message.unknown"))):"success"===D?e("div",{className:"adyen-checkout__adyen-giving"},e(a,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--success",src:w({imageFolder:"components/"})("heart"),alt:C.get("thanksForYourSupport")}),e("div",{className:"adyen-checkout__status__text"},C.get("thanksForYourSupport"))):e("div",{className:"adyen-checkout__adyen-giving"},e(o,g),e("div",{className:"adyen-checkout__adyen-giving-actions"},k&&e(c,{message:C.get("donationTermsCondition"),urls:[k]}),A?e(m,{donationAmount:p(C,{maxRoundupAmount:_.maxRoundupAmount,commercialTxAmount:h,currency:P}),originalPaymentAmount:d(C,{value:h,currency:P}),status:D,onDonateButtonClicked:I}):e(i,{selectedAmount:F.value,values:_.values,currency:P,status:D,onAmountSelected:({target:e})=>{const t=parseInt(e.value,10);B(!0),E(e=>f(y({},e),{value:t})),j({data:{amount:f(y({},F),{value:t})}})},onDonateButtonClicked:I}),O&&e(r,{classNameModifiers:["decline"],variant:"ghost",onClick:()=>{N("ready"),v({data:{amount:F},isValid:S})},disabled:"loading"===D,label:`${C.get("notNowButton")} ›`})))}_.defaultProps={onCancel:()=>{},onChange:()=>{},onDonate:()=>{},donation:{},showCancelButton:!0};export{_ as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as t,useRef as n,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import r from"./CampaignContent.js";import a from"../../internal/Button/Button.js";import s from"../../internal/Img/Img.js";import{useCoreContext as c}from"../../../core/Context/CoreProvider.js";import u from"../../internal/DisclaimerMessage/DisclaimerMessage.js";import i from"../../../core/Context/useImage.js";import m from"./FixedAmounts.js";import l from"./Roundup.js";import{getRoundupAmount as d,getAmountLabel as p,getRoundupAmountLabel as g}from"./utils.js";function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){y(e,t,n[t])})}return e}function _(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function j(y){const{donation:j,commercialTxAmount:v,onAmountSelected:b,onCancel:h,onDonate:O,showCancelButton:k=!0,termsAndConditionsUrl:C}=y,{i18n:w}=c(),P=i(),{currency:x,type:A}=j,D="roundup"===A,[N,S]=t("ready"),[B,R]=t(D),[F,E]=t({currency:x,value:D?d(j.maxRoundupAmount,v):null}),I=n({setStatus:S});o(()=>{y.setComponentRef(I.current)},[y.setComponentRef]);const M=()=>{S("loading"),O({data:{amount:F}})};return o(()=>{y.onChange({data:{amount:F},isValid:B})},[F,B]),"error"===N?e("div",{className:"adyen-checkout__adyen-giving"},e(s,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:P({imageFolder:"components/"})("error"),alt:w.get("error.message.unknown")}),e("div",{className:"adyen-checkout__status__text"},w.get("error.message.unknown"))):"success"===N?e("div",{className:"adyen-checkout__adyen-giving"},e(s,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--success",src:P({imageFolder:"components/"})("heart"),alt:w.get("thanksForYourSupport")}),e("div",{className:"adyen-checkout__status__text"},w.get("thanksForYourSupport"))):e("div",{className:"adyen-checkout__adyen-giving"},e(r,y),e("div",{className:"adyen-checkout__adyen-giving-actions"},C&&e(u,{message:w.get("donationTermsCondition"),urls:[C]}),D?e(l,{donationAmount:g(w,{maxRoundupAmount:j.maxRoundupAmount,commercialTxAmount:v,currency:x}),originalPaymentAmount:p(w,{value:v,currency:x}),status:N,onDonateButtonClicked:M}):e(m,{selectedAmount:F.value,values:j.values,currency:x,status:N,onAmountSelected:({target:e})=>{const t=parseInt(e.value,10);R(!0),E(e=>_(f({},e),{value:t})),b({data:{amount:_(f({},F),{value:t})}})},onDonateButtonClicked:M}),k&&e(a,{classNameModifiers:["decline"],variant:"ghost",onClick:()=>{S("ready"),h({data:{amount:F},isValid:B})},disabled:"loading"===N,label:`${w.get("notNowButton")} ›`})))}j.defaultProps={onCancel:()=>{},onChange:()=>{},onDonate:()=>{},donation:{},showCancelButton:!0};export{j as default};
2
2
  //# sourceMappingURL=DonationComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DonationComponent.js","sources":["../../../../../src/components/Donation/components/DonationComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport CampaignContent from './CampaignContent';\nimport Button from '../../internal/Button';\nimport Img from '../../internal/Img';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport '../Donation.scss';\nimport DisclaimerMessage from '../../internal/DisclaimerMessage';\nimport { DonationAmount, DonationComponentProps, Status } from './types';\nimport useImage from '../../../core/Context/useImage';\nimport FixedAmounts from './FixedAmounts';\nimport Roundup from './Roundup';\nimport { getAmountLabel, getRoundupAmount, getRoundupAmountLabel } from './utils';\n\nexport default function DonationComponent(props: Readonly<DonationComponentProps>) {\n const { donation, commercialTxAmount, onAmountSelected, onCancel, onDonate, showCancelButton = true, termsAndConditionsUrl } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const { currency, type } = donation;\n const isRoundupDonation = type === 'roundup';\n const [status, setStatus] = useState<Status>('ready');\n const [isValid, setIsValid] = useState<boolean>(isRoundupDonation);\n const [amount, setAmount] = useState<DonationAmount>({\n currency,\n value: isRoundupDonation ? getRoundupAmount(donation.maxRoundupAmount, commercialTxAmount) : null\n });\n\n this.setStatus = (status: Status) => {\n setStatus(status);\n };\n\n const handleAmountSelected = ({ target }) => {\n const value = parseInt(target.value, 10);\n setIsValid(true);\n setAmount((amount: DonationAmount) => ({ ...amount, value }));\n\n onAmountSelected({ data: { amount: { ...amount, value } } });\n };\n\n const handleDonate = () => {\n setStatus('loading');\n onDonate({ data: { amount } });\n };\n\n const handleDecline = () => {\n setStatus('ready');\n onCancel({ data: { amount }, isValid });\n };\n\n useEffect(() => {\n props.onChange({ data: { amount }, isValid });\n }, [amount, isValid]);\n\n if (status === 'error') {\n return (\n <div className=\"adyen-checkout__adyen-giving\">\n <Img\n className=\"adyen-checkout__status__icon adyen-checkout__status__icon--error\"\n src={getImage({ imageFolder: 'components/' })('error')}\n alt={i18n.get('error.message.unknown')}\n />\n <div className=\"adyen-checkout__status__text\">{i18n.get('error.message.unknown')}</div>\n </div>\n );\n }\n\n if (status === 'success') {\n return (\n <div className=\"adyen-checkout__adyen-giving\">\n <Img\n className=\"adyen-checkout__status__icon adyen-checkout__status__icon--success\"\n src={getImage({ imageFolder: 'components/' })('heart')}\n alt={i18n.get('thanksForYourSupport')}\n />\n\n <div className=\"adyen-checkout__status__text\">{i18n.get('thanksForYourSupport')}</div>\n </div>\n );\n }\n\n return (\n <div className=\"adyen-checkout__adyen-giving\">\n <CampaignContent {...props} />\n\n <div className=\"adyen-checkout__adyen-giving-actions\">\n {termsAndConditionsUrl && <DisclaimerMessage message={i18n.get('donationTermsCondition')} urls={[termsAndConditionsUrl]} />}\n {isRoundupDonation ? (\n <Roundup\n donationAmount={getRoundupAmountLabel(i18n, { maxRoundupAmount: donation.maxRoundupAmount, commercialTxAmount, currency })}\n originalPaymentAmount={getAmountLabel(i18n, { value: commercialTxAmount, currency })}\n status={status}\n onDonateButtonClicked={handleDonate}\n ></Roundup>\n ) : (\n <FixedAmounts\n selectedAmount={amount.value}\n values={donation.values}\n currency={currency}\n status={status}\n onAmountSelected={handleAmountSelected}\n onDonateButtonClicked={handleDonate}\n ></FixedAmounts>\n )}\n {showCancelButton && (\n <Button\n classNameModifiers={['decline']}\n variant=\"ghost\"\n onClick={handleDecline}\n disabled={status === 'loading'}\n label={`${i18n.get('notNowButton')} ›`}\n />\n )}\n </div>\n </div>\n );\n}\n\nDonationComponent.defaultProps = {\n onCancel: () => {},\n onChange: () => {},\n onDonate: () => {},\n donation: {},\n showCancelButton: true\n};\n"],"names":["DonationComponent","props","donation","commercialTxAmount","onAmountSelected","onCancel","onDonate","showCancelButton","termsAndConditionsUrl","i18n","useCoreContext","getImage","useImage","currency","type","isRoundupDonation","status","setStatus","useState","isValid","setIsValid","amount","setAmount","value","getRoundupAmount","maxRoundupAmount","this","handleDonate","data","useEffect","onChange","h","div","className","Img","src","imageFolder","alt","get","CampaignContent","DisclaimerMessage","message","urls","Roundup","donationAmount","getRoundupAmountLabel","originalPaymentAmount","getAmountLabel","onDonateButtonClicked","FixedAmounts","selectedAmount","values","target","parseInt","_object_spread_props","_object_spread","Button","classNameModifiers","variant","onClick","disabled","label","defaultProps"],"mappings":"25CAce,SAASA,EAAkBC,GACtC,MAAMC,SAAEA,EAAQC,mBAAEA,EAAkBC,iBAAEA,EAAgBC,SAAEA,EAAQC,SAAEA,EAAQC,iBAAEA,GAAmB,EAAIC,sBAAEA,GAA0BP,GACzHQ,KAAEA,GAASC,IACXC,EAAWC,KACXC,SAAEA,EAAQC,KAAEA,GAASZ,EACrBa,EAA6B,YAATD,GACnBE,EAAQC,GAAaC,EAAiB,UACtCC,EAASC,GAAcF,EAAkBH,IACzCM,EAAQC,GAAaJ,EAAyB,CACjDL,WACAU,MAAOR,EAAoBS,EAAiBtB,EAASuB,iBAAkBtB,GAAsB,OAGjGuB,KAAKT,UAAaD,IACdC,EAAUD,IAGd,MAQMW,EAAe,KACjBV,EAAU,WACVX,EAAS,CAAEsB,KAAM,CAAEP,aAYvB,OAJAQ,EAAU,KACN5B,EAAM6B,SAAS,CAAEF,KAAM,CAAEP,UAAUF,aACpC,CAACE,EAAQF,IAEG,UAAXH,EAEIe,EAACC,MAAAA,CAAIC,UAAU,gCACXF,EAACG,E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EuB,KAAM,CAAEP,UAAUF,aA8DbyC,SAAqB,YAAX5C,EACV6C,MAAO,GAAGpD,EAAK6B,IAAI,uBAM3C,CAEAtC,EAAkB8D,aAAe,CAC7BzD,SAAU,OACVyB,SAAU,OACVxB,SAAU,OACVJ,SAAU,CAAA,EACVK,kBAAkB"}
1
+ {"version":3,"file":"DonationComponent.js","sources":["../../../../../src/components/Donation/components/DonationComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport CampaignContent from './CampaignContent';\nimport Button from '../../internal/Button';\nimport Img from '../../internal/Img';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport '../Donation.scss';\nimport DisclaimerMessage from '../../internal/DisclaimerMessage';\nimport { DonationAmount, DonationComponentProps, Status } from './types';\nimport useImage from '../../../core/Context/useImage';\nimport FixedAmounts from './FixedAmounts';\nimport Roundup from './Roundup';\nimport { getAmountLabel, getRoundupAmount, getRoundupAmountLabel } from './utils';\nimport { ComponentMethodsRef } from '../../types';\n\nexport default function DonationComponent(props: Readonly<DonationComponentProps>) {\n const { donation, commercialTxAmount, onAmountSelected, onCancel, onDonate, showCancelButton = true, termsAndConditionsUrl } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const { currency, type } = donation;\n const isRoundupDonation = type === 'roundup';\n const [status, setStatus] = useState<Status>('ready');\n const [isValid, setIsValid] = useState<boolean>(isRoundupDonation);\n const [amount, setAmount] = useState<DonationAmount>({\n currency,\n value: isRoundupDonation ? getRoundupAmount(donation.maxRoundupAmount, commercialTxAmount) : null\n });\n\n const donationComponentRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus\n });\n\n useEffect(() => {\n props.setComponentRef(donationComponentRef.current);\n }, [props.setComponentRef]);\n\n const handleAmountSelected = ({ target }) => {\n const value = parseInt(target.value, 10);\n setIsValid(true);\n setAmount((amount: DonationAmount) => ({ ...amount, value }));\n\n onAmountSelected({ data: { amount: { ...amount, value } } });\n };\n\n const handleDonate = () => {\n setStatus('loading');\n onDonate({ data: { amount } });\n };\n\n const handleDecline = () => {\n setStatus('ready');\n onCancel({ data: { amount }, isValid });\n };\n\n useEffect(() => {\n props.onChange({ data: { amount }, isValid });\n }, [amount, isValid]);\n\n if (status === 'error') {\n return (\n <div className=\"adyen-checkout__adyen-giving\">\n <Img\n className=\"adyen-checkout__status__icon adyen-checkout__status__icon--error\"\n src={getImage({ imageFolder: 'components/' })('error')}\n alt={i18n.get('error.message.unknown')}\n />\n <div className=\"adyen-checkout__status__text\">{i18n.get('error.message.unknown')}</div>\n </div>\n );\n }\n\n if (status === 'success') {\n return (\n <div className=\"adyen-checkout__adyen-giving\">\n <Img\n className=\"adyen-checkout__status__icon adyen-checkout__status__icon--success\"\n src={getImage({ imageFolder: 'components/' })('heart')}\n alt={i18n.get('thanksForYourSupport')}\n />\n\n <div className=\"adyen-checkout__status__text\">{i18n.get('thanksForYourSupport')}</div>\n </div>\n );\n }\n\n return (\n <div className=\"adyen-checkout__adyen-giving\">\n <CampaignContent {...props} />\n\n <div className=\"adyen-checkout__adyen-giving-actions\">\n {termsAndConditionsUrl && <DisclaimerMessage message={i18n.get('donationTermsCondition')} urls={[termsAndConditionsUrl]} />}\n {isRoundupDonation ? (\n <Roundup\n donationAmount={getRoundupAmountLabel(i18n, { maxRoundupAmount: donation.maxRoundupAmount, commercialTxAmount, currency })}\n originalPaymentAmount={getAmountLabel(i18n, { value: commercialTxAmount, currency })}\n status={status}\n onDonateButtonClicked={handleDonate}\n ></Roundup>\n ) : (\n <FixedAmounts\n selectedAmount={amount.value}\n values={donation.values}\n currency={currency}\n status={status}\n onAmountSelected={handleAmountSelected}\n onDonateButtonClicked={handleDonate}\n ></FixedAmounts>\n )}\n {showCancelButton && (\n <Button\n classNameModifiers={['decline']}\n variant=\"ghost\"\n onClick={handleDecline}\n disabled={status === 'loading'}\n label={`${i18n.get('notNowButton')} ›`}\n />\n )}\n </div>\n </div>\n );\n}\n\nDonationComponent.defaultProps = {\n onCancel: () => {},\n onChange: () => {},\n onDonate: () => {},\n donation: {},\n showCancelButton: true\n};\n"],"names":["DonationComponent","props","donation","commercialTxAmount","onAmountSelected","onCancel","onDonate","showCancelButton","termsAndConditionsUrl","i18n","useCoreContext","getImage","useImage","currency","type","isRoundupDonation","status","setStatus","useState","isValid","setIsValid","amount","setAmount","value","getRoundupAmount","maxRoundupAmount","donationComponentRef","useRef","useEffect","setComponentRef","current","handleDonate","data","onChange","h","div","className","Img","src","imageFolder","alt","get","CampaignContent","DisclaimerMessage","message","urls","Roundup","donationAmount","getRoundupAmountLabel","originalPaymentAmount","getAmountLabel","onDonateButtonClicked","FixedAmounts","selectedAmount","values","target","parseInt","_object_spread_props","_object_spread","Button","classNameModifiers","variant","onClick","disabled","label","defaultProps"],"mappings":"u6CAee,SAASA,EAAkBC,GACtC,MAAMC,SAAEA,EAAQC,mBAAEA,EAAkBC,iBAAEA,EAAgBC,SAAEA,EAAQC,SAAEA,EAAQC,iBAAEA,GAAmB,EAAIC,sBAAEA,GAA0BP,GACzHQ,KAAEA,GAASC,IACXC,EAAWC,KACXC,SAAEA,EAAQC,KAAEA,GAASZ,EACrBa,EAA6B,YAATD,GACnBE,EAAQC,GAAaC,EAAiB,UACtCC,EAASC,GAAcF,EAAkBH,IACzCM,EAAQC,GAAaJ,EAAyB,CACjDL,WACAU,MAAOR,EAAoBS,EAAiBtB,EAASuB,iBAAkBtB,GAAsB,OAG3FuB,EAAuBC,EAA4B,CACrDV,UAAWA,IAGfW,EAAU,KACN3B,EAAM4B,gBAAgBH,EAAqBI,UAC5C,CAAC7B,EAAM4B,kBAEV,MAQME,EAAe,KACjBd,EAAU,WACVX,EAAS,CAAE0B,KAAM,CAAEX,aAYvB,OAJAO,EAAU,KACN3B,EAAMgC,SAAS,CAAED,KAAM,CAAEX,UAAUF,aACpC,CAACE,EAAQF,IAEG,UAAXH,EAEIkB,EAACC,MAAAA,CAAIC,UAAU,gCACXF,EAACG,EAAAA,CACGD,UAAU,mE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AUF,aA8Db4C,SAAqB,YAAX/C,EACVgD,MAAO,GAAGvD,EAAKgC,IAAI,uBAM3C,CAEAzC,EAAkBiE,aAAe,CAC7B5D,SAAU,OACV4B,SAAU,OACV3B,SAAU,OACVJ,SAAU,CAAA,EACVK,kBAAkB"}
@@ -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/DragonpayInput/DragonpayInput.js";import n from"./components/DragonpayVoucherResult/DragonpayVoucherResult.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){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}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 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 p extends e{get isValid(){return!!this.state.isValid}formatData(){const{issuer:t,shopperEmail:e}=this.state.data;return a(i({},e&&{shopperEmail:e}),{paymentMethod:a(i({},t&&{issuer:t}),{type:this.type})})}formatProps(t){var e,r,n;return a(i({},t),{issuers:null!==(e=null===(n=t.details)||void 0===n||null===(r=n.find(t=>"issuer"===t.key))||void 0===r?void 0:r.items)&&void 0!==e?e:t.issuers})}componentToRender(){return this.props.reference?t(n,a(i({icon:this.icon},this.props),{onActionHandled:this.onActionHandled})):t(r,a(i({setComponentRef:this.setComponentRef,items:this.props.issuers},this.props),{showPayButton:this.props.showPayButton,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}}s(p,"type",o.dragonpay),s(p,"txVariants",[o.dragonpay,o.dragonpay_ebanking,o.dragonpay_otc_banking,o.dragonpay_otc_non_banking,o.dragonpay_otc_philippines]);export{p as DragonpayElement,p 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/DragonpayInput/DragonpayInput.js";import n from"./components/DragonpayVoucherResult/DragonpayVoucherResult.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){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}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 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 p extends e{get isValid(){return!!this.state.isValid}formatData(){const{issuer:t,shopperEmail:e}=this.state.data;return a(i({},e&&{shopperEmail:e}),{paymentMethod:a(i({},t&&{issuer:t}),{type:this.type})})}formatProps(t){var e,r,n;return a(i({},t),{issuers:null!==(e=null===(n=t.details)||void 0===n||null===(r=n.find(t=>"issuer"===t.key))||void 0===r?void 0:r.items)&&void 0!==e?e:t.issuers})}componentToRender(){return this.props.reference?t(n,a(i({icon:this.icon},this.props),{onActionHandled:this.onActionHandled})):t(r,a(i({setComponentRef:this.setComponentRef,items:this.props.issuers},this.props),{onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}}s(p,"type",o.dragonpay),s(p,"txVariants",[o.dragonpay,o.dragonpay_ebanking,o.dragonpay_otc_banking,o.dragonpay_otc_non_banking,o.dragonpay_otc_philippines]);export{p as DragonpayElement,p as default};
2
2
  //# sourceMappingURL=Dragonpay.js.map