@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":"ANCV.js","sources":["../../../../src/components/ANCV/ANCV.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ANCVInput from './components/ANCVInput';\nimport config from './components/ANCVAwait/config';\nimport { Await } from '../../components/internal/Await';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport PayButton from '../internal/PayButton';\nimport { ANCVConfiguration } from './types';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\n\nexport class ANCVElement extends UIElement<ANCVConfiguration> {\n public static type = 'ancv';\n\n /**\n * Formats the component data output\n */\n formatData() {\n return {\n paymentMethod: {\n type: ANCVElement.type,\n beneficiaryId: this.state.data?.beneficiaryId\n }\n };\n }\n\n private onOrderRequest = data => {\n if (this.props.onOrderRequest)\n return new Promise((resolve, reject) => {\n this.props.onOrderRequest(resolve, reject, data);\n });\n\n if (this.props.session) {\n return this.props.session.createOrder();\n }\n };\n\n /**\n * Check if order exists, if it does Resolve.\n * Otherwise createOrder and then Resolve.\n */\n public createOrder = (): Promise<void> => {\n this.setStatus('loading');\n\n // allow for multiple ANCV payments, follow giftcard logic and just use order if it exists\n if (this.props.order) {\n return Promise.resolve();\n }\n\n return this.onOrderRequest(this.data)\n .then((order: { orderData: string; pspReference: string }) => {\n const stateOrder = { order: { orderData: order.orderData, pspReference: order.pspReference } };\n this.setState(stateOrder);\n return Promise.resolve();\n })\n .catch(error => {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', error));\n }\n });\n };\n\n public submit() {\n if (!this.isValid) {\n this.showValidation();\n return false;\n }\n\n this.createOrder()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n // Reimplement payButton similar to GiftCard to allow to set onClick\n public payButton = props => {\n return <PayButton {...props} />;\n };\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return (\n <Await\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={this.constructor['type']}\n messageText={this.props.i18n.get('ancv.confirmPayment')}\n awaitText={this.props.i18n.get('await.waitForConfirmation')}\n showCountdownTimer={config.showCountdownTimer}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n\n return (\n <ANCVInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onSubmit={this.submit}\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n />\n );\n }\n}\n\nexport default ANCVElement;\n"],"names":["ANCVElement","UIElement","formatData","_this_state_data","paymentMethod","type","beneficiaryId","this","state","data","submit","isValid","showValidation","createOrder","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","handleFailedResult","displayName","props","name","componentToRender","paymentData","h","Await","clientKey","onError","onComplete","brandLogo","icon","constructor","messageText","i18n","get","awaitText","showCountdownTimer","config","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","ANCVInput","ref","componentRef","onSubmit","onChange","setState","payButton","showPayButton","super","args","_define_property","onOrderRequest","Promise","resolve","reject","session","setStatus","order","stateOrder","orderData","pspReference","error","AdyenCheckoutError","handleError","PayButton"],"mappings":"67BAUO,MAAMA,UAAoBC,EAM7BC,UAAAA,GAI2B,IAAAC,EAHvB,MAAO,CACHC,cAAe,CACXC,KAAML,EAAYK,KAClBC,cAA8B,QAAfH,EAAAI,KAAKC,MAAMC,YAAX,IAAAN,OAAA,EAAAA,EAAiBG,eAG5C,CAwCOI,MAAAA,GACH,IAAKH,KAAKI,QAEN,OADAJ,KAAKK,kBACE,EAGXL,KAAKM,cACAC,KAAKP,KAAKQ,kBACVD,KAAKE,GACLF,KAAKG,GACLH,KAAKP,KAAKW,gBACVC,MAAMZ,KAAKa,mBACpB,CAOA,WAAIT,GACA,QAASJ,KAAKC,MAAMG,OACxB,CAEA,eAAIU,GACA,OAAOd,KAAKe,MAAMC,IACtB,CAEmBC,iBAAAA,GACf,OAAIjB,KAAKe,MAAMG,YAEPC,EAACC,EAAAA,CACGC,UAAWrB,KAAKe,MAAMM,UACtBH,YAAalB,KAAKe,MAAMG,YACxBI,QAAStB,KAAKe,MAAMO,QACpBC,WAAYvB,KAAKuB,WACjBC,UAAWxB,KAAKyB,KAChB3B,KAAME,KAAK0B,YAAY,KACvBC,YAAa3B,KAAKe,MAAMa,KAAKC,IAAI,uBACjCC,UAAW9B,KAAKe,MAAMa,KAAKC,IAAI,6BAC/BE,mBAAoBC,EAAOD,mBAC3BE,aAAcD,EAAOE,cACrBC,iBAAkBH,EAAOI,kBACzBC,gBAAiBrC,KAAKqC,kBAM9BlB,EAACmB,EAAAA,oUAAAA,CAAAA,CACGC,IAAKA,IACDvC,KAAKwC,aAAeD,IAEpBvC,KAAKe,OAAK,CACd0B,SAAUzC,KAAKG,OACfuC,SAAU1C,KAAK2C,SACfC,UAAW5C,KAAK4C,UAChBC,cAAe7C,KAAKe,MAAM8B,gBAGtC,mBAhHGC,SAAAC,GAeHC,EAAAhD,KAAQiD,iBAAiB/C,GACjBF,KAAKe,MAAMkC,eACJ,IAAIC,QAAQ,CAACC,EAASC,KACzBpD,KAAKe,MAAMkC,eAAeE,EAASC,EAAQlD,KAG/CF,KAAKe,MAAMsC,QACJrD,KAAKe,MAAMsC,QAAQ/C,mBAD9B,GASJ0C,OAAO1C,cAAc,KACjBN,KAAKsD,UAAU,WAGXtD,KAAKe,MAAMwC,MACJL,QAAQC,UAGZnD,KAAKiD,eAAejD,KAAKE,MAC3BK,KAAMgD,IACH,MAAMC,EAAa,CAAED,MAAO,CAAEE,UAAWF,EAAME,UAAWC,aAAcH,EAAMG,eAE9E,OADA1D,KAAK2C,SAASa,GACPN,QAAQC,YAElBvC,MAAM+C,IACCA,aAAiBC,EACjB5D,KAAK6D,YAAYF,GAEjB3D,KAAK6D,YAAY,IAAID,EAAmB,QAASD,QAoBjEX,EAAAhD,KAAO4C,YAAY7B,GACRI,EAAC2C,EAAc/C,KApE1BiC,EADSvD,EACKK,OAAO"}
1
+ {"version":3,"file":"ANCV.js","sources":["../../../../src/components/ANCV/ANCV.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ANCVInput from './components/ANCVInput';\nimport config from './components/ANCVAwait/config';\nimport { Await } from '../../components/internal/Await';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport PayButton from '../internal/PayButton';\nimport { ANCVConfiguration } from './types';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\n\nexport class ANCVElement extends UIElement<ANCVConfiguration> {\n public static type = 'ancv';\n\n /**\n * Formats the component data output\n */\n formatData() {\n return {\n paymentMethod: {\n type: ANCVElement.type,\n beneficiaryId: this.state.data?.beneficiaryId\n }\n };\n }\n\n private onOrderRequest = data => {\n if (this.props.onOrderRequest)\n return new Promise((resolve, reject) => {\n this.props.onOrderRequest(resolve, reject, data);\n });\n\n if (this.props.session) {\n return this.props.session.createOrder();\n }\n };\n\n /**\n * Check if order exists, if it does Resolve.\n * Otherwise createOrder and then Resolve.\n */\n public createOrder = (): Promise<void> => {\n this.setStatus('loading');\n\n // allow for multiple ANCV payments, follow giftcard logic and just use order if it exists\n if (this.props.order) {\n return Promise.resolve();\n }\n\n return this.onOrderRequest(this.data)\n .then((order: { orderData: string; pspReference: string }) => {\n const stateOrder = { order: { orderData: order.orderData, pspReference: order.pspReference } };\n this.setState(stateOrder);\n return Promise.resolve();\n })\n .catch(error => {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', error));\n }\n });\n };\n\n public submit() {\n if (!this.isValid) {\n this.showValidation();\n return false;\n }\n\n this.createOrder()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n // Reimplement payButton similar to GiftCard to allow to set onClick\n protected override payButton = (props: PayButtonProps): h.JSX.Element => {\n return <PayButton {...props} />;\n };\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return (\n <Await\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={this.constructor['type']}\n messageText={this.props.i18n.get('ancv.confirmPayment')}\n awaitText={this.props.i18n.get('await.waitForConfirmation')}\n showCountdownTimer={config.showCountdownTimer}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n\n return (\n <ANCVInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onSubmit={this.submit}\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n />\n );\n }\n}\n\nexport default ANCVElement;\n"],"names":["ANCVElement","UIElement","formatData","_this_state_data","paymentMethod","type","beneficiaryId","this","state","data","submit","isValid","showValidation","createOrder","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","handleFailedResult","displayName","props","name","componentToRender","paymentData","h","Await","clientKey","onError","onComplete","brandLogo","icon","constructor","messageText","i18n","get","awaitText","showCountdownTimer","config","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","ANCVInput","ref","componentRef","onSubmit","onChange","setState","payButton","showPayButton","super","args","_define_property","onOrderRequest","Promise","resolve","reject","session","setStatus","order","stateOrder","orderData","pspReference","error","AdyenCheckoutError","handleError","PayButton"],"mappings":"67BAWO,MAAMA,UAAoBC,EAM7BC,UAAAA,GAI2B,IAAAC,EAHvB,MAAO,CACHC,cAAe,CACXC,KAAML,EAAYK,KAClBC,cAA8B,QAAfH,EAAAI,KAAKC,MAAMC,YAAX,IAAAN,OAAA,EAAAA,EAAiBG,eAG5C,CAwCOI,MAAAA,GACH,IAAKH,KAAKI,QAEN,OADAJ,KAAKK,kBACE,EAGXL,KAAKM,cACAC,KAAKP,KAAKQ,kBACVD,KAAKE,GACLF,KAAKG,GACLH,KAAKP,KAAKW,gBACVC,MAAMZ,KAAKa,mBACpB,CAOA,WAAIT,GACA,QAASJ,KAAKC,MAAMG,OACxB,CAEA,eAAIU,GACA,OAAOd,KAAKe,MAAMC,IACtB,CAEmBC,iBAAAA,GACf,OAAIjB,KAAKe,MAAMG,YAEPC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 -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 o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as s}from"../tx-variants.js";import a from"./components/AchComponent.js";import n from"./defaultProps.js";function r(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class p extends e{formatData(){var t,e;return!!this.props.storedPaymentMethodId?{paymentMethod:{type:p.type,storedPaymentMethodId:this.props.storedPaymentMethodId}}:function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},s=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),s.forEach(function(e){r(t,e,o[e])})}return t}({paymentMethod:{type:p.type,ownerName:this.state.data.ownerName,accountHolderType:null===(t=this.state.data.selectedAccountType)||void 0===t?void 0:t.split(".")[0],bankAccountType:null===(e=this.state.data.selectedAccountType)||void 0===e?void 0:e.split(".")[1],bankLocationId:this.state.data.routingNumber,bankAccountNumber:this.state.data.accountNumber}},this.state.storePaymentMethod&&{storePaymentMethod:this.state.storePaymentMethod})}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.bankAccountNumber?`•••• ${this.props.bankAccountNumber.slice(-4)}`:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.i18n.get("ach.savedBankAccount"):""}componentToRender(){return this.props.storedPaymentMethodId?t(o,{showPayButton:this.props.showPayButton,name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(a,{onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton,hasHolderName:this.props.hasHolderName,placeholders:this.props.placeholders,data:this.props.data,setComponentRef:this.setComponentRef,enableStoreDetails:this.props.enableStoreDetails})}}r(p,"type",s.ach),r(p,"defaultProps",n);export{p as AchElement,p as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as s}from"../tx-variants.js";import a from"./components/AchComponent.js";import n from"./defaultProps.js";function r(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class i extends e{formatData(){var t,e;return!!this.props.storedPaymentMethodId?{paymentMethod:{type:i.type,storedPaymentMethodId:this.props.storedPaymentMethodId}}:function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},s=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),s.forEach(function(e){r(t,e,o[e])})}return t}({paymentMethod:{type:i.type,ownerName:this.state.data.ownerName,accountHolderType:null===(t=this.state.data.selectedAccountType)||void 0===t?void 0:t.split(".")[0],bankAccountType:null===(e=this.state.data.selectedAccountType)||void 0===e?void 0:e.split(".")[1],bankLocationId:this.state.data.routingNumber,bankAccountNumber:this.state.data.accountNumber}},this.state.storePaymentMethod&&{storePaymentMethod:this.state.storePaymentMethod})}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.bankAccountNumber?`•••• ${this.props.bankAccountNumber.slice(-4)}`:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.i18n.get("ach.savedBankAccount"):""}componentToRender(){return this.props.storedPaymentMethodId?t(o,{showPayButton:this.props.showPayButton,name:this.displayName,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(a,{onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton,hasHolderName:this.props.hasHolderName,placeholders:this.props.placeholders,data:this.props.data,setComponentRef:this.setComponentRef,enableStoreDetails:this.props.enableStoreDetails})}}r(i,"type",s.ach),r(i,"defaultProps",n);export{i as AchElement,i as default};
2
2
  //# sourceMappingURL=Ach.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Ach.js","sources":["../../../../src/components/Ach/Ach.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport AchComponent from './components/AchComponent';\nimport defaultProps from './defaultProps';\n\nimport type { AchConfiguration } from './types';\n\nexport class AchElement extends UIElement<AchConfiguration> {\n public static type = TxVariants.ach;\n\n protected static defaultProps = defaultProps;\n\n public override formatData() {\n const recurringPayment = !!this.props.storedPaymentMethodId;\n\n if (recurringPayment) {\n return {\n paymentMethod: {\n type: AchElement.type,\n storedPaymentMethodId: this.props.storedPaymentMethodId\n }\n };\n }\n\n return {\n paymentMethod: {\n type: AchElement.type,\n ownerName: this.state.data.ownerName,\n accountHolderType: this.state.data.selectedAccountType?.split('.')[0],\n bankAccountType: this.state.data.selectedAccountType?.split('.')[1],\n bankLocationId: this.state.data.routingNumber,\n bankAccountNumber: this.state.data.accountNumber\n },\n ...(this.state.storePaymentMethod && { storePaymentMethod: this.state.storePaymentMethod })\n };\n }\n\n public override get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n public override get displayName(): string {\n if (this.props.storedPaymentMethodId && this.props.bankAccountNumber) {\n return `•••• ${this.props.bankAccountNumber.slice(-4)}`;\n }\n return this.props.name;\n }\n\n public override get additionalInfo(): string {\n return this.props.storedPaymentMethodId ? this.props.i18n.get('ach.savedBankAccount') : '';\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\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 <AchComponent\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n hasHolderName={this.props.hasHolderName}\n placeholders={this.props.placeholders}\n data={this.props.data}\n setComponentRef={this.setComponentRef}\n enableStoreDetails={this.props.enableStoreDetails}\n />\n );\n }\n}\n\nexport default AchElement;\n"],"names":["AchElement","UIElement","formatData","_this_state_data_selectedAccountType","_this_state_data_selectedAccountType1","this","props","storedPaymentMethodId","paymentMethod","type","_object_spread","ownerName","state","data","accountHolderType","selectedAccountType","split","bankAccountType","bankLocationId","routingNumber","bankAccountNumber","accountNumber","storePaymentMethod","isValid","displayName","slice","name","additionalInfo","i18n","get","componentToRender","h","RedirectButton","showPayButton","amount","payButton","onSubmit","submit","ref","componentRef","AchComponent","onChange","setState","hasHolderName","placeholders","setComponentRef","enableStoreDetails","_define_property","TxVariants","ach","defaultProps"],"mappings":"obASO,MAAMA,UAAmBC,EAKZC,UAAAA,OAgBeC,EACFC,EAdzB,QAF2BC,KAAKC,MAAMC,sBAG3B,CACHC,cAAe,CACXC,KAAMT,EAAWS,KACjBF,sBAAuBF,KAAKC,MAAMC,0VAKvCG,CAAA,CACHF,cAAe,CACXC,KAAMT,EAAWS,KACjBE,UAAWN,KAAKO,MAAMC,KAAKF,UAC3BG,kBAAsD,QAAnCX,EAAAE,KAAKO,MAAMC,KAAKE,+BAAhBZ,SAAAA,EAAqCa,MAAM,KAAK,GACnEC,gBAAoD,QAAnCb,EAAAC,KAAKO,MAAMC,KAAKE,+BAAhBX,SAAAA,EAAqCY,MAAM,KAAK,GACjEE,eAAgBb,KAAKO,MAAMC,KAAKM,cAChCC,kBAAmBf,KAAKO,MAAMC,KAAKQ,gBAEnChB,KAAKO,MAAMU,oBAAsB,CAAEA,mBAAoBjB,KAAKO,MAAMU,oBAE9E,CAEA,WAAoBC,GAChB,QAAIlB,KAAKC,MAAMC,yBAINF,KAAKO,MAAMW,OACxB,CAEA,eAAoBC,GAChB,OAAInB,KAAKC,MAAMC,uBAAyBF,KAAKC,MAAMc,kBACxC,QAAQf,KAAKC,MAAMc,kBAAkBK,OAAM,KAE/CpB,KAAKC,MAAMoB,IACtB,CAEA,kBAAoBC,GAChB,OAAOtB,KAAKC,MAAMC,sBAAwBF,KAAKC,MAAMsB,KAAKC,IAAI,wBAA0B,EAC5F,CAEmBC,iBAAAA,GACf,OAAOzB,KAAKC,MAAMC,sBACdwB,EAACC,EAAAA,CACGC,cAAe5B,KAAKC,MAAM2B,cAC1BP,KAAMrB,KAAKmB,YACXU,OAAQ7B,KAAKC,MAAM4B,OACnBC,UAAW9B,KAAK8B,UAChBC,SAAU/B,KAAKgC,OACfC,IAAKA,IACDjC,KAAKkC,aAAeD,KAI5BP,EAACS,EAAAA,CACGC,SAAUpC,KAAKqC,SACfP,UAAW9B,KAAK8B,UAChBF,cAAe5B,KAAKC,MAAM2B,cAC1BU,cAAetC,KAAKC,MAAMqC,cAC1BC,aAAcvC,KAAKC,MAAMsC,aACzB/B,KAAMR,KAAKC,MAAMO,KACjBgC,gBAAiBxC,KAAKwC,gBACtBC,mBAAoBzC,KAAKC,MAAMwC,oBAG3C,EAxEAC,EADS/C,EACKS,OAAOuC,EAAWC,KAEhCF,EAHS/C,EAGQkD,eAAeA"}
1
+ {"version":3,"file":"Ach.js","sources":["../../../../src/components/Ach/Ach.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport AchComponent from './components/AchComponent';\nimport defaultProps from './defaultProps';\n\nimport type { AchConfiguration } from './types';\n\nexport class AchElement extends UIElement<AchConfiguration> {\n public static type = TxVariants.ach;\n\n protected static defaultProps = defaultProps;\n\n public override formatData() {\n const recurringPayment = !!this.props.storedPaymentMethodId;\n\n if (recurringPayment) {\n return {\n paymentMethod: {\n type: AchElement.type,\n storedPaymentMethodId: this.props.storedPaymentMethodId\n }\n };\n }\n\n return {\n paymentMethod: {\n type: AchElement.type,\n ownerName: this.state.data.ownerName,\n accountHolderType: this.state.data.selectedAccountType?.split('.')[0],\n bankAccountType: this.state.data.selectedAccountType?.split('.')[1],\n bankLocationId: this.state.data.routingNumber,\n bankAccountNumber: this.state.data.accountNumber\n },\n ...(this.state.storePaymentMethod && { storePaymentMethod: this.state.storePaymentMethod })\n };\n }\n\n public override get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n public override get displayName(): string {\n if (this.props.storedPaymentMethodId && this.props.bankAccountNumber) {\n return `•••• ${this.props.bankAccountNumber.slice(-4)}`;\n }\n return this.props.name;\n }\n\n public override get additionalInfo(): string {\n return this.props.storedPaymentMethodId ? this.props.i18n.get('ach.savedBankAccount') : '';\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={(ref: RefObject<typeof RedirectButton>) => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <AchComponent\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n hasHolderName={this.props.hasHolderName}\n placeholders={this.props.placeholders}\n data={this.props.data}\n setComponentRef={this.setComponentRef}\n enableStoreDetails={this.props.enableStoreDetails}\n />\n );\n }\n}\n\nexport default AchElement;\n"],"names":["AchElement","UIElement","formatData","_this_state_data_selectedAccountType","_this_state_data_selectedAccountType1","this","props","storedPaymentMethodId","paymentMethod","type","_object_spread","ownerName","state","data","accountHolderType","selectedAccountType","split","bankAccountType","bankLocationId","routingNumber","bankAccountNumber","accountNumber","storePaymentMethod","isValid","displayName","slice","name","additionalInfo","i18n","get","componentToRender","h","RedirectButton","showPayButton","payButton","onSubmit","submit","ref","componentRef","AchComponent","onChange","setState","hasHolderName","placeholders","setComponentRef","enableStoreDetails","_define_property","TxVariants","ach","defaultProps"],"mappings":"obASO,MAAMA,UAAmBC,EAKZC,UAAAA,O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,MAAMO,KACjB+B,gBAAiBvC,KAAKuC,gBACtBC,mBAAoBxC,KAAKC,MAAMuC,oBAG3C,EAvEAC,EADS9C,EACKS,OAAOsC,EAAWC,KAEhCF,EAHS9C,EAGQiD,eAAeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AccountTypeSelector.js","sources":["../../../../../src/components/Ach/components/AccountTypeSelector.tsx"],"sourcesContent":["import Select from '../../internal/FormFields/Select';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { useCallback, useMemo } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { SelectItem } from '../../internal/FormFields/Select/types';\n\nconst SELECTOR_OPTIONS = [\n { id: 'personal.checking', nameKey: 'ach.bankAccount.option.personal-checking' },\n { id: 'personal.savings', nameKey: 'ach.bankAccount.option.personal-savings' },\n { id: 'business.checking', nameKey: 'ach.bankAccount.option.business-checking' },\n { id: 'business.savings', nameKey: 'ach.bankAccount.option.business-savings' }\n];\n\ninterface AccountTypeSelectorProps {\n selectedAccountType?: string;\n onSelect(value: string): void;\n disabled: boolean;\n errorMessage?: string;\n placeholder?: string;\n}\n\nconst AccountTypeSelector = ({ onSelect, selectedAccountType, errorMessage, placeholder, disabled }: AccountTypeSelectorProps) => {\n const { i18n } = useCoreContext();\n const options: SelectItem[] = useMemo(\n () =>\n SELECTOR_OPTIONS.map(option => ({\n id: option.id,\n name: i18n.get(option.nameKey)\n })),\n [i18n, SELECTOR_OPTIONS]\n );\n\n const onChange = useCallback(\n event => {\n const value = event.target.value;\n onSelect(value);\n },\n [onSelect]\n );\n\n return (\n <Field\n name={'ach-bankaccount-type'}\n useLabelElement={true}\n showContextualElement={false}\n label={i18n.get('ach.bankAccount.label')}\n errorMessage={errorMessage}\n classNameModifiers={['selectedAccountType']}\n >\n <Select\n placeholder={placeholder || i18n.get('ach.bankAccount.placeholder')}\n filterable={false}\n items={options}\n selectedValue={selectedAccountType}\n onChange={onChange}\n name={'ach-bankaccount-type'}\n disabled={disabled}\n />\n </Field>\n );\n};\n\nexport { AccountTypeSelector };\n"],"names":["SELECTOR_OPTIONS","id","nameKey","AccountTypeSelector","onSelect","selectedAccountType","errorMessage","placeholder","disabled","i18n","useCoreContext","options","useMemo","map","option","name","get","onChange","useCallback","event","value","target","h","Field","useLabelElement","showContextualElement","label","classNameModifiers","Select","filterable","items","selectedValue"],"mappings":"yVAOA,MAAMA,EAAmB,CACrB,CAAEC,GAAI,oBAAqBC,QAAS,4CACpC,CAAED,GAAI,mBAAoBC,QAAS,2CACnC,CAAED,GAAI,oBAAqBC,QAAS,4CACpC,CAAED,GAAI,mBAAoBC,QAAS,4CAWjCC,EAAsB,EAAGC,WAAUC,sBAAqBC,eAAcC,cAAaC,eACrF,MAAMC,KAAEA,GAASC,IACXC,EAAwBC,EAC1B,IACIZ,EAAiBa,IAAIC,KACjBb,GAAIa,EAAOb,GACXc,KAAMN,EAAKO,IAAIF,EAAOZ,YAE9B,CAACO,EAAMT,IAGLiB,EAAWC,EACbC,IACI,MAAMC,EAAQD,EAAME,OAAOD,MAC3BhB,EAASgB,IAEb,CAAChB,IAGL,OACIkB,EAACC,EAAAA,CACGR,KAAM,uBACNS,iBAAiB,EACjBC,uBAAuB,EACvBC,MAAOjB,EAAKO,IAAI,yBAChBV,aAAcA,EACdqB,mBAAoB,CAAC,wBAErBL,EAACM,EAAAA,CACGrB,YAAaA,GAAeE,EAAKO,IAAI,+BACrCa,YAAY,EACZC,MAAOnB,EACPoB,cAAe1B,EACfY,SAAUA,EACVF,KAAM,uBACNP,SAAUA"}
1
+ {"version":3,"file":"AccountTypeSelector.js","sources":["../../../../../src/components/Ach/components/AccountTypeSelector.tsx"],"sourcesContent":["import Select from '../../internal/FormFields/Select';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { useCallback, useMemo } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { SelectItem, SelectTargetObject } from '../../internal/FormFields/Select/types';\n\nconst SELECTOR_OPTIONS = [\n { id: 'personal.checking', nameKey: 'ach.bankAccount.option.personal-checking' },\n { id: 'personal.savings', nameKey: 'ach.bankAccount.option.personal-savings' },\n { id: 'business.checking', nameKey: 'ach.bankAccount.option.business-checking' },\n { id: 'business.savings', nameKey: 'ach.bankAccount.option.business-savings' }\n];\n\ninterface AccountTypeSelectorProps {\n selectedAccountType?: string;\n onSelect(value: string): void;\n disabled: boolean;\n errorMessage?: string;\n placeholder?: string;\n}\n\nconst AccountTypeSelector = ({ onSelect, selectedAccountType, errorMessage, placeholder, disabled }: AccountTypeSelectorProps) => {\n const { i18n } = useCoreContext();\n const options: SelectItem[] = useMemo(\n () =>\n SELECTOR_OPTIONS.map(option => ({\n id: option.id,\n name: i18n.get(option.nameKey)\n })),\n [i18n, SELECTOR_OPTIONS]\n );\n\n const onChange = useCallback(\n (event: { target: SelectTargetObject }) => {\n const value = event.target.value as string;\n onSelect(value);\n },\n [onSelect]\n );\n\n return (\n <Field\n name={'ach-bankaccount-type'}\n useLabelElement={true}\n showContextualElement={false}\n label={i18n.get('ach.bankAccount.label')}\n errorMessage={errorMessage}\n classNameModifiers={['selectedAccountType']}\n >\n <Select\n placeholder={placeholder || i18n.get('ach.bankAccount.placeholder')}\n filterable={false}\n items={options}\n selectedValue={selectedAccountType}\n onChange={onChange}\n name={'ach-bankaccount-type'}\n disabled={disabled}\n />\n </Field>\n );\n};\n\nexport { AccountTypeSelector };\n"],"names":["SELECTOR_OPTIONS","id","nameKey","AccountTypeSelector","onSelect","selectedAccountType","errorMessage","placeholder","disabled","i18n","useCoreContext","options","useMemo","map","option","name","get","onChange","useCallback","event","value","target","h","Field","useLabelElement","showContextualElement","label","classNameModifiers","Select","filterable","items","selectedValue"],"mappings":"yVAOA,MAAMA,EAAmB,CACrB,CAAEC,GAAI,oBAAqBC,QAAS,4CACpC,CAAED,GAAI,mBAAoBC,QAAS,2CACnC,CAAED,GAAI,oBAAqBC,QAAS,4CACpC,CAAED,GAAI,mBAAoBC,QAAS,4CAWjCC,EAAsB,EAAGC,WAAUC,sBAAqBC,eAAcC,cAAaC,eACrF,MAAMC,KAAEA,GAASC,IACXC,EAAwBC,EAC1B,IACIZ,EAAiBa,IAAIC,KACjBb,GAAIa,EAAOb,GACXc,KAAMN,EAAKO,IAAIF,EAAOZ,YAE9B,CAACO,EAAMT,IAGLiB,EAAWC,EACZC,IACG,MAAMC,EAAQD,EAAME,OAAOD,MAC3BhB,EAASgB,IAEb,CAAChB,IAGL,OACIkB,EAACC,EAAAA,CACGR,KAAM,uBACNS,iBAAiB,EACjBC,uBAAuB,EACvBC,MAAOjB,EAAKO,IAAI,yBAChBV,aAAcA,EACdqB,mBAAoB,CAAC,wBAErBL,EAACM,EAAAA,CACGrB,YAAaA,GAAeE,EAAKO,IAAI,+BACrCa,YAAY,EACZC,MAAOnB,EACPoB,cAAe1B,EACfY,SAAUA,EACVF,KAAM,uBACNP,SAAUA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AchComponent.js","sources":["../../../../../src/components/Ach/components/AchComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport FormInstruction from '../../internal/FormInstruction';\nimport { AccountTypeSelector } from './AccountTypeSelector';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport useForm from '../../../utils/useForm';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\nimport { achValidationRules, achFormatters } from './validate';\nimport StoreDetails from '../../internal/StoreDetails';\nimport useSRPanelForAchErrors from './useSRPanelForACHErrors';\nimport useImage from '../../../core/Context/useImage';\nimport { PREFIX } from '../../internal/Icon/constants';\n\nimport type { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport type { ComponentMethodsRef } from '../../internal/UIElement/types';\nimport type { AchPlaceholders } from '../types';\nimport type { AchStateErrors } from './useSRPanelForACHErrors';\n\ntype AchForm = {\n selectedAccountType: string;\n ownerName: string;\n routingNumber: string;\n accountNumber: string;\n accountNumberVerification: string;\n};\n\nexport type AchFormPrefillData = Partial<Pick<AchForm, 'ownerName'>>;\n\ninterface AchComponentProps {\n onChange({\n data,\n valid,\n errors,\n isValid,\n storePaymentMethod\n }: {\n data: AchForm;\n valid: { [key: string]: boolean };\n errors: { [key: string]: any };\n isValid: boolean;\n storePaymentMethod: boolean;\n }): void;\n payButton: (props: Partial<PayButtonProps>) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n hasHolderName: boolean;\n showPayButton: boolean;\n enableStoreDetails: boolean;\n placeholders?: AchPlaceholders;\n data?: AchFormPrefillData;\n}\n\nfunction AchComponent({\n onChange,\n payButton,\n showPayButton,\n placeholders,\n data: defaultData,\n hasHolderName,\n setComponentRef,\n enableStoreDetails\n}: AchComponentProps) {\n const getImage = useImage();\n const schema = useMemo(\n () => ['selectedAccountType', 'routingNumber', 'accountNumber', 'accountNumberVerification', ...(hasHolderName ? ['ownerName'] : [])],\n [hasHolderName]\n );\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = useForm<AchForm>({\n schema,\n defaultData,\n rules: achValidationRules,\n formatters: achFormatters\n });\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const isFormDisabled = status === 'loading';\n\n const isValidating = useRef(false);\n\n const achRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n isValidating.current = true;\n triggerValidation();\n }\n });\n\n useEffect(() => {\n setComponentRef(achRef.current);\n }, [setComponentRef, achRef.current]);\n\n useSRPanelForAchErrors({ errors: errors as AchStateErrors, data, isValidating });\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid, storePaymentMethod });\n }, [onChange, data, valid, errors, isValid, storePaymentMethod]);\n\n /**\n * If the \"Verify account number\" field has errors, we want to trigger\n * its validation when there is any change done to the \"Account number\" field\n */\n const onAccountNumberInput = useCallback(\n (event: h.JSX.TargetedInputEvent<HTMLInputElement>) => {\n handleChangeFor('accountNumber', 'input')(event);\n\n const hasAccountVerificationError = !!errors.accountNumberVerification;\n if (hasAccountVerificationError) {\n triggerValidation(['accountNumberVerification']);\n }\n },\n [handleChangeFor, triggerValidation, data.accountNumberVerification, errors.accountNumberVerification]\n );\n\n return (\n <div className=\"adyen-checkout__ach\">\n <FormInstruction />\n\n <Fieldset classNameModifiers={[]} label={i18n.get('ach.bankAccount.title')}>\n <AccountTypeSelector\n placeholder={placeholders?.accountTypeSelector}\n onSelect={handleChangeFor('selectedAccountType')}\n selectedAccountType={data.selectedAccountType}\n disabled={isFormDisabled}\n errorMessage={!!errors.selectedAccountType && i18n.get(errors.selectedAccountType.errorMessage)}\n />\n\n {hasHolderName && (\n <Field\n label={i18n.get('ach.accountHolderNameField.title')}\n errorMessage={!!errors.ownerName && i18n.get(errors.ownerName.errorMessage)}\n isValid={!!valid.ownerName}\n name={'ownerName'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'ownerName'}\n placeholder={placeholders?.ownerName}\n value={data.ownerName}\n onInput={handleChangeFor('ownerName', 'input')}\n onBlur={handleChangeFor('ownerName', 'blur')}\n required={true}\n />\n </Field>\n )}\n\n <Field\n label={i18n.get('ach.routingNumber.label')}\n classNameModifiers={['col-60']}\n errorMessage={!!errors.routingNumber && i18n.get(errors.routingNumber.errorMessage)}\n name={'routingNumber'}\n isValid={!!valid.routingNumber}\n >\n <InputText\n disabled={isFormDisabled}\n name={'routingNumber'}\n placeholder={placeholders?.routingNumber}\n value={data.routingNumber}\n onInput={handleChangeFor('routingNumber', 'input')}\n onBlur={handleChangeFor('routingNumber', 'blur')}\n required={true}\n maxlength={9}\n />\n </Field>\n\n <Field\n label={i18n.get('ach.bankAccountNumber.label')}\n classNameModifiers={['col-40']}\n errorMessage={!!errors.accountNumber && i18n.get(errors.accountNumber.errorMessage)}\n isValid={!!valid.accountNumber}\n name={'accountNumber'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'accountNumber'}\n placeholder={placeholders?.accountNumber}\n value={data.accountNumber}\n onInput={onAccountNumberInput}\n onBlur={handleChangeFor('accountNumber', 'blur')}\n required={true}\n maxlength={17}\n />\n </Field>\n\n <Field\n label={i18n.get('ach.bankAccountNumberVerification.label')}\n errorMessage={!!errors.accountNumberVerification && i18n.get(errors.accountNumberVerification.errorMessage)}\n name={'accountNumberVerification'}\n isValid={!!valid.accountNumberVerification}\n >\n <InputText\n disabled={isFormDisabled}\n name={'accountNumberVerification'}\n placeholder={placeholders?.accountNumberVerification}\n value={data.accountNumberVerification}\n onInput={handleChangeFor('accountNumberVerification', 'input')}\n onBlur={handleChangeFor('accountNumberVerification', 'blur')}\n required={true}\n maxlength={17}\n />\n </Field>\n </Fieldset>\n\n {enableStoreDetails && <StoreDetails disabled={isFormDisabled} onChange={setStorePaymentMethod} />}\n\n {showPayButton && payButton({ status, icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`) })}\n </div>\n );\n}\n\nexport default AchComponent;\n"],"names":["AchComponent","onChange","payButton","showPayButton","placeholders","data","defaultData","hasHolderName","setComponentRef","enableStoreDetails","getImage","useImage","schema","useMemo","i18n","useCoreContext","status","setStatus","useState","handleChangeFor","triggerValidation","errors","valid","isValid","useForm","rules","achValidationRules","formatters","achFormatters","storePaymentMethod","setStorePaymentMethod","isFormDisabled","isValidating","useRef","achRef","showValidation","current","useEffect","useSRPanelForAchErrors","onAccountNumberInput","useCallback","event","accountNumberVerification","h","div","className","FormInstruction","Fieldset","classNameModifiers","label","get","AccountTypeSelector","placeholder","accountTypeSelector","onSelect","selectedAccountType","disabled","errorMessage","Field","ownerName","name","InputText","value","onInput","onBlur","required","routingNumber","maxlength","accountNumber","StoreDetails","icon","imageFolder","PREFIX"],"mappings":"o4BAqDA,SAASA,GAAaC,SAClBA,EAAQC,UACRA,EAASC,cACTA,EAAaC,aACbA,EACAC,KAAMC,EAAWC,cACjBA,EAAaC,gBACbA,EAAeC,mBACfA,IAE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kB,EAAAA,CACGL,SAAUzB,EACV6B,KAAM,4BACNR,YAAahD,aAAAA,EAAAA,EAAcsC,0BAC3BoB,MAAOzD,EAAKqC,0BACZqB,QAAS5C,EAAgB,4BAA6B,SACtD6C,OAAQ7C,EAAgB,4BAA6B,QACrD8C,UAAU,EACVE,UAAW,OAKtB1D,GAAsBkC,EAAC0B,EAAAA,CAAab,SAAUzB,EAAgB9B,SAAU6B,IAExE3B,GAAiBD,EAAU,CAAEc,SAAQsD,KAAM5D,EAAS,CAAE6D,YAAa,eAAxB7D,CAAyC,GAAG8D,WAGpG"}
1
+ {"version":3,"file":"AchComponent.js","sources":["../../../../../src/components/Ach/components/AchComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport FormInstruction from '../../internal/FormInstruction';\nimport { AccountTypeSelector } from './AccountTypeSelector';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport useForm from '../../../utils/useForm';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\nimport { achValidationRules, achFormatters } from './validate';\nimport StoreDetails from '../../internal/StoreDetails';\nimport useSRPanelForAchErrors from './useSRPanelForACHErrors';\nimport useImage from '../../../core/Context/useImage';\nimport { PREFIX } from '../../internal/Icon/constants';\n\nimport type { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport type { ComponentMethodsRef } from '../../internal/UIElement/types';\nimport type { AchPlaceholders } from '../types';\nimport type { AchStateErrors } from './useSRPanelForACHErrors';\n\ntype AchForm = {\n selectedAccountType: string;\n ownerName: string;\n routingNumber: string;\n accountNumber: string;\n accountNumberVerification: string;\n};\n\nexport type AchFormPrefillData = Partial<Pick<AchForm, 'ownerName'>>;\n\ninterface AchComponentProps {\n onChange({\n data,\n valid,\n errors,\n isValid,\n storePaymentMethod\n }: {\n data: AchForm;\n valid: { [key: string]: boolean };\n errors: { [key: string]: any };\n isValid: boolean;\n storePaymentMethod: boolean;\n }): void;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n hasHolderName: boolean;\n showPayButton: boolean;\n enableStoreDetails: boolean;\n placeholders?: AchPlaceholders;\n data?: AchFormPrefillData;\n}\n\nfunction AchComponent({\n onChange,\n payButton,\n showPayButton,\n placeholders,\n data: defaultData,\n hasHolderName,\n setComponentRef,\n enableStoreDetails\n}: AchComponentProps) {\n const getImage = useImage();\n const schema = useMemo(\n () => ['selectedAccountType', 'routingNumber', 'accountNumber', 'accountNumberVerification', ...(hasHolderName ? ['ownerName'] : [])],\n [hasHolderName]\n );\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = useForm<AchForm>({\n schema,\n defaultData,\n rules: achValidationRules,\n formatters: achFormatters\n });\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const isFormDisabled = status === 'loading';\n\n const isValidating = useRef(false);\n\n const achRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n isValidating.current = true;\n triggerValidation();\n }\n });\n\n useEffect(() => {\n setComponentRef(achRef.current);\n }, [setComponentRef, achRef.current]);\n\n useSRPanelForAchErrors({ errors: errors as AchStateErrors, data, isValidating });\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid, storePaymentMethod });\n }, [onChange, data, valid, errors, isValid, storePaymentMethod]);\n\n /**\n * If the \"Verify account number\" field has errors, we want to trigger\n * its validation when there is any change done to the \"Account number\" field\n */\n const onAccountNumberInput = useCallback(\n (event: h.JSX.TargetedInputEvent<HTMLInputElement>) => {\n handleChangeFor('accountNumber', 'input')(event);\n\n const hasAccountVerificationError = !!errors.accountNumberVerification;\n if (hasAccountVerificationError) {\n triggerValidation(['accountNumberVerification']);\n }\n },\n [handleChangeFor, triggerValidation, data.accountNumberVerification, errors.accountNumberVerification]\n );\n\n return (\n <div className=\"adyen-checkout__ach\">\n <FormInstruction />\n\n <Fieldset classNameModifiers={[]} label={i18n.get('ach.bankAccount.title')}>\n <AccountTypeSelector\n placeholder={placeholders?.accountTypeSelector}\n onSelect={handleChangeFor('selectedAccountType')}\n selectedAccountType={data.selectedAccountType}\n disabled={isFormDisabled}\n errorMessage={!!errors.selectedAccountType && i18n.get(errors.selectedAccountType.errorMessage)}\n />\n\n {hasHolderName && (\n <Field\n label={i18n.get('ach.accountHolderNameField.title')}\n errorMessage={!!errors.ownerName && i18n.get(errors.ownerName.errorMessage)}\n isValid={!!valid.ownerName}\n name={'ownerName'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'ownerName'}\n placeholder={placeholders?.ownerName}\n value={data.ownerName}\n onInput={handleChangeFor('ownerName', 'input')}\n onBlur={handleChangeFor('ownerName', 'blur')}\n required={true}\n />\n </Field>\n )}\n\n <Field\n label={i18n.get('ach.routingNumber.label')}\n classNameModifiers={['col-60']}\n errorMessage={!!errors.routingNumber && i18n.get(errors.routingNumber.errorMessage)}\n name={'routingNumber'}\n isValid={!!valid.routingNumber}\n >\n <InputText\n disabled={isFormDisabled}\n name={'routingNumber'}\n placeholder={placeholders?.routingNumber}\n value={data.routingNumber}\n onInput={handleChangeFor('routingNumber', 'input')}\n onBlur={handleChangeFor('routingNumber', 'blur')}\n required={true}\n maxlength={9}\n />\n </Field>\n\n <Field\n label={i18n.get('ach.bankAccountNumber.label')}\n classNameModifiers={['col-40']}\n errorMessage={!!errors.accountNumber && i18n.get(errors.accountNumber.errorMessage)}\n isValid={!!valid.accountNumber}\n name={'accountNumber'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'accountNumber'}\n placeholder={placeholders?.accountNumber}\n value={data.accountNumber}\n onInput={onAccountNumberInput}\n onBlur={handleChangeFor('accountNumber', 'blur')}\n required={true}\n maxlength={17}\n />\n </Field>\n\n <Field\n label={i18n.get('ach.bankAccountNumberVerification.label')}\n errorMessage={!!errors.accountNumberVerification && i18n.get(errors.accountNumberVerification.errorMessage)}\n name={'accountNumberVerification'}\n isValid={!!valid.accountNumberVerification}\n >\n <InputText\n disabled={isFormDisabled}\n name={'accountNumberVerification'}\n placeholder={placeholders?.accountNumberVerification}\n value={data.accountNumberVerification}\n onInput={handleChangeFor('accountNumberVerification', 'input')}\n onBlur={handleChangeFor('accountNumberVerification', 'blur')}\n required={true}\n maxlength={17}\n />\n </Field>\n </Fieldset>\n\n {enableStoreDetails && <StoreDetails disabled={isFormDisabled} onChange={setStorePaymentMethod} />}\n\n {showPayButton && payButton({ status, icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`) })}\n </div>\n );\n}\n\nexport default AchComponent;\n"],"names":["AchComponent","onChange","payButton","showPayButton","placeholders","data","defaultData","hasHolderName","setComponentRef","enableStoreDetails","getImage","useImage","schema","useMemo","i18n","useCoreContext","status","setStatus","useState","handleChangeFor","triggerValidation","errors","valid","isValid","useForm","rules","achValidationRules","formatters","achFormatters","storePaymentMethod","setStorePaymentMethod","isFormDisabled","isValidating","useRef","achRef","showValidation","current","useEffect","useSRPanelForAchErrors","onAccountNumberInput","useCallback","event","accountNumberVerification","h","div","className","FormInstruction","Fieldset","classNameModifiers","label","get","AccountTypeSelector","placeholder","accountTypeSelector","onSelect","selectedAccountType","disabled","errorMessage","Field","ownerName","name","InputText","value","onInput","onBlur","required","routingNumber","maxlength","accountNumber","StoreDetails","icon","imageFolder","PREFIX"],"mappings":"o4BAqDA,SAASA,GAAaC,SAClBA,EAAQC,UACRA,EAASC,cACTA,EAAaC,aACbA,EACAC,KAAMC,EAAWC,cACjBA,EAAaC,gBACbA,EAAeC,mBACfA,IAEA,MAAMC,EAAWC,IACXC,EAASC,EACX,IAAM,CAAC,sBAAuB,gBAAiB,gBAAiB,+BAAiCN,EAAgB,CAAC,aAAe,IACjI,CAACA,KAECO,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,gBAAEA,EAAeC,kBAAEA,EAAiBf,KAAEA,EAAIgB,OAAEA,EAAMC,MAAEA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ab,SAAUzB,EAAgB9B,SAAU6B,IAExE3B,GAAiBD,EAAU,CAAEc,SAAQsD,KAAM5D,EAAS,CAAE6D,YAAa,eAAxB7D,CAAyC,GAAG8D,WAGpG"}
@@ -1 +1 @@
1
- {"version":3,"file":"Affirm.js","sources":["../../../../src/components/Affirm/Affirm.tsx"],"sourcesContent":["import OpenInvoiceContainer from '../helpers/OpenInvoiceContainer';\nimport { ALLOWED_COUNTRIES } from './config';\nimport { TxVariants } from '../tx-variants';\n\nexport default class Affirm extends OpenInvoiceContainer {\n public static type = TxVariants.affirm;\n\n formatProps(props) {\n return {\n ...super.formatProps(props),\n allowedCountries: ALLOWED_COUNTRIES,\n personalDetailsRequiredFields: ['firstName', 'lastName', 'telephoneNumber', 'shopperEmail']\n };\n }\n}\n"],"names":["Affirm","OpenInvoiceContainer","formatProps","props","_object_spread_props","_object_spread","super","allowedCountries","ALLOWED_COUNTRIES","personalDetailsRequiredFields","_define_property","type","TxVariants","affirm"],"mappings":"2oBAIe,MAAMA,UAAeC,EAGhCC,WAAAA,CAAYC,GACR,OAAOC,oUAAAC,CAAA,CAAA,EACAC,MAAMJ,YAAYC,IAAAA,CACrBI,iBAAkBC,EAClBC,8BAA+B,CAAC,YAAa,WAAY,kBAAmB,iBAEpF,EARAC,EADiBV,EACHW,OAAOC,EAAWC"}
1
+ {"version":3,"file":"Affirm.js","sources":["../../../../src/components/Affirm/Affirm.tsx"],"sourcesContent":["import OpenInvoiceContainer from '../helpers/OpenInvoiceContainer';\nimport { ALLOWED_COUNTRIES } from './config';\nimport { TxVariants } from '../tx-variants';\nimport type { OpenInvoiceConfiguration } from '../types';\n\nexport default class Affirm extends OpenInvoiceContainer {\n public static type = TxVariants.affirm;\n\n formatProps(props: OpenInvoiceConfiguration) {\n return {\n ...super.formatProps(props),\n allowedCountries: ALLOWED_COUNTRIES,\n personalDetailsRequiredFields: ['firstName', 'lastName', 'telephoneNumber', 'shopperEmail']\n };\n }\n}\n"],"names":["Affirm","OpenInvoiceContainer","formatProps","props","_object_spread_props","_object_spread","super","allowedCountries","ALLOWED_COUNTRIES","personalDetailsRequiredFields","_define_property","type","TxVariants","affirm"],"mappings":"2oBAKe,MAAMA,UAAeC,EAGhCC,WAAAA,CAAYC,GACR,OAAOC,oUAAAC,CAAA,CAAA,EACAC,MAAMJ,YAAYC,IAAAA,CACrBI,iBAAkBC,EAClBC,8BAA+B,CAAC,YAAa,WAAY,kBAAmB,iBAEpF,EARAC,EADiBV,EACHW,OAAOC,EAAWC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AfterPay.js","sources":["../../../../src/components/AfterPay/AfterPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport OpenInvoiceContainer from '../helpers/OpenInvoiceContainer';\nimport ConsentCheckboxLabel from '../internal/ConsentCheckboxLabel';\nimport { ALLOWED_COUNTRIES, rivertyConsentUrlMap } from './config';\nimport { getConsentUrl } from '../../utils/getConsentUrl';\nimport { TxVariants } from '../tx-variants';\n\nexport default class AfterPay extends OpenInvoiceContainer {\n public static type = TxVariants.afterpay_default;\n public static txVariants = [TxVariants.afterpay_default, TxVariants.afterpay];\n\n formatProps(props) {\n return {\n ...super.formatProps(props),\n allowedCountries: props.countryCode ? [props.countryCode] : ALLOWED_COUNTRIES,\n consentCheckboxLabel: <ConsentCheckboxLabel url={getConsentUrl(props.countryCode, props.i18n?.locale, rivertyConsentUrlMap)} />\n };\n }\n}\n"],"names":["AfterPay","OpenInvoiceContainer","formatProps","props","_object_spread_props","_object_spread","super","allowedCountries","countryCode","ALLOWED_COUNTRIES","consentCheckboxLabel","h","ConsentCheckboxLabel","url","getConsentUrl","i18n","locale","rivertyConsentUrlMap","_define_property","type","TxVariants","afterpay_default","txVariants","afterpay"],"mappings":"+2BAOe,MAAMA,UAAiBC,EAIlCC,WAAAA,CAAYC,GAI8EA,IAAAA,EAHtF,OAAOC,oUAAAC,CAAA,CAAA,EACAC,MAAMJ,YAAYC,IAAAA,CACrBI,iBAAkBJ,EAAMK,YAAc,CAACL,EAAMK,aAAeC,EAC5DC,qBAAsBC,EAACC,EAAAA,CAAqBC,IAAKC,EAAcX,EAAMK,YAAuB,QAAVL,EAAAA,EAAMY,YAANZ,IAAAA,OAAAA,EAAAA,EAAYa,OAAQC,MAE9G,EATAC,EADiBlB,EACHmB,OAAOC,EAAWC,kBAChCH,EAFiBlB,EAEHsB,aAAa,CAACF,EAAWC,iBAAkBD,EAAWG"}
1
+ {"version":3,"file":"AfterPay.js","sources":["../../../../src/components/AfterPay/AfterPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport OpenInvoiceContainer from '../helpers/OpenInvoiceContainer';\nimport ConsentCheckboxLabel from '../internal/ConsentCheckboxLabel';\nimport { ALLOWED_COUNTRIES, rivertyConsentUrlMap } from './config';\nimport { getConsentUrl } from '../../utils/getConsentUrl';\nimport { TxVariants } from '../tx-variants';\nimport type { OpenInvoiceConfiguration } from '../types';\n\nexport default class AfterPay extends OpenInvoiceContainer {\n public static type = TxVariants.afterpay_default;\n public static txVariants = [TxVariants.afterpay_default, TxVariants.afterpay];\n\n formatProps(props: OpenInvoiceConfiguration) {\n return {\n ...super.formatProps(props),\n allowedCountries: props.countryCode ? [props.countryCode] : ALLOWED_COUNTRIES,\n consentCheckboxLabel: <ConsentCheckboxLabel url={getConsentUrl(props.countryCode, props.i18n?.locale, rivertyConsentUrlMap)} />\n };\n }\n}\n"],"names":["AfterPay","OpenInvoiceContainer","formatProps","props","_object_spread_props","_object_spread","super","allowedCountries","countryCode","ALLOWED_COUNTRIES","consentCheckboxLabel","h","ConsentCheckboxLabel","url","getConsentUrl","i18n","locale","rivertyConsentUrlMap","_define_property","type","TxVariants","afterpay_default","txVariants","afterpay"],"mappings":"+2BAQe,MAAMA,UAAiBC,EAIlCC,WAAAA,CAAYC,GAI8EA,IAAAA,EAHtF,OAAOC,oUAAAC,CAAA,CAAA,EACAC,MAAMJ,YAAYC,IAAAA,CACrBI,iBAAkBJ,EAAMK,YAAc,CAACL,EAAMK,aAAeC,EAC5DC,qBAAsBC,EAACC,EAAAA,CAAqBC,IAAKC,EAAcX,EAAMK,YAAuB,QAAVL,EAAAA,EAAMY,YAANZ,IAAAA,OAAAA,EAAAA,EAAYa,OAAQC,MAE9G,EATAC,EADiBlB,EACHmB,OAAOC,EAAWC,kBAChCH,EAFiBlB,EAEHsB,aAAa,CAACF,EAAWC,iBAAkBD,EAAWG"}
@@ -1 +1 @@
1
- {"version":3,"file":"AfterPayB2B.js","sources":["../../../../src/components/AfterPay/AfterPayB2B.tsx"],"sourcesContent":["import OpenInvoiceContainer from '../helpers/OpenInvoiceContainer';\nimport { TxVariants } from '../tx-variants';\nimport { OpenInvoiceConfiguration } from '../helpers/OpenInvoiceContainer/types';\nimport { ALLOWED_COUNTRIES } from './config';\n\nexport default class AfterPayB2B extends OpenInvoiceContainer {\n public static type = TxVariants.afterpay_b2b;\n\n protected static defaultProps: Partial<OpenInvoiceConfiguration> = {\n onChange: () => {},\n data: { companyDetails: {}, personalDetails: {}, billingAddress: {}, deliveryAddress: {} },\n visibility: {\n companyDetails: 'editable',\n personalDetails: 'editable',\n billingAddress: 'editable',\n deliveryAddress: 'editable'\n }\n };\n\n formatProps(props) {\n return {\n ...super.formatProps(props),\n allowedCountries: props.countryCode ? [props.countryCode] : ALLOWED_COUNTRIES\n };\n }\n}\n"],"names":["AfterPayB2B","OpenInvoiceContainer","formatProps","props","_object_spread_props","_object_spread","super","allowedCountries","countryCode","ALLOWED_COUNTRIES","_define_property","type","TxVariants","afterpay_b2b","defaultProps","onChange","data","companyDetails","personalDetails","billingAddress","deliveryAddress","visibility"],"mappings":"2oBAKe,MAAMA,UAAoBC,EAcrCC,WAAAA,CAAYC,GACR,OAAOC,oUAAAC,CAAA,CAAA,EACAC,MAAMJ,YAAYC,IAAAA,CACrBI,iBAAkBJ,EAAMK,YAAc,CAACL,EAAMK,aAAeC,GAEpE,EAlBAC,EADiBV,EACHW,OAAOC,EAAWC,cAEhCH,EAHiBV,EAGAc,eAAkD,CAC/DC,SAAU,OACVC,KAAM,CAAEC,eAAgB,CAAA,EAAIC,gBAAiB,CAAA,EAAIC,eAAgB,CAAA,EAAIC,gBAAiB,CAAA,GACtFC,WAAY,CACRJ,eAAgB,WAChBC,gBAAiB,WACjBC,eAAgB,WAChBC,gBAAiB"}
1
+ {"version":3,"file":"AfterPayB2B.js","sources":["../../../../src/components/AfterPay/AfterPayB2B.tsx"],"sourcesContent":["import OpenInvoiceContainer from '../helpers/OpenInvoiceContainer';\nimport { TxVariants } from '../tx-variants';\nimport { ALLOWED_COUNTRIES } from './config';\nimport type { OpenInvoiceConfiguration } from '../helpers/OpenInvoiceContainer/types';\n\nexport default class AfterPayB2B extends OpenInvoiceContainer {\n public static type = TxVariants.afterpay_b2b;\n\n protected static defaultProps: Partial<OpenInvoiceConfiguration> = {\n onChange: () => {},\n data: { companyDetails: {}, personalDetails: {}, billingAddress: {}, deliveryAddress: {} },\n visibility: {\n companyDetails: 'editable',\n personalDetails: 'editable',\n billingAddress: 'editable',\n deliveryAddress: 'editable'\n }\n };\n\n formatProps(props: OpenInvoiceConfiguration) {\n return {\n ...super.formatProps(props),\n allowedCountries: props.countryCode ? [props.countryCode] : ALLOWED_COUNTRIES\n };\n }\n}\n"],"names":["AfterPayB2B","OpenInvoiceContainer","formatProps","props","_object_spread_props","_object_spread","super","allowedCountries","countryCode","ALLOWED_COUNTRIES","_define_property","type","TxVariants","afterpay_b2b","defaultProps","onChange","data","companyDetails","personalDetails","billingAddress","deliveryAddress","visibility"],"mappings":"2oBAKe,MAAMA,UAAoBC,EAcrCC,WAAAA,CAAYC,GACR,OAAOC,oUAAAC,CAAA,CAAA,EACAC,MAAMJ,YAAYC,IAAAA,CACrBI,iBAAkBJ,EAAMK,YAAc,CAACL,EAAMK,aAAeC,GAEpE,EAlBAC,EADiBV,EACHW,OAAOC,EAAWC,cAEhCH,EAHiBV,EAGAc,eAAkD,CAC/DC,SAAU,OACVC,KAAM,CAAEC,eAAgB,CAAA,EAAIC,gBAAiB,CAAA,EAAIC,eAAgB,CAAA,EAAIC,gBAAiB,CAAA,GACtFC,WAAY,CACRJ,eAAgB,WAChBC,gBAAiB,WACjBC,eAAgB,WAChBC,gBAAiB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../external/preact/dist/preact.js";import{useState as e,useEffect as r}from"../../../external/preact/hooks/dist/hooks.js";import{getAmazonSignature as o}from"../services.js";import{getPayloadJSON as n,getAmazonPaySettings as c}from"../utils.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}function u(u){const{loadingContext:l}=i(),{amazonRef:f,configuration:p={}}=u,[y,m]=e(null),b=n(u),O=c(u),h=()=>{new Promise(u.onClick).then(this.initCheckout).catch(t=>{u.onError&&u.onError(t,this.componentRef)})};return this.initCheckout=()=>{const t={payloadJSON:JSON.stringify(b),publicKeyId:p.publicKeyId,signature:y};f.Pay.initCheckout(s(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){a(t,e,r[e])})}return t}({},O),{createCheckoutSessionConfig:t}))},r(()=>{const{clientKey:t}=u;o(l,t,b).then(t=>{if(!(null==t?void 0:t.signature))return console.error("Could not get AmazonPay signature");m(t.signature),u.showPayButton&&f.Pay.renderButton("#amazonPayButton",O).onClick(h)}).catch(t=>{console.error(t),u.onError&&u.onError(t,this.componentRef)})},[]),u.showPayButton?t("div",{className:"adyen-checkout__amazonpay__button",id:"amazonPayButton"}):null}export{u as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{useState as e,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import{getAmazonSignature as r}from"../services.js";import{getPayloadJSON as n,getAmazonPaySettings as c}from"../utils.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{useAmount as a}from"../../../core/Context/AmountProvider.js";function s(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function u(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}function l(l){const{amount:f}=a(),{loadingContext:p}=i(),{amazonRef:y,configuration:m={}}=l,[b,O]=e(null),h=n(l,f),P=c(l,f),j=()=>{new Promise(l.onClick).then(this.initCheckout).catch(t=>{l.onError&&l.onError(t,this.componentRef)})};return this.initCheckout=()=>{const t={payloadJSON:JSON.stringify(h),publicKeyId:m.publicKeyId,signature:b};y.Pay.initCheckout(u(function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){s(t,e,o[e])})}return t}({},P),{createCheckoutSessionConfig:t}))},o(()=>{const{clientKey:t}=l;r(p,t,h).then(t=>{if(!(null==t?void 0:t.signature))return console.error("Could not get AmazonPay signature");O(t.signature),l.showPayButton&&y.Pay.renderButton("#amazonPayButton",P).onClick(j)}).catch(t=>{console.error(t),l.onError&&l.onError(t,this.componentRef)})},[]),l.showPayButton?t("div",{className:"adyen-checkout__amazonpay__button",id:"amazonPayButton"}):null}export{l as default};
2
2
  //# sourceMappingURL=AmazonPayButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AmazonPayButton.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport { getAmazonSignature } from '../services';\nimport { getAmazonPaySettings, getPayloadJSON } from '../utils';\nimport { AmazonPayButtonProps, CheckoutSessionConfig, PayloadJSON } from '../types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\nexport default function AmazonPayButton(props: AmazonPayButtonProps) {\n const { loadingContext } = useCoreContext();\n const { amazonRef, configuration = {} } = props;\n const [signature, setSignature] = useState<string>(null);\n const payloadJSON: PayloadJSON = getPayloadJSON(props);\n const settings = getAmazonPaySettings(props);\n\n const handleOnClick = () => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n new Promise(props.onClick).then(this.initCheckout).catch(error => {\n if (props.onError) props.onError(error, this.componentRef);\n });\n };\n\n const renderAmazonPayButton = (): void => {\n const amazonPayButton = amazonRef.Pay.renderButton('#amazonPayButton', settings);\n amazonPayButton.onClick(handleOnClick);\n };\n\n this.initCheckout = () => {\n const checkoutSessionConfig: CheckoutSessionConfig = {\n payloadJSON: JSON.stringify(payloadJSON),\n publicKeyId: configuration.publicKeyId,\n signature\n };\n\n amazonRef.Pay.initCheckout({\n ...settings,\n createCheckoutSessionConfig: checkoutSessionConfig\n });\n };\n\n useEffect(() => {\n const { clientKey } = props;\n\n getAmazonSignature(loadingContext, clientKey, payloadJSON)\n .then(response => {\n if (!response?.signature) return console.error('Could not get AmazonPay signature');\n setSignature(response.signature);\n if (props.showPayButton) renderAmazonPayButton();\n })\n .catch(error => {\n console.error(error);\n if (props.onError) props.onError(error, this.componentRef);\n });\n }, []);\n\n if (!props.showPayButton) return null;\n return <div className=\"adyen-checkout__amazonpay__button\" id=\"amazonPayButton\" />;\n}\n"],"names":["AmazonPayButton","props","loadingContext","useCoreContext","amazonRef","configuration","signature","setSignature","useState","payloadJSON","getPayloadJSON","settings","getAmazonPaySettings","handleOnClick","Promise","onClick","then","this","initCheckout","catch","error","onError","componentRef","checkoutSessionConfig","JSON","stringify","publicKeyId","Pay","_object_spread_props","_object_spread","createCheckoutSessionConfig","useEffect","clientKey","getAmazonSignature","response","console","showPayButton","renderButton","h","div","className","id"],"mappings":"s0BAOe,SAASA,EAAgBC,GACpC,MAAMC,eAAEA,GAAmBC,KACrBC,UAAEA,EAASC,cAAEA,EAAgB,CAAA,GAAOJ,GACnCK,EAAWC,GAAgBC,EAAiB,MAC7CC,EAA2BC,EAAeT,GAC1CU,EAAWC,EAAqBX,GAEhCY,EAAgB,KAElB,IAAIC,QAAQb,EAAMc,SAASC,KAAKC,KAAKC,cAAcC,MAAMC,IACjDnB,EAAMoB,SAASpB,EAAMoB,QAAQD,EAAOH,KAAKK,iBAqCrD,OA5BAL,KAAKC,aAAe,KAChB,MAAMK,EAA+C,CACjDd,YAAae,KAAKC,UAAUhB,GAC5BiB,YAAarB,EAAcqB,YAC3BpB,aAGJF,EAAUuB,IAAIT,aAAaU,oUAAAC,CAAA,CAAA,EACpBlB,GAAAA,CACHmB,4BAA6BP,MAIrCQ,EAAU,KACN,MAAMC,UAAEA,GAAc/B,EAEtBgC,EAAmB/B,EAAgB8B,EAAWvB,GACzCO,KAAKkB,IACF,KAAKA,aAAAA,EAAAA,EAAU5B,WAAW,OAAO6B,QAAQf,MAAM,qCAC/Cb,EAAa2B,EAAS5B,WAClBL,EAAMmC,eAxBMhC,EAAUuB,IAAIU,aAAa,mBAAoB1B,GACvDI,QAAQF,KAyBnBM,MAAMC,IACHe,QAAQf,MAAMA,GACVnB,EAAMoB,SAASpB,EAAMoB,QAAQD,EAAOH,KAAKK,iBAEtD,IAEErB,EAAMmC,cACJE,EAACC,MAAAA,CAAIC,UAAU,oCAAoCC,GAAG,oBAD5B,IAErC"}
1
+ {"version":3,"file":"AmazonPayButton.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport { getAmazonSignature } from '../services';\nimport { getAmazonPaySettings, getPayloadJSON } from '../utils';\nimport { AmazonPayButtonProps, CheckoutSessionConfig, PayloadJSON } from '../types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\nexport default function AmazonPayButton(props: AmazonPayButtonProps) {\n const { amount } = useAmount();\n const { loadingContext } = useCoreContext();\n const { amazonRef, configuration = {} } = props;\n const [signature, setSignature] = useState<string>(null);\n const payloadJSON: PayloadJSON = getPayloadJSON(props, amount);\n const settings = getAmazonPaySettings(props, amount);\n\n const handleOnClick = () => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n new Promise(props.onClick).then(this.initCheckout).catch(error => {\n if (props.onError) props.onError(error, this.componentRef);\n });\n };\n\n const renderAmazonPayButton = (): void => {\n const amazonPayButton = amazonRef.Pay.renderButton('#amazonPayButton', settings);\n amazonPayButton.onClick(handleOnClick);\n };\n\n this.initCheckout = () => {\n const checkoutSessionConfig: CheckoutSessionConfig = {\n payloadJSON: JSON.stringify(payloadJSON),\n publicKeyId: configuration.publicKeyId,\n signature\n };\n\n amazonRef.Pay.initCheckout({\n ...settings,\n createCheckoutSessionConfig: checkoutSessionConfig\n });\n };\n\n useEffect(() => {\n const { clientKey } = props;\n\n getAmazonSignature(loadingContext, clientKey, payloadJSON)\n .then(response => {\n if (!response?.signature) return console.error('Could not get AmazonPay signature');\n setSignature(response.signature);\n if (props.showPayButton) renderAmazonPayButton();\n })\n .catch(error => {\n console.error(error);\n if (props.onError) props.onError(error, this.componentRef);\n });\n }, []);\n\n if (!props.showPayButton) return null;\n return <div className=\"adyen-checkout__amazonpay__button\" id=\"amazonPayButton\" />;\n}\n"],"names":["AmazonPayButton","props","amount","useAmount","loadingContext","useCoreContext","amazonRef","configuration","signature","setSignature","useState","payloadJSON","getPayloadJSON","settings","getAmazonPaySettings","handleOnClick","Promise","onClick","then","this","initCheckout","catch","error","onError","componentRef","checkoutSessionConfig","JSON","stringify","publicKeyId","Pay","_object_spread_props","_object_spread","createCheckoutSessionConfig","useEffect","clientKey","getAmazonSignature","response","console","showPayButton","renderButton","h","div","className","id"],"mappings":"04BAQe,SAASA,EAAgBC,GACpC,MAAMC,OAAEA,GAAWC,KACbC,eAAEA,GAAmBC,KACrBC,UAAEA,EAASC,cAAEA,EAAgB,CAAA,GAAON,GACnCO,EAAWC,GAAgBC,EAAiB,MAC7CC,EAA2BC,EAAeX,EAAOC,GACjDW,EAAWC,EAAqBb,EAAOC,GAEvCa,EAAgB,KAElB,IAAIC,QAAQf,EAAMgB,SAASC,KAAKC,KAAKC,cAAcC,MAAMC,IACjDrB,EAAMsB,SAAStB,EAAMsB,QAAQD,EAAOH,KAAKK,iBAqCrD,OA5BAL,KAAKC,aAAe,KAChB,MAAMK,EAA+C,CACjDd,YAAae,KAAKC,UAAUhB,GAC5BiB,YAAarB,EAAcqB,YAC3BpB,aAGJF,EAAUuB,IAAIT,aAAaU,oUAAAC,CAAA,CAAA,EACpBlB,GAAAA,CACHmB,4BAA6BP,MAIrCQ,EAAU,KACN,MAAMC,UAAEA,GAAcjC,EAEtBkC,EAAmB/B,EAAgB8B,EAAWvB,GACzCO,KAAKkB,IACF,KAAKA,aAAAA,EAAAA,EAAU5B,WAAW,OAAO6B,QAAQf,MAAM,qCAC/Cb,EAAa2B,EAAS5B,WAClBP,EAAMqC,eAxBMhC,EAAUuB,IAAIU,aAAa,mBAAoB1B,GACvDI,QAAQF,KAyBnBM,MAAMC,IACHe,QAAQf,MAAMA,GACVrB,EAAMsB,SAAStB,EAAMsB,QAAQD,EAAOH,KAAKK,iBAEtD,IAEEvB,EAAMqC,cACJE,EAACC,MAAAA,CAAIC,UAAU,oCAAoCC,GAAG,oBAD5B,IAErC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as t,useRef as n,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../internal/Spinner/Spinner.js";import{getAmazonPayUrl as a}from"../utils.js";import i from"./AmazonPayButton.js";import c from"./ChangePaymentDetailsButton.js";import s from"./OrderButton.js";import u from"./SignOutButton.js";import m from"../../../utils/Script.js";import p from"../../../core/Analytics/useAnalytics.js";function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function d(d){const[f,h]=t("pending"),g=n(null),O=n(null),{analytics:b}=p(),j=()=>{h("ready")};return this.getSubmitFunction=()=>g.current&&g.current.initCheckout?()=>g.current.initCheckout():O.current&&O.current.createOrder?()=>O.current.createOrder():void 0,o(()=>{const e=a(d.configuration.region),t=new m({src:e,component:"amazonpay",analytics:b});return window.amazon?j():t.load().then(j),()=>{t.remove()}},[b]),"pending"===f?e("div",{className:"adyen-checkout__amazonpay"},e("div",{className:"adyen-checkout__amazonpay__status adyen-checkout__amazonpay__status--pending"},e(r,null))):d.showSignOutButton?e("div",{className:"adyen-checkout__amazonpay"},e(u,{amazonRef:window.amazon,onSignOut:d.onSignOut})):d.amazonCheckoutSessionId?e("div",{className:"adyen-checkout__amazonpay"},d.showOrderButton&&e(s,{amazonCheckoutSessionId:d.amazonCheckoutSessionId,amount:d.amount,chargePermissionType:d.chargePermissionType,recurringMetadata:d.recurringMetadata,clientKey:d.clientKey,onError:d.onError,publicKeyId:null===(w=d.configuration)||void 0===w?void 0:w.publicKeyId,region:null===(z=d.configuration)||void 0===z?void 0:z.region,returnUrl:d.returnUrl,ref:O}),d.showChangePaymentDetailsButton&&e(c,{amazonCheckoutSessionId:d.amazonCheckoutSessionId,amazonRef:window.amazon})):e("div",{className:"adyen-checkout__amazonpay"},e(i,y(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){l(e,t,n[t])})}return e}({},d),{showPayButton:this.props.showPayButton,amazonRef:window.amazon,ref:g})));var w,z}export{d as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as t,useRef as n,useEffect as o}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../internal/Spinner/Spinner.js";import{getAmazonPayUrl as a}from"../utils.js";import i from"./AmazonPayButton.js";import c from"./ChangePaymentDetailsButton.js";import s from"./OrderButton.js";import u from"./SignOutButton.js";import m from"../../../utils/Script.js";import p from"../../../core/Analytics/useAnalytics.js";function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function d(d){const[f,h]=t("pending"),g=n(null),O=n(null),{analytics:b}=p(),j=()=>{h("ready")};return this.getSubmitFunction=()=>g.current&&g.current.initCheckout?()=>g.current.initCheckout():O.current&&O.current.createOrder?()=>O.current.createOrder():void 0,o(()=>{const e=a(d.configuration.region),t=new m({src:e,component:"amazonpay",analytics:b});return window.amazon?j():t.load().then(j),()=>{t.remove()}},[b]),"pending"===f?e("div",{className:"adyen-checkout__amazonpay"},e("div",{className:"adyen-checkout__amazonpay__status adyen-checkout__amazonpay__status--pending"},e(r,null))):d.showSignOutButton?e("div",{className:"adyen-checkout__amazonpay"},e(u,{amazonRef:window.amazon,onSignOut:d.onSignOut})):d.amazonCheckoutSessionId?e("div",{className:"adyen-checkout__amazonpay"},d.showOrderButton&&e(s,{amazonCheckoutSessionId:d.amazonCheckoutSessionId,chargePermissionType:d.chargePermissionType,recurringMetadata:d.recurringMetadata,clientKey:d.clientKey,onError:d.onError,publicKeyId:null===(w=d.configuration)||void 0===w?void 0:w.publicKeyId,region:null===(z=d.configuration)||void 0===z?void 0:z.region,returnUrl:d.returnUrl,ref:O}),d.showChangePaymentDetailsButton&&e(c,{amazonCheckoutSessionId:d.amazonCheckoutSessionId,amazonRef:window.amazon})):e("div",{className:"adyen-checkout__amazonpay"},e(i,y(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){l(e,t,n[t])})}return e}({},d),{showPayButton:this.props.showPayButton,amazonRef:window.amazon,ref:g})));var w,z}export{d as default};
2
2
  //# sourceMappingURL=AmazonPayComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AmazonPayComponent.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef } from 'preact/hooks';\nimport Spinner from '../../internal/Spinner';\nimport { getAmazonPayUrl } from '../utils';\nimport { AmazonPayComponentProps } from '../types';\nimport AmazonPayButton from './AmazonPayButton';\nimport ChangePaymentDetailsButton from './ChangePaymentDetailsButton';\nimport OrderButton from './OrderButton';\nimport SignOutButton from './SignOutButton';\nimport Script from '../../../utils/Script';\nimport useAnalytics from '../../../core/Analytics/useAnalytics';\n\nexport default function AmazonPayComponent(props: AmazonPayComponentProps) {\n const [status, setStatus] = useState('pending');\n const amazonPayButtonRef = useRef(null);\n const orderButtonRef = useRef(null);\n const { analytics } = useAnalytics();\n\n const handleLoad = () => {\n setStatus('ready');\n };\n\n this.getSubmitFunction = () => {\n if (amazonPayButtonRef.current && amazonPayButtonRef.current.initCheckout) return () => amazonPayButtonRef.current.initCheckout();\n if (orderButtonRef.current && orderButtonRef.current.createOrder) return () => orderButtonRef.current.createOrder();\n };\n\n useEffect(() => {\n const src = getAmazonPayUrl(props.configuration.region);\n const script = new Script({\n src,\n component: 'amazonpay',\n analytics\n });\n\n if (window.amazon) {\n handleLoad();\n } else {\n void script.load().then(handleLoad);\n }\n\n return () => {\n script.remove();\n };\n }, [analytics]);\n\n if (status === 'pending') {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <div className=\"adyen-checkout__amazonpay__status adyen-checkout__amazonpay__status--pending\">\n <Spinner />\n </div>\n </div>\n );\n }\n\n if (props.showSignOutButton) {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <SignOutButton amazonRef={window.amazon} onSignOut={props.onSignOut} />\n </div>\n );\n }\n\n if (props.amazonCheckoutSessionId) {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n {props.showOrderButton && (\n <OrderButton\n amazonCheckoutSessionId={props.amazonCheckoutSessionId}\n amount={props.amount}\n chargePermissionType={props.chargePermissionType}\n recurringMetadata={props.recurringMetadata}\n clientKey={props.clientKey}\n onError={props.onError}\n publicKeyId={props.configuration?.publicKeyId}\n region={props.configuration?.region}\n returnUrl={props.returnUrl}\n ref={orderButtonRef}\n />\n )}\n\n {props.showChangePaymentDetailsButton && (\n <ChangePaymentDetailsButton amazonCheckoutSessionId={props.amazonCheckoutSessionId} amazonRef={window.amazon} />\n )}\n </div>\n );\n }\n\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <AmazonPayButton {...props} showPayButton={this.props.showPayButton} amazonRef={window.amazon} ref={amazonPayButtonRef} />\n </div>\n );\n}\n"],"names":["AmazonPayComponent","props","status","setStatus","useState","amazonPayButtonRef","useRef","orderButtonRef","analytics","useAnalytics","handleLoad","this","getSubmitFunction","current","initCheckout","createOrder","useEffect","src","getAmazonPayUrl","configuration","region","script","Script","component","window","amazon","load","then","remove","h","div","className","Spinner","showSignOutButton","SignOutButton","amazonRef","onSignOut","amazonCheckoutSessionId","showOrderButton","OrderButton","amount","chargePermissionType","recurringMetadata","clientKey","onError","publicKeyId","returnUrl","ref","showChangePaymentDetailsButton","ChangePaymentDetailsButton","AmazonPayButton","showPayButton"],"mappings":"m+BAYe,SAASA,EAAmBC,GACvC,MAAOC,EAAQC,GAAaC,EAAS,WAC/BC,EAAqBC,EAAO,MAC5BC,EAAiBD,EAAO,OACxBE,UAAEA,GAAcC,IAEhBC,EAAa,KACfP,EAAU,UA2Bd,OAxBAQ,KAAKC,kBAAoB,IACjBP,EAAmBQ,SAAWR,EAAmBQ,QAAQC,aAAqB,IAAMT,EAAmBQ,QAAQC,eAC/GP,EAAeM,SAAWN,EAAeM,QAAQE,YAAoB,IAAMR,EAAeM,QAAQE,mBAAtG,EAGJC,EAAU,KACN,MAAMC,EAAMC,EAAgBjB,EAAMkB,cAAcC,QAC1CC,EAAS,IAAIC,EAAO,CACtBL,MACAM,UAAW,YACXf,cASJ,OANIgB,OAAOC,OACPf,IAEKW,EAAOK,OAAOC,KAAKjB,GAGrB,KACHW,EAAOO,WAEZ,CAACpB,IAEW,YAAXN,EAEI2B,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACC,MAAAA,CAAIC,UAAU,gFACXF,EAACG,EAAAA,QAMb/B,EAAMgC,kBAEFJ,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACK,EAAAA,CAAcC,UAAWX,OAAOC,OAAQW,UAAWnC,EAAMmC,aAKlEnC,EAAMoC,wBAEFR,EAACC,MAAAA,CAAIC,UAAU,6BACV9B,EAAMqC,iBACHT,EAACU,EAAAA,CACGF,wBAAyBpC,EAAMoC,wBAC/BG,OAAQvC,EAAMuC,OACdC,qBAAsBxC,EAAMwC,qBAC5BC,kBAAmBzC,EAAMyC,kBACzBC,UAAW1C,EAAM0C,UACjBC,QAAS3C,EAAM2C,QACfC,YAAgC,QAAnB5C,EAAAA,EAAMkB,qBAANlB,IAAAA,OAAAA,EAAAA,EAAqB4C,YAClCzB,OAA2B,QAAnBnB,EAAAA,EAAMkB,qBAANlB,IAAAA,OAAAA,EAAAA,EAAqBmB,OAC7B0B,UAAW7C,EAAM6C,UACjBC,IAAKxC,IAIZN,EAAM+C,gCACHnB,EAACoB,EAAAA,CAA2BZ,wBAAyBpC,EAAMoC,wBAAyBF,UAAWX,OAAOC,UAOlHI,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACqB,EAAAA,oUAAAA,CAAAA,CAAAA,EAAoBjD,GAAAA,CAAOkD,cAAexC,KAAKV,MAAMkD,cAAehB,UAAWX,OAAOC,OAAQsB,IAAK1C,UAhB3EJ,EACLA,CAkBhC"}
1
+ {"version":3,"file":"AmazonPayComponent.js","sources":["../../../../../src/components/AmazonPay/components/AmazonPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useRef } from 'preact/hooks';\nimport Spinner from '../../internal/Spinner';\nimport { getAmazonPayUrl } from '../utils';\nimport { AmazonPayComponentProps } from '../types';\nimport AmazonPayButton from './AmazonPayButton';\nimport ChangePaymentDetailsButton from './ChangePaymentDetailsButton';\nimport OrderButton from './OrderButton';\nimport SignOutButton from './SignOutButton';\nimport Script from '../../../utils/Script';\nimport useAnalytics from '../../../core/Analytics/useAnalytics';\n\nexport default function AmazonPayComponent(props: AmazonPayComponentProps) {\n const [status, setStatus] = useState('pending');\n const amazonPayButtonRef = useRef(null);\n const orderButtonRef = useRef(null);\n const { analytics } = useAnalytics();\n\n const handleLoad = () => {\n setStatus('ready');\n };\n\n this.getSubmitFunction = () => {\n if (amazonPayButtonRef.current && amazonPayButtonRef.current.initCheckout) return () => amazonPayButtonRef.current.initCheckout();\n if (orderButtonRef.current && orderButtonRef.current.createOrder) return () => orderButtonRef.current.createOrder();\n };\n\n useEffect(() => {\n const src = getAmazonPayUrl(props.configuration.region);\n const script = new Script({\n src,\n component: 'amazonpay',\n analytics\n });\n\n if (window.amazon) {\n handleLoad();\n } else {\n void script.load().then(handleLoad);\n }\n\n return () => {\n script.remove();\n };\n }, [analytics]);\n\n if (status === 'pending') {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <div className=\"adyen-checkout__amazonpay__status adyen-checkout__amazonpay__status--pending\">\n <Spinner />\n </div>\n </div>\n );\n }\n\n if (props.showSignOutButton) {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <SignOutButton amazonRef={window.amazon} onSignOut={props.onSignOut} />\n </div>\n );\n }\n\n if (props.amazonCheckoutSessionId) {\n return (\n <div className=\"adyen-checkout__amazonpay\">\n {props.showOrderButton && (\n <OrderButton\n amazonCheckoutSessionId={props.amazonCheckoutSessionId}\n chargePermissionType={props.chargePermissionType}\n recurringMetadata={props.recurringMetadata}\n clientKey={props.clientKey}\n onError={props.onError}\n publicKeyId={props.configuration?.publicKeyId}\n region={props.configuration?.region}\n returnUrl={props.returnUrl}\n ref={orderButtonRef}\n />\n )}\n\n {props.showChangePaymentDetailsButton && (\n <ChangePaymentDetailsButton amazonCheckoutSessionId={props.amazonCheckoutSessionId} amazonRef={window.amazon} />\n )}\n </div>\n );\n }\n\n return (\n <div className=\"adyen-checkout__amazonpay\">\n <AmazonPayButton {...props} showPayButton={this.props.showPayButton} amazonRef={window.amazon} ref={amazonPayButtonRef} />\n </div>\n );\n}\n"],"names":["AmazonPayComponent","props","status","setStatus","useState","amazonPayButtonRef","useRef","orderButtonRef","analytics","useAnalytics","handleLoad","this","getSubmitFunction","current","initCheckout","createOrder","useEffect","src","getAmazonPayUrl","configuration","region","script","Script","component","window","amazon","load","then","remove","h","div","className","Spinner","showSignOutButton","SignOutButton","amazonRef","onSignOut","amazonCheckoutSessionId","showOrderButton","OrderButton","chargePermissionType","recurringMetadata","clientKey","onError","publicKeyId","returnUrl","ref","showChangePaymentDetailsButton","ChangePaymentDetailsButton","AmazonPayButton","showPayButton"],"mappings":"m+BAYe,SAASA,EAAmBC,GACvC,MAAOC,EAAQC,GAAaC,EAAS,WAC/BC,EAAqBC,EAAO,MAC5BC,EAAiBD,EAAO,OACxBE,UAAEA,GAAcC,IAEhBC,EAAa,KACfP,EAAU,UA2Bd,OAxBAQ,KAAKC,kBAAoB,IACjBP,EAAmBQ,SAAWR,EAAmBQ,QAAQC,aAAqB,IAAMT,EAAmBQ,QAAQC,eAC/GP,EAAeM,SAAWN,EAAeM,QAAQE,YAAoB,IAAMR,EAAeM,QAAQE,mBAAtG,EAGJC,EAAU,KACN,MAAMC,EAAMC,EAAgBjB,EAAMkB,cAAcC,QAC1CC,EAAS,IAAIC,EAAO,CACtBL,MACAM,UAAW,YACXf,cASJ,OANIgB,OAAOC,OACPf,IAEKW,EAAOK,OAAOC,KAAKjB,GAGrB,KACHW,EAAOO,WAEZ,CAACpB,IAEW,YAAXN,EAEI2B,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACC,MAAAA,CAAIC,UAAU,gFACXF,EAACG,EAAAA,QAMb/B,EAAMgC,kBAEFJ,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACK,EAAAA,CAAcC,UAAWX,OAAOC,OAAQW,UAAWnC,EAAMmC,aAKlEnC,EAAMoC,wBAEFR,EAACC,MAAAA,CAAIC,UAAU,6BACV9B,EAAMqC,iBACHT,EAACU,EAAAA,CACGF,wBAAyBpC,EAAMoC,wBAC/BG,qBAAsBvC,EAAMuC,qBAC5BC,kBAAmBxC,EAAMwC,kBACzBC,UAAWzC,EAAMyC,UACjBC,QAAS1C,EAAM0C,QACfC,YAAgC,QAAnB3C,EAAAA,EAAMkB,qBAANlB,IAAAA,SAAAA,EAAqB2C,YAClCxB,OAA2B,QAAnBnB,EAAAA,EAAMkB,qBAANlB,IAAAA,SAAAA,EAAqBmB,OAC7ByB,UAAW5C,EAAM4C,UACjBC,IAAKvC,IAIZN,EAAM8C,gCACHlB,EAACmB,EAAAA,CAA2BX,wBAAyBpC,EAAMoC,wBAAyBF,UAAWX,OAAOC,UAOlHI,EAACC,MAAAA,CAAIC,UAAU,6BACXF,EAACoB,EAAAA,oUAAAA,CAAAA,CAAAA,EAAoBhD,GAAAA,CAAOiD,cAAevC,KAAKV,MAAMiD,cAAef,UAAWX,OAAOC,OAAQqB,IAAKzC,UAhB3EJ,EACLA,CAkBhC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import t from"../../internal/Button/Button.js";import{updateAmazonCheckoutSession as o}from"../services.js";function n(n){const{i18n:i,loadingContext:a}=r();return this.createOrder=()=>{const{amazonCheckoutSessionId:e,amount:r,clientKey:t,chargePermissionType:i,publicKeyId:c,region:s,recurringMetadata:l,returnUrl:u}=n;o(a,t,{amount:r,chargePermissionType:i,checkoutResultReturnUrl:u,checkoutSessionId:e,publicKeyId:c,recurringMetadata:l,region:s}).then(e=>{var r;if(!(null==e||null===(r=e.action)||void 0===r?void 0:r.type))return console.error(e.errorMessage||"Could not get the AmazonPay URL");"redirect"===e.action.type&&window.location.assign(e.action.url)}).catch(e=>{n.onError&&n.onError(e,this.componentRef)})},e(t,{classNameModifiers:["standalone","pay"],label:i.get("confirmPurchase"),onClick:this.createOrder})}export{n as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import o from"../../internal/Button/Button.js";import{updateAmazonCheckoutSession as t}from"../services.js";import{useAmount as n}from"../../../core/Context/AmountProvider.js";function i(i){const{i18n:a,loadingContext:c}=r(),{amount:s}=n();return this.createOrder=()=>{const{amazonCheckoutSessionId:e,clientKey:r,chargePermissionType:o,publicKeyId:n,region:a,recurringMetadata:l,returnUrl:u}=i;t(c,r,{amount:s,chargePermissionType:o,checkoutResultReturnUrl:u,checkoutSessionId:e,publicKeyId:n,recurringMetadata:l,region:a}).then(e=>{var r;if(!(null==e||null===(r=e.action)||void 0===r?void 0:r.type))return console.error(e.errorMessage||"Could not get the AmazonPay URL");"redirect"===e.action.type&&window.location.assign(e.action.url)}).catch(e=>{i.onError&&i.onError(e,this.componentRef)})},e(o,{classNameModifiers:["standalone","pay"],label:a.get("confirmPurchase"),onClick:this.createOrder})}export{i as default};
2
2
  //# sourceMappingURL=OrderButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderButton.js","sources":["../../../../../src/components/AmazonPay/components/OrderButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Button from '../../internal/Button';\nimport { updateAmazonCheckoutSession } from '../services';\nimport { OrderButtonProps, UpdateAmazonCheckoutSessionRequest } from '../types';\n\nexport default function OrderButton(props: OrderButtonProps) {\n const { i18n, loadingContext } = useCoreContext();\n\n this.createOrder = () => {\n const { amazonCheckoutSessionId, amount, clientKey, chargePermissionType, publicKeyId, region, recurringMetadata, returnUrl } = props;\n const request: UpdateAmazonCheckoutSessionRequest = {\n amount,\n chargePermissionType,\n checkoutResultReturnUrl: returnUrl,\n checkoutSessionId: amazonCheckoutSessionId,\n publicKeyId,\n recurringMetadata,\n region\n };\n\n updateAmazonCheckoutSession(loadingContext, clientKey, request)\n .then(response => {\n if (!response?.action?.type) return console.error(response.errorMessage || 'Could not get the AmazonPay URL');\n if (response.action.type === 'redirect') window.location.assign(response.action.url);\n })\n .catch(error => {\n if (props.onError) props.onError(error, this.componentRef);\n });\n };\n\n return <Button classNameModifiers={['standalone', 'pay']} label={i18n.get('confirmPurchase')} onClick={this.createOrder} />;\n}\n"],"names":["OrderButton","props","i18n","loadingContext","useCoreContext","this","createOrder","amazonCheckoutSessionId","amount","clientKey","chargePermissionType","publicKeyId","region","recurringMetadata","returnUrl","updateAmazonCheckoutSession","checkoutResultReturnUrl","checkoutSessionId","then","response","action","type","console","error","errorMessage","window","location","assign","url","catch","onError","componentRef","h","Button","classNameModifiers","label","get","onClick"],"mappings":"2PAMe,SAASA,EAAYC,GAChC,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,IAwBjC,OAtBAC,KAAKC,YAAc,KACf,MAAMC,wBAAEA,EAAuBC,OAAEA,EAAMC,UAAEA,EAASC,qBAAEA,EAAoBC,YAAEA,EAAWC,OAAEA,EAAMC,kBAAEA,EAAiBC,UAAEA,GAAcb,EAWhIc,EAA4BZ,EAAgBM,EAVQ,CAChDD,SACAE,uBACAM,wBAAyBF,EACzBG,kBAAmBV,EACnBI,cACAE,oBACAD,WAICM,KAAKC,IACGA,IAAAA,EAAL,KAAKA,SAAgB,QAAhBA,EAAAA,EAAUC,cAAVD,IAAAA,OAAAA,EAAAA,EAAkBE,MAAM,OAAOC,QAAQC,MAAMJ,EAASK,cAAgB,mCAC9C,aAAzBL,EAASC,OAAOC,MAAqBI,OAAOC,SAASC,OAAOR,EAASC,OAAOQ,OAEnFC,MAAMN,IACCtB,EAAM6B,SAAS7B,EAAM6B,QAAQP,EAAOlB,KAAK0B,iBAIlDC,EAACC,EAAAA,CAAOC,mBAAoB,CAAC,aAAc,OAAQC,MAAOjC,EAAKkC,IAAI,mBAAoBC,QAAShC,KAAKC,aAChH"}
1
+ {"version":3,"file":"OrderButton.js","sources":["../../../../../src/components/AmazonPay/components/OrderButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Button from '../../internal/Button';\nimport { updateAmazonCheckoutSession } from '../services';\nimport { OrderButtonProps, UpdateAmazonCheckoutSessionRequest } from '../types';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\nexport default function OrderButton(props: OrderButtonProps) {\n const { i18n, loadingContext } = useCoreContext();\n const { amount } = useAmount();\n\n this.createOrder = () => {\n const { amazonCheckoutSessionId, clientKey, chargePermissionType, publicKeyId, region, recurringMetadata, returnUrl } = props;\n\n const request: UpdateAmazonCheckoutSessionRequest = {\n amount,\n chargePermissionType,\n checkoutResultReturnUrl: returnUrl,\n checkoutSessionId: amazonCheckoutSessionId,\n publicKeyId,\n recurringMetadata,\n region\n };\n\n updateAmazonCheckoutSession(loadingContext, clientKey, request)\n .then(response => {\n if (!response?.action?.type) return console.error(response.errorMessage || 'Could not get the AmazonPay URL');\n if (response.action.type === 'redirect') window.location.assign(response.action.url);\n })\n .catch(error => {\n if (props.onError) props.onError(error, this.componentRef);\n });\n };\n\n return <Button classNameModifiers={['standalone', 'pay']} label={i18n.get('confirmPurchase')} onClick={this.createOrder} />;\n}\n"],"names":["OrderButton","props","i18n","loadingContext","useCoreContext","amount","useAmount","this","createOrder","amazonCheckoutSessionId","clientKey","chargePermissionType","publicKeyId","region","recurringMetadata","returnUrl","updateAmazonCheckoutSession","checkoutResultReturnUrl","checkoutSessionId","then","response","action","type","console","error","errorMessage","window","location","assign","url","catch","onError","componentRef","h","Button","classNameModifiers","label","get","onClick"],"mappings":"+TAOe,SAASA,EAAYC,GAChC,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,KAC3BC,OAAEA,GAAWC,IAyBnB,OAvBAC,KAAKC,YAAc,KACf,MAAMC,wBAAEA,EAAuBC,UAAEA,EAASC,qBAAEA,EAAoBC,YAAEA,EAAWC,OAAEA,EAAMC,kBAAEA,EAAiBC,UAAEA,GAAcd,EAYxHe,EAA4Bb,EAAgBO,EAVQ,CAChDL,SACAM,uBACAM,wBAAyBF,EACzBG,kBAAmBT,EACnBG,cACAE,oBACAD,WAICM,KAAKC,IACGA,IAAAA,EAAL,KAAKA,SAAgB,QAAhBA,EAAAA,EAAUC,kBAAVD,OAAAA,EAAAA,EAAkBE,MAAM,OAAOC,QAAQC,MAAMJ,EAASK,cAAgB,mCAC9C,aAAzBL,EAASC,OAAOC,MAAqBI,OAAOC,SAASC,OAAOR,EAASC,OAAOQ,OAEnFC,MAAMN,IACCvB,EAAM8B,SAAS9B,EAAM8B,QAAQP,EAAOjB,KAAKyB,iBAIlDC,EAACC,EAAAA,CAAOC,mBAAoB,CAAC,aAAc,OAAQC,MAAOlC,EAAKmC,IAAI,mBAAoBC,QAAS/B,KAAKC,aAChH"}
@@ -1,2 +1,2 @@
1
- import{AMAZONPAY_URL_US as e,AMAZONPAY_URL_EU as r,LEDGER_CURRENCIES_PER_REGION as t,FALLBACK_LOCALE_US as n,FALLBACK_LOCALE_EU as o,SUPPORTED_LOCALES_US as c,SUPPORTED_LOCALES_EU as u}from"./config.js";import{getDecimalAmount as i}from"../../utils/amount-util.js";function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){a(e,r,t[r])})}return e}function s(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function f(t){return"US"===t?e:r}function p(e){var r;return s(l({},e.buttonColor&&{buttonColor:e.buttonColor},e.design&&{design:m(e.design)}),{checkoutLanguage:g(e.locale,e.configuration.region),ledgerCurrency:t[e.configuration.region]||e.currency||(null===(r=e.amount)||void 0===r?void 0:r.currency),merchantId:e.configuration.merchantId,productType:e.productType,placement:e.placement,sandbox:"TEST"===e.environment})}function y(e){return"US"===e?n:o}function d(e){return"US"===e?c:u}function g(e,r){return d(r).includes(e)?e:y(r)}function m(e){return"noTagline"===e?"C0001":null}function b(e){return{amount:String(i(e.value,e.currency)),currencyCode:e.currency}}function O(e){const{addressDetails:r,cancelUrl:t,checkoutMode:n,deliverySpecifications:o,returnUrl:c,merchantMetadata:u,chargePermissionType:i,recurringMetadata:a}=e,{storeId:s}=e.configuration,f="ProcessOrder"===n,p=f?b(e.amount):null;return l({storeId:s,chargePermissionType:i,webCheckoutDetails:l({},f?{checkoutResultReturnUrl:c}:{checkoutReviewReturnUrl:c},t&&{checkoutCancelUrl:t},f&&{checkoutMode:n})},f&&{paymentDetails:{chargeAmount:p,paymentIntent:"Confirm",presentmentCurrency:p.currencyCode,totalOrderAmount:p}},a&&{recurringMetadata:a},u&&{merchantMetadata:u},o&&{deliverySpecifications:o},r&&{addressDetails:r})}export{p as getAmazonPaySettings,f as getAmazonPayUrl,b as getChargeAmount,g as getCheckoutLocale,m as getDesignCode,y as getFallbackLocale,O as getPayloadJSON,d as getSupportedLocales};
1
+ import{AMAZONPAY_URL_US as e,AMAZONPAY_URL_EU as r,LEDGER_CURRENCIES_PER_REGION as t,FALLBACK_LOCALE_US as n,FALLBACK_LOCALE_EU as o,SUPPORTED_LOCALES_US as c,SUPPORTED_LOCALES_EU as u}from"./config.js";import{getDecimalAmount as i}from"../../utils/amount-util.js";function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){a(e,r,t[r])})}return e}function s(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function f(t){return"US"===t?e:r}function p(e,r){return s(l({},e.buttonColor&&{buttonColor:e.buttonColor},e.design&&{design:b(e.design)}),{checkoutLanguage:g(e.locale,e.configuration.region),ledgerCurrency:t[e.configuration.region]||e.currency||(null==r?void 0:r.currency),merchantId:e.configuration.merchantId,productType:e.productType,placement:e.placement,sandbox:"TEST"===e.environment})}function y(e){return"US"===e?n:o}function d(e){return"US"===e?c:u}function g(e,r){return d(r).includes(e)?e:y(r)}function b(e){return"noTagline"===e?"C0001":null}function m(e){return{amount:String(i(e.value,e.currency)),currencyCode:e.currency}}function O(e,r){const{addressDetails:t,cancelUrl:n,checkoutMode:o,deliverySpecifications:c,returnUrl:u,merchantMetadata:i,chargePermissionType:a,recurringMetadata:s}=e,{storeId:f}=e.configuration,p="ProcessOrder"===o,y=p?m(r):null;return l({storeId:f,chargePermissionType:a,webCheckoutDetails:l({},p?{checkoutResultReturnUrl:u}:{checkoutReviewReturnUrl:u},n&&{checkoutCancelUrl:n},p&&{checkoutMode:o})},p&&{paymentDetails:{chargeAmount:y,paymentIntent:"Confirm",presentmentCurrency:y.currencyCode,totalOrderAmount:y}},s&&{recurringMetadata:s},i&&{merchantMetadata:i},c&&{deliverySpecifications:c},t&&{addressDetails:t})}export{p as getAmazonPaySettings,f as getAmazonPayUrl,m as getChargeAmount,g as getCheckoutLocale,b as getDesignCode,y as getFallbackLocale,O as getPayloadJSON,d as getSupportedLocales};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/components/AmazonPay/utils.ts"],"sourcesContent":["import {\n AMAZONPAY_URL_EU,\n AMAZONPAY_URL_US,\n FALLBACK_LOCALE_EU,\n FALLBACK_LOCALE_US,\n LEDGER_CURRENCIES_PER_REGION,\n SUPPORTED_LOCALES_EU,\n SUPPORTED_LOCALES_US\n} from './config';\nimport { AmazonPayButtonProps, AmazonPayButtonSettings, ChargeAmount, Currency, PayloadJSON, Region, SupportedLocale } from './types';\nimport { PaymentAmount } from '../../types/global-types';\nimport { getDecimalAmount } from '../../utils/amount-util';\n\n/**\n * Returns the AmazonPay script URL for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns the AmazonPay script URL\n */\nexport function getAmazonPayUrl(region: Region): string {\n return region === 'US' ? AMAZONPAY_URL_US : AMAZONPAY_URL_EU;\n}\n\n/**\n * Returns the AmazonPay button settings object\n * @param props -\n * @returns the AmazonPay button settings\n */\nexport function getAmazonPaySettings(props: AmazonPayButtonProps): AmazonPayButtonSettings {\n return {\n ...(props.buttonColor && { buttonColor: props.buttonColor }),\n ...(props.design && { design: getDesignCode(props.design) }),\n checkoutLanguage: getCheckoutLocale(props.locale, props.configuration.region),\n ledgerCurrency: LEDGER_CURRENCIES_PER_REGION[props.configuration.region] || props.currency || (props.amount?.currency as Currency),\n merchantId: props.configuration.merchantId,\n productType: props.productType,\n placement: props.placement,\n sandbox: props.environment === 'TEST'\n };\n}\n\n/**\n * Returns the fallback locale for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns A fallback locale\n */\nexport function getFallbackLocale(region: Region): SupportedLocale {\n return region === 'US' ? FALLBACK_LOCALE_US : FALLBACK_LOCALE_EU;\n}\n\n/**\n * Returns an array of supported locales for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns An array of supported locales\n */\nexport function getSupportedLocales(region: Region): SupportedLocale[] {\n const supportedLocales = region === 'US' ? SUPPORTED_LOCALES_US : SUPPORTED_LOCALES_EU;\n return supportedLocales as unknown as SupportedLocale[];\n}\n\n/**\n * Gets a locale and matches it with one of the supported locales for the given region.\n * If there's no match, it will return the region's fallback option.\n * @param locale - Locale to be processed\n * @param region - Two-letter country code in ISO 3166 format\n * @returns A supported locale\n */\nexport function getCheckoutLocale(locale: string, region: Region): SupportedLocale {\n const supportedLocales = getSupportedLocales(region);\n const isSupportedLocale = supportedLocales.includes(locale as SupportedLocale);\n const checkoutLocale = isSupportedLocale ? locale : getFallbackLocale(region);\n\n return checkoutLocale as SupportedLocale;\n}\n\n/**\n * Gets the design code from the given alias.\n * @param design - The alias of one of the possible designs.\n * @returns A design code\n */\nexport function getDesignCode(design: string): string {\n if (design === 'noTagline') return 'C0001';\n return null;\n}\n\n/**\n * Returns the amount in the format Amazon expects.\n * @param amount - The amount object in the Adyen format\n * @returns the charge amount object in the Amazon format\n */\nexport function getChargeAmount(amount: PaymentAmount): ChargeAmount {\n return {\n amount: String(getDecimalAmount(amount.value, amount.currency)),\n currencyCode: amount.currency as Currency\n };\n}\n\n/**\n * Returns a PayloadJSON object.\n * @param props -\n * @returns PayloadJSON\n */\nexport function getPayloadJSON(props): PayloadJSON {\n const { addressDetails, cancelUrl, checkoutMode, deliverySpecifications, returnUrl, merchantMetadata, chargePermissionType, recurringMetadata } =\n props;\n\n const { storeId } = props.configuration;\n const isPayNow = checkoutMode === 'ProcessOrder';\n const amount = isPayNow ? getChargeAmount(props.amount) : null;\n\n return {\n storeId,\n chargePermissionType,\n webCheckoutDetails: {\n ...(isPayNow ? { checkoutResultReturnUrl: returnUrl } : { checkoutReviewReturnUrl: returnUrl }),\n ...(cancelUrl && { checkoutCancelUrl: cancelUrl }),\n ...(isPayNow && { checkoutMode })\n },\n ...(isPayNow && {\n paymentDetails: {\n chargeAmount: amount,\n paymentIntent: 'Confirm',\n presentmentCurrency: amount.currencyCode,\n totalOrderAmount: amount\n }\n }),\n ...(recurringMetadata && { recurringMetadata }),\n ...(merchantMetadata && { merchantMetadata }),\n ...(deliverySpecifications && { deliverySpecifications }),\n ...(addressDetails && { addressDetails })\n };\n}\n"],"names":["getAmazonPayUrl","region","AMAZONPAY_URL_US","AMAZONPAY_URL_EU","getAmazonPaySettings","props","_object_spread_props","_object_spread","buttonColor","design","getDesignCode","checkoutLanguage","getCheckoutLocale","locale","configuration","ledgerCurrency","LEDGER_CURRENCIES_PER_REGION","currency","amount","merchantId","productType","placement","sandbox","environment","getFallbackLocale","FALLBACK_LOCALE_US","FALLBACK_LOCALE_EU","getSupportedLocales","SUPPORTED_LOCALES_US","SUPPORTED_LOCALES_EU","includes","getChargeAmount","String","getDecimalAmount","value","currencyCode","getPayloadJSON","addressDetails","cancelUrl","checkoutMode","deliverySpecifications","returnUrl","merchantMetadata","chargePermissionType","recurringMetadata","storeId","isPayNow","webCheckoutDetails","checkoutResultReturnUrl","checkoutReviewReturnUrl","checkoutCancelUrl","paymentDetails","chargeAmount","paymentIntent","presentmentCurrency","totalOrderAmount"],"mappings":"kjCAkBO,SAASA,EAAgBC,GAC5B,MAAkB,OAAXA,EAAkBC,EAAmBC,CAChD,CAOO,SAASC,EAAqBC,GAKkEA,IAAAA,EAJnG,OAAOC,EAAAC,EAAA,GACCF,EAAMG,aAAe,CAAEA,YAAaH,EAAMG,aAC1CH,EAAMI,QAAU,CAAEA,OAAQC,EAAcL,EAAMI,UAAQ,CAC1DE,iBAAkBC,EAAkBP,EAAMQ,OAAQR,EAAMS,cAAcb,QACtEc,eAAgBC,EAA6BX,EAAMS,cAAcb,SAAWI,EAAMY,WAAyB,QAAZZ,EAAAA,EAAMa,cAANb,IAAAA,OAAAA,EAAAA,EAAcY,UAC7GE,WAAYd,EAAMS,cAAcK,WAChCC,YAAaf,EAAMe,YACnBC,UAAWhB,EAAMgB,UACjBC,QAA+B,SAAtBjB,EAAMkB,aAEvB,CAOO,SAASC,EAAkBvB,GAC9B,MAAkB,OAAXA,EAAkBwB,EAAqBC,CAClD,CAOO,SAASC,EAAoB1B,GAEhC,MADoC,OAAXA,EAAkB2B,EAAuBC,CAEtE,CASO,SAASjB,EAAkBC,EAAgBZ,GAK9C,OAJyB0B,EAAoB1B,GACF6B,SAASjB,GACTA,EAASW,EAAkBvB,EAG1E,CAOO,SAASS,EAAcD,GAC1B,MAAe,cAAXA,EAA+B,QAC5B,IACX,CAOO,SAASsB,EAAgBb,GAC5B,MAAO,CACHA,OAAQc,OAAOC,EAAiBf,EAAOgB,MAAOhB,EAAOD,WACrDkB,aAAcjB,EAAOD,SAE7B,CAOO,SAASmB,EAAe/B,GAC3B,MAAMgC,eAAEA,EAAcC,UAAEA,EAASC,aAAEA,EAAYC,uBAAEA,EAAsBC,UAAEA,EAASC,iBAAEA,EAAgBC,qBAAEA,EAAoBC,kBAAEA,GACxHvC,GAEEwC,QAAEA,GAAYxC,EAAMS,cACpBgC,EAA4B,iBAAjBP,EACXrB,EAAS4B,EAAWf,EAAgB1B,EAAMa,QAAU,KAE1D,OAAOX,EAAA,CACHsC,UACAF,uBACAI,mBAAoBxC,KACZuC,EAAW,CAAEE,wBAAyBP,GAAc,CAAEQ,wBAAyBR,GAC/EH,GAAa,CAAEY,kBAAmBZ,GAClCQ,GAAY,CAAEP,kBAElBO,GAAY,CACZK,eAAgB,CACZC,aAAclC,EACdmC,cAAe,UACfC,oBAAqBpC,EAAOiB,aAC5BoB,iBAAkBrC,IAGtB0B,GAAqB,CAAEA,qBACvBF,GAAoB,CAAEA,oBACtBF,GAA0B,CAAEA,0BAC5BH,GAAkB,CAAEA,kBAEhC"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/AmazonPay/utils.ts"],"sourcesContent":["import {\n AMAZONPAY_URL_EU,\n AMAZONPAY_URL_US,\n FALLBACK_LOCALE_EU,\n FALLBACK_LOCALE_US,\n LEDGER_CURRENCIES_PER_REGION,\n SUPPORTED_LOCALES_EU,\n SUPPORTED_LOCALES_US\n} from './config';\nimport { AmazonPayButtonProps, AmazonPayButtonSettings, ChargeAmount, Currency, PayloadJSON, Region, SupportedLocale } from './types';\nimport { PaymentAmount } from '../../types/global-types';\nimport { getDecimalAmount } from '../../utils/amount-util';\n\n/**\n * Returns the AmazonPay script URL for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns the AmazonPay script URL\n */\nexport function getAmazonPayUrl(region: Region): string {\n return region === 'US' ? AMAZONPAY_URL_US : AMAZONPAY_URL_EU;\n}\n\n/**\n * Returns the AmazonPay button settings object\n * @param props -\n * @returns the AmazonPay button settings\n */\nexport function getAmazonPaySettings(props: AmazonPayButtonProps, amount?: PaymentAmount): AmazonPayButtonSettings {\n return {\n ...(props.buttonColor && { buttonColor: props.buttonColor }),\n ...(props.design && { design: getDesignCode(props.design) }),\n checkoutLanguage: getCheckoutLocale(props.locale, props.configuration.region),\n ledgerCurrency: LEDGER_CURRENCIES_PER_REGION[props.configuration.region] || props.currency || (amount?.currency as Currency),\n merchantId: props.configuration.merchantId,\n productType: props.productType,\n placement: props.placement,\n sandbox: props.environment === 'TEST'\n };\n}\n\n/**\n * Returns the fallback locale for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns A fallback locale\n */\nexport function getFallbackLocale(region: Region): SupportedLocale {\n return region === 'US' ? FALLBACK_LOCALE_US : FALLBACK_LOCALE_EU;\n}\n\n/**\n * Returns an array of supported locales for passed region.\n * @param region - Two-letter country code in ISO 3166 format\n * @returns An array of supported locales\n */\nexport function getSupportedLocales(region: Region): SupportedLocale[] {\n const supportedLocales = region === 'US' ? SUPPORTED_LOCALES_US : SUPPORTED_LOCALES_EU;\n return supportedLocales as unknown as SupportedLocale[];\n}\n\n/**\n * Gets a locale and matches it with one of the supported locales for the given region.\n * If there's no match, it will return the region's fallback option.\n * @param locale - Locale to be processed\n * @param region - Two-letter country code in ISO 3166 format\n * @returns A supported locale\n */\nexport function getCheckoutLocale(locale: string, region: Region): SupportedLocale {\n const supportedLocales = getSupportedLocales(region);\n const isSupportedLocale = supportedLocales.includes(locale as SupportedLocale);\n const checkoutLocale = isSupportedLocale ? locale : getFallbackLocale(region);\n\n return checkoutLocale as SupportedLocale;\n}\n\n/**\n * Gets the design code from the given alias.\n * @param design - The alias of one of the possible designs.\n * @returns A design code\n */\nexport function getDesignCode(design: string): string {\n if (design === 'noTagline') return 'C0001';\n return null;\n}\n\n/**\n * Returns the amount in the format Amazon expects.\n * @param amount - The amount object in the Adyen format\n * @returns the charge amount object in the Amazon format\n */\nexport function getChargeAmount(amount: PaymentAmount): ChargeAmount {\n return {\n amount: String(getDecimalAmount(amount.value, amount.currency)),\n currencyCode: amount.currency as Currency\n };\n}\n\n/**\n * Returns a PayloadJSON object.\n * @param props -\n * @returns PayloadJSON\n */\nexport function getPayloadJSON(props, amount: PaymentAmount): PayloadJSON {\n const { addressDetails, cancelUrl, checkoutMode, deliverySpecifications, returnUrl, merchantMetadata, chargePermissionType, recurringMetadata } =\n props;\n\n const { storeId } = props.configuration;\n const isPayNow = checkoutMode === 'ProcessOrder';\n const finalAmount = isPayNow ? getChargeAmount(amount) : null;\n\n return {\n storeId,\n chargePermissionType,\n webCheckoutDetails: {\n ...(isPayNow ? { checkoutResultReturnUrl: returnUrl } : { checkoutReviewReturnUrl: returnUrl }),\n ...(cancelUrl && { checkoutCancelUrl: cancelUrl }),\n ...(isPayNow && { checkoutMode })\n },\n ...(isPayNow && {\n paymentDetails: {\n chargeAmount: finalAmount,\n paymentIntent: 'Confirm',\n presentmentCurrency: finalAmount.currencyCode,\n totalOrderAmount: finalAmount\n }\n }),\n ...(recurringMetadata && { recurringMetadata }),\n ...(merchantMetadata && { merchantMetadata }),\n ...(deliverySpecifications && { deliverySpecifications }),\n ...(addressDetails && { addressDetails })\n };\n}\n"],"names":["getAmazonPayUrl","region","AMAZONPAY_URL_US","AMAZONPAY_URL_EU","getAmazonPaySettings","props","amount","_object_spread_props","_object_spread","buttonColor","design","getDesignCode","checkoutLanguage","getCheckoutLocale","locale","configuration","ledgerCurrency","LEDGER_CURRENCIES_PER_REGION","currency","merchantId","productType","placement","sandbox","environment","getFallbackLocale","FALLBACK_LOCALE_US","FALLBACK_LOCALE_EU","getSupportedLocales","SUPPORTED_LOCALES_US","SUPPORTED_LOCALES_EU","includes","getChargeAmount","String","getDecimalAmount","value","currencyCode","getPayloadJSON","addressDetails","cancelUrl","checkoutMode","deliverySpecifications","returnUrl","merchantMetadata","chargePermissionType","recurringMetadata","storeId","isPayNow","finalAmount","webCheckoutDetails","checkoutResultReturnUrl","checkoutReviewReturnUrl","checkoutCancelUrl","paymentDetails","chargeAmount","paymentIntent","presentmentCurrency","totalOrderAmount"],"mappings":"kjCAkBO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Ac,CAAES,wBAAyBT,GAC/EH,GAAa,CAAEa,kBAAmBb,GAClCQ,GAAY,CAAEP,kBAElBO,GAAY,CACZM,eAAgB,CACZC,aAAcN,EACdO,cAAe,UACfC,oBAAqBR,EAAYZ,aACjCqB,iBAAkBT,IAGtBH,GAAqB,CAAEA,qBACvBF,GAAoB,CAAEA,oBACtBF,GAA0B,CAAEA,0BAC5BH,GAAkB,CAAEA,kBAEhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApplePay.js","sources":["../../../../src/components/ApplePay/ApplePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ApplePayButton from './components/ApplePayButton';\nimport ApplePayService from './services/ApplePayService';\nimport base64 from '../../utils/base64';\nimport defaultProps from './defaultProps';\nimport { httpPost } from '../../core/Services/http';\nimport { preparePaymentRequest } from './utils/payment-request';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { DecodeObject } from '../../types/global-types';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { resolveSupportedVersion } from './utils/resolve-supported-version';\nimport { formatApplePayContactToAdyenAddressFormat } from './utils/format-applepay-contact-to-adyen-format';\nimport { mapBrands } from './utils/map-adyen-brands-to-applepay-brands';\nimport ApplePaySdkLoader from './services/ApplePaySdkLoader';\nimport { detectInIframe } from '../../utils/detectInIframe';\nimport type { ApplePayConfiguration, ApplePayElementData, ApplePayPaymentOrderDetails, ApplePaySessionRequest } from './types';\nimport type { ICore } from '../../core/types';\nimport type { PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nconst LATEST_APPLE_PAY_VERSION = 14;\n\nclass ApplePayElement extends UIElement<ApplePayConfiguration> {\n public static type = TxVariants.applepay;\n\n protected static defaultProps = defaultProps;\n\n private sdkLoader: ApplePaySdkLoader;\n private applePayVersionNumber: number = undefined;\n\n constructor(checkout: ICore, props?: ApplePayConfiguration) {\n super(checkout, props);\n\n const { isExpress, onShippingContactSelected, onShippingMethodSelected } = this.props;\n\n if (isExpress === false && (onShippingContactSelected || onShippingMethodSelected)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'ApplePay - You must set \"isExpress\" flag to \"true\" in order to use \"onShippingContactSelected\" and/or \"onShippingMethodSelected\" callbacks'\n );\n }\n\n this.startSession = this.startSession.bind(this);\n this.submit = this.submit.bind(this);\n this.validateMerchant = this.validateMerchant.bind(this);\n this.collectOrderTrackingDetailsIfNeeded = this.collectOrderTrackingDetailsIfNeeded.bind(this);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.defineApplePayVersionNumber = this.defineApplePayVersionNumber.bind(this);\n this.configureApplePayWebOptions = this.configureApplePayWebOptions.bind(this);\n\n this.sdkLoader = new ApplePaySdkLoader({ analytics: this.analytics });\n\n void this.sdkLoader\n .load()\n .then(this.defineApplePayVersionNumber)\n .then(this.configureApplePayWebOptions)\n .catch(error => {\n this.handleError(error);\n });\n }\n\n /**\n * Formats the component props\n */\n protected override formatProps(props: ApplePayConfiguration): ApplePayConfiguration {\n // @ts-ignore TODO: Fix brands prop\n const supportedNetworks = props.brands?.length ? mapBrands(props.brands) : props.supportedNetworks;\n\n return {\n ...props,\n configuration: props.configuration,\n supportedNetworks,\n buttonLocale: props.buttonLocale ?? props.i18n?.locale,\n totalPriceLabel: props.totalPriceLabel || props.configuration?.merchantName,\n renderApplePayCodeAs: props.renderApplePayCodeAs ?? (detectInIframe() ? 'window' : 'modal')\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData(): ApplePayElementData {\n const { applePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: ApplePayElement.type,\n applePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n protected override beforeRender(configSetByMerchant?: ApplePayConfiguration) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.isExpress && { isExpress: configSetByMerchant.isExpress }),\n ...(configSetByMerchant?.expressPage && { expressPage: configSetByMerchant.expressPage })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n public override submit = (): void => {\n if (this.props.isInstantPayment) {\n const event = new AnalyticsInfoEvent({ component: this.type, type: InfoEventType.selected, target: UiTarget.instantPaymentButton });\n this.submitAnalytics(event);\n }\n void this.startSession();\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n /**\n * This API is only intended for upstreaming or defaulting to Apple Pay, all other scenarios should continue to\n * use canMakePayments(). For Safari browsers, this API will indicate whether there is a card available to make\n * payments. For third-party browsers a new status of paymentCredentialStatusUnknown will be returned. This does\n * not mean there are no cards available, it means the status cannot be determined and as such defaulting\n * and upstreaming should still be considered.\n *\n * {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities}\n * @param merchantIdentifier\n */\n public async applePayCapabilities(merchantIdentifier?: string): Promise<ApplePayJS.PaymentCredentialStatusResponse> {\n const identifier = merchantIdentifier || this.props.configuration.merchantId;\n\n try {\n await this.sdkLoader.isSdkLoaded();\n return await ApplePaySession?.applePayCapabilities(identifier);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Apple Pay: Error when requesting applePayCapabilities()', { cause: error });\n }\n }\n\n /**\n * Determines if Apple Pay component can be displayed or not\n */\n public override async isAvailable(): Promise<void> {\n if (window.location.protocol !== 'https:') {\n return Promise.reject(new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Trying to start an Apple Pay session from an insecure document'));\n }\n\n try {\n await this.sdkLoader.isSdkLoaded();\n\n if (ApplePaySession?.canMakePayments()) {\n return Promise.resolve();\n }\n\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay is not available on this device'));\n } catch (error) {\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay SDK failed to load', { cause: error }));\n }\n }\n\n /**\n * Sets the Apple Pay version available for the shopper.\n * This code needs to be executed once the Apple Pay SDK is fully loaded\n * @private\n */\n private defineApplePayVersionNumber() {\n if (window.location.protocol !== 'https:') return;\n this.applePayVersionNumber = this.props.version || resolveSupportedVersion(LATEST_APPLE_PAY_VERSION);\n }\n\n /**\n * Sets the configuration/callbacks that pertain to the Apple Pay code overlay/modal.\n * @private\n */\n private configureApplePayWebOptions() {\n if (window.ApplePayWebOptions) {\n const { renderApplePayCodeAs, onApplePayCodeClose } = this.props;\n\n window.ApplePayWebOptions.set({\n renderApplePayCodeAs,\n ...(onApplePayCodeClose && { onApplePayCodeClose })\n });\n }\n }\n\n private startSession() {\n const { onValidateMerchant, onPaymentMethodSelected, onShippingMethodSelected, onShippingContactSelected } = this.props;\n\n const paymentRequest = preparePaymentRequest({\n companyName: this.props.configuration.merchantName,\n countryCode: this.core.options.countryCode,\n ...this.props\n });\n\n const session = new ApplePayService(paymentRequest, {\n version: this.applePayVersionNumber,\n onError: (error: unknown) => {\n this.handleError(\n new AdyenCheckoutError('ERROR', 'ApplePay - Something went wrong on ApplePayService', {\n cause: error\n })\n );\n },\n onCancel: event => {\n this.handleError(new AdyenCheckoutError('CANCEL', 'ApplePay UI dismissed', { cause: event }));\n },\n onPaymentMethodSelected,\n onShippingMethodSelected,\n onShippingContactSelected,\n onValidateMerchant: onValidateMerchant || this.validateMerchant,\n onPaymentAuthorized: (resolve, reject, event) => {\n const billingAddress = formatApplePayContactToAdyenAddressFormat(event.payment.billingContact);\n const deliveryAddress = formatApplePayContactToAdyenAddressFormat(event.payment.shippingContact, true);\n\n this.setState({\n applePayToken: btoa(JSON.stringify(event.payment.token.paymentData)),\n authorizedEvent: event,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.collectOrderTrackingDetailsIfNeeded)\n .then(({ paymentResponse, orderDetails }) => {\n resolve({\n status: ApplePaySession.STATUS_SUCCESS,\n ...(orderDetails && { orderDetails })\n });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n const errors = paymentResponse?.error?.applePayError;\n\n reject({\n status: ApplePaySession.STATUS_FAILURE,\n errors: errors ? (Array.isArray(errors) ? errors : [errors]) : undefined\n });\n\n const responseWithError: RawPaymentResponse = {\n ...paymentResponse,\n error: {\n applePayError: errors\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\n }\n });\n\n return new Promise((resolve, reject) => this.props.onClick(resolve, reject))\n .then(() => {\n session.begin();\n })\n .catch(() => ({\n // Swallow exception triggered by onClick reject\n }));\n }\n\n /**\n * Call the 'onAuthorized' callback if available.\n * Must be resolved/reject for the payment flow to continue\n *\n * @private\n */\n private async handleAuthorization(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.props.onAuthorized) {\n resolve();\n }\n\n const { authorizedEvent, billingAddress, deliveryAddress } = this.state;\n\n this.props.onAuthorized(\n {\n authorizedEvent,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n );\n }).catch((error?: ApplePayJS.ApplePayError) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { applePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Verify if the 'onOrderTrackingRequest' is provided. If so, triggers the callback expecting an\n * Apple Pay order details back\n *\n * @private\n */\n private async collectOrderTrackingDetailsIfNeeded(\n paymentResponse: PaymentResponseData\n ): Promise<{ orderDetails?: ApplePayPaymentOrderDetails; paymentResponse: PaymentResponseData }> {\n return new Promise<ApplePayPaymentOrderDetails | void>((resolve, reject) => {\n if (!this.props.onOrderTrackingRequest) {\n return resolve();\n }\n\n this.props.onOrderTrackingRequest(resolve, reject);\n })\n .then(orderDetails => {\n return {\n paymentResponse,\n ...(orderDetails && { orderDetails })\n };\n })\n .catch(() => {\n return { paymentResponse };\n });\n }\n\n private async validateMerchant(resolve, reject) {\n const { hostname } = window.location;\n const { clientKey, configuration, loadingContext, initiative, domainName } = this.props;\n const { merchantName, merchantId } = configuration;\n const path = `v1/applePay/sessions?clientKey=${clientKey}`;\n const options = { loadingContext, path };\n const request: ApplePaySessionRequest = {\n displayName: merchantName,\n domainName: domainName || hostname,\n initiative,\n merchantIdentifier: merchantId\n };\n\n try {\n const response = await httpPost(options, request);\n const decodedData: DecodeObject = base64.decode(response.data);\n if (!decodedData.success) {\n reject('Could not decode Apple Pay session');\n } else {\n const session = JSON.parse(decodedData.data);\n resolve(session);\n }\n } catch (e) {\n reject('Could not get Apple Pay session');\n }\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (!this.props.showPayButton) {\n return null;\n }\n\n return (\n <ApplePayButton\n buttonStyle={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonLocale={this.props.buttonLocale}\n onClick={this.submit}\n />\n );\n }\n}\n\nexport default ApplePayElement;\n"],"names":["ApplePayElement","UIElement","formatProps","props","supportedNetworks","brands","length","mapBrands","_object_spread_props","_object_spread","configuration","buttonLocale","i18n","locale","totalPriceLabel","merchantName","renderApplePayCodeAs","detectInIframe","formatData","applePayToken","billingAddress","deliveryAddress","this","state","isExpress","paymentMethod","type","subtype","beforeRender","configSetByMerchant","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","isValid","applePayCapabilities","merchantIdentifier","identifier","merchantId","ApplePaySession","sdkLoader","isSdkLoaded","error","AdyenCheckoutError","cause","isAvailable","window","location","protocol","Promise","reject","canMakePayments","resolve","defineApplePayVersionNumber","applePayVersionNumber","version","resolveSupportedVersion","configureApplePayWebOptions","ApplePayWebOptions","onApplePayCodeClose","set","startSession","onValidateMerchant","onPaymentMethodSelected","onShippingMethodSelected","onShippingContactSelected","paymentRequest","preparePaymentRequest","companyName","countryCode","core","options","session","ApplePayService","onError","handleError","onCancel","validateMerchant","onPaymentAuthorized","formatApplePayContactToAdyenAddressFormat","payment","billingContact","shippingContact","setState","btoa","JSON","stringify","token","paymentData","authorizedEvent","handleAuthorization","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","collectOrderTrackingDetailsIfNeeded","paymentResponse","orderDetails","status","STATUS_SUCCESS","handleResponse","catch","errors","applePayError","STATUS_FAILURE","Array","isArray","undefined","responseWithError","handleFailedResult","onClick","begin","onAuthorized","data","onOrderTrackingRequest","hostname","clientKey","loadingContext","initiative","domainName","path","request","displayName","response","httpPost","decodedData","base64","decode","success","parse","e","componentToRender","h","ApplePayButton","buttonStyle","buttonColor","buttonType","submit","constructor","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","bind","ApplePaySdkLoader","load","TxVariants","applepay","defaultProps"],"mappings":"43DAwBA,MAAMA,UAAwBC,EA0CPC,WAAAA,CAAYC,OAQTA,EAEQA,EARAA,EAMcA,EACMA,EAP9C,MAAMC,GAAgC,QAAZD,EAAAA,EAAME,cAANF,IAAAA,OAAAA,EAAAA,EAAcG,QAASC,EAAUJ,EAAME,QAAUF,EAAMC,kBAEjF,OAAOI,EAAAC,EAAA,CAAA,EACAN,GAAAA,CACHO,cAAeP,EAAMO,cACrBN,oBACAO,aAAgC,QAAlBR,EAAAA,EAAMQ,oBAANR,IAAAA,EAAAA,EAAgC,QAAVA,EAAAA,EAAMS,YAANT,IAAAA,OAAAA,EAAAA,EAAYU,OAChDC,gBAAiBX,EAAMW,kBAAsC,QAAnBX,EAAAA,EAAMO,qBAANP,IAAAA,OAAAA,EAAAA,EAAqBY,cAC/DC,6BAAsBb,EAAAA,EAAMa,4BAANb,IAAAA,EAAAA,EAA+Bc,IAAmB,SAAW,SAE3F,CAKA,UAAAC,GACI,MAAMC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AkB,IAAdqB,IAAwB+C,GAA6BD,GACrD,MAAM,IAAIrB,EACN,uBACA,8IAIR3B,KAAK6C,aAAe7C,KAAK6C,aAAauF,KAAKpI,MAC3CA,KAAKyH,OAASzH,KAAKyH,OAAOW,KAAKpI,MAC/BA,KAAK6D,iBAAmB7D,KAAK6D,iBAAiBuE,KAAKpI,MACnDA,KAAK+E,oCAAsC/E,KAAK+E,oCAAoCqD,KAAKpI,MACzFA,KAAK0E,oBAAsB1E,KAAK0E,oBAAoB0D,KAAKpI,MACzDA,KAAKqC,4BAA8BrC,KAAKqC,4BAA4B+F,KAAKpI,MACzEA,KAAKyC,4BAA8BzC,KAAKyC,4BAA4B2F,KAAKpI,MAEzEA,KAAKwB,UAAY,IAAI6G,EAAkB,CAAErH,UAAWhB,KAAKgB,YAEpDhB,KAAKwB,UACL8G,OACA3D,KAAK3E,KAAKqC,6BACVsC,KAAK3E,KAAKyC,6BACV4C,MAAM3D,IACH1B,KAAK2D,YAAYjC,IAE7B,EApCAmG,EADEnJ,EACY0B,OAAOmI,EAAWC,UAEhCX,EAHEnJ,EAGe+J,eAAeA"}
1
+ {"version":3,"file":"ApplePay.js","sources":["../../../../src/components/ApplePay/ApplePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ApplePayButton from './components/ApplePayButton';\nimport ApplePayService from './services/ApplePayService';\nimport base64 from '../../utils/base64';\nimport defaultProps from './defaultProps';\nimport { httpPost } from '../../core/Services/http';\nimport { preparePaymentRequest } from './utils/payment-request';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { DecodeObject } from '../../types/global-types';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { resolveSupportedVersion } from './utils/resolve-supported-version';\nimport { formatApplePayContactToAdyenAddressFormat } from './utils/format-applepay-contact-to-adyen-format';\nimport { mapBrands } from './utils/map-adyen-brands-to-applepay-brands';\nimport ApplePaySdkLoader from './services/ApplePaySdkLoader';\nimport { detectInIframe } from '../../utils/detectInIframe';\nimport type { ApplePayConfiguration, ApplePayElementData, ApplePayPaymentOrderDetails, ApplePaySessionRequest } from './types';\nimport type { ICore } from '../../core/types';\nimport type { PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\n\nconst LATEST_APPLE_PAY_VERSION = 14;\n\nclass ApplePayElement extends UIElement<ApplePayConfiguration> {\n public static type = TxVariants.applepay;\n\n protected static defaultProps = defaultProps;\n\n private sdkLoader: ApplePaySdkLoader;\n private applePayVersionNumber: number = undefined;\n\n constructor(checkout: ICore, props?: ApplePayConfiguration) {\n super(checkout, props);\n\n const { isExpress, onShippingContactSelected, onShippingMethodSelected } = this.props;\n\n if (isExpress === false && (onShippingContactSelected || onShippingMethodSelected)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'ApplePay - You must set \"isExpress\" flag to \"true\" in order to use \"onShippingContactSelected\" and/or \"onShippingMethodSelected\" callbacks'\n );\n }\n\n this.startSession = this.startSession.bind(this);\n this.submit = this.submit.bind(this);\n this.validateMerchant = this.validateMerchant.bind(this);\n this.collectOrderTrackingDetailsIfNeeded = this.collectOrderTrackingDetailsIfNeeded.bind(this);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.defineApplePayVersionNumber = this.defineApplePayVersionNumber.bind(this);\n this.configureApplePayWebOptions = this.configureApplePayWebOptions.bind(this);\n\n this.sdkLoader = new ApplePaySdkLoader({ analytics: this.analytics });\n\n void this.sdkLoader\n .load()\n .then(this.defineApplePayVersionNumber)\n .then(this.configureApplePayWebOptions)\n .catch(error => {\n this.handleError(error);\n });\n }\n\n /**\n * Formats the component props\n */\n protected override formatProps(props: ApplePayConfiguration): ApplePayConfiguration {\n // @ts-ignore TODO: Fix brands prop\n const supportedNetworks = props.brands?.length ? mapBrands(props.brands) : props.supportedNetworks;\n\n return {\n ...props,\n configuration: props.configuration,\n supportedNetworks,\n buttonLocale: props.buttonLocale ?? props.i18n?.locale,\n totalPriceLabel: props.totalPriceLabel || props.configuration?.merchantName,\n renderApplePayCodeAs: props.renderApplePayCodeAs ?? (detectInIframe() ? 'window' : 'modal')\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData(): ApplePayElementData {\n const { applePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: ApplePayElement.type,\n applePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n protected override beforeRender(configSetByMerchant?: ApplePayConfiguration) {\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.isExpress && { isExpress: configSetByMerchant.isExpress }),\n ...(configSetByMerchant?.expressPage && { expressPage: configSetByMerchant.expressPage })\n });\n\n this.analytics.sendAnalytics(event);\n }\n\n public override submit = (): void => {\n if (this.props.isInstantPayment) {\n const event = new AnalyticsInfoEvent({ component: this.type, type: InfoEventType.selected, target: UiTarget.instantPaymentButton });\n this.submitAnalytics(event);\n }\n void this.startSession();\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n /**\n * This API is only intended for upstreaming or defaulting to Apple Pay, all other scenarios should continue to\n * use canMakePayments(). For Safari browsers, this API will indicate whether there is a card available to make\n * payments. For third-party browsers a new status of paymentCredentialStatusUnknown will be returned. This does\n * not mean there are no cards available, it means the status cannot be determined and as such defaulting\n * and upstreaming should still be considered.\n *\n * {@link https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities}\n * @param merchantIdentifier\n */\n public async applePayCapabilities(merchantIdentifier?: string): Promise<ApplePayJS.PaymentCredentialStatusResponse> {\n const identifier = merchantIdentifier || this.props.configuration.merchantId;\n\n try {\n await this.sdkLoader.isSdkLoaded();\n return await ApplePaySession?.applePayCapabilities(identifier);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Apple Pay: Error when requesting applePayCapabilities()', { cause: error });\n }\n }\n\n /**\n * Determines if Apple Pay component can be displayed or not\n */\n public override async isAvailable(): Promise<void> {\n if (window.location.protocol !== 'https:') {\n return Promise.reject(new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Trying to start an Apple Pay session from an insecure document'));\n }\n\n try {\n await this.sdkLoader.isSdkLoaded();\n\n if (ApplePaySession?.canMakePayments()) {\n return Promise.resolve();\n }\n\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay is not available on this device'));\n } catch (error) {\n return Promise.reject(new AdyenCheckoutError('ERROR', 'Apple Pay SDK failed to load', { cause: error }));\n }\n }\n\n /**\n * Sets the Apple Pay version available for the shopper.\n * This code needs to be executed once the Apple Pay SDK is fully loaded\n * @private\n */\n private defineApplePayVersionNumber() {\n if (window.location.protocol !== 'https:') return;\n this.applePayVersionNumber = this.props.version || resolveSupportedVersion(LATEST_APPLE_PAY_VERSION);\n }\n\n /**\n * Sets the configuration/callbacks that pertain to the Apple Pay code overlay/modal.\n * @private\n */\n private configureApplePayWebOptions() {\n if (window.ApplePayWebOptions) {\n const { renderApplePayCodeAs, onApplePayCodeClose } = this.props;\n\n window.ApplePayWebOptions.set({\n renderApplePayCodeAs,\n ...(onApplePayCodeClose && { onApplePayCodeClose })\n });\n }\n }\n\n private startSession() {\n const { onValidateMerchant, onPaymentMethodSelected, onShippingMethodSelected, onShippingContactSelected } = this.props;\n\n const paymentRequest = preparePaymentRequest({\n companyName: this.props.configuration.merchantName,\n countryCode: this.core.options.countryCode,\n ...this.props\n });\n\n const session = new ApplePayService(paymentRequest, {\n version: this.applePayVersionNumber,\n onError: (error: unknown) => {\n this.handleError(\n new AdyenCheckoutError('ERROR', 'ApplePay - Something went wrong on ApplePayService', {\n cause: error\n })\n );\n },\n onCancel: event => {\n this.handleError(new AdyenCheckoutError('CANCEL', 'ApplePay UI dismissed', { cause: event }));\n },\n onPaymentMethodSelected,\n onShippingMethodSelected,\n onShippingContactSelected,\n onValidateMerchant: onValidateMerchant || this.validateMerchant,\n onPaymentAuthorized: (resolve, reject, event) => {\n const billingAddress = formatApplePayContactToAdyenAddressFormat(event.payment.billingContact);\n const deliveryAddress = formatApplePayContactToAdyenAddressFormat(event.payment.shippingContact, true);\n\n this.setState({\n applePayToken: btoa(JSON.stringify(event.payment.token.paymentData)),\n authorizedEvent: event,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.collectOrderTrackingDetailsIfNeeded)\n .then(({ paymentResponse, orderDetails }) => {\n resolve({\n status: ApplePaySession.STATUS_SUCCESS,\n ...(orderDetails && { orderDetails })\n });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n const errors = paymentResponse?.error?.applePayError;\n\n reject({\n status: ApplePaySession.STATUS_FAILURE,\n errors: errors ? (Array.isArray(errors) ? errors : [errors]) : undefined\n });\n\n const responseWithError: RawPaymentResponse = {\n ...paymentResponse,\n error: {\n applePayError: errors\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\n }\n });\n\n return new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject))\n .then(() => {\n session.begin();\n })\n .catch(() => ({\n // Swallow exception triggered by onClick reject\n }));\n }\n\n /**\n * Call the 'onAuthorized' callback if available.\n * Must be resolved/reject for the payment flow to continue\n *\n * @private\n */\n private async handleAuthorization(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.props.onAuthorized) {\n resolve();\n }\n\n const { authorizedEvent, billingAddress, deliveryAddress } = this.state;\n\n this.props.onAuthorized(\n {\n authorizedEvent,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n );\n }).catch((error?: ApplePayJS.ApplePayError) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { applePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Verify if the 'onOrderTrackingRequest' is provided. If so, triggers the callback expecting an\n * Apple Pay order details back\n *\n * @private\n */\n private async collectOrderTrackingDetailsIfNeeded(\n paymentResponse: PaymentResponseData\n ): Promise<{ orderDetails?: ApplePayPaymentOrderDetails; paymentResponse: PaymentResponseData }> {\n return new Promise<ApplePayPaymentOrderDetails | void>((resolve, reject) => {\n if (!this.props.onOrderTrackingRequest) {\n return resolve();\n }\n\n this.props.onOrderTrackingRequest(resolve, reject);\n })\n .then(orderDetails => {\n return {\n paymentResponse,\n ...(orderDetails && { orderDetails })\n };\n })\n .catch(() => {\n return { paymentResponse };\n });\n }\n\n private async validateMerchant(resolve: (merchantSession: any) => void, reject: (error: string) => void) {\n const { hostname } = window.location;\n const { clientKey, configuration, loadingContext, initiative, domainName } = this.props;\n const { merchantName, merchantId } = configuration;\n const path = `v1/applePay/sessions?clientKey=${clientKey}`;\n const options = { loadingContext, path };\n const request: ApplePaySessionRequest = {\n displayName: merchantName,\n domainName: domainName || hostname,\n initiative,\n merchantIdentifier: merchantId\n };\n\n try {\n const response = await httpPost(options, request);\n const decodedData: DecodeObject = base64.decode(response.data);\n if (!decodedData.success) {\n reject('Could not decode Apple Pay session');\n } else {\n const session = JSON.parse(decodedData.data);\n resolve(session);\n }\n } catch (e) {\n reject('Could not get Apple Pay session');\n }\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (!this.props.showPayButton) {\n return null;\n }\n\n return (\n <ApplePayButton\n buttonStyle={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonLocale={this.props.buttonLocale}\n onClick={this.submit}\n />\n );\n }\n}\n\nexport default ApplePayElement;\n"],"names":["ApplePayElement","UIElement","formatProps","props","supportedNetworks","brands","length","mapBrands","_object_spread_props","_object_spread","configuration","buttonLocale","i18n","locale","totalPriceLabel","merchantName","renderApplePayCodeAs","detectInIframe","formatData","applePayToken","billingAddress","deliveryAddress","this","state","isExpress","paymentMethod","type","subtype","beforeRender","configSetByMerchant","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","isValid","applePayCapabilities","merchantIdentifier","identifier","merchantId","ApplePaySession","sdkLoader","isSdkLoaded","error","AdyenCheckoutError","cause","isAvailable","window","location","protocol","Promise","reject","canMakePayments","resolve","defineApplePayVersionNumber","applePayVersionNumber","version","resolveSupportedVersion","configureApplePayWebOptions","ApplePayWebOptions","onApplePayCodeClose","set","startSession","onValidateMerchant","onPaymentMethodSelected","onShippingMethodSelected","onShippingContactSelected","paymentRequest","preparePaymentRequest","companyName","countryCode","core","options","session","ApplePayService","onError","handleError","onCancel","validateMerchant","onPaymentAuthorized","formatApplePayContactToAdyenAddressFormat","payment","billingContact","shippingContact","setState","btoa","JSON","stringify","token","paymentData","authorizedEvent","handleAuthorization","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","collectOrderTrackingDetailsIfNeeded","paymentResponse","orderDetails","status","STATUS_SUCCESS","handleResponse","catch","errors","applePayError","STATUS_FAILURE","Array","isArray","undefined","responseWithError","handleFailedResult","onClick","begin","onAuthorized","data","onOrderTrackingRequest","hostname","clientKey","loadingContext","initiative","domainName","path","request","displayName","response","httpPost","decodedData","base64","decode","success","parse","e","componentToRender","h","ApplePayButton","buttonStyle","buttonColor","buttonType","submit","constructor","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","bind","ApplePaySdkLoader","load","TxVariants","applepay","defaultProps"],"mappings":"43DAwBA,MAAMA,UAAwBC,EA0CPC,WAAAA,CAAYC,OAQTA,EAEQA,EARAA,EAMcA,EACMA,EAP9C,MAAMC,GAAgC,QAAZD,EAAAA,EAAME,cAANF,IAAAA,OAAAA,EAAAA,EAAc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EAAiB9I,GACzB+I,MAAMD,EAAU9I,GAJpBgJ,EAAA7H,KAAQwB,iBAAR,GACAqG,EAAA7H,KAAQsC,6BAAgCqD,GAgFxCkC,EAAA7H,KAAgByH,SAAS,KACrB,GAAIzH,KAAKnB,MAAMiJ,iBAAkB,CAC7B,MAAMtH,EAAQ,IAAIC,EAAmB,CAAEG,UAAWZ,KAAKI,KAAMA,KAAMM,EAAcqH,SAAUC,OAAQC,EAASC,uBAC5GlI,KAAKmI,gBAAgB3H,EACzB,CACKR,KAAK6C,iBAhFV,MAAM3C,UAAEA,EAAS+C,0BAAEA,EAAyBD,yBAAEA,GAA6BhD,KAAKnB,MAEhF,IAAkB,IAAdqB,IAAwB+C,GAA6BD,GACrD,MAAM,IAAIrB,EACN,uBACA,8IAIR3B,KAAK6C,aAAe7C,KAAK6C,aAAauF,KAAKpI,MAC3CA,KAAKyH,OAASzH,KAAKyH,OAAOW,KAAKpI,MAC/BA,KAAK6D,iBAAmB7D,KAAK6D,iBAAiBuE,KAAKpI,MACnDA,KAAK+E,oCAAsC/E,KAAK+E,oCAAoCqD,KAAKpI,MACzFA,KAAK0E,oBAAsB1E,KAAK0E,oBAAoB0D,KAAKpI,MACzDA,KAAKqC,4BAA8BrC,KAAKqC,4BAA4B+F,KAAKpI,MACzEA,KAAKyC,4BAA8BzC,KAAKyC,4BAA4B2F,KAAKpI,MAEzEA,KAAKwB,UAAY,IAAI6G,EAAkB,CAAErH,UAAWhB,KAAKgB,YAEpDhB,KAAKwB,UACL8G,OACA3D,KAAK3E,KAAKqC,6BACVsC,KAAK3E,KAAKyC,6BACV4C,MAAM3D,IACH1B,KAAK2D,YAAYjC,IAE7B,EApCAmG,EADEnJ,EACY0B,OAAOmI,EAAWC,UAEhCX,EAHEnJ,EAGe+J,eAAeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApplePaySdkLoader.js","sources":["../../../../../src/components/ApplePay/services/ApplePaySdkLoader.ts"],"sourcesContent":["import Script from '../../../utils/Script';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport const APPLE_PAY_SDK_URL = 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js';\n\nclass ApplePaySdkLoader {\n private sdkLoadingPromise: Promise<void>;\n private readonly analytics: IAnalytics;\n\n constructor({ analytics }: { analytics: IAnalytics }) {\n this.analytics = analytics;\n }\n\n public async load(): Promise<ApplePaySession> {\n try {\n const scriptElement = new Script({\n src: APPLE_PAY_SDK_URL,\n component: 'applepay',\n attributes: { crossOrigin: 'anonymous' },\n analytics: this.analytics\n });\n\n this.sdkLoadingPromise = scriptElement.load();\n await this.sdkLoadingPromise;\n\n return window?.ApplePaySession;\n } catch (error) {\n throw new AdyenCheckoutError('SCRIPT_ERROR', 'ApplePaySDK failed to load', { cause: error });\n }\n }\n\n public isSdkLoaded(): Promise<void> {\n if (this.sdkLoadingPromise === undefined) {\n return Promise.reject();\n }\n\n return this.sdkLoadingPromise;\n }\n}\n\nexport default ApplePaySdkLoader;\n"],"names":["APPLE_PAY_SDK_URL","ApplePaySdkLoader","load","window","scriptElement","Script","src","component","attributes","crossOrigin","analytics","this","sdkLoadingPromise","ApplePaySession","error","AdyenCheckoutError","cause","isSdkLoaded","undefined","Promise","reject","constructor","_define_property"],"mappings":"0NAIO,MAAMA,EAAoB,iEAEjC,MAAMC,EAQF,UAAaC,GACT,IAWWC,IAAAA,EAVP,MAAMC,EAAgB,IAAIC,EAAO,CAC7BC,IAAKN,EACLO,UAAW,WACXC,WAAY,CAAEC,YAAa,aAC3BC,UAAWC,KAAKD,YAMpB,OAHAC,KAAKC,kBAAoBR,EAAcF,aACjCS,KAAKC,kBAEJT,QAAAA,EAAAA,cAAAA,IAAAA,OAAAA,EAAAA,EAAQU,eACnB,CAAE,MAAOC,GACL,MAAM,IAAIC,EAAmB,eAAgB,6BAA8B,CAAEC,MAAOF,GACxF,CACJ,CAEOG,WAAAA,GACH,YAA+BC,IAA3BP,KAAKC,kBACEO,QAAQC,SAGZT,KAAKC,iBAChB,CA5BA,WAAAS,EAAYX,UAAEA,IAHdY,EAAAX,KAAQC,yBAAR,GACAU,EAAAX,KAAiBD,iBAAjB,GAGIC,KAAKD,UAAYA,CACrB"}
1
+ {"version":3,"file":"ApplePaySdkLoader.js","sources":["../../../../../src/components/ApplePay/services/ApplePaySdkLoader.ts"],"sourcesContent":["import Script from '../../../utils/Script';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport const APPLE_PAY_SDK_URL = 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js';\n\nclass ApplePaySdkLoader {\n private sdkLoadingPromise: Promise<void>;\n private readonly analytics: IAnalytics;\n\n constructor({ analytics }: { analytics: IAnalytics }) {\n this.analytics = analytics;\n }\n\n public async load(): Promise<ApplePaySession> {\n try {\n const scriptElement = new Script({\n src: APPLE_PAY_SDK_URL,\n component: 'applepay',\n attributes: { crossOrigin: 'anonymous' },\n analytics: this.analytics\n });\n\n this.sdkLoadingPromise = scriptElement.load();\n await this.sdkLoadingPromise;\n\n return window?.ApplePaySession;\n } catch (error) {\n throw new AdyenCheckoutError('SCRIPT_ERROR', 'ApplePaySDK failed to load', { cause: error });\n }\n }\n\n public isSdkLoaded(): Promise<void> {\n if (this.sdkLoadingPromise === undefined) {\n return Promise.reject();\n }\n\n return this.sdkLoadingPromise;\n }\n}\n\nexport default ApplePaySdkLoader;\n"],"names":["APPLE_PAY_SDK_URL","ApplePaySdkLoader","load","window","scriptElement","Script","src","component","attributes","crossOrigin","analytics","this","sdkLoadingPromise","ApplePaySession","error","AdyenCheckoutError","cause","isSdkLoaded","undefined","Promise","reject","constructor","_define_property"],"mappings":"0NAIO,MAAMA,EAAoB,iEAEjC,MAAMC,EAQF,UAAaC,GACT,IAWWC,IAAAA,EAVP,MAAMC,EAAgB,IAAIC,EAAO,CAC7BC,IAAKN,EACLO,UAAW,WACXC,WAAY,CAAEC,YAAa,aAC3BC,UAAWC,KAAKD,YAMpB,OAHAC,KAAKC,kBAAoBR,EAAcF,aACjCS,KAAKC,kBAEJT,QAAAA,EAAAA,cAAAA,IAAAA,OAAAA,EAAAA,EAAQU,eACnB,CAAE,MAAOC,GACL,MAAM,IAAIC,EAAmB,eAAgB,6BAA8B,CAAEC,MAAOF,GACxF,CACJ,CAEOG,WAAAA,GACH,YAA+BC,IAA3BP,KAAKC,kBACEO,QAAQC,SAGZT,KAAKC,iBAChB,CA5BA,WAAAS,EAAYX,UAAEA,IAHdY,EAAAX,KAAQC,4BACRU,EAAAX,KAAiBD,oBAGbC,KAAKD,UAAYA,CACrB"}
@@ -1,2 +1,2 @@
1
- function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class t{begin(){return this.session.begin()}onvalidatemerchant(e,t){return new Promise((n,o)=>t(n,o,e.validationURL)).then(e=>{this.session.completeMerchantValidation(e)}).catch(e=>{console.error(e),this.session.abort(),this.options.onError(e)})}onpaymentauthorized(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completePayment(e)}).catch(e=>{this.session.completePayment(e)})}onpaymentmethodselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completePaymentMethodSelection(e)}).catch(e=>{this.session.completePaymentMethodSelection(e)})}onshippingcontactselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completeShippingContactSelection(e)}).catch(e=>{this.session.completeShippingContactSelection(e)})}onshippingmethodselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completeShippingMethodSelection(e)}).catch(e=>{this.session.completeShippingMethodSelection(e)})}oncancel(e,t){t(e)}constructor(t,n){e(this,"session",void 0),e(this,"options",void 0),this.options=n,this.session=new ApplePaySession(n.version,t),this.session.onvalidatemerchant=e=>{this.onvalidatemerchant(e,n.onValidateMerchant)},this.session.onpaymentauthorized=e=>{this.onpaymentauthorized(e,n.onPaymentAuthorized)},this.session.oncancel=e=>{this.oncancel(e,n.onCancel)},"function"==typeof n.onPaymentMethodSelected&&(this.session.onpaymentmethodselected=e=>{this.onpaymentmethodselected(e,n.onPaymentMethodSelected)}),"function"==typeof n.onShippingContactSelected&&(this.session.onshippingcontactselected=e=>{this.onshippingcontactselected(e,n.onShippingContactSelected)}),"function"==typeof n.onShippingMethodSelected&&(this.session.onshippingmethodselected=e=>{this.onshippingmethodselected(e,n.onShippingMethodSelected)})}}export{t as default};
1
+ function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class t{begin(){return this.session.begin()}onvalidatemerchant(e,t){return new Promise((n,o)=>{t(n,o,e.validationURL)}).then(e=>{this.session.completeMerchantValidation(e)}).catch(e=>{console.error(e),this.session.abort(),this.options.onError(e)})}onpaymentauthorized(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completePayment(e)}).catch(e=>{this.session.completePayment(e)})}onpaymentmethodselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completePaymentMethodSelection(e)}).catch(e=>{this.session.completePaymentMethodSelection(e)})}onshippingcontactselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completeShippingContactSelection(e)}).catch(e=>{this.session.completeShippingContactSelection(e)})}onshippingmethodselected(e,t){return new Promise((n,o)=>t(n,o,e)).then(e=>{this.session.completeShippingMethodSelection(e)}).catch(e=>{this.session.completeShippingMethodSelection(e)})}oncancel(e,t){t(e)}constructor(t,n){e(this,"session",void 0),e(this,"options",void 0),this.options=n,this.session=new ApplePaySession(n.version,t),this.session.onvalidatemerchant=e=>{this.onvalidatemerchant(e,n.onValidateMerchant)},this.session.onpaymentauthorized=e=>{this.onpaymentauthorized(e,n.onPaymentAuthorized)},this.session.oncancel=e=>{this.oncancel(e,n.onCancel)},"function"==typeof n.onPaymentMethodSelected&&(this.session.onpaymentmethodselected=e=>{this.onpaymentmethodselected(e,n.onPaymentMethodSelected)}),"function"==typeof n.onShippingContactSelected&&(this.session.onshippingcontactselected=e=>{this.onshippingcontactselected(e,n.onShippingContactSelected)}),"function"==typeof n.onShippingMethodSelected&&(this.session.onshippingmethodselected=e=>{this.onshippingmethodselected(e,n.onShippingMethodSelected)})}}export{t as default};
2
2
  //# sourceMappingURL=ApplePayService.js.map