@adyen/adyen-web 6.30.0 → 6.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/dist/cjs/adyen.css +2 -2
  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 +557 -484
  6. package/dist/es/adyen.css +2 -2
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  9. package/dist/es/components/Ach/Ach.js +1 -1
  10. package/dist/es/components/Ach/Ach.js.map +1 -1
  11. package/dist/es/components/Ach/components/AccountTypeSelector.js.map +1 -1
  12. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  13. package/dist/es/components/Affirm/Affirm.js.map +1 -1
  14. package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
  15. package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
  16. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  17. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  18. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  19. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  20. package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
  21. package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
  22. package/dist/es/components/AmazonPay/utils.js +1 -1
  23. package/dist/es/components/AmazonPay/utils.js.map +1 -1
  24. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  25. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  26. package/dist/es/components/ApplePay/services/ApplePayService.js +1 -1
  27. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  28. package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
  29. package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -1
  30. package/dist/es/components/Atome/Atome.js.map +1 -1
  31. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  32. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  33. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  34. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  35. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  36. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  37. package/dist/es/components/Blik/Blik.js +1 -1
  38. package/dist/es/components/Blik/Blik.js.map +1 -1
  39. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  40. package/dist/es/components/Card/Card.js +1 -1
  41. package/dist/es/components/Card/Card.js.map +1 -1
  42. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  43. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  44. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  45. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  46. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  47. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  48. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  49. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  50. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  51. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  52. package/dist/es/components/Card/components/ClickToPayWrapper.js +1 -1
  53. package/dist/es/components/Card/components/ClickToPayWrapper.js.map +1 -1
  54. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  55. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  56. package/dist/es/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
  57. package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
  58. package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
  59. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  60. package/dist/es/components/ClickToPay/ClickToPay.js +1 -1
  61. package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
  62. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  63. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  64. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  65. package/dist/es/components/Dropin/Dropin.js +1 -1
  66. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  67. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  68. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  69. package/dist/es/components/Dropin/components/DropinSuccessState.js +2 -0
  70. package/dist/es/components/Dropin/components/DropinSuccessState.js.map +1 -0
  71. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  72. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  73. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  74. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  75. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  76. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  77. package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
  78. package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
  79. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  80. package/dist/es/components/Iris/Iris.js +1 -1
  81. package/dist/es/components/Iris/Iris.js.map +1 -1
  82. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  83. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  84. package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  85. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  86. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  87. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  88. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  89. package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
  90. package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
  91. package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  92. package/dist/es/components/PayByBankPix/services/PasskeyService.js.map +1 -1
  93. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  94. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  95. package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  96. package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  97. package/dist/es/components/PayTo/PayTo.js +1 -1
  98. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  99. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  100. package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
  101. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  102. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  103. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  104. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  105. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  106. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  107. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  108. package/dist/es/components/Twint/Twint.js +1 -1
  109. package/dist/es/components/Twint/Twint.js.map +1 -1
  110. package/dist/es/components/UPI/UPI.js +1 -1
  111. package/dist/es/components/UPI/UPI.js.map +1 -1
  112. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  113. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  114. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  115. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  116. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  117. package/dist/es/components/internal/Await/Await.js +1 -1
  118. package/dist/es/components/internal/Await/Await.js.map +1 -1
  119. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  120. package/dist/es/components/internal/Button/Button.js +1 -1
  121. package/dist/es/components/internal/Button/Button.js.map +1 -1
  122. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  123. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  124. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  125. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  126. package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
  127. package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
  128. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  129. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  130. package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  131. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  132. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  133. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  134. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  135. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  136. package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  137. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  138. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  139. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  140. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  141. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  142. package/dist/es/components/internal/PayButton/utils.js +1 -1
  143. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  144. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  145. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  146. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  147. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  148. package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
  149. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  150. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  151. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  152. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  153. package/dist/es/components/internal/SecuredFields/utils.js.map +1 -1
  154. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  155. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  156. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  157. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  158. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  159. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  160. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  161. package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
  162. package/dist/es/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
  163. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  164. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  165. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  166. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  167. package/dist/es/core/Analytics/utils.js +1 -1
  168. package/dist/es/core/Analytics/utils.js.map +1 -1
  169. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  170. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  171. package/dist/es/core/Context/AmountProvider.js +2 -0
  172. package/dist/es/core/Context/AmountProvider.js.map +1 -0
  173. package/dist/es/core/Context/Resources.js.map +1 -1
  174. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  175. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  176. package/dist/es/core/config.js +1 -1
  177. package/dist/es/core/core.js +1 -1
  178. package/dist/es/core/core.js.map +1 -1
  179. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  180. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  181. package/dist/es/external/preact/dist/preact.js +1 -1
  182. package/dist/es/external/preact/dist/preact.js.map +1 -1
  183. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  184. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  185. package/dist/es/index.d.ts +557 -484
  186. package/dist/es/language/Language.js.map +1 -1
  187. package/dist/es/utils/Script.js.map +1 -1
  188. package/dist/es/utils/Storage.js +1 -1
  189. package/dist/es/utils/Storage.js.map +1 -1
  190. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  191. package/dist/es/utils/Validator/Validator.js.map +1 -1
  192. package/dist/es/utils/amount-util.js +1 -1
  193. package/dist/es/utils/amount-util.js.map +1 -1
  194. package/dist/es/utils/browserInfo.js +1 -1
  195. package/dist/es/utils/browserInfo.js.map +1 -1
  196. package/dist/es/utils/constants/currency-minor-units.js.map +1 -1
  197. package/dist/es/utils/createSdkData.js.map +1 -1
  198. package/dist/es/utils/getErrorMessage.js.map +1 -1
  199. package/dist/es/utils/getProp.js +1 -1
  200. package/dist/es/utils/getProp.js.map +1 -1
  201. package/dist/es/utils/hasOwnProperty.js.map +1 -1
  202. package/dist/es/utils/isValidURL.js.map +1 -1
  203. package/dist/es/utils/listenerUtils.js.map +1 -1
  204. package/dist/es/utils/promiseTimeout.js.map +1 -1
  205. package/dist/es/utils/textUtils.js.map +1 -1
  206. package/dist/es/utils/validator-utils.js.map +1 -1
  207. package/dist/es-legacy/adyen.css +2 -2
  208. package/dist/es-legacy/adyen.css.map +1 -1
  209. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  210. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  211. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  212. package/dist/es-legacy/components/Ach/components/AccountTypeSelector.js.map +1 -1
  213. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  214. package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
  215. package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
  216. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
  217. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  218. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  219. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  220. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  221. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
  222. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
  223. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  224. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  225. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  226. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  227. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js +1 -1
  228. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  229. package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
  230. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  231. package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
  232. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  233. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  234. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  235. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  236. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  237. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  238. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  239. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  240. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  241. package/dist/es-legacy/components/Card/Card.js +1 -1
  242. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  243. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  244. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  245. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  246. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  247. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  248. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  249. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  250. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  251. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  252. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  253. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  254. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  255. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  256. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  257. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  258. package/dist/es-legacy/components/Card/components/Fastlane/USOnlyPhoneInput.js.map +1 -1
  259. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  260. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  261. package/dist/es-legacy/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
  262. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
  263. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
  264. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  265. package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
  266. package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
  267. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  268. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  269. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  270. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  271. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  272. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  273. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  274. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  275. package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js +2 -0
  276. package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js.map +1 -0
  277. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  278. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  279. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  280. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  281. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  282. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  283. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
  284. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
  285. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  286. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  287. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  288. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  289. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  290. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  291. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  292. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  293. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  294. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  295. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  296. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  297. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  298. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
  299. package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
  300. package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
  301. package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  302. package/dist/es-legacy/components/PayByBankPix/services/PasskeyService.js.map +1 -1
  303. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  304. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  305. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  306. package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  307. package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  308. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  309. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  310. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  311. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
  312. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  313. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
  314. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  315. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  316. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  317. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  318. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  319. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  320. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  321. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  322. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  323. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  324. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  325. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  326. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  327. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  328. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  329. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  330. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  331. package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
  332. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  333. package/dist/es-legacy/components/internal/Await/Await.js +1 -1
  334. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  335. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  336. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  337. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  338. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  339. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  340. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  341. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  342. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  343. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  344. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  345. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
  346. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
  347. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  348. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  349. package/dist/es-legacy/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  350. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  351. package/dist/es-legacy/components/internal/ClickToPay/services/create-clicktopay-service.js.map +1 -1
  352. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  353. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  354. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  355. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  356. package/dist/es-legacy/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  357. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  358. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  359. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  360. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +1 -1
  361. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  362. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  363. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  364. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  365. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  366. package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
  367. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  368. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  369. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  370. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  371. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  372. package/dist/es-legacy/components/internal/QRLoader/QRLoader.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.map +1 -1
  376. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  377. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  378. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  379. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
  380. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  381. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  382. package/dist/es-legacy/components/internal/SecuredFields/utils.js.map +1 -1
  383. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  384. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  385. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  386. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  387. package/dist/es-legacy/components/internal/Tooltip/Tooltip.js.map +1 -1
  388. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  389. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  390. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  391. package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
  392. package/dist/es-legacy/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
  393. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  394. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  395. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  396. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  397. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  398. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  399. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
  400. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
  401. package/dist/es-legacy/core/Context/AmountProvider.js +2 -0
  402. package/dist/es-legacy/core/Context/AmountProvider.js.map +1 -0
  403. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  404. package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
  405. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  406. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  407. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  408. package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  409. package/dist/es-legacy/core/Services/http.js.map +1 -1
  410. package/dist/es-legacy/core/config.js +1 -1
  411. package/dist/es-legacy/core/core.js +1 -1
  412. package/dist/es-legacy/core/core.js.map +1 -1
  413. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  414. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  415. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  416. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  417. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  418. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  419. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  420. package/dist/es-legacy/language/Language.js.map +1 -1
  421. package/dist/es-legacy/utils/Script.js.map +1 -1
  422. package/dist/es-legacy/utils/Storage.js +1 -1
  423. package/dist/es-legacy/utils/Storage.js.map +1 -1
  424. package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
  425. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  426. package/dist/es-legacy/utils/amount-util.js +1 -1
  427. package/dist/es-legacy/utils/amount-util.js.map +1 -1
  428. package/dist/es-legacy/utils/browserInfo.js +1 -1
  429. package/dist/es-legacy/utils/browserInfo.js.map +1 -1
  430. package/dist/es-legacy/utils/constants/currency-minor-units.js.map +1 -1
  431. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  432. package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
  433. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  434. package/dist/es-legacy/utils/getProp.js +1 -1
  435. package/dist/es-legacy/utils/getProp.js.map +1 -1
  436. package/dist/es-legacy/utils/hasOwnProperty.js.map +1 -1
  437. package/dist/es-legacy/utils/isValidURL.js.map +1 -1
  438. package/dist/es-legacy/utils/listenerUtils.js.map +1 -1
  439. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  440. package/dist/es-legacy/utils/textUtils.js.map +1 -1
  441. package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
  442. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  443. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  444. package/package.json +11 -11
  445. package/styles/adyen.css +2 -2
@@ -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 { InstallmentOptions } from './components/types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\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, PaymentAmount } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\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;\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 amount?: PaymentAmount;\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?: string;\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?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: (o: CardAllValidData) => {};\n onAutoComplete?: (o: CardAutoCompleteData) => {};\n onBinValue?: (o: CardBinValueData) => {};\n onBlur?: (e) => {};\n onBrand?: (o: CardBrandData) => {};\n onConfigSuccess?: (O: CardConfigSuccessData) => {};\n onChange?: (state) => {};\n onError?: () => {};\n onFieldValid?: (o: CardFieldValidData) => {};\n onFocus?: (e) => {};\n onLoad?: (o: CardLoadData) => {};\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (obj) => {};\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?: any;\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"],"names":["AddressModeOptions"],"mappings":"AA2MO,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 { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\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';\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;\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?: string;\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?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: (o: CardAllValidData) => {};\n onAutoComplete?: (o: CardAutoCompleteData) => {};\n onBinValue?: (o: CardBinValueData) => {};\n onBlur?: (e) => {};\n onBrand?: (o: CardBrandData) => {};\n onConfigSuccess?: (O: CardConfigSuccessData) => {};\n onChange?: (state) => {};\n onError?: () => {};\n onFieldValid?: (o: CardFieldValidData) => {};\n onFocus?: (e) => {};\n onLoad?: (o: CardLoadData) => {};\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: 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?: any;\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"],"names":["AddressModeOptions"],"mappings":"AA4MO,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 r,KCP_CARD_NAME_BOTTOM as i,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as a,CREDIT_CARD as s,KCP_CARD as l,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"===e?.plan||e?.value>1,g=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=s;const h=e.hasHolderName&&e.holderNameRequired;if(h&&(C=e.positionHolderNameOnTop?o:n),c&&(C=l,h&&(C=e.positionHolderNameOnTop?r:i)),u&&(C=d,h&&(C=e.positionHolderNameOnTop?t:a)),m){const r=m.flat(2).filter(e=>"number"!=typeof e);let i=r;p&&(i=r.filter(e=>p.includes(e))),C=s.concat(i),h&&(C=e.positionHolderNameOnTop?o.concat(i):n.concat(i))}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 n?.[e]?o.get(n?.[e]):o.get(e);default:return null}},y=e=>({amount:e.amount,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,handleKeyPress:e.handleKeyPress,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){return u[e]??e}const x=(e,o)=>e.map(e=>{const n=e.id,r=m(),i="card"===n?"nocard":n,t=o[n]?.icon??C(i,r);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:t,altName:S(n)}}),A=(e,o,n)=>o.some(o=>e.includes(o[n]));export{y as extractPropsForCardFields,O as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,g as getLayout,b as handlePartialAddressMode,h as hasValidInstallmentsObject,f as lookupBlurBasedErrors,x as mapDualBrandButtons,R as mapFieldKey,A as mustHandleDualBrandingAccordingToEURegulations};
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 r,KCP_CARD_NAME_BOTTOM as i,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as a,CREDIT_CARD as s,KCP_CARD as l,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(e?.plan)||e?.value>1,g=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=s;const h=e.hasHolderName&&e.holderNameRequired;if(h&&(C=e.positionHolderNameOnTop?o:n),c&&(C=l,h&&(C=e.positionHolderNameOnTop?r:i)),u&&(C=d,h&&(C=e.positionHolderNameOnTop?t:a)),m){const r=m.flat(2).filter(e=>"number"!=typeof e);let i=r;p&&(i=r.filter(e=>p.includes(e))),C=s.concat(i),h&&(C=e.positionHolderNameOnTop?o.concat(i):n.concat(i))}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 n?.[e]?o.get(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}),b=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,handleKeyPress:e.handleKeyPress,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),O=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){return u[e]??e}const x=(e,o)=>e.map(e=>{const n=e.id,r=m(),i="card"===n?"nocard":n,t=o[n]?.icon??C(i,r);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:t,altName:S(n)}}),A=(e,o,n)=>o.some(o=>e.includes(o[n]));export{y as extractPropsForCardFields,b as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,g as getLayout,O as handlePartialAddressMode,f as lookupBlurBasedErrors,x as mapDualBrandButtons,R as mapFieldKey,A as mustHandleDualBrandingAccordingToEURegulations,h as shouldIncludeInstallmentsInPaymentData};
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 { InstallmentsObj } 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 } 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 * Verifies that installment object is valid to send to the Backend.\n * Valid means that it has 'revolving' plan set, or the number of installments is bigger than one\n */\nexport const hasValidInstallmentsObject = (installments?: InstallmentsObj) => {\n return installments?.plan === 'revolving' || installments?.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') as string[];\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 amount, hasCVC, installmentOptions)\n amount: props.amount,\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) => {\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 handleKeyPress: props.handleKeyPress,\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 } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\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) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const mapDualBrandButtons = (dualBrandSelectElements: DualBrandSelectElement[], brandsConfiguration: CardBrandsConfiguration): any => {\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 * Only if the brands in EU_BrandArray are present in the binLookup response should we handle dual branding based on EU regulations\n *\n * If the result from Array.some is true - then we are in a EU dual branding regulation scenario, i.e.\n * - Show the new dualBranding UI Buttons\n * - Preselect a card brand\n */\nexport const mustHandleDualBrandingAccordingToEURegulations = (\n EU_BrandArray: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => EU_BrandArray.includes(item[key]));\n"],"names":["getCardImageUrl","brand","getImage","type","extension","hasValidInstallmentsObject","installments","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","includes","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","amount","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","handleKeyPress","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","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","name","brandObject","localeBrand","altName","mustHandleDualBrandingAccordingToEURegulations","EU_BrandArray","returnedDualBrandingObjects","some"],"mappings":"ojBAsBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GAOrBI,EAA8BC,GACT,cAAvBA,GAAcC,MAAwBD,GAAcE,MAAQ,EAG1DC,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,EAA4BH,EAA2BC,OAAOG,GAAKnB,EAA6BoB,SAASD,KAG7GlB,EAASC,EAAYmB,OAAOH,GACxBf,IACAF,EAASL,EAAMU,wBACTC,EAAqBc,OAAOH,GAC5BV,EAAwBa,OAAOH,GAG7C,CACA,OAAOjB,GAMEqB,EAAc,CAACC,EAAaC,EAAgBC,KAErD,OAAQF,GACJ,IAAK,uBACD,OAAOC,EAAKE,IAAI,UAAUH,KAE9B,IAAK,SACL,IAAK,oBACL,IAAK,aACL,IAAK,kBACL,IAAK,OACL,IAAK,UACD,OAAOE,IAAwBF,GAAOC,EAAKE,IAAID,IAAwBF,IAAQC,EAAKE,IAAIH,GAE5F,QACI,OAAO,OAINI,EAA6B/B,IAC/B,CAEHgC,OAAQhC,EAAMgC,OACdC,uBAAwBjC,EAAMiC,uBAC9B7B,6BAA8BJ,EAAMI,6BACpC8B,+BAAgClC,EAAMkC,+BACtCC,oBAAqBnC,EAAMmC,oBAC3BC,yBAA0BpC,EAAMoC,yBAChCC,OAAQrC,EAAMqC,OACd7B,cAAeR,EAAMQ,cACrBC,mBAAoBT,EAAMS,mBAC1B6B,mBAAoBtC,EAAMsC,mBAC1BC,aAAcvC,EAAMuC,aACpB7B,wBAAyBV,EAAMU,wBAE/B8B,cAAexC,EAAMwC,cACrBC,sBAAuBzC,EAAMyC,sBAE7BC,SAAU1C,EAAM0C,SAChBC,YAAa3C,EAAM2C,YACnBC,WAAY5C,EAAM4C,WAClBC,kBAAmB7C,EAAM6C,oBAIpBC,EAAsB9C,IACxB,CACH+C,UAAW/C,EAAM+C,UACjBC,OAAQhD,EAAMgD,OACdb,oBAAqBnC,EAAMmC,oBAC3Bc,UAAWjD,EAAMiD,UACjBC,YAAalD,EAAMkD,YACnBC,YAAanD,EAAMmD,YACnBvB,KAAM5B,EAAM4B,KACZwB,mBAAoBpD,EAAMoD,mBAC1BC,UAAWrD,EAAMqD,UACjBC,gBAAiBtD,EAAMsD,gBACvBC,eAAgBvD,EAAMuD,eACtBC,iBAAkBxD,EAAMwD,iBACxBC,iBAAkBzD,EAAMyD,iBACxBC,kBAAmB1D,EAAM0D,kBACzBC,qBAAsB3D,EAAM2D,qBAC5BC,sBAAuB5D,EAAM4D,sBAC7BC,WAAY7D,EAAM6D,WAClBC,eAAgB9D,EAAM8D,eACtBC,WAAY/D,EAAM+D,WAClBC,gBAAiBhE,EAAMgE,gBACvBC,eAAgBjE,EAAMiE,eACtBC,QAASlE,EAAMkE,QACfC,aAAcnE,EAAMmE,aACpBC,OAAQpE,EAAMoE,OACd7B,aAAcvC,EAAMuC,aACpB8B,UAAWrE,EAAMqE,UACjB5B,sBAAuBzC,EAAMyC,sBAC7B6B,aAActE,EAAMsE,aACpBC,sBAAuBvE,EAAMuE,wBAIxBC,EAA4BC,GAC9BA,GAAeC,EAAmBC,QAAUC,EAAyB,KAIzE,SAASC,EAAsBC,GAElC,OAAQ,CACJC,EAAcC,mCACdD,EAAcE,uBACdF,EAAcG,iCACdH,EAAcI,iCAChB3D,SAASsD,EACf,CAEO,SAASM,EAAiB7F,GAC7B,OAAO8F,EAAwB9F,IAAUA,CAC7C,CAEO,MAAM+F,EAAsB,CAACC,EAAmDpD,IAC5EoD,EAAwBC,IAAInE,IAC/B,MAAM9B,EAAQ8B,EAAKoE,GACbjG,EAAWkG,IACXC,EAAsB,SAAVpG,EAAmB,SAAWA,EAC1CqG,EAAWzD,EAAoB5C,IAAQsG,MAAQvG,EAAgBqG,EAAWnG,GAIhF,MAAO,CACHiG,GAAIpE,EAAKoE,GACTK,KAAMzE,EAAK0E,YAAYC,aAAe3E,EAAK0E,YAAYxG,MACvDqG,WACAK,QAASb,EAAiB7F,MAYzB2G,EAAiD,CAC1DC,EACAC,EACAzE,IACCyE,EAA4BC,KAAKhF,GAAQ8E,EAAc3E,SAASH,EAAKM"}
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 { 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 } 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') as string[];\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) => {\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 handleKeyPress: props.handleKeyPress,\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 } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\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) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const mapDualBrandButtons = (dualBrandSelectElements: DualBrandSelectElement[], brandsConfiguration: CardBrandsConfiguration): any => {\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 * Only if the brands in EU_BrandArray are present in the binLookup response should we handle dual branding based on EU regulations\n *\n * If the result from Array.some is true - then we are in a EU dual branding regulation scenario, i.e.\n * - Show the new dualBranding UI Buttons\n * - Preselect a card brand\n */\nexport const mustHandleDualBrandingAccordingToEURegulations = (\n EU_BrandArray: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => EU_BrandArray.includes(item[key]));\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","handleKeyPress","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","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","name","brandObject","localeBrand","altName","mustHandleDualBrandingAccordingToEURegulations","EU_BrandArray","returnedDualBrandingObjects","some"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import o from"../../internal/ClickToPay/context/ClickToPayProvider.js";import t from"./ClickToPayHolder.js";import{createElement as e}from"../../../external/preact/dist/preact.js";const n=({amount:n,configuration:r,clickToPayService:a,setClickToPayRef:i,onSetStatus:c,onSubmit:l,onError:m,isStandaloneComponent:s,...u})=>e(o,{isStandaloneComponent:s,configuration:r,amount:n,clickToPayService:a,setClickToPayRef:i,onSetStatus:c,onSubmit:l,onError:m},e(t,null,u.children));export{n as default};
1
+ import o from"../../internal/ClickToPay/context/ClickToPayProvider.js";import t from"./ClickToPayHolder.js";import{createElement as e}from"../../../external/preact/dist/preact.js";const n=({configuration:n,clickToPayService:r,setClickToPayRef:i,onSetStatus:a,onSubmit:c,onError:l,isStandaloneComponent:s,...m})=>e(o,{isStandaloneComponent:s,configuration:n,clickToPayService:r,setClickToPayRef:i,onSetStatus:a,onSubmit:c,onError:l},e(t,null,m.children));export{n as default};
2
2
  //# sourceMappingURL=ClickToPayWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClickToPayWrapper.js","sources":["../../../../../src/components/Card/components/ClickToPayWrapper.tsx"],"sourcesContent":["import ClickToPayProvider, { ClickToPayProviderProps } from '../../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayHolder from './ClickToPayHolder';\nimport { h } from 'preact';\n\nconst ClickToPayWrapper = ({\n amount,\n configuration,\n clickToPayService,\n setClickToPayRef,\n onSetStatus,\n onSubmit,\n onError,\n isStandaloneComponent,\n ...props\n}: ClickToPayProviderProps) => {\n return (\n <ClickToPayProvider\n isStandaloneComponent={isStandaloneComponent}\n configuration={configuration}\n amount={amount}\n clickToPayService={clickToPayService}\n setClickToPayRef={setClickToPayRef}\n onSetStatus={onSetStatus}\n onSubmit={onSubmit}\n onError={onError}\n >\n <ClickToPayHolder>{props.children}</ClickToPayHolder>\n </ClickToPayProvider>\n );\n};\n\nexport default ClickToPayWrapper;\n"],"names":["ClickToPayWrapper","amount","configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent","props","h","ClickToPayProvider","ClickToPayHolder","children"],"mappings":"oLAIA,MAAMA,EAAoB,EACtBC,SACAC,gBACAC,oBACAC,mBACAC,cACAC,WACAC,UACAC,2BACGC,KAGCC,EAACC,EAAAA,CACGH,sBAAuBA,EACvBN,cAAeA,EACfD,OAAQA,EACRE,kBAAmBA,EACnBC,iBAAkBA,EAClBC,YAAaA,EACbC,SAAUA,EACVC,QAASA,GAETG,EAACE,EAAAA,KAAkBH,EAAMI"}
1
+ {"version":3,"file":"ClickToPayWrapper.js","sources":["../../../../../src/components/Card/components/ClickToPayWrapper.tsx"],"sourcesContent":["import ClickToPayProvider, { ClickToPayProviderProps } from '../../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayHolder from './ClickToPayHolder';\nimport { h } from 'preact';\n\nconst ClickToPayWrapper = ({\n configuration,\n clickToPayService,\n setClickToPayRef,\n onSetStatus,\n onSubmit,\n onError,\n isStandaloneComponent,\n ...props\n}: ClickToPayProviderProps) => {\n return (\n <ClickToPayProvider\n isStandaloneComponent={isStandaloneComponent}\n configuration={configuration}\n clickToPayService={clickToPayService}\n setClickToPayRef={setClickToPayRef}\n onSetStatus={onSetStatus}\n onSubmit={onSubmit}\n onError={onError}\n >\n <ClickToPayHolder>{props.children}</ClickToPayHolder>\n </ClickToPayProvider>\n );\n};\n\nexport default ClickToPayWrapper;\n"],"names":["ClickToPayWrapper","configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent","props","h","ClickToPayProvider","ClickToPayHolder","children"],"mappings":"oLAIA,MAAMA,EAAoB,EACtBC,gBACAC,oBACAC,mBACAC,cACAC,WACAC,UACAC,2BACGC,KAGCC,EAACC,EAAAA,CACGH,sBAAuBA,EACvBN,cAAeA,EACfC,kBAAmBA,EACnBC,iBAAkBA,EAClBC,YAAaA,EACbC,SAAUA,EACVC,QAASA,GAETG,EAACE,EAAAA,KAAkBH,EAAMI"}
@@ -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 s}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as r}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import"../internal/Button/Button.js";import"../../core/Context/CoreProvider.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 d(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class c extends e{formatProps(t){return{...t,enableStoreDetails:t.session?.configuration?.enableStoreDetails||t.enableStoreDetails}}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:s,cashTag:o,customerId:r}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:c.type,storedPaymentMethodId:i}};return{paymentMethod:{type:c.type,...e&&{grantId:e},...r&&{customerId:r},...s&&o&&{onFileGrantId:s,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(){return this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,label:a(this.props.i18n,this.props.amount),icon:this.resources?.getImage({imageFolder:"components/"})(`${h}lock`),name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(s,{ref:t=>{this.componentRef=t},enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize})}constructor(t,e){if(super(t,e),d(this,"cashAppService",void 0),d(this,"submit",()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let s=!1;new Promise((e,s)=>t({resolve:e,reject:s})).catch(()=>{throw s=!0,Error("onClick rejected")}).then(()=>this.cashAppService.createCustomerRequest()).then(()=>{this.cashAppService.begin()}).catch(t=>{s||this.handleError(t)})}),d(this,"handleOnChangeStoreDetails",t=>{const e={...this.state.data,shopperWantsToStore:t};this.setState({data:e})}),d(this,"handleAuthorize",t=>{const e={...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 s=new r({environment:this.props.environment,analytics:this.analytics});this.cashAppService=new o(s,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,amount:this.props.amount,redirectURL:this.props.redirectURL,clientId:this.props.configuration?.clientId,scopeId:this.props.configuration?.scopeId,button:this.props.button,referenceId:this.props.referenceId})}}d(c,"type",p.cashapp),d(c,"defaultProps",n);export{c as CashAppPay,c 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 s}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as r}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 d(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class c extends e{formatProps(t){return{...t,enableStoreDetails:t.session?.configuration?.enableStoreDetails||t.enableStoreDetails}}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:s,cashTag:o,customerId:r}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:c.type,storedPaymentMethodId:i}};return{paymentMethod:{type:c.type,...e&&{grantId:e},...r&&{customerId:r},...s&&o&&{onFileGrantId:s,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(){return this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,label:a(this.props.i18n,this.props.amount),icon:this.resources?.getImage({imageFolder:"components/"})(`${h}lock`),name:this.displayName,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(s,{ref:t=>{this.componentRef=t},enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize})}constructor(t,e){if(super(t,e),d(this,"cashAppService",void 0),d(this,"submit",()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let s=!1;new Promise((e,s)=>t({resolve:e,reject:s})).catch(()=>{throw s=!0,Error("onClick rejected")}).then(()=>this.cashAppService.createCustomerRequest(this.props.amount)).then(()=>{this.cashAppService.begin()}).catch(t=>{s||this.handleError(t)})}),d(this,"handleOnChangeStoreDetails",t=>{const e={...this.state.data,shopperWantsToStore:t};this.setState({data:e})}),d(this,"handleAuthorize",t=>{const e={...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 s=new r({environment:this.props.environment,analytics:this.analytics});this.cashAppService=new o(s,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,redirectURL:this.props.redirectURL,clientId:this.props.configuration?.clientId,scopeId:this.props.configuration?.scopeId,button:this.props.button,referenceId:this.props.referenceId})}}d(c,"type",p.cashapp),d(c,"defaultProps",n);export{c as CashAppPay,c 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';\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 type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static 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 amount: this.props.amount,\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 Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\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 handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private 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 amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\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","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","h","RedirectButton","showPayButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","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":"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"}
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 type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static 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 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 handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private 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 ref={ref => {\n this.componentRef = ref;\n }}\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","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","h","RedirectButton","showPayButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","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":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppSdkLoader.js","sources":["../../../../../src/components/CashAppPay/services/CashAppSdkLoader.ts"],"sourcesContent":["import { CASHAPPPAY_PROD_SDK, CASHAPPPAY_SANDBOX_SDK } from './config';\nimport Script from '../../../utils/Script';\nimport { ICashAppWindowObject } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface ICashAppSdkLoader {\n load(environment: string): Promise<ICashAppWindowObject>;\n}\n\nclass CashAppSdkLoader implements ICashAppSdkLoader {\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore CashApp is created by the Cash App SDK\n return !!window.CashApp;\n }\n\n public async load(): Promise<ICashAppWindowObject> {\n const src = this.environment.toLowerCase().includes('live') ? CASHAPPPAY_PROD_SDK : CASHAPPPAY_SANDBOX_SDK;\n\n if (!this.isSdkIsAvailableOnWindow()) {\n const scriptElement = new Script({\n src,\n component: 'cashapppay',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n }\n\n // @ts-ignore CashApp is created by the Cash App SDK\n return window.CashApp;\n }\n}\n\nexport { CashAppSdkLoader };\n"],"names":["CashAppSdkLoader","isSdkIsAvailableOnWindow","window","CashApp","load","src","this","environment","toLowerCase","includes","CASHAPPPAY_PROD_SDK","CASHAPPPAY_SANDBOX_SDK","scriptElement","Script","component","analytics","constructor","_define_property"],"mappings":"8OASA,MAAMA,EASMC,wBAAAA,GAEJ,QAASC,OAAOC,OACpB,CAEA,UAAaC,GACT,MAAMC,EAAMC,KAAKC,YAAYC,cAAcC,SAAS,QAAUC,EAAsBC,EAEpF,IAAKL,KAAKL,2BAA4B,CAClC,MAAMW,EAAgB,IAAIC,EAAO,CAC7BR,MACAS,UAAW,aACXC,UAAWT,KAAKS,kBAGdH,EAAcR,MACxB,CAGA,OAAOF,OAAOC,OAClB,CAzBA,WAAAa,EAAYD,UAAEA,EAASR,YAAEA,IAHzBU,EAAAX,KAAiBS,iBAAjB,GACAE,EAAAX,KAAiBC,mBAAjB,GAGID,KAAKS,UAAYA,EACjBT,KAAKC,YAAcA,CACvB"}
1
+ {"version":3,"file":"CashAppSdkLoader.js","sources":["../../../../../src/components/CashAppPay/services/CashAppSdkLoader.ts"],"sourcesContent":["import { CASHAPPPAY_PROD_SDK, CASHAPPPAY_SANDBOX_SDK } from './config';\nimport Script from '../../../utils/Script';\nimport { ICashAppWindowObject } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface ICashAppSdkLoader {\n load(environment: string): Promise<ICashAppWindowObject>;\n}\n\nclass CashAppSdkLoader implements ICashAppSdkLoader {\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore CashApp is created by the Cash App SDK\n return !!window.CashApp;\n }\n\n public async load(): Promise<ICashAppWindowObject> {\n const src = this.environment.toLowerCase().includes('live') ? CASHAPPPAY_PROD_SDK : CASHAPPPAY_SANDBOX_SDK;\n\n if (!this.isSdkIsAvailableOnWindow()) {\n const scriptElement = new Script({\n src,\n component: 'cashapppay',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n }\n\n // @ts-ignore CashApp is created by the Cash App SDK\n return window.CashApp;\n }\n}\n\nexport { CashAppSdkLoader };\n"],"names":["CashAppSdkLoader","isSdkIsAvailableOnWindow","window","CashApp","load","src","this","environment","toLowerCase","includes","CASHAPPPAY_PROD_SDK","CASHAPPPAY_SANDBOX_SDK","scriptElement","Script","component","analytics","constructor","_define_property"],"mappings":"8OASA,MAAMA,EASMC,wBAAAA,GAEJ,QAASC,OAAOC,OACpB,CAEA,UAAaC,GACT,MAAMC,EAAMC,KAAKC,YAAYC,cAAcC,SAAS,QAAUC,EAAsBC,EAEpF,IAAKL,KAAKL,2BAA4B,CAClC,MAAMW,EAAgB,IAAIC,EAAO,CAC7BR,MACAS,UAAW,aACXC,UAAWT,KAAKS,kBAGdH,EAAcR,MACxB,CAGA,OAAOF,OAAOC,OAClB,CAzBA,WAAAa,EAAYD,UAAEA,EAASR,YAAEA,IAHzBU,EAAAX,KAAiBS,oBACjBE,EAAAX,KAAiBC,sBAGbD,KAAKS,UAAYA,EACjBT,KAAKC,YAAcA,CACvB"}
@@ -1,2 +1,2 @@
1
- import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class i{get hasOneTimePayment(){const{amount:t}=this.configuration;return t?.value>0}get hasOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,i=await this.sdkLoader.load(t);this.pay=await i.pay({clientId:e})}catch(e){throw new t("ERROR","Error during initialization",{cause:e})}}async renderButton(e){try{const{button:t,useCashAppButtonUi:i}=this.configuration,{begin:n}=await this.pay.render(e,{manage:!1,button:!!i&&{width:"full",shape:"semiround",...t}});this.startAuthorization=n}catch(e){throw new t("ERROR","Error rendering CashAppPay button",{cause:e})}}begin(){this.startAuthorization?this.startAuthorization():console.warn("CashAppService - begin() not available")}subscribeToEvent(t,e){return this.pay.addEventListener(t,e),()=>{this.pay.removeEventListener(t,e)}}async createCustomerRequest(){try{const{referenceId:t,amount:e,scopeId:i,redirectURL:n=window.location.href}=this.configuration,r={referenceId:t,redirectURL:n,actions:{...this.hasOneTimePayment&&{payment:{amount:e,scopeId:i}},...this.hasOnFilePayment&&{onFile:{scopeId:i}}}};await this.pay.customerRequest(r)}catch(e){throw new t("ERROR","Something went wrong during customerRequest creation",{cause:e})}}async restart(){await this.pay.restart()}constructor(t,i){e(this,"sdkLoader",void 0),e(this,"configuration",void 0),e(this,"pay",void 0),e(this,"startAuthorization",void 0),this.configuration=i,this.sdkLoader=t,i.clientId||console.warn("CashAppService: clientId is missing")}}export{i as default};
1
+ import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class i{isOneTimePayment(t){return t?.value>0}isOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,i=await this.sdkLoader.load(t);this.pay=await i.pay({clientId:e})}catch(e){throw new t("ERROR","Error during initialization",{cause:e})}}async renderButton(e){try{const{button:t,useCashAppButtonUi:i}=this.configuration,{begin:n}=await this.pay.render(e,{manage:!1,button:!!i&&{width:"full",shape:"semiround",...t}});this.startAuthorization=n}catch(e){throw new t("ERROR","Error rendering CashAppPay button",{cause:e})}}begin(){this.startAuthorization?this.startAuthorization():console.warn("CashAppService - begin() not available")}subscribeToEvent(t,e){return this.pay.addEventListener(t,e),()=>{this.pay.removeEventListener(t,e)}}async createCustomerRequest(e){try{const{referenceId:t,scopeId:i,redirectURL:n=window.location.href}=this.configuration,r={referenceId:t,redirectURL:n,actions:{...this.isOneTimePayment(e)&&{payment:{amount:e,scopeId:i}},...this.isOnFilePayment()&&{onFile:{scopeId:i}}}};await this.pay.customerRequest(r)}catch(e){throw new t("ERROR","Something went wrong during customerRequest creation",{cause:e})}}async restart(){await this.pay.restart()}constructor(t,i){e(this,"sdkLoader",void 0),e(this,"configuration",void 0),e(this,"pay",void 0),e(this,"startAuthorization",void 0),this.configuration=i,this.sdkLoader=t,i.clientId||console.warn("CashAppService: clientId is missing")}}export{i as default};
2
2
  //# sourceMappingURL=CashAppService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n get hasOneTimePayment() {\n const { amount } = this.configuration;\n return amount?.value > 0;\n }\n\n get hasOnFilePayment() {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(): Promise<void> {\n try {\n const { referenceId, amount, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.hasOneTimePayment && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.hasOnFilePayment && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","hasOneTimePayment","amount","this","configuration","value","hasOnFilePayment","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","clientId","cashApp","sdkLoader","load","pay","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","width","shape","startAuthorization","console","warn","subscribeToEvent","eventType","callback","addEventListener","removeEventListener","createCustomerRequest","referenceId","scopeId","redirectURL","window","location","href","customerRequest","actions","payment","onFile","restart","constructor","_define_property"],"mappings":"kLAIe,MAAMA,EAoBjB,qBAAIC,GACA,MAAMC,OAAEA,GAAWC,KAAKC,cACxB,OAAOF,GAAQG,MAAQ,CAC3B,CAEA,oBAAIC,GACA,OAAOH,KAAKC,cAAcG,kBAC9B,CAEOC,qBAAAA,CAAsBC,GACzBN,KAAKC,cAAcG,mBAAqBE,CAC5C,CAEA,gBAAaC,GACT,IACI,MAAMC,YAAEA,EAAWC,SAAEA,GAAaT,KAAKC,cACjCS,QAAgBV,KAAKW,UAAUC,KAAKJ,GAC1CR,KAAKa,UAAYH,EAAQG,IAAI,CAAEJ,YACnC,CAAE,MAAOK,GACL,MAAM,IAAIC,EAAmB,QAAS,8BAA+B,CAAEC,MAAOF,GAClF,CACJ,CAEA,kBAAaG,CAAaC,GACtB,IACI,MAAMC,OAAEA,EAAMC,mBAAEA,GAAuBpB,KAAKC,eAEtCoB,MAAEA,SAAgBrB,KAAKa,IAAIS,OAAOJ,EAAQ,CAC5CK,QAAQ,EACRJ,SAAQC,GAAqB,CAAEI,MAAO,OAAQC,MAAO,eAAgBN,KAEzEnB,KAAK0B,mBAAqBL,CAC9B,CAAE,MAAOP,GACL,MAAM,IAAIC,EAAmB,QAAS,oCAAqC,CAAEC,MAAOF,GACxF,CACJ,CAEOO,KAAAA,GACErB,KAAK0B,mBACL1B,KAAK0B,qBADoBC,QAAQC,KAAK,yCAE/C,CAEOC,gBAAAA,CAAiBC,EAA6BC,GAEjD,OADA/B,KAAKa,IAAImB,iBAAiBF,EAAWC,GAC9B,KACH/B,KAAKa,IAAIoB,oBAAoBH,EAAWC,GAEhD,CAEA,2BAAaG,GACT,IACI,MAAMC,YAAEA,EAAWpC,OAAEA,EAAMqC,QAAEA,EAAOC,YAAEA,EAAcC,OAAOC,SAASC,MAASxC,KAAKC,cAE5EwC,EAAkB,CACpBN,cACAE,cACAK,QAAS,IACD1C,KAAKF,mBAAqB,CAC1B6C,QAAS,CACL5C,SACAqC,eAGJpC,KAAKG,kBAAoB,CACzByC,OAAQ,CACJR,oBAKVpC,KAAKa,IAAI4B,gBAAgBA,EACnC,CAAE,MAAO3B,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAa+B,SACH7C,KAAKa,IAAIgC,SACnB,CAvFA,WAAAC,CAAYnC,EAA8BV,GAV1C8C,EAAA/C,KAAiBW,iBAAjB,GACAoC,EAAA/C,KAAiBC,qBAAjB,GAEA8C,EAAA/C,KAAQa,WAAR,GAKAkC,EAAA/C,KAAQ0B,0BAAR,GAGI1B,KAAKC,cAAgBA,EACrBD,KAAKW,UAAYA,EAEZV,EAAcQ,UACfkB,QAAQC,KAAK,sCAErB"}
1
+ {"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\nimport { PaymentAmount } from '../../../types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n private isOneTimePayment(amount: PaymentAmount): boolean {\n return amount?.value > 0;\n }\n\n private isOnFilePayment(): boolean {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(amount: PaymentAmount): Promise<void> {\n try {\n const { referenceId, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.isOneTimePayment(amount) && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.isOnFilePayment() && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","isOneTimePayment","amount","value","isOnFilePayment","this","configuration","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","clientId","cashApp","sdkLoader","load","pay","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","width","shape","startAuthorization","console","warn","subscribeToEvent","eventType","callback","addEventListener","removeEventListener","createCustomerRequest","referenceId","scopeId","redirectURL","window","location","href","customerRequest","actions","payment","onFile","restart","constructor","_define_property"],"mappings":"kLAKe,MAAMA,EAoBTC,gBAAAA,CAAiBC,GACrB,OAAOA,GAAQC,MAAQ,CAC3B,CAEQC,eAAAA,GACJ,OAAOC,KAAKC,cAAcC,kBAC9B,CAEOC,qBAAAA,CAAsBC,GACzBJ,KAAKC,cAAcC,mBAAqBE,CAC5C,CAEA,gBAAaC,GACT,IACI,MAAMC,YAAEA,EAAWC,SAAEA,GAAaP,KAAKC,cACjCO,QAAgBR,KAAKS,UAAUC,KAAKJ,GAC1CN,KAAKW,UAAYH,EAAQG,IAAI,CAAEJ,YACnC,CAAE,MAAOK,GACL,MAAM,IAAIC,EAAmB,QAAS,8BAA+B,CAAEC,MAAOF,GAClF,CACJ,CAEA,kBAAaG,CAAaC,GACtB,IACI,MAAMC,OAAEA,EAAMC,mBAAEA,GAAuBlB,KAAKC,eAEtCkB,MAAEA,SAAgBnB,KAAKW,IAAIS,OAAOJ,EAAQ,CAC5CK,QAAQ,EACRJ,SAAQC,GAAqB,CAAEI,MAAO,OAAQC,MAAO,eAAgBN,KAEzEjB,KAAKwB,mBAAqBL,CAC9B,CAAE,MAAOP,GACL,MAAM,IAAIC,EAAmB,QAAS,oCAAqC,CAAEC,MAAOF,GACxF,CACJ,CAEOO,KAAAA,GACEnB,KAAKwB,mBACLxB,KAAKwB,qBADoBC,QAAQC,KAAK,yCAE/C,CAEOC,gBAAAA,CAAiBC,EAA6BC,GAEjD,OADA7B,KAAKW,IAAImB,iBAAiBF,EAAWC,GAC9B,KACH7B,KAAKW,IAAIoB,oBAAoBH,EAAWC,GAEhD,CAEA,2BAAaG,CAAsBnC,GAC/B,IACI,MAAMoC,YAAEA,EAAWC,QAAEA,EAAOC,YAAEA,EAAcC,OAAOC,SAASC,MAAStC,KAAKC,cAEpEsC,EAAkB,CACpBN,cACAE,cACAK,QAAS,IACDxC,KAAKJ,iBAAiBC,IAAW,CACjC4C,QAAS,CACL5C,SACAqC,eAGJlC,KAAKD,mBAAqB,CAC1B2C,OAAQ,CACJR,oBAKVlC,KAAKW,IAAI4B,gBAAgBA,EACnC,CAAE,MAAO3B,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAa+B,SACH3C,KAAKW,IAAIgC,SACnB,CAtFA,WAAAC,CAAYnC,EAA8BR,GAV1C4C,EAAA7C,KAAiBS,oBACjBoC,EAAA7C,KAAiBC,wBAEjB4C,EAAA7C,KAAQW,cAKRkC,EAAA7C,KAAQwB,6BAGJxB,KAAKC,cAAgBA,EACrBD,KAAKS,UAAYA,EAEZR,EAAcM,UACfkB,QAAQC,KAAK,sCAErB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types/global-types';\n\nexport interface ICashAppWindowObject {\n pay({ clientId }: { clientId: string }): Promise<ICashAppSDK>;\n}\n\n/**\n * https://developers.cash.app/docs/api/technical-documentation/sdks/pay-kit/technical-reference\n */\nexport interface ICashAppSDK {\n render(target: string | HTMLElement, options?: any): Promise<{ begin?: () => void }>;\n addEventListener(eventType: CashAppPayEvents, callback: Function): void;\n removeEventListener(eventType: CashAppPayEvents, callback: Function): void;\n customerRequest(customerRequest: any): Promise<void>;\n restart(): Promise<void>;\n}\n\nexport enum CashAppPayEvents {\n CustomerDismissed = 'CUSTOMER_DISMISSED',\n CustomerRequestApproved = 'CUSTOMER_REQUEST_APPROVED',\n CustomerRequestDeclined = 'CUSTOMER_REQUEST_DECLINED',\n CustomerRequestFailed = 'CUSTOMER_REQUEST_FAILED'\n}\n\nexport interface ICashAppService {\n begin(): void;\n initialize(): Promise<void>;\n setStorePaymentMethod(store: boolean): void;\n renderButton(target: HTMLElement): Promise<void>;\n restart(): Promise<void>;\n createCustomerRequest(): Promise<void>;\n subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function;\n}\n\nexport type CashAppServiceConfig = {\n useCashAppButtonUi: boolean;\n storePaymentMethod: boolean;\n environment: string;\n clientId: string;\n scopeId: string;\n amount: PaymentAmount;\n referenceId?: string;\n redirectURL?: string;\n button?: {\n shape?: 'semiround' | 'round';\n size?: 'medium' | 'small';\n theme?: 'dark' | 'light';\n width?: 'static' | 'full';\n };\n};\n"],"names":["CashAppPayEvents"],"mappings":"AAiBO,IAAAA,EAAKA,SAAAA,GAAAA,8MAAAA,CAKX,CALWA,CAKX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types';\n\nexport interface ICashAppWindowObject {\n pay({ clientId }: { clientId: string }): Promise<ICashAppSDK>;\n}\n\n/**\n * https://developers.cash.app/docs/api/technical-documentation/sdks/pay-kit/technical-reference\n */\nexport interface ICashAppSDK {\n render(target: string | HTMLElement, options?: any): Promise<{ begin?: () => void }>;\n addEventListener(eventType: CashAppPayEvents, callback: Function): void;\n removeEventListener(eventType: CashAppPayEvents, callback: Function): void;\n customerRequest(customerRequest: any): Promise<void>;\n restart(): Promise<void>;\n}\n\nexport enum CashAppPayEvents {\n CustomerDismissed = 'CUSTOMER_DISMISSED',\n CustomerRequestApproved = 'CUSTOMER_REQUEST_APPROVED',\n CustomerRequestDeclined = 'CUSTOMER_REQUEST_DECLINED',\n CustomerRequestFailed = 'CUSTOMER_REQUEST_FAILED'\n}\n\nexport interface ICashAppService {\n begin(): void;\n initialize(): Promise<void>;\n setStorePaymentMethod(store: boolean): void;\n renderButton(target: HTMLElement): Promise<void>;\n restart(): Promise<void>;\n createCustomerRequest(amount: PaymentAmount): Promise<void>;\n subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function;\n}\n\nexport type CashAppServiceConfig = {\n useCashAppButtonUi: boolean;\n storePaymentMethod: boolean;\n environment: string;\n clientId: string;\n scopeId: string;\n referenceId?: string;\n redirectURL?: string;\n button?: {\n shape?: 'semiround' | 'round';\n size?: 'medium' | 'small';\n theme?: 'dark' | 'light';\n width?: 'static' | 'full';\n };\n};\n"],"names":["CashAppPayEvents"],"mappings":"AAiBO,IAAAA,EAAKA,SAAAA,GAAAA,8MAAAA,CAKX,CALWA,CAKX,CAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import i from"../../utils/browserInfo.js";import t from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as r}from"../internal/ClickToPay/services/ClickToPayService.js";import s from"../internal/ClickToPay/context/ClickToPayProvider.js";import n from"../internal/ClickToPay/ClickToPayComponent.js";import a from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as c}from"../tx-variants.js";function l(e,o,i){return o in e?Object.defineProperty(e,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[o]=i,e}class p extends o{get isValid(){return!0}get browserInfo(){return i()}formatData(){const{srcScheme:e,srcCorrelationId:o,srcTokenReference:i,srcCheckoutPayload:t,srcDigitalCardId:r}=this.state.data;return{paymentMethod:{type:p.type,...e&&{srcScheme:e},...o&&{srcCorrelationId:o},...i&&{srcTokenReference:i},...t&&{srcCheckoutPayload:t},...r&&{srcDigitalCardId:r}},browserInfo:this.browserInfo,origin:window?.location?.origin}}formatProps(e){return{...e,disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:e.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:e.locale||e.i18n?.locale?.replace("-","_")}}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise((e,o)=>{this.clickToPayService.subscribeOnStateChange(i=>{this.clickToPayService.shopperAccountFound&&e(),i!==r.NotAvailable&&i!==r.Login&&i!==r.Idle||o()})}):Promise.reject()}componentToRender(){return e(s,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,amount:this.props.amount,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(n,null))}constructor(e,o){super(e,o),l(this,"clickToPayService",void 0),l(this,"ctpConfiguration",void 0),l(this,"handleClickToPaySubmit",e=>{this.setState({data:{...e},valid:{},errors:{},isValid:!0}),this.submit()}),this.ctpConfiguration={shopperEmail:this.props.shopperEmail,telephoneNumber:this.props.telephoneNumber,merchantDisplayName:this.props.merchantDisplayName,locale:this.props.locale,onReady:this.props.onReady,onTimeout:this.props.onTimeout},this.clickToPayService=t(this.props.configuration,this.ctpConfiguration,this.props.environment,this.analytics),this.clickToPayService?.initialize().catch(e=>{this.handleError(new a("ERROR",e.toString(),{cause:e}))}),this.clickToPayService||console.warn("ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing")}}l(p,"type",c.clicktopay);export{p as ClickToPayElement,p as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import i from"../../utils/browserInfo.js";import t from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as r}from"../internal/ClickToPay/services/ClickToPayService.js";import s from"../internal/ClickToPay/context/ClickToPayProvider.js";import n from"../internal/ClickToPay/ClickToPayComponent.js";import a from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as c}from"../tx-variants.js";function l(e,o,i){return o in e?Object.defineProperty(e,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[o]=i,e}class p extends o{get isValid(){return!0}get browserInfo(){return i()}formatData(){const{srcScheme:e,srcCorrelationId:o,srcTokenReference:i,srcCheckoutPayload:t,srcDigitalCardId:r}=this.state.data;return{paymentMethod:{type:p.type,...e&&{srcScheme:e},...o&&{srcCorrelationId:o},...i&&{srcTokenReference:i},...t&&{srcCheckoutPayload:t},...r&&{srcDigitalCardId:r}},browserInfo:this.browserInfo,origin:window?.location?.origin}}formatProps(e){return{...e,disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:e.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:e.locale||e.i18n?.locale?.replace("-","_")}}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise((e,o)=>{this.clickToPayService.subscribeOnStateChange(i=>{this.clickToPayService.shopperAccountFound&&e(),i!==r.NotAvailable&&i!==r.Login&&i!==r.Idle||o()})}):Promise.reject()}componentToRender(){return e(s,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(n,null))}constructor(e,o){super(e,o),l(this,"clickToPayService",void 0),l(this,"ctpConfiguration",void 0),l(this,"handleClickToPaySubmit",e=>{this.setState({data:{...e},valid:{},errors:{},isValid:!0}),this.submit()}),this.ctpConfiguration={shopperEmail:this.props.shopperEmail,telephoneNumber:this.props.telephoneNumber,merchantDisplayName:this.props.merchantDisplayName,locale:this.props.locale,onReady:this.props.onReady,onTimeout:this.props.onTimeout},this.clickToPayService=t(this.props.configuration,this.ctpConfiguration,this.props.environment,this.analytics),this.clickToPayService?.initialize().catch(e=>{this.handleError(new a("ERROR",e.toString(),{cause:e}))}),this.clickToPayService||console.warn("ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing")}}l(p,"type",c.clicktopay);export{p as ClickToPayElement,p as default};
2
2
  //# sourceMappingURL=ClickToPay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClickToPay.js","sources":["../../../../src/components/ClickToPay/ClickToPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { ClickToPayConfiguration, ClickToPayPaymentData } from './types';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport { ClickToPayProps } from '../internal/ClickToPay/types';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { CtpState } from '../internal/ClickToPay/services/ClickToPayService';\nimport ClickToPayProvider from '../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayComponent from '../internal/ClickToPay';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\n\nexport class ClickToPayElement extends UIElement<ClickToPayConfiguration> {\n public static type = TxVariants.clicktopay;\n\n private readonly clickToPayService: IClickToPayService | null;\n private readonly ctpConfiguration: ClickToPayProps;\n\n constructor(checkout: ICore, props?: ClickToPayConfiguration) {\n super(checkout, props);\n\n this.ctpConfiguration = {\n shopperEmail: this.props.shopperEmail,\n telephoneNumber: this.props.telephoneNumber,\n merchantDisplayName: this.props.merchantDisplayName,\n locale: this.props.locale,\n onReady: this.props.onReady,\n onTimeout: this.props.onTimeout\n };\n\n this.clickToPayService = createClickToPayService(this.props.configuration, this.ctpConfiguration, this.props.environment, this.analytics);\n\n this.clickToPayService?.initialize().catch(error => {\n this.handleError(new AdyenCheckoutError('ERROR', error.toString(), { cause: error }));\n });\n\n if (!this.clickToPayService) {\n console.warn('ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing');\n }\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n public formatData(): ClickToPayPaymentData {\n const { srcScheme, srcCorrelationId, srcTokenReference, srcCheckoutPayload, srcDigitalCardId } = this.state.data;\n return {\n paymentMethod: {\n type: ClickToPayElement.type,\n ...(srcScheme && { srcScheme }),\n ...(srcCorrelationId && { srcCorrelationId }),\n ...(srcTokenReference && { srcTokenReference }),\n ...(srcCheckoutPayload && { srcCheckoutPayload }),\n ...(srcDigitalCardId && { srcDigitalCardId })\n },\n browserInfo: this.browserInfo,\n origin: window?.location?.origin\n };\n }\n\n protected formatProps(props: ClickToPayConfiguration) {\n return {\n ...props,\n disableOtpAutoFocus: props.disableOtpAutoFocus || false,\n shopperEmail: props.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.locale || props.i18n?.locale?.replace('-', '_')\n };\n }\n\n /**\n * Method used to let the merchant know if the shopper have a valid CtP accoubt\n *\n * Resolves Promise if the Shopper has cookies OR has valid CtP account\n * Rejects Promise if account isn't found or if Login screen is triggered\n */\n public override async isAvailable(): Promise<void> {\n if (!this.clickToPayService) {\n return Promise.reject();\n }\n\n if (this.clickToPayService.shopperAccountFound) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n this.clickToPayService.subscribeOnStateChange((state: CtpState) => {\n if (this.clickToPayService.shopperAccountFound) resolve();\n if (state === CtpState.NotAvailable || state === CtpState.Login || state === CtpState.Idle) reject();\n });\n });\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <ClickToPayProvider\n isStandaloneComponent={true}\n configuration={this.ctpConfiguration}\n amount={this.props.amount}\n clickToPayService={this.clickToPayService}\n setClickToPayRef={this.setComponentRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n <ClickToPayComponent />\n </ClickToPayProvider>\n );\n }\n}\n\nexport default ClickToPayElement;\n"],"names":["ClickToPayElement","UIElement","isValid","browserInfo","collectBrowserInfo","formatData","srcScheme","srcCorrelationId","srcTokenReference","srcCheckoutPayload","srcDigitalCardId","this","state","data","paymentMethod","type","origin","window","location","formatProps","props","disableOtpAutoFocus","shopperEmail","core","options","session","telephoneNumber","locale","i18n","replace","isAvailable","clickToPayService","shopperAccountFound","Promise","resolve","reject","subscribeOnStateChange","CtpState","NotAvailable","Login","Idle","componentToRender","h","ClickToPayProvider","isStandaloneComponent","configuration","ctpConfiguration","amount","setClickToPayRef","setComponentRef","onSetStatus","setElementStatus","onSubmit","handleClickToPaySubmit","onError","handleError","ClickToPayComponent","constructor","checkout","super","_define_property","payload","setState","valid","errors","submit","merchantDisplayName","onReady","onTimeout","createClickToPayService","environment","analytics","initialize","catch","error","AdyenCheckoutError","toString","cause","console","warn","TxVariants","clicktopay"],"mappings":"yqBAcO,MAAMA,UAA0BC,EA6BnC,WAAIC,GACA,OAAO,CACX,CAEA,eAAIC,GACA,OAAOC,GACX,CAEOC,UAAAA,GACH,MAAMC,UAAEA,EAASC,iBAAEA,EAAgBC,kBAAEA,EAAiBC,mBAAEA,EAAkBC,iBAAEA,GAAqBC,KAAKC,MAAMC,KAC5G,MAAO,CACHC,cAAe,CACXC,KAAMf,EAAkBe,QACpBT,GAAa,CAAEA,gBACfC,GAAoB,CAAEA,uBACtBC,GAAqB,CAAEA,wBACvBC,GAAsB,CAAEA,yBACxBC,GAAoB,CAAEA,qBAE9BP,YAAaQ,KAAKR,YAClBa,OAAQC,QAAQC,UAAUF,OAElC,CAEUG,WAAAA,CAAYC,GAClB,MAAO,IACAA,EACHC,oBAAqBD,EAAMC,sBAAuB,EAClDC,aAAcF,EAAME,cAAgBX,KAAKY,KAAKC,SAASC,SAASH,aAChEI,gBAAiBN,EAAMM,iBAAmBf,KAAKY,KAAKC,SAASC,SAASC,gBACtEC,OAAQP,EAAMO,QAAUP,EAAMQ,MAAMD,QAAQE,QAAQ,IAAK,KAEjE,CAQA,iBAAsBC,GAClB,OAAKnB,KAAKoB,kBAINpB,KAAKoB,kBAAkBC,oBAChBC,QAAQC,UAGZ,IAAID,QAAQ,CAACC,EAASC,KACzBxB,KAAKoB,kBAAkBK,uBAAwBxB,IACvCD,KAAKoB,kBAAkBC,qBAAqBE,IAC5CtB,IAAUyB,EAASC,cAAgB1B,IAAUyB,EAASE,OAAS3B,IAAUyB,EAASG,MAAML,QAVzFF,QAAQE,QAavB,CAOmBM,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,uBAAuB,EACvBC,cAAelC,KAAKmC,iBACpBC,OAAQpC,KAAKS,MAAM2B,OACnBhB,kBAAmBpB,KAAKoB,kBACxBiB,iBAAkBrC,KAAKsC,gBACvBC,YAAavC,KAAKwC,iBAClBC,SAAUzC,KAAK0C,uBACfC,QAAS3C,KAAK4C,aAEdb,EAACc,EAAAA,MAGb,CApGA,WAAAC,CAAYC,EAAiBtC,GACzBuC,MAAMD,EAAUtC,GAJpBwC,EAAAjD,KAAiBoB,yBAAjB,GACA6B,EAAAjD,KAAiBmC,wBAAjB,GAkFAc,EAAAjD,KAAQ0C,yBAA0BQ,IAC9BlD,KAAKmD,SAAS,CAAEjD,KAAM,IAAKgD,GAAWE,MAAO,CAAA,EAAIC,OAAQ,CAAA,EAAI9D,SAAS,IACtES,KAAKsD,WA/ELtD,KAAKmC,iBAAmB,CACpBxB,aAAcX,KAAKS,MAAME,aACzBI,gBAAiBf,KAAKS,MAAMM,gBAC5BwC,oBAAqBvD,KAAKS,MAAM8C,oBAChCvC,OAAQhB,KAAKS,MAAMO,OACnBwC,QAASxD,KAAKS,MAAM+C,QACpBC,UAAWzD,KAAKS,MAAMgD,WAG1BzD,KAAKoB,kBAAoBsC,EAAwB1D,KAAKS,MAAMyB,cAAelC,KAAKmC,iBAAkBnC,KAAKS,MAAMkD,YAAa3D,KAAK4D,WAE/H5D,KAAKoB,mBAAmByC,aAAaC,MAAMC,IACvC/D,KAAK4C,YAAY,IAAIoB,EAAmB,QAASD,EAAME,WAAY,CAAEC,MAAOH,OAG3E/D,KAAKoB,mBACN+C,QAAQC,KAAK,2GAErB,EA1BAnB,EADS5D,EACKe,OAAOiE,EAAWC"}
1
+ {"version":3,"file":"ClickToPay.js","sources":["../../../../src/components/ClickToPay/ClickToPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { ClickToPayConfiguration, ClickToPayPaymentData } from './types';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport { ClickToPayProps } from '../internal/ClickToPay/types';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { CtpState } from '../internal/ClickToPay/services/ClickToPayService';\nimport ClickToPayProvider from '../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayComponent from '../internal/ClickToPay';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\n\nexport class ClickToPayElement extends UIElement<ClickToPayConfiguration> {\n public static type = TxVariants.clicktopay;\n\n private readonly clickToPayService: IClickToPayService | null;\n private readonly ctpConfiguration: ClickToPayProps;\n\n constructor(checkout: ICore, props?: ClickToPayConfiguration) {\n super(checkout, props);\n\n this.ctpConfiguration = {\n shopperEmail: this.props.shopperEmail,\n telephoneNumber: this.props.telephoneNumber,\n merchantDisplayName: this.props.merchantDisplayName,\n locale: this.props.locale,\n onReady: this.props.onReady,\n onTimeout: this.props.onTimeout\n };\n\n this.clickToPayService = createClickToPayService(this.props.configuration, this.ctpConfiguration, this.props.environment, this.analytics);\n\n this.clickToPayService?.initialize().catch(error => {\n this.handleError(new AdyenCheckoutError('ERROR', error.toString(), { cause: error }));\n });\n\n if (!this.clickToPayService) {\n console.warn('ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing');\n }\n }\n\n get isValid() {\n return true;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n public formatData(): ClickToPayPaymentData {\n const { srcScheme, srcCorrelationId, srcTokenReference, srcCheckoutPayload, srcDigitalCardId } = this.state.data;\n return {\n paymentMethod: {\n type: ClickToPayElement.type,\n ...(srcScheme && { srcScheme }),\n ...(srcCorrelationId && { srcCorrelationId }),\n ...(srcTokenReference && { srcTokenReference }),\n ...(srcCheckoutPayload && { srcCheckoutPayload }),\n ...(srcDigitalCardId && { srcDigitalCardId })\n },\n browserInfo: this.browserInfo,\n origin: window?.location?.origin\n };\n }\n\n protected formatProps(props: ClickToPayConfiguration) {\n return {\n ...props,\n disableOtpAutoFocus: props.disableOtpAutoFocus || false,\n shopperEmail: props.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.locale || props.i18n?.locale?.replace('-', '_')\n };\n }\n\n /**\n * Method used to let the merchant know if the shopper have a valid CtP accoubt\n *\n * Resolves Promise if the Shopper has cookies OR has valid CtP account\n * Rejects Promise if account isn't found or if Login screen is triggered\n */\n public override async isAvailable(): Promise<void> {\n if (!this.clickToPayService) {\n return Promise.reject();\n }\n\n if (this.clickToPayService.shopperAccountFound) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n this.clickToPayService.subscribeOnStateChange((state: CtpState) => {\n if (this.clickToPayService.shopperAccountFound) resolve();\n if (state === CtpState.NotAvailable || state === CtpState.Login || state === CtpState.Idle) reject();\n });\n });\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <ClickToPayProvider\n isStandaloneComponent={true}\n configuration={this.ctpConfiguration}\n clickToPayService={this.clickToPayService}\n setClickToPayRef={this.setComponentRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n <ClickToPayComponent />\n </ClickToPayProvider>\n );\n }\n}\n\nexport default ClickToPayElement;\n"],"names":["ClickToPayElement","UIElement","isValid","browserInfo","collectBrowserInfo","formatData","srcScheme","srcCorrelationId","srcTokenReference","srcCheckoutPayload","srcDigitalCardId","this","state","data","paymentMethod","type","origin","window","location","formatProps","props","disableOtpAutoFocus","shopperEmail","core","options","session","telephoneNumber","locale","i18n","replace","isAvailable","clickToPayService","shopperAccountFound","Promise","resolve","reject","subscribeOnStateChange","CtpState","NotAvailable","Login","Idle","componentToRender","h","ClickToPayProvider","isStandaloneComponent","configuration","ctpConfiguration","setClickToPayRef","setComponentRef","onSetStatus","setElementStatus","onSubmit","handleClickToPaySubmit","onError","handleError","ClickToPayComponent","constructor","checkout","super","_define_property","payload","setState","valid","errors","submit","merchantDisplayName","onReady","onTimeout","createClickToPayService","environment","analytics","initialize","catch","error","AdyenCheckoutError","toString","cause","console","warn","TxVariants","clicktopay"],"mappings":"yqBAcO,MAAMA,UAA0BC,EA6BnC,WAAIC,GACA,OAAO,CACX,CAEA,eAAIC,GACA,OAAOC,GACX,CAEOC,UAAAA,GACH,MAAMC,UAAEA,EAASC,iBAAEA,EAAgBC,kBAAEA,EAAiBC,mBAAEA,EAAkBC,iBAAEA,GAAqBC,KAAKC,MAAMC,KAC5G,MAAO,CACHC,cAAe,CACXC,KAAMf,EAAkBe,QACpBT,GAAa,CAAEA,gBACfC,GAAoB,CAAEA,uBACtBC,GAAqB,CAAEA,wBACvBC,GAAsB,CAAEA,yBACxBC,GAAoB,CAAEA,qBAE9BP,YAAaQ,KAAKR,YAClBa,OAAQC,QAAQC,UAAUF,OAElC,CAEUG,WAAAA,CAAYC,GAClB,MAAO,IACAA,EACHC,oBAAqBD,EAAMC,sBAAuB,EAClDC,aAAcF,EAAME,cAAgBX,KAAKY,KAAKC,SAASC,SAASH,aAChEI,gBAAiBN,EAAMM,iBAAmBf,KAAKY,KAAKC,SAASC,SAASC,gBACtEC,OAAQP,EAAMO,QAAUP,EAAMQ,MAAMD,QAAQE,QAAQ,IAAK,KAEjE,CAQA,iBAAsBC,GAClB,OAAKnB,KAAKoB,kBAINpB,KAAKoB,kBAAkBC,oBAChBC,QAAQC,UAGZ,IAAID,QAAQ,CAACC,EAASC,KACzBxB,KAAKoB,kBAAkBK,uBAAwBxB,IACvCD,KAAKoB,kBAAkBC,qBAAqBE,IAC5CtB,IAAUyB,EAASC,cAAgB1B,IAAUyB,EAASE,OAAS3B,IAAUyB,EAASG,MAAML,QAVzFF,QAAQE,QAavB,CAOmBM,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,uBAAuB,EACvBC,cAAelC,KAAKmC,iBACpBf,kBAAmBpB,KAAKoB,kBACxBgB,iBAAkBpC,KAAKqC,gBACvBC,YAAatC,KAAKuC,iBAClBC,SAAUxC,KAAKyC,uBACfC,QAAS1C,KAAK2C,aAEdZ,EAACa,EAAAA,MAGb,CAnGA,WAAAC,CAAYC,EAAiBrC,GACzBsC,MAAMD,EAAUrC,GAJpBuC,EAAAhD,KAAiBoB,4BACjB4B,EAAAhD,KAAiBmC,2BAkFjBa,EAAAhD,KAAQyC,yBAA0BQ,IAC9BjD,KAAKkD,SAAS,CAAEhD,KAAM,IAAK+C,GAAWE,MAAO,CAAA,EAAIC,OAAQ,CAAA,EAAI7D,SAAS,IACtES,KAAKqD,WA/ELrD,KAAKmC,iBAAmB,CACpBxB,aAAcX,KAAKS,MAAME,aACzBI,gBAAiBf,KAAKS,MAAMM,gBAC5BuC,oBAAqBtD,KAAKS,MAAM6C,oBAChCtC,OAAQhB,KAAKS,MAAMO,OACnBuC,QAASvD,KAAKS,MAAM8C,QACpBC,UAAWxD,KAAKS,MAAM+C,WAG1BxD,KAAKoB,kBAAoBqC,EAAwBzD,KAAKS,MAAMyB,cAAelC,KAAKmC,iBAAkBnC,KAAKS,MAAMiD,YAAa1D,KAAK2D,WAE/H3D,KAAKoB,mBAAmBwC,aAAaC,MAAMC,IACvC9D,KAAK2C,YAAY,IAAIoB,EAAmB,QAASD,EAAME,WAAY,CAAEC,MAAOH,OAG3E9D,KAAKoB,mBACN8C,QAAQC,KAAK,2GAErB,EA1BAnB,EADS3D,EACKe,OAAOgE,EAAWC"}
@@ -1 +1 @@
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 } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n protected static 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\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)\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 handleKeyPress={this.handleKeyPress}\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","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyPress","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","defaultProps"],"mappings":"ypBAYO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA,CAAaC,GAET,OADIX,KAAKY,cAAcF,cAAcV,KAAKY,aAAaF,aAAaC,GAC7DX,IACX,CAEAa,UAAAA,CAAWC,GAEP,OADId,KAAKY,cAAcC,YAAYb,KAAKY,aAAaC,WAAWC,GACzDd,IACX,CAEAe,wBAAAA,CAAyBC,GAErB,OADIhB,KAAKY,cAAcG,0BAA0Bf,KAAKY,aAAaG,yBAAyBC,GACrFhB,IACX,CAEAiB,yBAAAA,CAA0BC,GAEtB,OADIlB,KAAKY,cAAcK,2BAA2BjB,KAAKY,aAAaK,0BAA0BC,GACvFlB,IACX,CAEAmB,qBAAAA,CAAsBC,GAElB,OADIpB,KAAKY,cAAcO,uBAAuBnB,KAAKY,aAAaO,sBAAsBC,GAC/EpB,IACX,CAEAqB,WAAAA,CAAYC,GACR,MAAMC,EAAQ,IAAKD,GACnBC,EAAMC,SAAWxB,KAAKyB,MAEjBF,EAAMG,UAEPH,EAAMI,mBAAqBL,EAAIK,oBAAoBC,IAAKC,IACpDA,EAAKC,cAAgB9B,KAAKN,MAAMqC,oBAAoBF,EAAKxB,QAAQ2B,MAAQC,EAAgBJ,EAAKxB,MAAOL,KAAKkC,WACnGL,KAIf7B,KAAKN,MAAM2B,YAAYE,EAC3B,CAIA,WAAIY,GACA,QAASnC,KAAKC,MAAMkC,OACxB,CAEA,eAAI7B,GACA,OAAO8B,GACX,CAmBmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,IAAKA,IACDxC,KAAKY,aAAe4B,MAEpBxC,KAAKN,SACLM,KAAKC,MACTwC,eAAgBzC,KAAKyC,eACrBjB,SAAUxB,KAAKyB,MACfiB,SAAU1C,KAAK2C,SACfC,WAAY5C,KAAK4C,WACjBC,mBAAoB,SACpBX,UAAWlC,KAAKkC,UAChB7B,MAAOL,KAAKK,MACZyC,QAAS9C,KAAK8C,QACdC,kBAAmB/C,KAAKgD,iBAGpC,mBAvHGC,SAAAC,GAQHC,EAAAnD,KAAQK,QAAQT,EAAWwD,MAiE3BD,EAAAnD,KAAO4C,aAAaS,EAAiBrD,OAUrCmD,EAAAnD,KAAQ8C,UAAWxB,IACf,MAAMgC,EAAQ,IAAIC,EAAmB,CACjCC,UAAWxD,KAAKL,KAChBA,MAAoB,IAAd2B,EAAImC,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqBvC,EAAIwC,aAGrC9D,KAAKgD,gBAAgBM,GAGrBtD,KAAKN,MAAMoD,UAAUxB,KAGzB6B,EAAAnD,KAAU+D,oBAAoB,CAACC,EAAwBR,KACnDxD,KAAKN,MAAMqE,oBAAoBC,EAAeR,MAhGlDL,EADS5D,EACKI,OAAOC,EAAWC,YAEhCsD,EAHS5D,EAGQ0E,eAAe,CAC5B5C,YAAa,OACbU,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';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n protected static 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\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 handleKeyPress={this.handleKeyPress}\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","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyPress","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","defaultProps"],"mappings":"ypBAYO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA,CAAaC,GAET,OADIX,KAAKY,cAAcF,cAAcV,KAAKY,aAAaF,aAAaC,GAC7DX,IACX,CAEAa,UAAAA,CAAWC,GAEP,OADId,KAAKY,cAAcC,YAAYb,KAAKY,aAAaC,WAAWC,GACzDd,IACX,CAEAe,wBAAAA,CAAyBC,GAErB,OADIhB,KAAKY,cAAcG,0BAA0Bf,KAAKY,aAAaG,yBAAyBC,GACrFhB,IACX,CAEAiB,yBAAAA,CAA0BC,GAEtB,OADIlB,KAAKY,cAAcK,2BAA2BjB,KAAKY,aAAaK,0BAA0BC,GACvFlB,IACX,CAEAmB,qBAAAA,CAAsBC,GAElB,OADIpB,KAAKY,cAAcO,uBAAuBnB,KAAKY,aAAaO,sBAAsBC,GAC/EpB,IACX,CAEAqB,WAAAA,CAAYC,GACR,MAAMC,EAAQ,IAAKD,GACnBC,EAAMC,SAAWxB,KAAKyB,MAEjBF,EAAMG,UAEPH,EAAMI,mBAAqBL,EAAIK,oBAAoBC,IAAKC,IACpDA,EAAKC,cAAgB9B,KAAKN,MAAMqC,oBAAoBF,EAAKxB,QAAQ2B,MAAQC,EAAgBJ,EAAKxB,MAAOL,KAAKkC,WACnGL,KAIf7B,KAAKN,MAAM2B,YAAYE,EAC3B,CAIA,WAAIY,GACA,QAASnC,KAAKC,MAAMkC,OACxB,CAEA,eAAI7B,GACA,OAAO8B,GACX,CAmBmBC,iBAAAA,GACf,OACIC,EAACC,EAAAA,CACGC,IAAKA,IACDxC,KAAKY,aAAe4B,MAEpBxC,KAAKN,SACLM,KAAKC,MACTwC,eAAgBzC,KAAKyC,eACrBjB,SAAUxB,KAAKyB,MACfiB,SAAU1C,KAAK2C,SACfC,WAAY5C,KAAK4C,WACjBC,mBAAoB,SACpBX,UAAWlC,KAAKkC,UAChB7B,MAAOL,KAAKK,MACZyC,QAAS9C,KAAK8C,QACdC,kBAAmB/C,KAAKgD,iBAGpC,mBAvHGC,SAAAC,GAQHC,EAAAnD,KAAQK,QAAQT,EAAWwD,MAiE3BD,EAAAnD,KAAO4C,aAAaS,EAAiBrD,OAUrCmD,EAAAnD,KAAQ8C,UAAWxB,IACf,MAAMgC,EAAQ,IAAIC,EAAmB,CACjCC,UAAWxD,KAAKL,KAChBA,MAAoB,IAAd2B,EAAImC,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqBvC,EAAIwC,aAGrC9D,KAAKgD,gBAAgBM,GAGrBtD,KAAKN,MAAMoD,UAAUxB,KAGzB6B,EAAAnD,KAAU+D,oBAAoB,CAACC,EAAwBR,KACnDxD,KAAKN,MAAMqE,oBAAoBC,EAAeR,MAhGlDL,EADS5D,EACKI,OAAOC,EAAWC,YAEhCsD,EAHS5D,EAGQ0E,eAAe,CAC5B5C,YAAa,OACbU,oBAAqB,CAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useEffect as a,useState as r}from"../../../../external/preact/hooks/dist/hooks.js";import o from"../../../../utils/useForm/useForm.js";import t from"../../../internal/FormFields/Field/Field.js";import s from"../../../../utils/get-issuer-image.js";import{useCoreContext as i}from"../../../../core/Context/CoreProvider.js";import n from"../../../internal/FormFields/InputEmail.js";import l from"../../../internal/FormFields/Select/Select.js";import p from"../../../../core/Context/useImage.js";import{validationRules as m}from"../../../../utils/Validator/defaultRules.js";import{getErrorMessage as u}from"../../../../utils/getErrorMessage.js";function d(d){const{i18n:c}=i(),g=p(),h=()=>["dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking"].indexOf(d.type)>-1,{handleChangeFor:f,triggerValidation:_,data:y,valid:E,errors:k,isValid:F}=o({schema:[...h()?["issuer"]:[],"shopperEmail"],rules:{issuer:{validate:e=>h()&&!!e,modes:["input","blur"]},shopperEmail:m.emailRule}}),j=s({},d.type,g),b=d.items.map(e=>({...e,icon:j(e.id&&e.id.toLowerCase())}));a(()=>{d.onChange({isValid:F,data:y,valid:E,errors:k})},[F,y,E,k]);const[x,C]=r("ready");return this.setStatus=C,this.showValidation=_,e("div",{className:"adyen-checkout__dragonpay-input__field"},e(t,{label:c.get("shopperEmail"),errorMessage:u(c,k.shopperEmail,c.get("shopperEmail")),name:"dragonpay-shopperEmail"},e(n,{name:"dragonpay-shopperEmail",autoCorrect:"off",value:y.shopperEmail,className:"adyen-checkout__input--large",spellCheck:!1,onInput:f("shopperEmail","input"),onBlur:f("shopperEmail","blur")})),h()&&e(t,{label:c.get((V=d.type,"dragonpay_otc_non_banking"===V?"dragonpayVoucher.selectField.contextualText.nonBank":"dragonpayVoucher.selectField.contextualText.bank")),errorMessage:!!k.issuer,name:"issuer"},e(l,{items:b,selectedValue:y.issuer,name:"issuer",className:"adyen-checkout__dropdown--large adyen-checkout__issuer-list__dropdown",onChange:f("issuer")})),d.showPayButton&&d.payButton({status:x,label:c.get("confirmPurchase")}));var V}d.defaultProps={data:{},items:[],onChange:()=>{}};export{d as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useEffect as a,useState as r}from"../../../../external/preact/hooks/dist/hooks.js";import o from"../../../../utils/useForm/useForm.js";import t from"../../../internal/FormFields/Field/Field.js";import s from"../../../../utils/get-issuer-image.js";import{useCoreContext as i}from"../../../../core/Context/CoreProvider.js";import n from"../../../internal/FormFields/InputEmail.js";import l from"../../../internal/FormFields/Select/Select.js";import p from"../../../../core/Context/useImage.js";import{validationRules as m}from"../../../../utils/Validator/defaultRules.js";import{getErrorMessage as u}from"../../../../utils/getErrorMessage.js";function d(d){const{i18n:c}=i(),g=p(),h=()=>["dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking"].indexOf(d.type)>-1,{handleChangeFor:f,triggerValidation:_,data:y,valid:E,errors:k,isValid:F}=o({schema:[...h()?["issuer"]:[],"shopperEmail"],rules:{issuer:{validate:e=>h()&&!!e,modes:["input","blur"]},shopperEmail:m.emailRule}}),j=s({},d.type,g),b=d.items.map(e=>({...e,icon:j(e.id&&e.id.toLowerCase())}));a(()=>{d.onChange({isValid:F,data:y,valid:E,errors:k})},[F,y,E,k]);const[x,C]=r("ready");return this.setStatus=C,this.showValidation=_,e("div",{className:"adyen-checkout__dragonpay-input__field"},e(t,{label:c.get("shopperEmail"),errorMessage:u(c,k.shopperEmail,c.get("shopperEmail")),name:"dragonpay-shopperEmail"},e(n,{name:"dragonpay-shopperEmail",autoCorrect:"off",value:y.shopperEmail,className:"adyen-checkout__input--large",spellcheck:!1,onInput:f("shopperEmail","input"),onBlur:f("shopperEmail","blur")})),h()&&e(t,{label:c.get((V=d.type,"dragonpay_otc_non_banking"===V?"dragonpayVoucher.selectField.contextualText.nonBank":"dragonpayVoucher.selectField.contextualText.bank")),errorMessage:!!k.issuer,name:"issuer"},e(l,{items:b,selectedValue:y.issuer,name:"issuer",className:"adyen-checkout__dropdown--large adyen-checkout__issuer-list__dropdown",onChange:f("issuer")})),d.showPayButton&&d.payButton({status:x,label:c.get("confirmPurchase")}));var V}d.defaultProps={data:{},items:[],onChange:()=>{}};export{d as default};
2
2
  //# sourceMappingURL=DragonpayInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragonpayInput.js","sources":["../../../../../../src/components/Dragonpay/components/DragonpayInput/DragonpayInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport useForm from '../../../../utils/useForm';\nimport Field from '../../../internal/FormFields/Field';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { DragonpayInputData, DragonpayInputIssuerItem, DragonpayInputProps } from '../../types';\nimport InputEmail from '../../../internal/FormFields/InputEmail';\nimport Select from '../../../internal/FormFields/Select';\nimport useImage from '../../../../core/Context/useImage';\nimport { validationRules } from '../../../../utils/Validator/defaultRules';\nimport { getErrorMessage } from '../../../../utils/getErrorMessage';\n\nexport default function DragonpayInput(props: DragonpayInputProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const isIssuerRequired = () => {\n const typesRequiringIssuers = ['dragonpay_ebanking', 'dragonpay_otc_banking', 'dragonpay_otc_non_banking'];\n return typesRequiringIssuers.indexOf(props.type) > -1;\n };\n\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<DragonpayInputData>({\n schema: [...(isIssuerRequired() ? ['issuer'] : []), 'shopperEmail'],\n rules: {\n issuer: {\n validate: issuer => isIssuerRequired() && !!issuer,\n modes: ['input', 'blur']\n },\n shopperEmail: validationRules.emailRule\n }\n });\n\n const getIssuerIcon = getIssuerImageUrl({}, props.type, getImage);\n const items = props.items.map(\n (item: DragonpayInputIssuerItem): DragonpayInputIssuerItem => ({\n ...item,\n icon: getIssuerIcon(item.id && item.id.toLowerCase())\n })\n );\n\n const getIssuerSelectFieldKey = type => {\n if (type === 'dragonpay_otc_non_banking') {\n return 'dragonpayVoucher.selectField.contextualText.nonBank';\n }\n return 'dragonpayVoucher.selectField.contextualText.bank';\n };\n\n useEffect(() => {\n props.onChange({ isValid, data, valid, errors });\n }, [isValid, data, valid, errors]);\n\n const [status, setStatus] = useState('ready');\n this.setStatus = setStatus;\n this.showValidation = triggerValidation;\n\n return (\n <div className=\"adyen-checkout__dragonpay-input__field\">\n <Field\n label={i18n.get('shopperEmail')}\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n name={'dragonpay-shopperEmail'}\n >\n <InputEmail\n name={'dragonpay-shopperEmail'}\n autoCorrect={'off'}\n value={data.shopperEmail}\n className={'adyen-checkout__input--large'}\n spellCheck={false}\n onInput={handleChangeFor('shopperEmail', 'input')}\n onBlur={handleChangeFor('shopperEmail', 'blur')}\n />\n </Field>\n\n {isIssuerRequired() && (\n <Field label={i18n.get(getIssuerSelectFieldKey(props.type))} errorMessage={!!errors.issuer} name={'issuer'}>\n <Select\n items={items}\n selectedValue={data.issuer}\n name={'issuer'}\n className={'adyen-checkout__dropdown--large adyen-checkout__issuer-list__dropdown'}\n onChange={handleChangeFor('issuer')}\n />\n </Field>\n )}\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n\nDragonpayInput.defaultProps = {\n data: {},\n items: [],\n onChange: () => {}\n};\n"],"names":["DragonpayInput","props","i18n","useCoreContext","getImage","useImage","isIssuerRequired","indexOf","type","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","rules","issuer","validate","modes","shopperEmail","validationRules","emailRule","getIssuerIcon","getIssuerImageUrl","items","map","item","icon","id","toLowerCase","useEffect","onChange","status","setStatus","useState","this","showValidation","h","div","className","Field","label","get","errorMessage","getErrorMessage","name","InputEmail","autoCorrect","value","spellCheck","onInput","onBlur","Select","selectedValue","showPayButton","payButton","defaultProps"],"mappings":"mtBAae,SAASA,EAAeC,GACnC,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IACXC,EAAmB,IACS,CAAC,qBAAsB,wBAAyB,6BACjDC,QAAQN,EAAMO,OAAQ,GAGjDC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA4B,CACrGC,OAAQ,IAAKV,IAAqB,CAAC,UAAY,GAAK,gBACpDW,MAAO,CACHC,OAAQ,CACJC,SAAUD,GAAUZ,OAAwBY,EAC5CE,MAAO,CAAC,QAAS,SAErBC,aAAcC,EAAgBC,aAIhCC,EAAgBC,EAAkB,CAAA,EAAIxB,EAAMO,KAAMJ,GAClDsB,EAAQzB,EAAMyB,MAAMC,IACrBC,QACMA,EACHC,KAAML,EAAcI,EAAKE,IAAMF,EAAKE,GAAGC,kBAW/CC,EAAU,KACN/B,EAAMgC,SAAS,CAAEnB,UAASH,OAAMC,QAAOC,YACxC,CAACC,EAASH,EAAMC,EAAOC,IAE1B,MAAOqB,EAAQC,GAAaC,EAAS,SAIrC,OAHAC,KAAKF,UAAYA,EACjBE,KAAKC,eAAiB5B,EAGlB6B,EAACC,MAAAA,CAAIC,UAAU,0CACXF,EAACG,EAAAA,CACGC,MAAOzC,EAAK0C,IAAI,gBAChBC,aAAcC,EAAgB5C,EAAMW,EAAOQ,aAAcnB,EAAK0C,IAAI,iBAClEG,KAAM,0BAENR,EAACS,EAAAA,CACGD,KAAM,yBACNE,YAAa,MACbC,MAAOvC,EAAKU,aACZoB,UAAW,+BACXU,YAAY,EACZC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,WAI/CH,KACGiC,EAACG,EAAAA,CAAMC,MAAOzC,EAAK0C,KAlCCpC,EAkC2BP,EAAMO,KAjChD,8BAATA,EACO,sDAEJ,qDA8B8DqC,eAAgBhC,EAAOK,OAAQ6B,KAAM,UAC9FR,EAACe,EAAAA,CACG5B,MAAOA,EACP6B,cAAe5C,EAAKO,OACpB6B,KAAM,SACNN,UAAW,wEACXR,SAAUxB,EAAgB,aAKrCR,EAAMuD,eAAiBvD,EAAMwD,UAAU,CAAEvB,SAAQS,MAAOzC,EAAK0C,IAAI,sBA7C1CpC,IAAAA,CAgDpC,CAEAR,EAAe0D,aAAe,CAC1B/C,KAAM,CAAA,EACNe,MAAO,GACPO,SAAU"}
1
+ {"version":3,"file":"DragonpayInput.js","sources":["../../../../../../src/components/Dragonpay/components/DragonpayInput/DragonpayInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport useForm from '../../../../utils/useForm';\nimport Field from '../../../internal/FormFields/Field';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { DragonpayInputData, DragonpayInputIssuerItem, DragonpayInputProps } from '../../types';\nimport InputEmail from '../../../internal/FormFields/InputEmail';\nimport Select from '../../../internal/FormFields/Select';\nimport useImage from '../../../../core/Context/useImage';\nimport { validationRules } from '../../../../utils/Validator/defaultRules';\nimport { getErrorMessage } from '../../../../utils/getErrorMessage';\n\nexport default function DragonpayInput(props: DragonpayInputProps) {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const isIssuerRequired = () => {\n const typesRequiringIssuers = ['dragonpay_ebanking', 'dragonpay_otc_banking', 'dragonpay_otc_non_banking'];\n return typesRequiringIssuers.indexOf(props.type) > -1;\n };\n\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<DragonpayInputData>({\n schema: [...(isIssuerRequired() ? ['issuer'] : []), 'shopperEmail'],\n rules: {\n issuer: {\n validate: issuer => isIssuerRequired() && !!issuer,\n modes: ['input', 'blur']\n },\n shopperEmail: validationRules.emailRule\n }\n });\n\n const getIssuerIcon = getIssuerImageUrl({}, props.type, getImage);\n const items = props.items.map(\n (item: DragonpayInputIssuerItem): DragonpayInputIssuerItem => ({\n ...item,\n icon: getIssuerIcon(item.id && item.id.toLowerCase())\n })\n );\n\n const getIssuerSelectFieldKey = type => {\n if (type === 'dragonpay_otc_non_banking') {\n return 'dragonpayVoucher.selectField.contextualText.nonBank';\n }\n return 'dragonpayVoucher.selectField.contextualText.bank';\n };\n\n useEffect(() => {\n props.onChange({ isValid, data, valid, errors });\n }, [isValid, data, valid, errors]);\n\n const [status, setStatus] = useState('ready');\n this.setStatus = setStatus;\n this.showValidation = triggerValidation;\n\n return (\n <div className=\"adyen-checkout__dragonpay-input__field\">\n <Field\n label={i18n.get('shopperEmail')}\n errorMessage={getErrorMessage(i18n, errors.shopperEmail, i18n.get('shopperEmail'))}\n name={'dragonpay-shopperEmail'}\n >\n <InputEmail\n name={'dragonpay-shopperEmail'}\n autoCorrect={'off'}\n value={data.shopperEmail}\n className={'adyen-checkout__input--large'}\n spellcheck={false}\n onInput={handleChangeFor('shopperEmail', 'input')}\n onBlur={handleChangeFor('shopperEmail', 'blur')}\n />\n </Field>\n\n {isIssuerRequired() && (\n <Field label={i18n.get(getIssuerSelectFieldKey(props.type))} errorMessage={!!errors.issuer} name={'issuer'}>\n <Select\n items={items}\n selectedValue={data.issuer}\n name={'issuer'}\n className={'adyen-checkout__dropdown--large adyen-checkout__issuer-list__dropdown'}\n onChange={handleChangeFor('issuer')}\n />\n </Field>\n )}\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n );\n}\n\nDragonpayInput.defaultProps = {\n data: {},\n items: [],\n onChange: () => {}\n};\n"],"names":["DragonpayInput","props","i18n","useCoreContext","getImage","useImage","isIssuerRequired","indexOf","type","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","rules","issuer","validate","modes","shopperEmail","validationRules","emailRule","getIssuerIcon","getIssuerImageUrl","items","map","item","icon","id","toLowerCase","useEffect","onChange","status","setStatus","useState","this","showValidation","h","div","className","Field","label","get","errorMessage","getErrorMessage","name","InputEmail","autoCorrect","value","spellcheck","onInput","onBlur","Select","selectedValue","showPayButton","payButton","defaultProps"],"mappings":"mtBAae,SAASA,EAAeC,GACnC,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IACXC,EAAmB,IACS,CAAC,qBAAsB,wBAAyB,6BACjDC,QAAQN,EAAMO,OAAQ,GAGjDC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA4B,CACrGC,OAAQ,IAAKV,IAAqB,CAAC,UAAY,GAAK,gBACpDW,MAAO,CACHC,OAAQ,CACJC,SAAUD,GAAUZ,OAAwBY,EAC5CE,MAAO,CAAC,QAAS,SAErBC,aAAcC,EAAgBC,aAIhCC,EAAgBC,EAAkB,CAAA,EAAIxB,EAAMO,KAAMJ,GAClDsB,EAAQzB,EAAMyB,MAAMC,IACrBC,QACMA,EACHC,KAAML,EAAcI,EAAKE,IAAMF,EAAKE,GAAGC,kBAW/CC,EAAU,KACN/B,EAAMgC,SAAS,CAAEnB,UAASH,OAAMC,QAAOC,YACxC,CAACC,EAASH,EAAMC,EAAOC,IAE1B,MAAOqB,EAAQC,GAAaC,EAAS,SAIrC,OAHAC,KAAKF,UAAYA,EACjBE,KAAKC,eAAiB5B,EAGlB6B,EAACC,MAAAA,CAAIC,UAAU,0CACXF,EAACG,EAAAA,CACGC,MAAOzC,EAAK0C,IAAI,gBAChBC,aAAcC,EAAgB5C,EAAMW,EAAOQ,aAAcnB,EAAK0C,IAAI,iBAClEG,KAAM,0BAENR,EAACS,EAAAA,CACGD,KAAM,yBACNE,YAAa,MACbC,MAAOvC,EAAKU,aACZoB,UAAW,+BACXU,YAAY,EACZC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,WAI/CH,KACGiC,EAACG,EAAAA,CAAMC,MAAOzC,EAAK0C,KAlCCpC,EAkC2BP,EAAMO,KAjChD,8BAATA,EACO,sDAEJ,qDA8B8DqC,eAAgBhC,EAAOK,OAAQ6B,KAAM,UAC9FR,EAACe,EAAAA,CACG5B,MAAOA,EACP6B,cAAe5C,EAAKO,OACpB6B,KAAM,SACNN,UAAW,wEACXR,SAAUxB,EAAgB,aAKrCR,EAAMuD,eAAiBvD,EAAMwD,UAAU,CAAEvB,SAAQS,MAAOzC,EAAK0C,IAAI,sBA7C1CpC,IAAAA,CAgDpC,CAEAR,EAAe0D,aAAe,CAC1B/C,KAAM,CAAA,EACNe,MAAO,GACPO,SAAU"}
@@ -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"./defaultProps.js";import{DropinComponent as o}from"./components/DropinComponent.js";import i from"./elements/createElements.js";import s from"./elements/createStoredElements.js";import r from"./elements/createInstantPaymentElements.js";import{hasOwnProperty as a}from"../../utils/hasOwnProperty.js";import h from"./elements/splitPaymentMethods.js";import{TxVariants as d}from"../tx-variants.js";function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const p=["paywithgoogle","googlepay","applepay"];class c extends e{reportIntegrationFlavor(){this.analytics.sendFlavor("dropin")}storeElementRefOnCore(){this.core.storeElementReference(this)}formatProps(t){return{...super.formatProps(t),instantPaymentTypes:Array.from(new Set(t.instantPaymentTypes)).filter(t=>p.includes(t))}}get isValid(){return!!this.dropinRef&&!!this.dropinRef.state.activePaymentMethod&&!!this.dropinRef.state.activePaymentMethod.isValid}showValidation(){return this.dropinRef.state.activePaymentMethod&&this.dropinRef.state.activePaymentMethod.showValidation(),this}setStatus(t,e={}){return this.dropinRef?.setStatus(t,e),this}get activePaymentMethod(){return this.dropinRef?.state||this.dropinRef?.state.activePaymentMethod?this.dropinRef.state.activePaymentMethod:null}get data(){return this.activePaymentMethod?this.dropinRef.state.activePaymentMethod.data:null}displayFinalAnimation(t){this.props.disableFinalAnimation||this.dropinRef?.setStatus(t)}submit(){if(!this.activePaymentMethod)throw new Error("No active payment method.");this.activePaymentMethod.isValid||this.activePaymentMethod.showValidation(),this.activePaymentMethod.isInstantPayment&&this.closeActivePaymentMethod(),this.activePaymentMethod.submit()}handleAction(t,e={}){if(!t||!t.type){if(a(t,"action")&&a(t,"resultCode"))throw new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('handleAction::Invalid Action - the passed action object does not have a "type" property')}if("redirect"!==t.type&&this.activePaymentMethod?.updateWithAction)return this.activePaymentMethod.updateWithAction(t);this.elementRef instanceof c&&(e={...this.elementRef.activePaymentMethod?.props,...e});const n=this.core.createFromAction(t,{...e,elementRef:this.elementRef,isDropin:!0});return n?(this.setStatus(n.props.statusType,{component:n}),this.componentFromAction=n,this):null}closeActivePaymentMethod(){this.dropinRef.closeActivePaymentMethod()}handleKeyPress(t){if("Enter"===t.key||"Enter"===t.code){if("radio"===document?.activeElement?.getAttribute("role"))return;super.handleKeyPress(t)}}onEnterKeyPressed(t,e){const n=this.activePaymentMethod??e;this.activePaymentMethod?.onEnterKeyPressed(t,n)}componentToRender(){return t(o,{...this.props,core:this.core,elementRef:this.elementRef,onCreateElements:this.handleCreate,ref:t=>{this.dropinRef=t}})}constructor(t,e){super(t,e),m(this,"dropinRef",null),m(this,"paymentMethodsConfiguration",void 0),m(this,"componentFromAction",void 0),m(this,"handleCreate",()=>{const{paymentMethodsConfiguration:t,showStoredPaymentMethods:e,showPaymentMethods:n,instantPaymentTypes:o}=this.props,{paymentMethods:a,storedPaymentMethods:d,instantPaymentMethods:m,fastlanePaymentMethod:p}=h(this.core.paymentMethodsResponse,o),c={elementRef:this.elementRef,isDropin:!0},l=n?i(a,t,c,this.core):[],y=r(m,t,c,this.core);return[e?s(this.props.filterStoredPaymentMethods?.(d)??d,t,c,this.core):[],l,y,p?i([p],t,c,this.core):[]]}),m(this,"handleOrder",({order:t})=>{this.updateParent({order:t})}),this.submit=this.submit.bind(this),this.handleAction=this.handleAction.bind(this),this.props.paymentMethodComponents.forEach(t=>this.core.register(t)),this.paymentMethodsConfiguration=this.props.paymentMethodsConfiguration||{}}}m(c,"type",d.dropin),m(c,"defaultProps",n);export{c 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"./defaultProps.js";import{DropinComponent as o}from"./components/DropinComponent.js";import s from"./elements/createElements.js";import i from"./elements/createStoredElements.js";import a from"./elements/createInstantPaymentElements.js";import{hasOwnProperty as r}from"../../utils/hasOwnProperty.js";import h from"./elements/splitPaymentMethods.js";import{TxVariants as d}from"../tx-variants.js";function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const p=["paywithgoogle","googlepay","applepay"];class l extends e{reportIntegrationFlavor(){this.analytics.sendFlavor("dropin")}storeElementRefOnCore(){this.core.storeElementReference(this)}formatProps(t){return{...super.formatProps(t),instantPaymentTypes:Array.from(new Set(t.instantPaymentTypes)).filter(t=>p.includes(t))}}get isValid(){return!!this.dropinRef&&!!this.dropinRef.state.activePaymentMethod&&!!this.dropinRef.state.activePaymentMethod.isValid}showValidation(){return this.dropinRef.state.activePaymentMethod&&this.dropinRef.state.activePaymentMethod.showValidation(),this}setStatus(t,e={}){return this.dropinRef?.setStatus(t,e),this}get activePaymentMethod(){return this.dropinRef?.state||this.dropinRef?.state.activePaymentMethod?this.dropinRef.state.activePaymentMethod:null}get data(){return this.activePaymentMethod?this.dropinRef.state.activePaymentMethod.data:null}displayFinalAnimation(t){this.props.disableFinalAnimation||this.dropinRef?.setStatus(t)}submit(){if(!this.activePaymentMethod)throw new Error("No active payment method.");this.activePaymentMethod.isValid||this.activePaymentMethod.showValidation(),this.activePaymentMethod.isInstantPayment&&this.closeActivePaymentMethod(),this.activePaymentMethod.submit()}updateAmount(t,e){this.props={...this.props,...t&&{amount:t},...e&&{secondaryAmount:e}},this.amountProviderRef.current?.update(t,e),this.paymentMethodElements.forEach(n=>{n.updateAmount(t,e)})}handleElementsCreated(t){t&&0!==t.length||(this.paymentMethodElements=[]),this.paymentMethodElements=t}handleAction(t,e={}){if(!t||!t.type){if(r(t,"action")&&r(t,"resultCode"))throw new Error('handleAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('handleAction::Invalid Action - the passed action object does not have a "type" property')}if("redirect"!==t.type&&this.activePaymentMethod?.updateWithAction)return this.activePaymentMethod.updateWithAction(t);this.elementRef instanceof l&&(e={...this.elementRef.activePaymentMethod?.props,...e});const n=this.core.createFromAction(t,{...e,elementRef:this.elementRef,isDropin:!0});return n?(this.setStatus(n.props.statusType,{component:n}),this.componentFromAction=n,this):null}closeActivePaymentMethod(){this.dropinRef.closeActivePaymentMethod()}handleKeyPress(t){if("Enter"===t.key||"Enter"===t.code){if("radio"===document?.activeElement?.getAttribute("role"))return;super.handleKeyPress(t)}}onEnterKeyPressed(t,e){const n=this.activePaymentMethod??e;this.activePaymentMethod?.onEnterKeyPressed(t,n)}componentToRender(){return t(o,{...this.props,core:this.core,elementRef:this.elementRef,onCreateElements:this.handleCreate,onElementsCreated:this.handleElementsCreated,ref:t=>{this.dropinRef=t}})}constructor(t,e){super(t,e),m(this,"dropinRef",null),m(this,"paymentMethodsConfiguration",void 0),m(this,"componentFromAction",void 0),m(this,"paymentMethodElements",[]),m(this,"handleCreate",()=>{const{paymentMethodsConfiguration:t,showStoredPaymentMethods:e,showPaymentMethods:n,instantPaymentTypes:o}=this.props,{paymentMethods:r,storedPaymentMethods:d,instantPaymentMethods:m,fastlanePaymentMethod:p}=h(this.core.paymentMethodsResponse,o),l={elementRef:this.elementRef,isDropin:!0},c=n?s(r,t,l,this.core):[],y=a(m,t,l,this.core);return[e?i(this.props.filterStoredPaymentMethods?.(d)??d,t,l,this.core):[],c,y,p?s([p],t,l,this.core):[]]}),m(this,"handleOrder",({order:t})=>{this.updateParent({order:t})}),this.submit=this.submit.bind(this),this.handleAction=this.handleAction.bind(this),this.handleElementsCreated=this.handleElementsCreated.bind(this),this.props.paymentMethodComponents.forEach(t=>this.core.register(t)),this.paymentMethodsConfiguration=this.props.paymentMethodsConfiguration||{}}}m(l,"type",d.dropin),m(l,"defaultProps",n);export{l as default};
2
2
  //# sourceMappingURL=Dropin.js.map