@adyen/adyen-web 6.46.0 → 6.47.0-alpha.41c41fe

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 (273) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +63 -46
  4. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  5. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  6. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  7. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  8. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  9. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  10. package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
  11. package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
  12. package/dist/es/components/AmazonPay/components/SignOutButton.js +1 -1
  13. package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
  14. package/dist/es/components/AmazonPay/utils.js +1 -1
  15. package/dist/es/components/AmazonPay/utils.js.map +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  18. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  19. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  20. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  21. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  22. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  23. package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
  24. package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
  25. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  26. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  27. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  28. package/dist/es/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js +1 -1
  29. package/dist/es/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js.map +1 -1
  30. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  31. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  32. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  33. package/dist/es/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js +1 -1
  34. package/dist/es/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
  35. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  36. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  37. package/dist/es/components/PayPal/Paypal.js +1 -1
  38. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  39. package/dist/es/components/PayPal/utils/get-paypal-locale.js.map +1 -1
  40. package/dist/es/components/PayPal/utils/get-paypal-settings.js +1 -1
  41. package/dist/es/components/PayPal/utils/get-paypal-settings.js.map +1 -1
  42. package/dist/es/components/PayPalFastlane/Fastlane.js +1 -1
  43. package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
  44. package/dist/es/components/PayPalFastlane/FastlaneSDK.js +1 -1
  45. package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  46. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  47. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  48. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  49. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  50. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  51. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  52. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  53. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  54. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  55. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  56. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  57. package/dist/es/components/ThreeDS2/components/utils.js +1 -1
  58. package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
  59. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  60. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  61. package/dist/es/components/internal/Address/Address.js +1 -1
  62. package/dist/es/components/internal/Address/Address.js.map +1 -1
  63. package/dist/es/components/internal/Address/Specifications.js +1 -1
  64. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  65. package/dist/es/components/internal/Address/components/AddressSearch.js +1 -1
  66. package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
  67. package/dist/es/components/internal/Address/components/FieldContainer.js +1 -1
  68. package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
  69. package/dist/es/components/internal/Address/constants.js.map +1 -1
  70. package/dist/es/components/internal/Address/utils.js.map +1 -1
  71. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  72. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  73. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  74. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  75. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  76. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  77. package/dist/es/components/internal/CompanyDetails/validate.js +1 -1
  78. package/dist/es/components/internal/CompanyDetails/validate.js.map +1 -1
  79. package/dist/es/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.js.map +1 -1
  80. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  81. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  82. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  83. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  84. package/dist/es/components/internal/FormFields/InputDate/InputDate.js +1 -1
  85. package/dist/es/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
  86. package/dist/es/components/internal/FormFields/InputDate/utils.js.map +1 -1
  87. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  88. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  89. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  90. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  91. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  92. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  93. package/dist/es/components/internal/IbanInput/specifications.js.map +1 -1
  94. package/dist/es/components/internal/IbanInput/utils.js +1 -1
  95. package/dist/es/components/internal/IbanInput/utils.js.map +1 -1
  96. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  97. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  98. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  99. package/dist/es/components/internal/PersonalDetails/validate.js +1 -1
  100. package/dist/es/components/internal/PersonalDetails/validate.js.map +1 -1
  101. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  102. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  103. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  104. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  105. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  106. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  107. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  108. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  109. package/dist/es/core/config.js +1 -1
  110. package/dist/es/core/config.js.map +1 -1
  111. package/dist/es/core/core.js +1 -1
  112. package/dist/es/core/core.js.map +1 -1
  113. package/dist/es/core/utils.js +1 -1
  114. package/dist/es/core/utils.js.map +1 -1
  115. package/dist/es/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
  116. package/dist/es/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  117. package/dist/es/index.d.ts +63 -46
  118. package/dist/es/utils/Script.js.map +1 -1
  119. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  120. package/dist/es/utils/Validator/Validator.js +1 -1
  121. package/dist/es/utils/Validator/Validator.js.map +1 -1
  122. package/dist/es/utils/Validator/defaultRules.js +1 -1
  123. package/dist/es/utils/Validator/defaultRules.js.map +1 -1
  124. package/dist/es/utils/browserInfo.js.map +1 -1
  125. package/dist/es/utils/createSdkData.js.map +1 -1
  126. package/dist/es/utils/get-issuer-image.js +1 -1
  127. package/dist/es/utils/get-issuer-image.js.map +1 -1
  128. package/dist/es/utils/get-process-message-handler.js.map +1 -1
  129. package/dist/es/utils/getConsentUrl.js +1 -1
  130. package/dist/es/utils/getConsentUrl.js.map +1 -1
  131. package/dist/es/utils/getErrorMessage.js.map +1 -1
  132. package/dist/es/utils/getOrigin.js.map +1 -1
  133. package/dist/es/utils/isValidURL.js +1 -1
  134. package/dist/es/utils/isValidURL.js.map +1 -1
  135. package/dist/es/utils/promiseTimeout.js.map +1 -1
  136. package/dist/es/utils/useAutoFocus.js.map +1 -1
  137. package/dist/es/utils/validator-utils.js +1 -1
  138. package/dist/es/utils/validator-utils.js.map +1 -1
  139. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  140. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  141. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  142. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  143. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  144. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  145. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
  146. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
  147. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js +1 -1
  148. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
  149. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  150. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  151. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  152. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  153. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  154. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  155. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  156. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  157. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  158. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
  159. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
  160. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  161. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  162. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  163. package/dist/es-legacy/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js +1 -1
  164. package/dist/es-legacy/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js.map +1 -1
  165. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  166. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  167. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  168. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js +1 -1
  169. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
  170. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  171. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  172. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  173. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  174. package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js.map +1 -1
  175. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +1 -1
  176. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -1
  177. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js +1 -1
  178. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
  179. package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js +1 -1
  180. package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  181. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  182. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  183. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  184. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  185. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  186. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  187. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  188. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  189. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  190. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  191. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  192. package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
  193. package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
  194. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  195. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  196. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  197. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  198. package/dist/es-legacy/components/internal/Address/Specifications.js +1 -1
  199. package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
  200. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js +1 -1
  201. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
  202. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js +1 -1
  203. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
  204. package/dist/es-legacy/components/internal/Address/constants.js.map +1 -1
  205. package/dist/es-legacy/components/internal/Address/utils.js.map +1 -1
  206. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  207. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  208. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  209. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  210. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  211. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  212. package/dist/es-legacy/components/internal/CompanyDetails/validate.js +1 -1
  213. package/dist/es-legacy/components/internal/CompanyDetails/validate.js.map +1 -1
  214. package/dist/es-legacy/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.js.map +1 -1
  215. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  216. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  217. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  218. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  219. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js +1 -1
  220. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
  221. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js.map +1 -1
  222. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  223. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  224. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  225. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  226. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  227. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  228. package/dist/es-legacy/components/internal/IbanInput/specifications.js.map +1 -1
  229. package/dist/es-legacy/components/internal/IbanInput/utils.js +1 -1
  230. package/dist/es-legacy/components/internal/IbanInput/utils.js.map +1 -1
  231. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  232. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  233. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  234. package/dist/es-legacy/components/internal/PersonalDetails/validate.js +1 -1
  235. package/dist/es-legacy/components/internal/PersonalDetails/validate.js.map +1 -1
  236. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  237. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  238. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  239. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  240. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  241. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  242. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  243. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  244. package/dist/es-legacy/core/config.js +1 -1
  245. package/dist/es-legacy/core/config.js.map +1 -1
  246. package/dist/es-legacy/core/core.js +1 -1
  247. package/dist/es-legacy/core/core.js.map +1 -1
  248. package/dist/es-legacy/core/utils.js +1 -1
  249. package/dist/es-legacy/core/utils.js.map +1 -1
  250. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
  251. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  252. package/dist/es-legacy/utils/Script.js.map +1 -1
  253. package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
  254. package/dist/es-legacy/utils/Validator/Validator.js +1 -1
  255. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  256. package/dist/es-legacy/utils/Validator/defaultRules.js +1 -1
  257. package/dist/es-legacy/utils/Validator/defaultRules.js.map +1 -1
  258. package/dist/es-legacy/utils/browserInfo.js.map +1 -1
  259. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  260. package/dist/es-legacy/utils/get-issuer-image.js +1 -1
  261. package/dist/es-legacy/utils/get-issuer-image.js.map +1 -1
  262. package/dist/es-legacy/utils/get-process-message-handler.js.map +1 -1
  263. package/dist/es-legacy/utils/getConsentUrl.js +1 -1
  264. package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
  265. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  266. package/dist/es-legacy/utils/getOrigin.js.map +1 -1
  267. package/dist/es-legacy/utils/isValidURL.js +1 -1
  268. package/dist/es-legacy/utils/isValidURL.js.map +1 -1
  269. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  270. package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
  271. package/dist/es-legacy/utils/validator-utils.js +1 -1
  272. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  273. package/package.json +3 -2
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as t,useState as r,useEffect as n,useCallback as a}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import s from"../../internal/Spinner/Spinner.js";import{CashAppPayEvents as i}from"../services/types.js";import c from"../../internal/StoreDetails/StoreDetails.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u({enableStoreDetails:u,cashAppService:d,setComponentRef:m,onClick:p,onChangeStoreDetails:f,onAuthorize:b,onError:y}){const h=t(null),[g,v]=r("loading"),C=t([]),[E,R]=r(!1),w=t({setStatus:v});n(()=>{m(w.current)},[m]);const S=a(async()=>{try{await d.initialize(),C.current=[d.subscribeToEvent(i.CustomerDismissed,()=>{y(new o("CANCEL","Customer dismissed the modal"))}),d.subscribeToEvent(i.CustomerRequestDeclined,async()=>{y(new o("ERROR","Payment declined by CashAppPay")),await d.restart(),await d.renderButton(h.current)}),d.subscribeToEvent(i.CustomerRequestApproved,({customerProfile:e,grants:t})=>{var r,n;const a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({},(null==e?void 0:e.id)&&{customerId:e.id},(null==e?void 0:e.cashtag)&&{cashTag:e.cashtag},(null==t||null===(r=t.payment)||void 0===r?void 0:r.grantId)&&{grantId:t.payment.grantId},(null==t||null===(n=t.onFile)||void 0===n?void 0:n.grantId)&&{onFileGrantId:t.onFile.grantId});b(a)}),d.subscribeToEvent(i.CustomerRequestFailed,()=>{y(new o("ERROR","Customer request failed"))})],await d.renderButton(h.current),v("ready")}catch(e){y(e instanceof o?e:new o("ERROR","Error when initializing CashAppPay",{cause:e}))}},[d,y,b]);return n(()=>{u&&(d.setStorePaymentMethod(E),f(E))},[u,E]),n(()=>(S(),()=>{d.restart(),C.current.forEach(e=>e())}),[d,S]),e("div",{className:"adyen-checkout__cashapp","aria-live":"polite","aria-busy":"loading"===g},"loading"===g&&e(s,null),"loading"!==g&&u&&e(c,{storeDetails:E,onChange:R}),e("div",{onClick:p,className:"adyen-checkout__cashapp-button",ref:h}))}export{u as CashAppComponent};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as t,useState as r,useEffect as n,useCallback as a}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import s from"../../internal/Spinner/Spinner.js";import{CashAppPayEvents as i}from"../services/types.js";import c from"../../internal/StoreDetails/StoreDetails.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u({enableStoreDetails:u,cashAppService:d,setComponentRef:p,onClick:m,onChangeStoreDetails:f,onAuthorize:b,onError:y}){const h=t(null),[g,v]=r("loading"),C=t([]),[E,R]=r(!1),w=t({setStatus:v});n(()=>{p(w.current)},[p]);const O=a(async()=>{const e=async()=>{if(!h.current)throw new o("ERROR","CashAppPay button container is not available");await d.renderButton(h.current)};try{await d.initialize(),C.current=[d.subscribeToEvent(i.CustomerDismissed,()=>{y(new o("CANCEL","Customer dismissed the modal"))}),d.subscribeToEvent(i.CustomerRequestDeclined,async()=>{y(new o("ERROR","Payment declined by CashAppPay")),await d.restart(),await e()}),d.subscribeToEvent(i.CustomerRequestApproved,({customerProfile:e,grants:t})=>{var r,n;const a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){l(e,t,r[t])})}return e}({},(null==e?void 0:e.id)&&{customerId:e.id},(null==e?void 0:e.cashtag)&&{cashTag:e.cashtag},(null==t||null===(r=t.payment)||void 0===r?void 0:r.grantId)&&{grantId:t.payment.grantId},(null==t||null===(n=t.onFile)||void 0===n?void 0:n.grantId)&&{onFileGrantId:t.onFile.grantId});b(a)}),d.subscribeToEvent(i.CustomerRequestFailed,()=>{y(new o("ERROR","Customer request failed"))})],await e(),v("ready")}catch(e){y(e instanceof o?e:new o("ERROR","Error when initializing CashAppPay",{cause:e}))}},[d,y,b]);return n(()=>{u&&(d.setStorePaymentMethod(E),f(E))},[u,E]),n(()=>(O(),()=>{d.restart(),C.current.forEach(e=>e())}),[d,O]),e("div",{className:"adyen-checkout__cashapp","aria-live":"polite","aria-busy":"loading"===g},"loading"===g&&e(s,null),"loading"!==g&&u&&e(c,{storeDetails:E,onChange:R}),e("div",{onClick:m,className:"adyen-checkout__cashapp-button",ref:h}))}export{u as CashAppComponent};
2
2
  //# sourceMappingURL=CashAppComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport './CashAppComponent.scss';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(storePayment: boolean): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n setComponentRef,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: Readonly<CashAppComponentProps>): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n const cashAppComponentRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus\n });\n\n useEffect(() => {\n setComponentRef(cashAppComponentRef.current);\n }, [setComponentRef]);\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error when initializing CashAppPay', { cause: error }));\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n void initializeCashAppSdk();\n return () => {\n void cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","setComponentRef","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","cashAppComponentRef","useEffect","current","initializeCashAppSdk","useCallback","async","initialize","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","_object_spread","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","cause","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"khBAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,gBACdA,EAAeC,QACfA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEhEI,EAAsBP,EAA4B,CACpDE,UAAWA,IAGfM,EAAU,KACNd,EAAgBa,EAAoBE,UACrC,CAACf,IAEJ,MAAMgB,EAAuBC,EAAYC,UACrC,UACUnB,EAAeoB,aAErBT,EAAcK,QAAU,CACpBhB,EAAeqB,iBAAi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AAwBT,GAAsB+C,EAACM,EAAAA,CAAaC,aAAczC,EAAoB0C,SAAUzC,IAGzGiC,EAACC,MAAAA,CAAI7C,QAASA,EAAS8C,UAAW,iCAAkCO,IAAKjD,IAGrF"}
1
+ {"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport './CashAppComponent.scss';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(storePayment: boolean): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n setComponentRef,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: Readonly<CashAppComponentProps>): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n const cashAppComponentRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus\n });\n\n useEffect(() => {\n setComponentRef(cashAppComponentRef.current);\n }, [setComponentRef]);\n\n const initializeCashAppSdk = useCallback(async () => {\n const renderButton = async () => {\n if (!cashAppRef.current) throw new AdyenCheckoutError('ERROR', 'CashAppPay button container is not available');\n await cashAppService.renderButton(cashAppRef.current);\n };\n\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await renderButton();\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await renderButton();\n\n setStatus('ready');\n } catch (error) {\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error when initializing CashAppPay', { cause: error }));\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n void initializeCashAppSdk();\n return () => {\n void cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","setComponentRef","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","cashAppComponentRef","useEffect","current","initializeCashAppSdk","useCallback","async","renderButton","AdyenCheckoutError","initialize","subscribeToEvent","CashAppPayEvents","CustomerDismissed","CustomerRequestDeclined","restart","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","_object_spread","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","cause","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"khBAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,gBACdA,EAAeC,QACfA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEhEI,EAAsBP,EAA4B,CACpDE,UAAWA,IAGfM,EAAU,KACNd,EAAgBa,EAAoBE,UACrC,CAACf,IAEJ,MAAMgB,EAAuBC,EAAYC,UACrC,MAAMC,EAAeD,UACjB,IAAKb,EAAWU,QAAS,MAAM,IAAIK,EAAmB,QAAS,sDACzDrB,EAAeoB,aAAad,EAAWU,UAGjD,UACUhB,EAAesB,aAErBX,EAAcK,QAAU,CACpBhB,EAAeuB,iBAAiBC,EAAiBC,kBAAmB,KAChEpB,EAAQ,IAAIgB,EAAmB,SAAU,mCAE7CrB,EAAeuB,iBAAiBC,EAAiBE,wBAAyBP,UACtEd,EAAQ,IAAIgB,EAAmB,QAAS,yCAClCrB,EAAe2B,gBACfP,MAGVpB,EAAeuB,iBAAiBC,EAAiBI,wBAAyB,EAAGC,kBAAiBC,iBAIlFA,EACAA,EAJR,MAAMC,oUAA0CC,CAAA,CAAA,GACxCH,aAAAA,EAAAA,EAAiBI,KAAM,CAAEC,WAAYL,EAAgBI,KACrDJ,aAAAA,EAAAA,EAAiBM,UAAW,CAAEC,QAASP,EAAgBM,UACvDL,SAAe,QAAfA,EAAAA,EAAQO,eAARP,IAAAA,OAAAA,EAAAA,EAAiBQ,UAAW,CAAEA,QAASR,EAAOO,QAAQC,UACtDR,SAAc,QAAdA,EAAAA,EAAQS,cAART,IAAAA,OAAAA,EAAAA,EAAgBQ,UAAW,CAAEE,cAAeV,EAAOS,OAAOD,UAGlElC,EAAY2B,KAEhB/B,EAAeuB,iBAAiBC,EAAiBiB,sBAAuB,KACpEpC,EAAQ,IAAIgB,EAAmB,QAAS,qCAI1CD,IAENX,EAAU,QACd,CAAE,MAAOiC,GACoCrC,EAArCqC,aAAiBrB,EAA4BqB,EACpC,IAAIrB,EAAmB,QAAS,qCAAsC,CAAEsB,MAAOD,IAChG,GACD,CAAC1C,EAAgBK,EAASD,IAiB7B,OAfAW,EAAU,KACFhB,IACAC,EAAea,sBAAsBD,GACrCT,EAAqBS,KAE1B,CAACb,EAAoBa,IAExBG,EAAU,KACDE,IACE,KACEjB,EAAe2B,UACpBhB,EAAcK,QAAQ4B,QAAQC,GAAiBA,OAEpD,CAAC7C,EAAgBiB,IAGhB6B,EAACC,MAAAA,CAAIC,UAAU,0BAA0BC,YAAU,SAASC,YAAsB,YAAX1C,GACvD,YAAXA,GAAwBsC,EAACK,EAAAA,MACd,YAAX3C,GAAwBT,GAAsB+C,EAACM,EAAAA,CAAaC,aAAczC,EAAoB0C,SAAUzC,IAGzGiC,EAACC,MAAAA,CAAI7C,QAASA,EAAS8C,UAAW,iCAAkCO,IAAKjD,IAGrF"}
@@ -1,2 +1,2 @@
1
- import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable}))),r.forEach(function(n){e(t,n,i[n])})}return t}class i{isOneTimePayment(t){return(null==t?void 0:t.value)>0}isOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,n=await this.sdkLoader.load(t);this.pay=await n.pay({clientId:e})}catch(e){throw new t("ERROR","Error during initialization",{cause:e})}}async renderButton(e){try{const{button:t,useCashAppButtonUi:i}=this.configuration,{begin:r}=await this.pay.render(e,{manage:!1,button:!!i&&n({width:"full",shape:"semiround"},t)});this.startAuthorization=r}catch(e){throw new t("ERROR","Error rendering CashAppPay button",{cause:e})}}begin(){this.startAuthorization?this.startAuthorization():console.warn("CashAppService - begin() not available")}subscribeToEvent(t,e){return this.pay.addEventListener(t,e),()=>{this.pay.removeEventListener(t,e)}}async createCustomerRequest(e){try{const{referenceId:t,scopeId:i,redirectURL:r=window.location.href}=this.configuration,o={referenceId:t,redirectURL:r,actions:n({},this.isOneTimePayment(e)&&{payment:{amount:e,scopeId:i}},this.isOnFilePayment()&&{onFile:{scopeId:i}})};await this.pay.customerRequest(o)}catch(e){throw new t("ERROR","Something went wrong during customerRequest creation",{cause:e})}}async restart(){await this.pay.restart()}constructor(t,n){e(this,"sdkLoader",void 0),e(this,"configuration",void 0),e(this,"pay",void 0),e(this,"startAuthorization",void 0),this.configuration=n,this.sdkLoader=t,n.clientId||console.warn("CashAppService: clientId is missing")}}export{i as default};
1
+ import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable}))),r.forEach(function(n){e(t,n,i[n])})}return t}class i{isOneTimePayment(t){var e;return(null!==(e=null==t?void 0:t.value)&&void 0!==e?e:0)>0}isOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,n=await this.sdkLoader.load(t);this.pay=await n.pay({clientId:e})}catch(e){throw new t("ERROR","Error during initialization",{cause:e})}}async renderButton(e){try{const{button:t,useCashAppButtonUi:i}=this.configuration,{begin:r}=await this.pay.render(e,{manage:!1,button:!!i&&n({width:"full",shape:"semiround"},t)});this.startAuthorization=r}catch(e){throw new t("ERROR","Error rendering CashAppPay button",{cause:e})}}begin(){this.startAuthorization?this.startAuthorization():console.warn("CashAppService - begin() not available")}subscribeToEvent(t,e){return this.pay.addEventListener(t,e),()=>{this.pay.removeEventListener(t,e)}}async createCustomerRequest(e){try{const{referenceId:t,scopeId:i,redirectURL:r=window.location.href}=this.configuration,o={referenceId:t,redirectURL:r,actions:n({},this.isOneTimePayment(e)&&{payment:{amount:e,scopeId:i}},this.isOnFilePayment()&&{onFile:{scopeId:i}})};await this.pay.customerRequest(o)}catch(e){throw new t("ERROR","Something went wrong during customerRequest creation",{cause:e})}}async restart(){await this.pay.restart()}constructor(t,n){e(this,"sdkLoader",void 0),e(this,"configuration",void 0),e(this,"pay",void 0),e(this,"startAuthorization",void 0),this.configuration=n,this.sdkLoader=t,n.clientId||console.warn("CashAppService: clientId is missing")}}export{i as default};
2
2
  //# sourceMappingURL=CashAppService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\nimport { PaymentAmount } from '../../../types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n private isOneTimePayment(amount: PaymentAmount): boolean {\n return amount?.value > 0;\n }\n\n private isOnFilePayment(): boolean {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(amount: PaymentAmount): Promise<void> {\n try {\n const { referenceId, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.isOneTimePayment(amount) && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.isOnFilePayment() && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","isOneTimePayment","amount","value","isOnFilePayment","this","configuration","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","clientId","cashApp","sdkLoader","load","pay","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","_object_spread","width","shape","startAuthorization","console","warn","subscribeToEvent","eventType","callback","addEventListener","removeEventListener","createCustomerRequest","referenceId","scopeId","redirectURL","window","location","href","customerRequest","actions","payment","onFile","restart","constructor","_define_property"],"mappings":"sfAKe,MAAMA,EAoBTC,gBAAAA,CAAiBC,GACrB,OAAOA,eAAAA,EAAQC,OAAQ,CAC3B,CAEQC,eAAAA,GACJ,OAAOC,KAAKC,cAAcC,kBAC9B,CAEOC,qBAAAA,CAAsBC,GACzBJ,KAAKC,cAAcC,mBAAqBE,CAC5C,CAEA,gBAAaC,GACT,IACI,MAAMC,YAAEA,EAAWC,SAAEA,GAAaP,KAAKC,cACjCO,QAAgBR,KAAKS,UAAUC,KAAKJ,GAC1CN,KAAKW,UAAYH,EAAQG,IAAI,CAAEJ,YACnC,CAAE,MAAOK,GACL,MAAM,IAAIC,EAAmB,QAAS,8BAA+B,CAAEC,MAAOF,GAClF,CACJ,CAEA,kBAAaG,CAAaC,GACtB,IACI,MAAMC,OAAEA,EAAMC,mBAAEA,GAAuBlB,KAAKC,eAEtCkB,MAAEA,SAAgBnB,KAAKW,IAAIS,OAAOJ,EAAQ,CAC5CK,QAAQ,EACRJ,SAAQC,GAAqBI,EAAA,CAAEC,MAAO,OAAQC,MAAO,aAAgBP,KAEzEjB,KAAKyB,mBAAqBN,CAC9B,CAAE,MAAOP,GACL,MAAM,IAAIC,EAAmB,QAAS,oCAAqC,CAAEC,MAAOF,GACxF,CACJ,CAEOO,KAAAA,GACEnB,KAAKyB,mBACLzB,KAAKyB,qBADoBC,QAAQC,KAAK,yCAE/C,CAEOC,gBAAAA,CAAiBC,EAA6BC,GAEjD,OADA9B,KAAKW,IAAIoB,iBAAiBF,EAAWC,GAC9B,KACH9B,KAAKW,IAAIqB,oBAAoBH,EAAWC,GAEhD,CAEA,2BAAaG,CAAsBpC,GAC/B,IACI,MAAMqC,YAAEA,EAAWC,QAAEA,EAAOC,YAAEA,EAAcC,OAAOC,SAASC,MAASvC,KAAKC,cAEpEuC,EAAkB,CACpBN,cACAE,cACAK,QAASnB,EAAA,CAAA,EACDtB,KAAKJ,iBAAiBC,IAAW,CACjC6C,QAAS,CACL7C,SACAsC,YAGJnC,KAAKD,mBAAqB,CAC1B4C,OAAQ,CACJR,oBAKVnC,KAAKW,IAAI6B,gBAAgBA,EACnC,CAAE,MAAO5B,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAagC,SACH5C,KAAKW,IAAIiC,SACnB,CAtFA,WAAAC,CAAYpC,EAA8BR,GAV1C6C,EAAA9C,KAAiBS,oBACjBqC,EAAA9C,KAAiBC,wBAEjB6C,EAAA9C,KAAQW,cAKRmC,EAAA9C,KAAQyB,6BAGJzB,KAAKC,cAAgBA,EACrBD,KAAKS,UAAYA,EAEZR,EAAcM,UACfmB,QAAQC,KAAK,sCAErB"}
1
+ {"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\nimport { PaymentAmount } from '../../../types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n private isOneTimePayment(amount?: PaymentAmount): boolean {\n return (amount?.value ?? 0) > 0;\n }\n\n private isOnFilePayment(): boolean {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(amount?: PaymentAmount): Promise<void> {\n try {\n const { referenceId, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.isOneTimePayment(amount) && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.isOnFilePayment() && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","isOneTimePayment","amount","value","isOnFilePayment","this","configuration","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","clientId","cashApp","sdkLoader","load","pay","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","_object_spread","width","shape","startAuthorization","console","warn","subscribeToEvent","eventType","callback","addEventListener","removeEventListener","createCustomerRequest","referenceId","scopeId","redirectURL","window","location","href","customerRequest","actions","payment","onFile","restart","constructor","_define_property"],"mappings":"sfAKe,MAAMA,EAoBTC,gBAAAA,CAAiBC,SACrB,iBAAQA,aAAAA,EAAAA,EAAQC,qBAAS,GAAK,CAClC,CAEQC,eAAAA,GACJ,OAAOC,KAAKC,cAAcC,kBAC9B,CAEOC,qBAAAA,CAAsBC,GACzBJ,KAAKC,cAAcC,mBAAqBE,CAC5C,CAEA,gBAAaC,GACT,IACI,MAAMC,YAAEA,EAAWC,SAAEA,GAAaP,KAAKC,cACjCO,QAAgBR,KAAKS,UAAUC,KAAKJ,GAC1CN,KAAKW,UAAYH,EAAQG,IAAI,CAAEJ,YACnC,CAAE,MAAOK,GACL,MAAM,IAAIC,EAAmB,QAAS,8BAA+B,CAAEC,MAAOF,GAClF,CACJ,CAEA,kBAAaG,CAAaC,GACtB,IACI,MAAMC,OAAEA,EAAMC,mBAAEA,GAAuBlB,KAAKC,eAEtCkB,MAAEA,SAAgBnB,KAAKW,IAAIS,OAAOJ,EAAQ,CAC5CK,QAAQ,EACRJ,SAAQC,GAAqBI,EAAA,CAAEC,MAAO,OAAQC,MAAO,aAAgBP,KAEzEjB,KAAKyB,mBAAqBN,CAC9B,CAAE,MAAOP,GACL,MAAM,IAAIC,EAAmB,QAAS,oCAAqC,CAAEC,MAAOF,GACxF,CACJ,CAEOO,KAAAA,GACEnB,KAAKyB,mBACLzB,KAAKyB,qBADoBC,QAAQC,KAAK,yCAE/C,CAEOC,gBAAAA,CAAiBC,EAA6BC,GAEjD,OADA9B,KAAKW,IAAIoB,iBAAiBF,EAAWC,GAC9B,KACH9B,KAAKW,IAAIqB,oBAAoBH,EAAWC,GAEhD,CAEA,2BAAaG,CAAsBpC,GAC/B,IACI,MAAMqC,YAAEA,EAAWC,QAAEA,EAAOC,YAAEA,EAAcC,OAAOC,SAASC,MAASvC,KAAKC,cAEpEuC,EAAkB,CACpBN,cACAE,cACAK,QAASnB,EAAA,CAAA,EACDtB,KAAKJ,iBAAiBC,IAAW,CACjC6C,QAAS,CACL7C,SACAsC,YAGJnC,KAAKD,mBAAqB,CAC1B4C,OAAQ,CACJR,oBAKVnC,KAAKW,IAAI6B,gBAAgBA,EACnC,CAAE,MAAO5B,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAagC,SACH5C,KAAKW,IAAIiC,SACnB,CAtFA,WAAAC,CAAYpC,EAA8BR,GAV1C6C,EAAA9C,KAAiBS,oBACjBqC,EAAA9C,KAAiBC,wBAEjB6C,EAAA9C,KAAQW,cAKRmC,EAAA9C,KAAQyB,6BAGJzB,KAAKC,cAAgBA,EACrBD,KAAKS,UAAYA,EAEZR,EAAcM,UACfmB,QAAQC,KAAK,sCAErB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types';\n\nexport interface ICashAppWindowObject {\n pay({ clientId }: { clientId: string }): Promise<ICashAppSDK>;\n}\n\n/**\n * @link https://developers.cash.app/cash-app-pay-partner-api/guides/pay-kit-sdk/pay-kit-web-overview/technical-reference\n */\nexport interface ICashAppSDK {\n render(target: string | HTMLElement, options?: unknown): Promise<{ begin?: () => void }>;\n addEventListener(eventType: CashAppPayEvents, callback: Function): void;\n removeEventListener(eventType: CashAppPayEvents, callback: Function): void;\n customerRequest(customerRequest: unknown): Promise<void>;\n restart(): Promise<void>;\n}\n\nexport enum CashAppPayEvents {\n CustomerDismissed = 'CUSTOMER_DISMISSED',\n CustomerRequestApproved = 'CUSTOMER_REQUEST_APPROVED',\n CustomerRequestDeclined = 'CUSTOMER_REQUEST_DECLINED',\n CustomerRequestFailed = 'CUSTOMER_REQUEST_FAILED'\n}\n\nexport interface ICashAppService {\n begin(): void;\n initialize(): Promise<void>;\n setStorePaymentMethod(store: boolean): void;\n renderButton(target: HTMLElement): Promise<void>;\n restart(): Promise<void>;\n createCustomerRequest(amount: PaymentAmount): Promise<void>;\n subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function;\n}\n\nexport type CashAppServiceConfig = {\n useCashAppButtonUi: boolean;\n storePaymentMethod: boolean;\n environment: string;\n clientId: string;\n scopeId: string;\n referenceId?: string;\n redirectURL?: string;\n button?: {\n shape?: 'semiround' | 'round';\n size?: 'medium' | 'small';\n theme?: 'dark' | 'light';\n width?: 'static' | 'full';\n };\n};\n"],"names":["CashAppPayEvents"],"mappings":"AAiBO,IAAAA,EAAKA,SAAAA,GAAAA,8MAAAA,CAKX,CALWA,CAKX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types';\n\nexport interface ICashAppWindowObject {\n pay({ clientId }: { clientId: string }): Promise<ICashAppSDK>;\n}\n\n/**\n * @link https://developers.cash.app/cash-app-pay-partner-api/guides/pay-kit-sdk/pay-kit-web-overview/technical-reference\n */\nexport interface ICashAppSDK {\n render(target: string | HTMLElement, options?: unknown): Promise<{ begin?: () => void }>;\n addEventListener(eventType: CashAppPayEvents, callback: Function): void;\n removeEventListener(eventType: CashAppPayEvents, callback: Function): void;\n customerRequest(customerRequest: unknown): Promise<void>;\n restart(): Promise<void>;\n}\n\nexport enum CashAppPayEvents {\n CustomerDismissed = 'CUSTOMER_DISMISSED',\n CustomerRequestApproved = 'CUSTOMER_REQUEST_APPROVED',\n CustomerRequestDeclined = 'CUSTOMER_REQUEST_DECLINED',\n CustomerRequestFailed = 'CUSTOMER_REQUEST_FAILED'\n}\n\nexport interface ICashAppService {\n begin(): void;\n initialize(): Promise<void>;\n setStorePaymentMethod(store: boolean): void;\n renderButton(target: HTMLElement): Promise<void>;\n restart(): Promise<void>;\n createCustomerRequest(amount?: PaymentAmount): Promise<void>;\n subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function;\n}\n\nexport type CashAppServiceConfig = {\n useCashAppButtonUi: boolean;\n storePaymentMethod: boolean;\n environment: string;\n clientId: string;\n scopeId: string;\n referenceId?: string;\n redirectURL?: string;\n button?: {\n shape?: 'semiround' | 'round';\n size?: 'medium' | 'small';\n theme?: 'dark' | 'light';\n width?: 'static' | 'full';\n };\n};\n"],"names":["CashAppPayEvents"],"mappings":"AAiBO,IAAAA,EAAKA,SAAAA,GAAAA,8MAAAA,CAKX,CALWA,CAKX,CAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import n from"./CustomCardInput/CustomCardInput.js";import o from"../../utils/browserInfo.js";import{triggerBinLookUp as r}from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as s,fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{TxVariants as a}from"../tx-variants.js";import{AnalyticsInfoEvent as u,InfoEventType as d}from"../../core/Analytics/events/AnalyticsInfoEvent.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as l}from"../Card/constants.js";function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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){p(e,t,n[t])})}return e}function m(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}class h extends t{formatProps(e){return m(c({},e),{type:a.customCard})}formatData(){const e=this.state.selectedBrandValue;return{paymentMethod:c({type:"scheme"},this.state.data,e&&{brand:e}),browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.updateStyles)&&this.componentRef.updateStyles(e),this}setFocusOn(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.setFocusOn)&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.processBinLookupResponse)&&this.componentRef.processBinLookupResponse(e),this}dualBrandingChangeHandler(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.dualBrandingChangeHandler)&&this.componentRef.dualBrandingChangeHandler(e),this}handleUnsupportedCard(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.handleUnsupportedCard)&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){const t=c({},e);if(t.rootNode=this._node,!t.isReset){var n,o;t.supportedBrandsRaw=null===(n=e.supportedBrandsRaw)||void 0===n?void 0:n.map(e=>{var t,n;return e.brandImageUrl=null!==(t=null===(n=this.props.brandsConfiguration[e.brand])||void 0===n?void 0:n.icon)&&void 0!==t?t:s(e.brand,this.resources),e});let r=!1,i=!1;(null===(o=e.supportedBrandsRaw)||void 0===o?void 0:o.length)>1&&(r=!0,i=e.detectedBrands.some(e=>l.includes(e))),t.dualBrandingType=null,r&&(t.dualBrandingType=i?"Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism":"Dual Branded (Display-only): No selection mechanism required")}this.props.onBinLookup(t)}get isValid(){return!!this.state.isValid}get browserInfo(){return o()}componentToRender(){return e(n,m(c({ref:e=>{this.componentRef=e}},this.props,this.state),{handleKeyDown:this.handleKeyDown,rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.brand,onFocus:this.onFocus,onSubmitAnalytics:this.submitAnalytics}))}constructor(...e){super(...e),p(this,"brand",a.card),p(this,"onBinValue",r(this)),p(this,"onFocus",e=>{var t,n;const o=new u({component:this.type,type:!0===e.focus?d.focus:d.unfocus,target:i(e.fieldType)});this.submitAnalytics(o),null===(t=(n=this.props).onFocus)||void 0===t||t.call(n,e)}),p(this,"onEnterKeyPressed",(e,t)=>{var n,o;null===(n=(o=this.props).onEnterKeyPressed)||void 0===n||n.call(o,e,t)})}}p(h,"type",a.customCard),p(h,"defaultProps",{onBinLookup:()=>{},brandsConfiguration:{}});export{h as CustomCard,h as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import n from"./CustomCardInput/CustomCardInput.js";import o from"../../utils/browserInfo.js";import{triggerBinLookUp as r}from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as s,fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{TxVariants as a}from"../tx-variants.js";import{AnalyticsInfoEvent as u,InfoEventType as d}from"../../core/Analytics/events/AnalyticsInfoEvent.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as l}from"../Card/constants.js";function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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){p(e,t,n[t])})}return e}function m(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}class h extends t{formatProps(e){return m(c({},e),{type:a.customCard})}formatData(){const e=this.state.selectedBrandValue;return{paymentMethod:c({type:"scheme"},this.state.data,e&&{brand:e}),browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.updateStyles)&&this.componentRef.updateStyles(e),this}setFocusOn(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.setFocusOn)&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.processBinLookupResponse)&&this.componentRef.processBinLookupResponse(e),this}dualBrandingChangeHandler(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.dualBrandingChangeHandler)&&this.componentRef.dualBrandingChangeHandler(e),this}handleUnsupportedCard(e){var t;return(null===(t=this.componentRef)||void 0===t?void 0:t.handleUnsupportedCard)&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){var t;const n=c({},e);if(n.rootNode=null!==(t=this._node)&&void 0!==t?t:void 0,!n.isReset){var o,r;n.supportedBrandsRaw=null===(o=e.supportedBrandsRaw)||void 0===o?void 0:o.map(e=>{var t,n;return e.brandImageUrl=null!==(t=null===(n=this.props.brandsConfiguration[e.brand])||void 0===n?void 0:n.icon)&&void 0!==t?t:s(e.brand,this.resources),e});let t=!1,i=!1;(null===(r=e.supportedBrandsRaw)||void 0===r?void 0:r.length)>1&&(t=!0,i=e.detectedBrands.some(e=>l.includes(e))),n.dualBrandingType=null,t&&(n.dualBrandingType=i?"Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism":"Dual Branded (Display-only): No selection mechanism required")}this.props.onBinLookup(n)}get isValid(){return!!this.state.isValid}get browserInfo(){return o()}componentToRender(){var t;return e(n,m(c({ref:e=>{this.componentRef=e}},this.props,this.state),{handleKeyDown:this.handleKeyDown,rootNode:null!==(t=this._node)&&void 0!==t?t:void 0,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.brand,onFocus:this.onFocus,onSubmitAnalytics:this.submitAnalytics}))}constructor(...e){super(...e),p(this,"brand",a.card),p(this,"onBinValue",r(this)),p(this,"onFocus",e=>{var t,n;const o=new u({component:this.type,type:!0===e.focus?d.focus:d.unfocus,target:i(e.fieldType)});this.submitAnalytics(o),null===(t=(n=this.props).onFocus)||void 0===t||t.call(n,e)}),p(this,"onEnterKeyPressed",(e,t)=>{var n,o;null===(n=(o=this.props).onEnterKeyPressed)||void 0===n||n.call(o,e,t)})}}p(h,"type",a.customCard),p(h,"defaultProps",{onBinLookup:()=>{},brandsConfiguration:{}});export{h as CustomCard,h as default};
2
2
  //# sourceMappingURL=CustomCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../Card/constants';\nimport type { CustomCardInputRef } from './CustomCardInput';\n\nconst SELECTABLE_DUAL_BRANDED_SCENARIO = 'Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism';\nconst DISPLAY_ONLY_DUAL_BRANDED_SCENARIO = 'Dual Branded (Display-only): No selection mechanism required';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static readonly type = TxVariants.customCard;\n\n declare protected componentRef: CustomCardInputRef | undefined;\n\n protected static readonly defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private readonly brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n const securedFieldsData = this.state.data as Record<string, string>;\n return {\n paymentMethod: {\n type: 'scheme',\n ...securedFieldsData,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CardBinLookupData) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n\n // Check for dual branded scenario and, if so, discern which type\n let isDualBrandedScenario = false;\n let isSelectableDualBrandedScenario = false;\n\n if (obj.supportedBrandsRaw?.length > 1) {\n isDualBrandedScenario = true;\n isSelectableDualBrandedScenario = obj.detectedBrands.some(item =>\n (DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as readonly string[]).includes(item)\n );\n }\n\n // Set the dual branding type\n nuObj.dualBrandingType = null;\n\n if (isDualBrandedScenario) {\n nuObj.dualBrandingType = isSelectableDualBrandedScenario ? SELECTABLE_DUAL_BRANDED_SCENARIO : DISPLAY_ONLY_DUAL_BRANDED_SCENARIO;\n }\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private readonly onFocus = (obj: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyDown={this.handleKeyDown}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","_object_spread_props","_object_spread","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","_this_componentRef","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","_this_props_brandsConfiguration_item_brand","brandImageUrl","brandsConfiguration","icon","_ref","getCardImageUrl","resources","isDualBrandedScenario","isSelectableDualBrandedScenario","length","detectedBrands","some","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","includes","dualBrandingType","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyDown","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","_this_props_onFocus","_this_props","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","call","onEnterKeyPressed","activeElement","_this_props_onEnterKeyPressed","defaultProps"],"mappings":"+6CAiBO,MAAMA,UAAmBC,EAY5BC,WAAAA,CAAYC,GACR,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,KAAMC,EAAWC,YAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAE3B,MAAO,CACHC,cAAeT,EAAA,CACXC,KAAM,UAHYK,KAAKC,MAAMG,KAKzBL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA,CAAaC,GACL,IAAAC,EACJ,eADIA,EAAAZ,KAAKa,oBAAL,IAAAD,OAAA,EAAAA,EAAmBF,eAAcV,KAAKa,aAAaH,aAAaC,GAC7DX,IACX,CAEAc,UAAAA,CAAWC,GACH,IAAAH,EACJ,eADIA,EAAAZ,KAAKa,oBAAL,IAAAD,OAAA,EAAAA,EAAmBE,aAAYd,KAAKa,aAAaC,WAAWC,GACzDf,IACX,CAEAgB,wBAAAA,CAAyBC,GACjB,IAAAL,EACJ,eADIA,EAAAZ,KAAKa,o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A,CACGC,IAAKA,IACDnD,KAAKa,aAAesC,IAEpBnD,KAAKR,MACLQ,KAAKC,OAAK,CACdmD,cAAepD,KAAKoD,cACpB3B,SAAUzB,KAAK0B,MACf2B,SAAUrD,KAAKsD,SACfC,WAAYvD,KAAKuD,WACjBC,mBAAoB,SACpBnB,UAAWrC,KAAKqC,UAChBhC,MAAOL,KAAKK,MACZoD,QAASzD,KAAKyD,QACdC,kBAAmB1D,KAAK2D,kBAGpC,mBA5IGC,SAAAC,GAUHC,EAAA9D,KAAiBK,QAAQT,EAAWmE,MAoFpCD,EAAA9D,KAAOuD,aAAaS,EAAiBhE,OAUrC8D,EAAA9D,KAAiByD,UAAWlC,QAUxB0C,EAAAC,EATA,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,UAAWrE,KAAKL,KAChBA,MAAoB,IAAd4B,EAAI+C,MAAiBC,EAAcD,MAAQC,EAAcC,QAC/DC,OAAQC,EAAqBnD,EAAIoD,aAGrC3E,KAAK2D,gBAAgBQ,GAGH,QAAlBF,GAAAC,EAAAlE,KAAKR,OAAMiE,eAAX,IAAAQ,GAAAA,EAAAW,KAAAV,EAAqB3C,KAGzBuC,EAAA9D,KAAU6E,oBAAoB,CAACC,EAAwBT,SACnDU,EAAAb,EAA4B,QAA5Ba,GAAAb,EAAAlE,KAAKR,OAAMqF,yBAAX,IAAAE,GAAAA,EAAAH,KAAAV,EAA+BY,EAAeT,MArHlDP,EADSzE,EACcM,OAAOC,EAAWC,YAIzCiE,EALSzE,EAKiB2F,eAAe,CACrC1D,YAAa,OACbW,oBAAqB,CAAA"}
1
+ {"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../Card/constants';\nimport type { CustomCardInputRef } from './CustomCardInput';\n\nconst SELECTABLE_DUAL_BRANDED_SCENARIO = 'Dual Branded (Selectable): Regulation mandates that you must provide a brand selection mechanism';\nconst DISPLAY_ONLY_DUAL_BRANDED_SCENARIO = 'Dual Branded (Display-only): No selection mechanism required';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static readonly type = TxVariants.customCard;\n\n declare protected componentRef: CustomCardInputRef | undefined;\n\n protected static readonly defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private readonly brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n const securedFieldsData = this.state.data as Record<string, string>;\n return {\n paymentMethod: {\n type: 'scheme',\n ...securedFieldsData,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CardBinLookupData) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node ?? undefined;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n\n // Check for dual branded scenario and, if so, discern which type\n let isDualBrandedScenario = false;\n let isSelectableDualBrandedScenario = false;\n\n if (obj.supportedBrandsRaw?.length > 1) {\n isDualBrandedScenario = true;\n isSelectableDualBrandedScenario = obj.detectedBrands.some(item =>\n (DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as readonly string[]).includes(item)\n );\n }\n\n // Set the dual branding type\n nuObj.dualBrandingType = null;\n\n if (isDualBrandedScenario) {\n nuObj.dualBrandingType = isSelectableDualBrandedScenario ? SELECTABLE_DUAL_BRANDED_SCENARIO : DISPLAY_ONLY_DUAL_BRANDED_SCENARIO;\n }\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private readonly onFocus = (obj: CardFocusData) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: obj.focus === true ? InfoEventType.focus : InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyDown={this.handleKeyDown}\n rootNode={this._node ?? undefined}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","_object_spread_props","_object_spread","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","updateStyles","stylesObj","_this_componentRef","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","_this__node","nuObj","rootNode","_node","undefined","isReset","supportedBrandsRaw","map","item","_this_props_brandsConfiguration_item_brand","brandImageUrl","brandsConfiguration","icon","_ref","getCardImageUrl","resources","isDualBrandedScenario","isSelectableDualBrandedScenario","length","detectedBrands","some","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","includes","dualBrandingType","isValid","collectBrowserInfo","componentToRender","h","CustomCardInput","ref","handleKeyDown","onChange","setState","onBinValue","implementationType","onFocus","onSubmitAnalytics","submitAnalytics","super","args","_define_property","card","triggerBinLookUp","_this_props_onFocus","_this_props","event","AnalyticsInfoEvent","component","focus","InfoEventType","unfocus","target","fieldTypeToSnakeCase","fieldType","call","onEnterKeyPressed","activeElement","_this_props_onEnterKeyPressed","defaultProps"],"mappings":"+6CAiBO,MAAMA,UAAmBC,EAY5BC,WAAAA,CAAYC,GACR,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,KAAMC,EAAWC,YAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAE3B,MAAO,CACHC,cAAeT,EAAA,CACXC,KAAM,UAHYK,KAAKC,MAAMG,KAKzBL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEAG,YAAAA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b,EAAApE,KAAKR,OAAMuF,yBAAX,IAAAE,GAAAA,EAAAH,KAAAV,EAA+BY,EAAeT,MArHlDP,EADS3E,EACcM,OAAOC,EAAWC,YAIzCmE,EALS3E,EAKiB6F,eAAe,CACrC5D,YAAa,OACba,oBAAqB,CAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../../internal/Voucher/Voucher.js";import t from"../../../../utils/get-issuer-image.js";import{useCoreContext as o}from"../../../../core/Context/CoreProvider.js";import n from"../../../../core/Context/useImage.js";import{extractCommonPropsForVoucher as i}from"../../../internal/Voucher/utils.js";function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(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 u(u){const{surcharge:s,expiresAt:l,alternativeReference:p,instructionsUrl:f,icon:m,issuer:b,paymentMethodType:y}=u,{i18n:g}=o(),O=n(),j="dragonpay_otc_philippines"!==y?t({},y,O)(b.toLowerCase()):null;return e(r,a(function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){c(e,r,t[r])})}return e}({},i({props:u,i18n:g,introKey:"voucher.introduction",getImage:O()})),{imageUrl:m,issuerImageUrl:j,instructionsUrl:f,surcharge:s&&g.amount(s.value,s.currency),voucherDetails:[{label:g.get("voucher.expirationDate"),value:g.dateTime(l)},{label:g.get("voucher.alternativeReference"),value:p}],copyBtn:!0}))}export{u as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../../internal/Voucher/Voucher.js";import t from"../../../../utils/get-issuer-image.js";import{useCoreContext as o}from"../../../../core/Context/CoreProvider.js";import n from"../../../../core/Context/useImage.js";import{extractCommonPropsForVoucher as i}from"../../../internal/Voucher/utils.js";function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(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 u(u){const{surcharge:s,expiresAt:p,alternativeReference:l,instructionsUrl:f,icon:m,issuer:b,paymentMethodType:y}=u,{i18n:g}=o(),O=n(),j="dragonpay_otc_philippines"!==y?t({},y,O)(b.toLowerCase()):void 0;return e(r,a(function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){c(e,r,t[r])})}return e}({},i({props:u,i18n:g,introKey:"voucher.introduction",getImage:O()})),{imageUrl:m,issuerImageUrl:j,instructionsUrl:f,surcharge:s&&g.amount(s.value,s.currency),voucherDetails:[{label:g.get("voucher.expirationDate"),value:g.dateTime(p)},{label:g.get("voucher.alternativeReference"),value:l}],copyBtn:!0}))}export{u as default};
2
2
  //# sourceMappingURL=DragonpayVoucherResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragonpayVoucherResult.js","sources":["../../../../../../src/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Voucher from '../../../internal/Voucher';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { DragonpayVoucherResultProps } from '../../types';\nimport { VoucherDetail } from '../../../internal/Voucher/types';\nimport useImage from '../../../../core/Context/useImage';\nimport { extractCommonPropsForVoucher } from '../../../internal/Voucher/utils';\n\nexport default function DragonpayVoucherResult(props: Readonly<DragonpayVoucherResultProps>) {\n const { surcharge, expiresAt, alternativeReference, instructionsUrl, icon, issuer, paymentMethodType } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const issuerImageUrl =\n paymentMethodType !== 'dragonpay_otc_philippines' ? getIssuerImageUrl({}, paymentMethodType, getImage)(issuer.toLowerCase()) : null;\n\n return (\n <Voucher\n {...extractCommonPropsForVoucher({ props, i18n, introKey: 'voucher.introduction', getImage: getImage() })}\n imageUrl={icon} // Can this url be different to the one generated by using the paymentMethodType?\n issuerImageUrl={issuerImageUrl}\n instructionsUrl={instructionsUrl}\n surcharge={surcharge && i18n.amount(surcharge.value, surcharge.currency)}\n voucherDetails={\n [\n { label: i18n.get('voucher.expirationDate'), value: i18n.dateTime(expiresAt) },\n { label: i18n.get('voucher.alternativeReference'), value: alternativeReference }\n ] as VoucherDetail[]\n }\n copyBtn\n />\n );\n}\n"],"names":["DragonpayVoucherResult","props","surcharge","expiresAt","alternativeReference","instructionsUrl","icon","issuer","paymentMethodType","i18n","useCoreContext","getImage","useImage","issuerImageUrl","getIssuerImageUrl","toLowerCase","h","Voucher","extractCommonPropsForVoucher","introKey","imageUrl","amount","value","currency","voucherDetails","label","get","dateTime","copyBtn"],"mappings":"y2BASe,SAASA,EAAuBC,GAC3C,MAAMC,UAAEA,EAASC,UAAEA,EAASC,qBAAEA,EAAoBC,gBAAEA,EAAeC,KAAEA,EAAIC,OAAEA,EAAMC,kBAAEA,GAAsBP,GACnGQ,KAAEA,GAASC,IACXC,EAAWC,IACXC,EACoB,8BAAtBL,EAAoDM,EAAkB,CAAA,EAAIN,EAAmBG,EAAzCG,CAAmDP,EAAOQ,eAAiB,KAEnI,OACIC,EAACC,0UACOC,EAA6B,CAAEjB,QAAOQ,OAAMU,SAAU,uBAAwBR,SAAUA,OAAW,CACvGS,SAAUd,EACVO,eAAgBA,EAChBR,gBAAiBA,EACjBH,UAAWA,GAAaO,EAAKY,OAAOnB,EAAUoB,MAAOpB,EAAUqB,UAC/DC,eACI,CACI,CAAEC,MAAOhB,EAAKiB,IAAI,0BAA2BJ,MAAOb,EAAKkB,SAASxB,IAClE,CAAEsB,MAAOhB,EAAKiB,IAAI,gCAAiCJ,MAAOlB,IAGlEwB,SAAAA,IAGZ"}
1
+ {"version":3,"file":"DragonpayVoucherResult.js","sources":["../../../../../../src/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Voucher from '../../../internal/Voucher';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { DragonpayVoucherResultProps } from '../../types';\nimport { VoucherDetail } from '../../../internal/Voucher/types';\nimport useImage from '../../../../core/Context/useImage';\nimport { extractCommonPropsForVoucher } from '../../../internal/Voucher/utils';\n\nexport default function DragonpayVoucherResult(props: Readonly<DragonpayVoucherResultProps>) {\n const { surcharge, expiresAt, alternativeReference, instructionsUrl, icon, issuer, paymentMethodType } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const issuerImageUrl =\n paymentMethodType !== 'dragonpay_otc_philippines' ? getIssuerImageUrl({}, paymentMethodType, getImage)(issuer.toLowerCase()) : undefined;\n\n return (\n <Voucher\n {...extractCommonPropsForVoucher({ props, i18n, introKey: 'voucher.introduction', getImage: getImage() })}\n imageUrl={icon} // Can this url be different to the one generated by using the paymentMethodType?\n issuerImageUrl={issuerImageUrl}\n instructionsUrl={instructionsUrl}\n surcharge={surcharge && i18n.amount(surcharge.value, surcharge.currency)}\n voucherDetails={\n [\n { label: i18n.get('voucher.expirationDate'), value: i18n.dateTime(expiresAt) },\n { label: i18n.get('voucher.alternativeReference'), value: alternativeReference }\n ] as VoucherDetail[]\n }\n copyBtn\n />\n );\n}\n"],"names":["DragonpayVoucherResult","props","surcharge","expiresAt","alternativeReference","instructionsUrl","icon","issuer","paymentMethodType","i18n","useCoreContext","getImage","useImage","issuerImageUrl","getIssuerImageUrl","toLowerCase","undefined","h","Voucher","extractCommonPropsForVoucher","introKey","imageUrl","amount","value","currency","voucherDetails","label","get","dateTime","copyBtn"],"mappings":"y2BASe,SAASA,EAAuBC,GAC3C,MAAMC,UAAEA,EAASC,UAAEA,EAASC,qBAAEA,EAAoBC,gBAAEA,EAAeC,KAAEA,EAAIC,OAAEA,EAAMC,kBAAEA,GAAsBP,GACnGQ,KAAEA,GAASC,IACXC,EAAWC,IACXC,EACoB,8BAAtBL,EAAoDM,EAAkB,CAAA,EAAIN,EAAmBG,EAAzCG,CAAmDP,EAAOQ,oBAAiBC,EAEnI,OACIC,EAACC,0UACOC,EAA6B,CAAElB,QAAOQ,OAAMW,SAAU,uBAAwBT,SAAUA,OAAW,CACvGU,SAAUf,EACVO,eAAgBA,EAChBR,gBAAiBA,EACjBH,UAAWA,GAAaO,EAAKa,OAAOpB,EAAUqB,MAAOrB,EAAUsB,UAC/DC,eACI,CACI,CAAEC,MAAOjB,EAAKkB,IAAI,0BAA2BJ,MAAOd,EAAKmB,SAASzB,IAClE,CAAEuB,MAAOjB,EAAKkB,IAAI,gCAAiCJ,MAAOnB,IAGlEyB,SAAAA,IAGZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"GooglePay.js","sources":["../../../../src/components/GooglePay/GooglePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GooglePayService from './GooglePayService';\nimport GooglePayButton from './components/GooglePayButton';\nimport defaultProps from './defaultProps';\nimport { formatGooglePayContactToAdyenAddressFormat, getGooglePayLocale } from './utils';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\n\nimport type { AddressData, BrowserInfo, RawPaymentMethod, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { mapGooglePayBrands } from './utils/map-adyen-brands-to-googlepay-brands';\n\nconst DEFAULT_ALLOWED_CARD_NETWORKS: google.payments.api.CardNetwork[] = ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'];\n\nclass GooglePay extends UIElement<GooglePayConfiguration> {\n public static readonly type = TxVariants.googlepay;\n public static readonly txVariants = [TxVariants.googlepay, TxVariants.paywithgoogle];\n public static readonly defaultProps = defaultProps;\n\n protected readonly googlePay;\n\n constructor(checkout: ICore, props?: GooglePayConfiguration) {\n super(checkout, props);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.showGooglePayPaymentSheet = this.showGooglePayPaymentSheet.bind(this);\n\n const { isExpress, paymentDataCallbacks } = this.props;\n\n if (isExpress === false && paymentDataCallbacks?.onPaymentDataChanged) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - You must set \"isExpress\" flag to \"true\" in order to use \"onPaymentDataChanged\" callback'\n );\n }\n\n if (!this.props.configuration.merchantId) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - Missing merchantId. Please ensure that it is correctly configured in your customer area.'\n );\n }\n\n this.googlePay = new GooglePayService(\n this.props.environment,\n this.analytics,\n {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n },\n this.props.nonce\n );\n }\n\n /**\n * Google Pay requires custom logic due to supporting two Tx variants that lead to the same payment method.\n * If the merchant creates a standalone Google Pay component, we need to verify if the payment method is available using both tx variants\n *\n * @param type\n * @param paymentMethodId - Unique internal payment method ID\n * @returns\n */\n protected override getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n\n return (\n this.core.paymentMethodsResponse.find(type || this.constructor['type']) || this.core.paymentMethodsResponse.find(TxVariants.paywithgoogle)\n );\n }\n\n protected override formatProps(props: GooglePayConfiguration): GooglePayConfiguration {\n const buttonSizeMode = props.buttonSizeMode ?? (props.isDropin ? 'fill' : 'static');\n const buttonLocale = getGooglePayLocale(props.buttonLocale ?? props.i18n?.locale);\n\n const callbackIntents: google.payments.api.CallbackIntent[] = [...props.callbackIntents, 'PAYMENT_AUTHORIZATION'];\n\n const allowedCardNetworks = this.createAllowedCardNetworksValues({\n allowedCardNetworks: props.allowedCardNetworks,\n brands: props.brands\n });\n\n return {\n ...props,\n allowedCardNetworks,\n configuration: props.configuration,\n buttonSizeMode,\n buttonLocale,\n callbackIntents\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData() {\n const { googlePayCardNetwork, googlePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: this.type,\n googlePayCardNetwork,\n googlePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n /**\n * Generate the 'allowedCardNetworks' value used by Google Pay\n *\n * If the 'allowedCardNetworks' is defined in the Component configuration, it will be used. Otherwise we fallback\n * to use the 'brands' returned by the backoffice. It can be that 'brands' is not returned, which in this case we\n * set default values\n *\n * @param {object} brandsConfig\n * @param brandsConfig.allowedCardNetworks - Brands set in the component config\n * @param brandsConfig.brands - Brands returned by backend\n * @private\n */\n private createAllowedCardNetworksValues({\n allowedCardNetworks,\n brands\n }: {\n allowedCardNetworks?: google.payments.api.CardNetwork[];\n brands?: string[];\n }): google.payments.api.CardNetwork[] {\n if (allowedCardNetworks?.length > 0) return allowedCardNetworks;\n if (brands?.length > 0) return mapGooglePayBrands(brands);\n\n return DEFAULT_ALLOWED_CARD_NETWORKS;\n }\n\n protected override beforeRender(configSetByMerchant?: GooglePayConfiguration) {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\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 /**\n * Displays the Google Pay payment sheet overlay\n */\n private showGooglePayPaymentSheet() {\n this.googlePay.initiatePayment(this.props, this.core.options.countryCode).catch((error: google.payments.api.PaymentsError) => {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n this.handleError(new AdyenCheckoutError(error.statusCode === 'CANCELED' ? 'CANCEL' : 'ERROR', error.toString(), { cause: error }));\n });\n }\n\n public override submit = () => {\n if (this.props.isInstantPayment) {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.selected,\n target: UiTarget.instantPaymentButton\n });\n\n this.submitAnalytics(event);\n }\n\n new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject)).then(this.showGooglePayPaymentSheet).catch(() => {\n // Swallow exception triggered by onClick reject\n });\n };\n\n /**\n * Method called when the payment is authorized in the payment sheet\n *\n * @see https://developers.google.com/pay/api/web/reference/client#onPaymentAuthorized\n **/\n private onPaymentAuthorized = async (paymentData: google.payments.api.PaymentData): Promise<google.payments.api.PaymentAuthorizationResult> => {\n const billingAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.paymentMethodData.info.billingAddress);\n const deliveryAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.shippingAddress, true);\n\n this.setState({\n authorizedEvent: paymentData,\n googlePayToken: paymentData.paymentMethodData.tokenizationData.token,\n googlePayCardNetwork: paymentData.paymentMethodData.info.cardNetwork,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<google.payments.api.PaymentAuthorizationResult>(resolve => {\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((paymentResponse: PaymentResponseData) => {\n resolve({ transactionState: 'SUCCESS' });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n this.setElementStatus('ready');\n\n const googlePayError = paymentResponse?.error?.googlePayError;\n const fallbackMessage = this.props.i18n.get('error.subtitle.payment');\n\n const error: google.payments.api.PaymentDataError =\n typeof googlePayError === 'string' || undefined\n ? {\n intent: 'PAYMENT_AUTHORIZATION',\n reason: 'OTHER_ERROR',\n message: (googlePayError as string) || fallbackMessage\n }\n : {\n intent: googlePayError?.intent || 'PAYMENT_AUTHORIZATION',\n reason: googlePayError?.reason || 'OTHER_ERROR',\n message: googlePayError?.message || fallbackMessage\n };\n\n resolve({\n transactionState: 'ERROR',\n error\n });\n\n const responseWithError = {\n ...paymentResponse,\n error: {\n googlePayError: error\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\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 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?: google.payments.api.PaymentDataError | string) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { googlePayError: error } };\n return Promise.reject(data);\n });\n }\n\n public get isValid(): boolean {\n return true;\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public override async isAvailable(): Promise<void> {\n return this.isReadyToPay()\n .then(response => {\n if (!response.result) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay is not available');\n }\n\n if (response.paymentMethodPresent === false) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay - No paymentMethodPresent');\n }\n\n return Promise.resolve();\n })\n .catch(error => {\n return Promise.reject(error);\n });\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public isReadyToPay = (): Promise<google.payments.api.IsReadyToPayResponse> => {\n return this.googlePay.isReadyToPay(this.props);\n };\n\n /**\n * Use this method to prefetch a PaymentDataRequest configuration to improve loadPaymentData execution time on later user interaction. No value is returned.\n */\n public prefetch = (): void => {\n return this.googlePay.prefetchPaymentData(this.props, this.core.options.countryCode);\n };\n\n get browserInfo(): BrowserInfo {\n return collectBrowserInfo();\n }\n\n get icon(): string {\n return this.props.icon ?? this.resources.getImage()('googlepay');\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.showPayButton) {\n return (\n <GooglePayButton\n buttonColor={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonSizeMode={this.props.buttonSizeMode}\n buttonLocale={this.props.buttonLocale}\n buttonRootNode={this.props.buttonRootNode}\n buttonRadius={this.props.buttonRadius}\n paymentsClient={this.googlePay.paymentsClient}\n onClick={this.submit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default GooglePay;\n"],"names":["DEFAULT_ALLOWED_CARD_NETWORKS","GooglePay","UIElement","getPaymentMethodFromPaymentMethodsResponse","type","paymentMethodId","this","core","paymentMethodsResponse","findById","find","constructor","TxVariants","paywithgoogle","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","allowedCardNetworks","createAllowedCardNetworksValues","brands","_object_spread_props","_object_spread","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","state","isExpress","paymentMethod","subtype","browserInfo","origin","window","location","length","mapGooglePayBrands","beforeRender","configSetByMerchant","originalAction","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","showGooglePayPaymentSheet","googlePay","initiatePayment","options","countryCode","catch","error","handleError","AdyenCheckoutError","statusCode","toString","cause","handleAuthorization","Promise","resolve","reject","onAuthorized","authorizedEvent","data","googlePayError","isValid","isAvailable","isReadyToPay","then","response","result","paymentMethodPresent","collectBrowserInfo","icon","_this_props_icon","resources","getImage","componentToRender","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","onClick","submit","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","onPaymentAuthorized","async","paymentData","formatGooglePayContactToAdyenAddressFormat","paymentMethodData","info","shippingAddress","setState","tokenizationData","token","cardNetwork","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","paymentResponse","transactionState","handleResponse","setElementStatus","fallbackMessage","get","intent","reason","message","responseWithError","handleFailedResult","prefetch","prefetchPaymentData","bind","paymentDataCallbacks","onPaymentDataChanged","merchantId","GooglePayService","environment","nonce","googlepay","txVariants","defaultProps"],"mappings":"8jDAiBA,MAAMA,EAAmE,CAAC,OAAQ,WAAY,MAAO,aAAc,QAEnH,MAAMC,UAAkBC,EA+CpB,0CAAAC,CAA8DC,EAAeC,GACzE,OAAIA,EAAwBC,KAAKC,KAAKC,uBAAuBC,SAASJ,GAGlEC,KAAKC,KAAKC,uBAAuBE,KAAKN,GAAQE,KAAKK,YAAY,OAAYL,KAAKC,KAAKC,uBAAuBE,KAAKE,EAAWC,cAEpI,CAEmBC,WAAAA,CAAYC,OACJA,EACiBA,EAAsBA,EAD9D,MAAM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AAOQ,EAAWkI,WACzCzC,EAFEpG,EAEqB8I,aAAa,CAACnI,EAAWkI,UAAWlI,EAAWC,gBACtEwF,EAHEpG,EAGqB+I,eAAeA"}
1
+ {"version":3,"file":"GooglePay.js","sources":["../../../../src/components/GooglePay/GooglePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GooglePayService from './GooglePayService';\nimport GooglePayButton from './components/GooglePayButton';\nimport defaultProps from './defaultProps';\nimport { formatGooglePayContactToAdyenAddressFormat, getGooglePayLocale } from './utils';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\n\nimport type { AddressData, BrowserInfo, RawPaymentMethod, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { mapGooglePayBrands } from './utils/map-adyen-brands-to-googlepay-brands';\n\nconst DEFAULT_ALLOWED_CARD_NETWORKS: google.payments.api.CardNetwork[] = ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'];\n\nclass GooglePay extends UIElement<GooglePayConfiguration> {\n public static readonly type = TxVariants.googlepay;\n public static readonly txVariants = [TxVariants.googlepay, TxVariants.paywithgoogle];\n public static readonly defaultProps = defaultProps;\n\n protected readonly googlePay;\n\n constructor(checkout: ICore, props?: GooglePayConfiguration) {\n super(checkout, props);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.showGooglePayPaymentSheet = this.showGooglePayPaymentSheet.bind(this);\n\n const { isExpress, paymentDataCallbacks } = this.props;\n\n if (isExpress === false && paymentDataCallbacks?.onPaymentDataChanged) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - You must set \"isExpress\" flag to \"true\" in order to use \"onPaymentDataChanged\" callback'\n );\n }\n\n if (!this.props.configuration.merchantId) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - Missing merchantId. Please ensure that it is correctly configured in your customer area.'\n );\n }\n\n this.googlePay = new GooglePayService(\n this.props.environment,\n this.analytics,\n {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n },\n this.props.nonce\n );\n }\n\n /**\n * Google Pay requires custom logic due to supporting two Tx variants that lead to the same payment method.\n * If the merchant creates a standalone Google Pay component, we need to verify if the payment method is available using both tx variants\n *\n * @param type\n * @param paymentMethodId - Unique internal payment method ID\n * @returns\n */\n protected override getPaymentMethodFromPaymentMethodsResponse(type?: string, paymentMethodId?: string): RawPaymentMethod {\n if (paymentMethodId) return this.core.paymentMethodsResponse.findById(paymentMethodId);\n\n return (\n this.core.paymentMethodsResponse.find(type || this.constructor['type']) || this.core.paymentMethodsResponse.find(TxVariants.paywithgoogle)\n );\n }\n\n protected override formatProps(props: GooglePayConfiguration): GooglePayConfiguration {\n const buttonSizeMode = props.buttonSizeMode ?? (props.isDropin ? 'fill' : 'static');\n const buttonLocale = getGooglePayLocale(props.buttonLocale ?? props.i18n?.locale);\n\n const callbackIntents: google.payments.api.CallbackIntent[] = [...props.callbackIntents, 'PAYMENT_AUTHORIZATION'];\n\n const allowedCardNetworks = this.createAllowedCardNetworksValues({\n allowedCardNetworks: props.allowedCardNetworks,\n brands: props.brands\n });\n\n return {\n ...props,\n allowedCardNetworks,\n configuration: props.configuration,\n buttonSizeMode,\n buttonLocale,\n callbackIntents\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData() {\n const { googlePayCardNetwork, googlePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: this.type,\n googlePayCardNetwork,\n googlePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n /**\n * Generate the 'allowedCardNetworks' value used by Google Pay\n *\n * If the 'allowedCardNetworks' is defined in the Component configuration, it will be used. Otherwise we fallback\n * to use the 'brands' returned by the backoffice. It can be that 'brands' is not returned, which in this case we\n * set default values\n *\n * @param {object} brandsConfig\n * @param brandsConfig.allowedCardNetworks - Brands set in the component config\n * @param brandsConfig.brands - Brands returned by backend\n * @private\n */\n private createAllowedCardNetworksValues({\n allowedCardNetworks,\n brands\n }: {\n allowedCardNetworks?: google.payments.api.CardNetwork[];\n brands?: string[];\n }): google.payments.api.CardNetwork[] {\n if (allowedCardNetworks?.length > 0) return allowedCardNetworks;\n if (brands?.length > 0) return mapGooglePayBrands(brands);\n\n return DEFAULT_ALLOWED_CARD_NETWORKS;\n }\n\n protected override beforeRender(configSetByMerchant?: GooglePayConfiguration) {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\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 /**\n * Displays the Google Pay payment sheet overlay\n */\n private showGooglePayPaymentSheet() {\n this.googlePay.initiatePayment(this.props, this.core.options.countryCode).catch((error: google.payments.api.PaymentsError) => {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n this.handleError(new AdyenCheckoutError(error.statusCode === 'CANCELED' ? 'CANCEL' : 'ERROR', error.toString(), { cause: error }));\n });\n }\n\n public override submit = () => {\n if (this.props.isInstantPayment) {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.selected,\n target: UiTarget.instantPaymentButton\n });\n\n this.submitAnalytics(event);\n }\n\n new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject)).then(this.showGooglePayPaymentSheet).catch(() => {\n // Swallow exception triggered by onClick reject\n });\n };\n\n /**\n * Method called when the payment is authorized in the payment sheet\n *\n * @see https://developers.google.com/pay/api/web/reference/client#onPaymentAuthorized\n **/\n private onPaymentAuthorized = async (paymentData: google.payments.api.PaymentData): Promise<google.payments.api.PaymentAuthorizationResult> => {\n const billingAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.paymentMethodData.info.billingAddress);\n const deliveryAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.shippingAddress, true);\n\n this.setState({\n authorizedEvent: paymentData,\n googlePayToken: paymentData.paymentMethodData.tokenizationData.token,\n googlePayCardNetwork: paymentData.paymentMethodData.info.cardNetwork,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<google.payments.api.PaymentAuthorizationResult>(resolve => {\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((paymentResponse: PaymentResponseData) => {\n resolve({ transactionState: 'SUCCESS' });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n this.setElementStatus('ready');\n\n const googlePayError = paymentResponse?.error?.googlePayError;\n const fallbackMessage = this.props.i18n.get('error.subtitle.payment');\n\n const error: google.payments.api.PaymentDataError =\n typeof googlePayError === 'string' || undefined\n ? {\n intent: 'PAYMENT_AUTHORIZATION',\n reason: 'OTHER_ERROR',\n message: (googlePayError as string) || fallbackMessage\n }\n : {\n intent: googlePayError?.intent || 'PAYMENT_AUTHORIZATION',\n reason: googlePayError?.reason || 'OTHER_ERROR',\n message: googlePayError?.message || fallbackMessage\n };\n\n resolve({\n transactionState: 'ERROR',\n error\n });\n\n const responseWithError = {\n ...paymentResponse,\n error: {\n googlePayError: error\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\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 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?: google.payments.api.PaymentDataError | string) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { googlePayError: error } };\n return Promise.reject(data);\n });\n }\n\n public get isValid(): boolean {\n return true;\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public override async isAvailable(): Promise<void> {\n return this.isReadyToPay()\n .then(response => {\n if (!response.result) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay is not available');\n }\n\n if (response.paymentMethodPresent === false) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay - No paymentMethodPresent');\n }\n\n return Promise.resolve();\n })\n .catch(error => {\n return Promise.reject(error);\n });\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public isReadyToPay = (): Promise<google.payments.api.IsReadyToPayResponse> => {\n return this.googlePay.isReadyToPay(this.props);\n };\n\n /**\n * Use this method to prefetch a PaymentDataRequest configuration to improve loadPaymentData execution time on later user interaction. No value is returned.\n */\n public prefetch = (): void => {\n return this.googlePay.prefetchPaymentData(this.props, this.core.options.countryCode);\n };\n\n get browserInfo(): BrowserInfo | undefined {\n return collectBrowserInfo();\n }\n\n get icon(): string {\n return this.props.icon ?? this.resources.getImage()('googlepay');\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.showPayButton) {\n return (\n <GooglePayButton\n buttonColor={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonSizeMode={this.props.buttonSizeMode}\n buttonLocale={this.props.buttonLocale}\n buttonRootNode={this.props.buttonRootNode}\n buttonRadius={this.props.buttonRadius}\n paymentsClient={this.googlePay.paymentsClient}\n onClick={this.submit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default GooglePay;\n"],"names":["DEFAULT_ALLOWED_CARD_NETWORKS","GooglePay","UIElement","getPaymentMethodFromPaymentMethodsResponse","type","paymentMethodId","this","core","paymentMethodsResponse","findById","find","constructor","TxVariants","paywithgoogle","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","allowedCardNetworks","createAllowedCardNetworksValues","brands","_object_spread_props","_object_spread","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","state","isExpress","paymentMethod","subtype","browserInfo","origin","window","location","length","mapGooglePayBrands","beforeRender","configSetByMerchant","originalAction","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","expressPage","analytics","sendAnalytics","showGooglePayPaymentSheet","googlePay","initiatePayment","options","countryCode","catch","error","handleError","AdyenCheckoutError","statusCode","toString","cause","handleAuthorization","Promise","resolve","reject","onAuthorized","authorizedEvent","data","googlePayError","isValid","isAvailable","isReadyToPay","then","response","result","paymentMethodPresent","collectBrowserInfo","icon","_this_props_icon","resources","getImage","componentToRender","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","onClick","submit","checkout","super","_define_property","isInstantPayment","selected","target","UiTarget","instantPaymentButton","submitAnalytics","onPaymentAuthorized","async","paymentData","formatGooglePayContactToAdyenAddressFormat","paymentMethodData","info","shippingAddress","setState","tokenizationData","token","cardNetwork","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","paymentResponse","transactionState","handleResponse","setElementStatus","fallbackMessage","get","intent","reason","message","responseWithError","handleFailedResult","prefetch","prefetchPaymentData","bind","paymentDataCallbacks","onPaymentDataChanged","merchantId","GoogleP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,EAAsBC,sBAC7C,MAAM,IAAIxE,EACN,uBACA,uGAIR,IAAK3D,KAAKS,MAAMa,cAAc8G,WAC1B,MAAM,IAAIzE,EACN,uBACA,wGAIR3D,KAAKoD,UAAY,IAAIiF,EACjBrI,KAAKS,MAAM6H,YACXtI,KAAKiD,UACL7B,EAAAC,EAAA,GACQQ,IAAaqG,aAAAA,EAAAA,EAAsBC,uBAAwB,CAAEA,qBAAsBD,EAAqBC,uBAAqB,CACjI7B,oBAAqBtG,KAAKsG,sBAE9BtG,KAAKS,MAAM8H,MAEnB,EApCAxC,EADEpG,EACqBG,OAAOQ,EAAWkI,WACzCzC,EAFEpG,EAEqB8I,aAAa,CAACnI,EAAWkI,UAAWlI,EAAWC,gBACtEwF,EAHEpG,EAGqB+I,eAAeA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{TxVariants as t}from"../tx-variants.js";import{UIElement as n}from"../internal/UIElement/UIElement.js";import r from"../internal/RedirectButton/RedirectButton.js";import i from"../internal/PayButton/PayButton.js";import o,{ERROR as s}from"../../core/Errors/AdyenCheckoutError.js";import{PasskeyService as a}from"./services/PasskeyService.js";import{authorizeEnrollment as l}from"./services/authorizeEnrollment.js";import{authorizePayment as p}from"./services/authorizePayment.js";import d from"./components/StoredPayment/StoredPayment.js";import c from"./components/Enrollment/Enrollment.js";function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function m(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 u(e,t){if(null==e)return{};var n,r,i,o={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),i=0;i<n.length;i++)r=n[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)r=n[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}class v extends n{get isValid(){var e;return!(this.props._isAdyenHosted&&!this.props.storedPaymentMethodId)||!!(null===(e=this.state)||void 0===e?void 0:e.isValid)}get additionalInfo(){var e,t;return this.props.storedPaymentMethodId?this.props.i18n.get("paybybankpix.storedPayment.additionalLabel",{values:{receiver:null===(t=this.props)||void 0===t||null===(e=t.payByBankPixDetails)||void 0===e?void 0:e.receiver}}):""}get icon(){var e,t;return this.props.storedPaymentMethodId?this.resources.getImage({parentFolder:`${v.type}/`})(null===(t=this.props)||void 0===t||null===(e=t.payByBankPixDetails)||void 0===e?void 0:e.ispb):super.icon}async isAvailable(){const e=await this.passkeyService.getWebAuthnUnsupportedReason();if(e)return Promise.reject(new o(s,e));if(!this.props._isAdyenHosted)return Promise.resolve();try{if(await this.passkeyService.initialize(),this.props.storedPaymentMethodId){return await this.passkeyService.canUseStoredCredential()?Promise.resolve():Promise.reject(new o("ERROR","The stored payment method is not available on this device"))}return Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?null==e?void 0:e.message:"Unknown error")}}handleAction(e,t={}){const n=this.core.createFromAction(e,m(y({},this.elementRef.props,t),{onAdditionalDetails:this.handleAdditionalDetails}));return n?(this.unmount(),n.isAvailable().then(()=>{n.mount(this._node)}),n):null}formatData(){if(!this.props._isAdyenHosted)return{paymentMethod:{type:t.paybybank_pix}};const e=null==this.props.storedPaymentMethodId;return y({paymentMethod:y({type:t.paybybank_pix},this.state.data)},e?{storePaymentMethod:!0}:{})}componentToRender(){var t,n,i;return this.props._isAdyenHosted?null!=this.props.storedPaymentMethodId?e(d,{txVariant:v.type,type:this.props.type,clientKey:this.props.clientKey,enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,setComponentRef:this.setComponentRef,onPay:this.payWithStoredPayment,onAuthorize:this.authorizePayment}):e(c,{onError:this.handleError,txVariant:v.type,type:this.props.type,clientKey:this.props.clientKey,enrollmentId:null===(i=this.props.paymentMethodData)||void 0===i?void 0:i.enrollmentId,countdownTime:this.props.countdownTime,onEnroll:this.authorizeEnrollment,issuers:this.props.issuers,payButton:this.enrollmentPayButton,onChange:this.onIssuerSelected,onSubmitAnalytics:this.submitAnalytics,setComponentRef:this.setComponentRef}):e(r,{name:this.displayName,label:this.props.i18n.get("paybybankpix.redirectBtn.label"),payButton:this.payButton,onSubmit:this.submit,setComponentRef:this.setComponentRef})}constructor(t,n){var r,d;super(t,n),h(this,"passkeyService",void 0),h(this,"onIssuerSelected",async e=>{try{const{data:t={}}=e;if(!t.issuer)return;const n=await this.passkeyService.captureRiskSignalsEnrollment(),{deviceId:r}=n,i=u(n,["deviceId"]);this.setState(m(y({},e),{data:m(y({},t),{riskSignals:i,deviceId:r})}))}catch(e){const t=e instanceof Error?e.message:"Unknown error in the onIssuerSelected";this.handleError(e instanceof o?e:new o(s,t))}}),h(this,"authorizeEnrollment",async e=>{try{var t;const n=await this.passkeyService.createCredentialForEnrollment(e),r={enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,fidoAssertion:n},{redirectResult:i}=await l({enrollment:r,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:i}}})}catch(e){const t=e instanceof Error?e.message:"Unknown error in the authorizeEnrollment";this.handleError(e instanceof o?e:new o(s,t))}}),h(this,"payWithStoredPayment",async()=>{try{const e=await this.passkeyService.captureRiskSignalsAuthentication(),{deviceId:t}=e,n=u(e,["deviceId"]);this.state=y({},this.state,{data:{storedPaymentMethodId:this.props.storedPaymentMethodId,riskSignals:n,deviceId:t}}),this.executePaymentsCall()}catch(e){const t=e instanceof Error?e.message:"Unknown error in the payWithStoredPayment";this.handleError(e instanceof o?e:new o(s,t))}}),h(this,"authorizePayment",async e=>{try{var t,n;const r=await this.passkeyService.authenticateWithCredential(e),i={enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,fidoAssertion:r},{redirectResult:o}=await p({payment:i,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:o}}})}catch(e){const t=e instanceof Error?e.message:"Unknown error in the authorizePayment";this.handleError(e instanceof o?e:new o(s,t))}}),h(this,"enrollmentPayButton",t=>e(i,m(y({},t),{showPayButton:!0,disclaimerMessage:this.props.disclaimerMessage,onClick:this.submit})));const c=this.props.storedPaymentMethodId?null===(d=this.props)||void 0===d||null===(r=d.payByBankPixDetails)||void 0===r?void 0:r.deviceId:this.props.deviceId;this.passkeyService=new a({environment:this.props.environment,deviceId:c},this.analytics),this.props._isAdyenHosted&&this.passkeyService.initialize()}}h(v,"type",t.paybybank_pix),h(v,"TIMEOUT_MINUTES",1),h(v,"defaultProps",{showPayButton:!0,_isAdyenHosted:(()=>{try{return new URL(window.location.href).hostname.endsWith(".adyen.com")}catch(e){return!1}})(),countdownTime:v.TIMEOUT_MINUTES});export{v as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{TxVariants as t}from"../tx-variants.js";import{UIElement as n}from"../internal/UIElement/UIElement.js";import r from"../internal/RedirectButton/RedirectButton.js";import o from"../internal/PayButton/PayButton.js";import i,{ERROR as s}from"../../core/Errors/AdyenCheckoutError.js";import{PasskeyService as a}from"./services/PasskeyService.js";import{authorizeEnrollment as l}from"./services/authorizeEnrollment.js";import{authorizePayment as p}from"./services/authorizePayment.js";import d from"./components/StoredPayment/StoredPayment.js";import c from"./components/Enrollment/Enrollment.js";function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function m(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 u(e,t){if(null==e)return{};var n,r,o,i={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}class v extends n{get isValid(){var e;return!(this.props._isAdyenHosted&&!this.props.storedPaymentMethodId)||!!(null===(e=this.state)||void 0===e?void 0:e.isValid)}get additionalInfo(){var e,t;return this.props.storedPaymentMethodId?this.props.i18n.get("paybybankpix.storedPayment.additionalLabel",{values:{receiver:null===(t=this.props)||void 0===t||null===(e=t.payByBankPixDetails)||void 0===e?void 0:e.receiver}}):""}get icon(){var e,t;return this.props.storedPaymentMethodId?this.resources.getImage({parentFolder:`${v.type}/`})(null===(t=this.props)||void 0===t||null===(e=t.payByBankPixDetails)||void 0===e?void 0:e.ispb):super.icon}async isAvailable(){const e=await this.passkeyService.getWebAuthnUnsupportedReason();if(e)return Promise.reject(new i(s,e));if(!this.props._isAdyenHosted)return Promise.resolve();try{if(await this.passkeyService.initialize(),this.props.storedPaymentMethodId){return await this.passkeyService.canUseStoredCredential()?Promise.resolve():Promise.reject(new i("ERROR","The stored payment method is not available on this device"))}return Promise.resolve()}catch(e){return Promise.reject(e instanceof Error?null==e?void 0:e.message:"Unknown error")}}handleAction(e,t={}){const n=this.core.createFromAction(e,m(y({},this.elementRef.props,t),{onAdditionalDetails:this.handleAdditionalDetails}));return n?(this.unmount(),n.isAvailable().then(()=>{n.mount(this.mountedNode)}),n):null}formatData(){if(!this.props._isAdyenHosted)return{paymentMethod:{type:t.paybybank_pix}};const e=null==this.props.storedPaymentMethodId;return y({paymentMethod:y({type:t.paybybank_pix},this.state.data)},e?{storePaymentMethod:!0}:{})}componentToRender(){var t,n,o;return this.props._isAdyenHosted?null!=this.props.storedPaymentMethodId?e(d,{txVariant:v.type,type:this.props.type,clientKey:this.props.clientKey,enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,setComponentRef:this.setComponentRef,onPay:this.payWithStoredPayment,onAuthorize:this.authorizePayment}):e(c,{onError:this.handleError,txVariant:v.type,type:this.props.type,clientKey:this.props.clientKey,enrollmentId:null===(o=this.props.paymentMethodData)||void 0===o?void 0:o.enrollmentId,countdownTime:this.props.countdownTime,onEnroll:this.authorizeEnrollment,issuers:this.props.issuers,payButton:this.enrollmentPayButton,onChange:this.onIssuerSelected,onSubmitAnalytics:this.submitAnalytics,setComponentRef:this.setComponentRef}):e(r,{name:this.displayName,label:this.props.i18n.get("paybybankpix.redirectBtn.label"),payButton:this.payButton,onSubmit:this.submit,setComponentRef:this.setComponentRef})}constructor(t,n){var r,d;super(t,n),h(this,"passkeyService",void 0),h(this,"onIssuerSelected",async e=>{try{const{data:t={}}=e;if(!t.issuer)return;const n=await this.passkeyService.captureRiskSignalsEnrollment(),{deviceId:r}=n,o=u(n,["deviceId"]);this.setState(m(y({},e),{data:m(y({},t),{riskSignals:o,deviceId:r})}))}catch(e){const t=e instanceof Error?e.message:"Unknown error in the onIssuerSelected";this.handleError(e instanceof i?e:new i(s,t))}}),h(this,"authorizeEnrollment",async e=>{try{var t;const n=await this.passkeyService.createCredentialForEnrollment(e),r={enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,fidoAssertion:n},{redirectResult:o}=await l({enrollment:r,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:o}}})}catch(e){const t=e instanceof Error?e.message:"Unknown error in the authorizeEnrollment";this.handleError(e instanceof i?e:new i(s,t))}}),h(this,"payWithStoredPayment",async()=>{try{const e=await this.passkeyService.captureRiskSignalsAuthentication(),{deviceId:t}=e,n=u(e,["deviceId"]);this.state=y({},this.state,{data:{storedPaymentMethodId:this.props.storedPaymentMethodId,riskSignals:n,deviceId:t}}),this.executePaymentsCall()}catch(e){const t=e instanceof Error?e.message:"Unknown error in the payWithStoredPayment";this.handleError(e instanceof i?e:new i(s,t))}}),h(this,"authorizePayment",async e=>{try{var t,n;const r=await this.passkeyService.authenticateWithCredential(e),o={enrollmentId:null===(t=this.props.paymentMethodData)||void 0===t?void 0:t.enrollmentId,initiationId:null===(n=this.props.paymentMethodData)||void 0===n?void 0:n.initiationId,fidoAssertion:r},{redirectResult:i}=await p({payment:o,clientKey:this.props.clientKey,loadingContext:this.props.loadingContext});this.handleAdditionalDetails({data:{details:{redirectResult:i}}})}catch(e){const t=e instanceof Error?e.message:"Unknown error in the authorizePayment";this.handleError(e instanceof i?e:new i(s,t))}}),h(this,"enrollmentPayButton",t=>e(o,m(y({},t),{showPayButton:!0,disclaimerMessage:this.props.disclaimerMessage,onClick:this.submit})));const c=this.props.storedPaymentMethodId?null===(d=this.props)||void 0===d||null===(r=d.payByBankPixDetails)||void 0===r?void 0:r.deviceId:this.props.deviceId;this.passkeyService=new a({environment:this.props.environment,deviceId:c},this.analytics),this.props._isAdyenHosted&&this.passkeyService.initialize()}}h(v,"type",t.paybybank_pix),h(v,"TIMEOUT_MINUTES",1),h(v,"defaultProps",{showPayButton:!0,_isAdyenHosted:(()=>{try{return new URL(window.location.href).hostname.endsWith(".adyen.com")}catch(e){return!1}})(),countdownTime:v.TIMEOUT_MINUTES});export{v as default};
2
2
  //# sourceMappingURL=PayByBankPix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayByBankPix.js","sources":["../../../../src/components/PayByBankPix/PayByBankPix.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { PayByBankPixData, PayByBankPixConfiguration } from './types';\nimport { TxVariants } from '../tx-variants';\nimport UIElement from '../internal/UIElement';\nimport RedirectButton from '../internal/RedirectButton';\nimport PayButton, { PayButtonProps } from '../internal/PayButton/PayButton';\nimport AdyenCheckoutError, { ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { PasskeyService } from './services/PasskeyService';\nimport { authorizeEnrollment } from './services/authorizeEnrollment';\nimport { authorizePayment } from './services/authorizePayment';\nimport StoredPayment from './components/StoredPayment';\nimport Enrollment from './components/Enrollment';\nimport { PaymentAction } from '../../types/global-types';\nimport type { ICore } from '../../core/types';\n\nconst isAdyenHosted = () => {\n try {\n const currentUrl = new URL(window.location.href);\n return currentUrl.hostname.endsWith('.adyen.com');\n } catch (e) {\n // SSR, or it fails to parse the full url\n return false;\n }\n};\nclass PayByBankPixElement extends UIElement<PayByBankPixConfiguration> {\n public static readonly type = TxVariants.paybybank_pix;\n private static readonly TIMEOUT_MINUTES = 1;\n private readonly passkeyService: PasskeyService;\n\n public static readonly defaultProps: PayByBankPixConfiguration = {\n showPayButton: true,\n _isAdyenHosted: isAdyenHosted(),\n countdownTime: PayByBankPixElement.TIMEOUT_MINUTES\n };\n\n constructor(checkout: ICore, props?: PayByBankPixConfiguration) {\n super(checkout, props);\n const deviceId = this.props.storedPaymentMethodId ? this.props?.payByBankPixDetails?.deviceId : this.props.deviceId;\n\n this.passkeyService = new PasskeyService(\n {\n environment: this.props.environment,\n deviceId\n },\n this.analytics\n );\n\n if (this.props._isAdyenHosted) {\n void this.passkeyService.initialize();\n }\n }\n\n get isValid(): boolean {\n // Always true for non-hosted page or stored payment\n if (!this.props._isAdyenHosted || this.props.storedPaymentMethodId) {\n return true;\n }\n return !!this.state?.isValid;\n }\n\n /**\n * Display in the drop-in\n */\n get additionalInfo() {\n return this.props.storedPaymentMethodId\n ? this.props.i18n.get('paybybankpix.storedPayment.additionalLabel', { values: { receiver: this.props?.payByBankPixDetails?.receiver } })\n : '';\n }\n\n /**\n * Display in the drop-in\n */\n public override get icon() {\n return this.props.storedPaymentMethodId\n ? this.resources.getImage({ parentFolder: `${PayByBankPixElement.type}/` })(this.props?.payByBankPixDetails?.ispb)\n : super.icon;\n }\n\n /**\n * Method used to let the merchant know if the shopper's device supports WebAuthn APIs: https://featuredetect.passkeys.dev/\n */\n public override async isAvailable(): Promise<void> {\n const unsupportedReason = await this.passkeyService.getWebAuthnUnsupportedReason();\n if (unsupportedReason) {\n return Promise.reject(new AdyenCheckoutError(ERROR, unsupportedReason));\n }\n if (!this.props._isAdyenHosted) {\n return Promise.resolve();\n }\n\n // Load passkey sdk on the hosted page\n try {\n await this.passkeyService.initialize();\n\n if (this.props.storedPaymentMethodId) {\n // If the provided deviceId from the server does not match the localstorage deviceId, do not render the stored payment component.\n const shouldShowStoredPaymentMethod = await this.passkeyService.canUseStoredCredential();\n return shouldShowStoredPaymentMethod\n ? Promise.resolve()\n : Promise.reject(new AdyenCheckoutError('ERROR', 'The stored payment method is not available on this device'));\n }\n\n return Promise.resolve();\n } catch (error) {\n return Promise.reject(error instanceof Error ? error?.message : 'Unknown error');\n }\n }\n\n /**\n * Make sure the await action UIElement is available before mounting\n */\n public override handleAction(action: PaymentAction, props: {} = {}): UIElement | null {\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n if (paymentAction) {\n this.unmount();\n void paymentAction.isAvailable().then(() => {\n paymentAction.mount(this._node);\n });\n return paymentAction;\n }\n\n return null;\n }\n\n formatData(): PayByBankPixData {\n if (!this.props._isAdyenHosted) {\n return {\n paymentMethod: { type: TxVariants.paybybank_pix }\n };\n }\n\n const isEnrollment = this.props.storedPaymentMethodId == null;\n return {\n paymentMethod: { type: TxVariants.paybybank_pix, ...this.state.data },\n // Always store the payment method for the enrollment flow.\n ...(isEnrollment ? { storePaymentMethod: true } : {})\n };\n }\n\n /**\n * There are 3 endpoints (stages) we need to call for the enrollment flow.\n * The first one is the regular payments call on issuer selection - we indicate to store the payment token for the selected issuer.\n * The second one is to poll the enrollment eligibility - we poll the server to get the enrollment challenge in the `getEnrollmentStatus` function.\n * The third one is in the `authorizeEnrollment` function - we create passkeys and authorize the enrollment with shopper's passkey.\n */\n private readonly onIssuerSelected = async payload => {\n try {\n const { data = {} } = payload;\n if (!data.issuer) {\n return;\n }\n\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsEnrollment();\n this.setState({ ...payload, data: { ...data, riskSignals, deviceId } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the onIssuerSelected';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizeEnrollment = async (registrationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.createCredentialForEnrollment(registrationOptions); // Create passkey and trigger biometrics\n const enrollment = { enrollmentId: this.props.paymentMethodData?.enrollmentId, fidoAssertion };\n const { redirectResult } = await authorizeEnrollment({\n enrollment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n // Make paymentDetails call to finalize the enrollment.\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizeEnrollment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n /**\n * There are 3 endpoints (stages) we need to call for the payment flow.\n * The first one `payWithStoredPayment` is the regular payments call - we attempt to pay with the stored payment token.\n * The second one is to poll the authorization options - we poll the server to get the challenge in the `getAuthorizationStatus` function.\n * The third one is in the `authorizePayment` function - we authorize the payment with shopper's passkey.\n */\n private readonly payWithStoredPayment = async () => {\n try {\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsAuthentication();\n this.state = { ...this.state, ...{ data: { storedPaymentMethodId: this.props.storedPaymentMethodId, riskSignals, deviceId } } };\n this.executePaymentsCall();\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the payWithStoredPayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizePayment = async (authenticationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.authenticateWithCredential(authenticationOptions);\n const payment = {\n enrollmentId: this.props.paymentMethodData?.enrollmentId,\n initiationId: this.props.paymentMethodData?.initiationId,\n fidoAssertion\n };\n const { redirectResult } = await authorizePayment({\n payment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizePayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n /**\n * The enrollment flow is only rendered on the Adyen hosted page and it is always shown, regardless of the showPayButton configuration.\n */\n private readonly enrollmentPayButton = (props: PayButtonProps): h.JSX.Element => {\n return <PayButton {...props} showPayButton={true} disclaimerMessage={this.props.disclaimerMessage} onClick={this.submit} />;\n };\n\n protected override componentToRender(): h.JSX.Element {\n // Always render the redirect button on the merchant's page\n if (!this.props._isAdyenHosted) {\n return (\n <RedirectButton\n name={this.displayName}\n label={this.props.i18n.get('paybybankpix.redirectBtn.label')}\n payButton={this.payButton}\n onSubmit={this.submit}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n\n return this.props.storedPaymentMethodId != null ? (\n <StoredPayment\n txVariant={PayByBankPixElement.type}\n type={this.props.type}\n clientKey={this.props.clientKey}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n initiationId={this.props.paymentMethodData?.initiationId}\n setComponentRef={this.setComponentRef}\n onPay={this.payWithStoredPayment}\n onAuthorize={this.authorizePayment}\n />\n ) : (\n <Enrollment\n onError={this.handleError}\n txVariant={PayByBankPixElement.type}\n // Await\n type={this.props.type}\n clientKey={this.props.clientKey}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n countdownTime={this.props.countdownTime}\n onEnroll={this.authorizeEnrollment}\n // Issuer List\n issuers={this.props.issuers}\n payButton={this.enrollmentPayButton}\n onChange={this.onIssuerSelected}\n onSubmitAnalytics={this.submitAnalytics}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n//\nexport default PayByBankPixElement;\n"],"names":["PayByBankPixElement","UIElement","isValid","_this_state","this","props","_isAdyenHosted","storedPaymentMethodId","state","additionalInfo","_this_props_payByBankPixDetails","_this_props","i18n","get","values","receiver","payByBankPixDetails","icon","resources","getImage","parentFolder","type","ispb","super","isAvailable","unsupportedReason","passkeyService","getWebAuthnUnsupportedReason","Promise","reject","AdyenCheckoutError","ERROR","resolve","initialize","canUseStoredCredential","error","Error","message","handleAction","action","paymentAction","core","createFromAction","_object_spread_props","_object_spread","elementRef","onAdditionalDetails","handleAdditionalDetails","unmount","then","mount","_node","formatData","paymentMethod","TxVariants","paybybank_pix","isEnrollment","data","storePaymentMethod","componentToRender","_this_props_paymentMethodData","_this_props_paymentMethodData1","_this_props_paymentMethodData2","h","StoredPayment","txVariant","clientKey","enrollmentId","paymentMethodData","initiationId","setComponentRef","onPay","payWithStoredPayment","onAuthorize","authorizePayment","Enrollment","onError","handleError","countdownTime","onEnroll","authorizeEnrollment","issuers","payButton","enrollmentPayButton","onChange","onIssuerSelected","onSubmitAnalytics","submitAnalytics","RedirectButton","name","displayName","label","onSubmit","submit","constructor","checkout","_define_property","async","payload","issuer","_ref","captureRiskSignalsEnrollment","deviceId","riskSignals","setState","errorMsg","registrationOptions","fidoAssertion","createCredentialForEnrollment","enrollment","redirectResult","loadingContext","details","captureRiskSignalsAuthentication","executePaymentsCall","authenticationOptions","authenticateWithCredential","payment","PayButton","showPayButton","disclaimerMessage","onClick","PasskeyService","environment","analytics","TIMEOUT_MINUTES","defaultProps","URL","window","location","href","hostname","endsWith","e","isAdyenHosted"],"mappings":"8jEAwBA,MAAMA,UAA4BC,EA4B9B,WAAIC,GAKS,IAAAC,EAHT,QAAKC,KAAKC,MAAMC,iBAAkBF,KAAKC,MAAME,2BAG1B,QAAVJ,EAAAC,KAAKI,aAAL,IAAAL,SAAAA,EAAYD,QACzB,CAKA,kBAAIO,OAE8FC,EAAAC,EAD9F,OAAOP,KAAKC,MAAME,sBACZH,KAAKC,MAAMO,KAAKC,IAAI,6CAA8C,CAAEC,OAAQ,CAAEC,SAAoB,QAAVJ,EAAAP,KAAKC,iBAALM,GAA+B,QAA/BD,EAAAC,EAAYK,2BAAZ,IAAAN,OAAA,EAAAA,EAAiCK,YACzH,EACV,CAKA,QAAoBE,OAEgEP,EAAAC,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G,EACqBqB,OAAOiC,EAAWC,eACzCyC,EAFEhG,EAEsB6H,kBAAkB,GAG1C7B,EALEhG,EAKqB8H,eAA0C,CAC7DP,eAAe,EACfjH,eAhBc,MAClB,IAEI,OADmB,IAAIyH,IAAIC,OAAOC,SAASC,MACzBC,SAASC,SAAS,aACxC,CAAE,MAAOC,GAEL,OAAO,CACX,GASoBC,GAChBxD,cAAe9E,EAAoB6H"}
1
+ {"version":3,"file":"PayByBankPix.js","sources":["../../../../src/components/PayByBankPix/PayByBankPix.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { PayByBankPixData, PayByBankPixConfiguration } from './types';\nimport { TxVariants } from '../tx-variants';\nimport UIElement from '../internal/UIElement';\nimport RedirectButton from '../internal/RedirectButton';\nimport PayButton, { PayButtonProps } from '../internal/PayButton/PayButton';\nimport AdyenCheckoutError, { ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { PasskeyService } from './services/PasskeyService';\nimport { authorizeEnrollment } from './services/authorizeEnrollment';\nimport { authorizePayment } from './services/authorizePayment';\nimport StoredPayment from './components/StoredPayment';\nimport Enrollment from './components/Enrollment';\nimport { PaymentAction } from '../../types/global-types';\nimport type { ICore } from '../../core/types';\n\nconst isAdyenHosted = () => {\n try {\n const currentUrl = new URL(window.location.href);\n return currentUrl.hostname.endsWith('.adyen.com');\n } catch (e) {\n // SSR, or it fails to parse the full url\n return false;\n }\n};\nclass PayByBankPixElement extends UIElement<PayByBankPixConfiguration> {\n public static readonly type = TxVariants.paybybank_pix;\n private static readonly TIMEOUT_MINUTES = 1;\n private readonly passkeyService: PasskeyService;\n\n public static readonly defaultProps: PayByBankPixConfiguration = {\n showPayButton: true,\n _isAdyenHosted: isAdyenHosted(),\n countdownTime: PayByBankPixElement.TIMEOUT_MINUTES\n };\n\n constructor(checkout: ICore, props?: PayByBankPixConfiguration) {\n super(checkout, props);\n const deviceId = this.props.storedPaymentMethodId ? this.props?.payByBankPixDetails?.deviceId : this.props.deviceId;\n\n this.passkeyService = new PasskeyService(\n {\n environment: this.props.environment,\n deviceId\n },\n this.analytics\n );\n\n if (this.props._isAdyenHosted) {\n void this.passkeyService.initialize();\n }\n }\n\n get isValid(): boolean {\n // Always true for non-hosted page or stored payment\n if (!this.props._isAdyenHosted || this.props.storedPaymentMethodId) {\n return true;\n }\n return !!this.state?.isValid;\n }\n\n /**\n * Display in the drop-in\n */\n get additionalInfo() {\n return this.props.storedPaymentMethodId\n ? this.props.i18n.get('paybybankpix.storedPayment.additionalLabel', { values: { receiver: this.props?.payByBankPixDetails?.receiver } })\n : '';\n }\n\n /**\n * Display in the drop-in\n */\n public override get icon() {\n return this.props.storedPaymentMethodId\n ? this.resources.getImage({ parentFolder: `${PayByBankPixElement.type}/` })(this.props?.payByBankPixDetails?.ispb)\n : super.icon;\n }\n\n /**\n * Method used to let the merchant know if the shopper's device supports WebAuthn APIs: https://featuredetect.passkeys.dev/\n */\n public override async isAvailable(): Promise<void> {\n const unsupportedReason = await this.passkeyService.getWebAuthnUnsupportedReason();\n if (unsupportedReason) {\n return Promise.reject(new AdyenCheckoutError(ERROR, unsupportedReason));\n }\n if (!this.props._isAdyenHosted) {\n return Promise.resolve();\n }\n\n // Load passkey sdk on the hosted page\n try {\n await this.passkeyService.initialize();\n\n if (this.props.storedPaymentMethodId) {\n // If the provided deviceId from the server does not match the localstorage deviceId, do not render the stored payment component.\n const shouldShowStoredPaymentMethod = await this.passkeyService.canUseStoredCredential();\n return shouldShowStoredPaymentMethod\n ? Promise.resolve()\n : Promise.reject(new AdyenCheckoutError('ERROR', 'The stored payment method is not available on this device'));\n }\n\n return Promise.resolve();\n } catch (error) {\n return Promise.reject(error instanceof Error ? error?.message : 'Unknown error');\n }\n }\n\n /**\n * Make sure the await action UIElement is available before mounting\n */\n public override handleAction(action: PaymentAction, props: {} = {}): UIElement | null {\n const paymentAction = this.core.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n if (paymentAction) {\n this.unmount();\n void paymentAction.isAvailable().then(() => {\n paymentAction.mount(this.mountedNode);\n });\n return paymentAction;\n }\n\n return null;\n }\n\n formatData(): PayByBankPixData {\n if (!this.props._isAdyenHosted) {\n return {\n paymentMethod: { type: TxVariants.paybybank_pix }\n };\n }\n\n const isEnrollment = this.props.storedPaymentMethodId == null;\n return {\n paymentMethod: { type: TxVariants.paybybank_pix, ...this.state.data },\n // Always store the payment method for the enrollment flow.\n ...(isEnrollment ? { storePaymentMethod: true } : {})\n };\n }\n\n /**\n * There are 3 endpoints (stages) we need to call for the enrollment flow.\n * The first one is the regular payments call on issuer selection - we indicate to store the payment token for the selected issuer.\n * The second one is to poll the enrollment eligibility - we poll the server to get the enrollment challenge in the `getEnrollmentStatus` function.\n * The third one is in the `authorizeEnrollment` function - we create passkeys and authorize the enrollment with shopper's passkey.\n */\n private readonly onIssuerSelected = async payload => {\n try {\n const { data = {} } = payload;\n if (!data.issuer) {\n return;\n }\n\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsEnrollment();\n this.setState({ ...payload, data: { ...data, riskSignals, deviceId } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the onIssuerSelected';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizeEnrollment = async (registrationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.createCredentialForEnrollment(registrationOptions); // Create passkey and trigger biometrics\n const enrollment = { enrollmentId: this.props.paymentMethodData?.enrollmentId, fidoAssertion };\n const { redirectResult } = await authorizeEnrollment({\n enrollment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n // Make paymentDetails call to finalize the enrollment.\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizeEnrollment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n /**\n * There are 3 endpoints (stages) we need to call for the payment flow.\n * The first one `payWithStoredPayment` is the regular payments call - we attempt to pay with the stored payment token.\n * The second one is to poll the authorization options - we poll the server to get the challenge in the `getAuthorizationStatus` function.\n * The third one is in the `authorizePayment` function - we authorize the payment with shopper's passkey.\n */\n private readonly payWithStoredPayment = async () => {\n try {\n const { deviceId, ...riskSignals } = await this.passkeyService.captureRiskSignalsAuthentication();\n this.state = { ...this.state, ...{ data: { storedPaymentMethodId: this.props.storedPaymentMethodId, riskSignals, deviceId } } };\n this.executePaymentsCall();\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the payWithStoredPayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n private readonly authorizePayment = async (authenticationOptions: string): Promise<void> => {\n try {\n const fidoAssertion = await this.passkeyService.authenticateWithCredential(authenticationOptions);\n const payment = {\n enrollmentId: this.props.paymentMethodData?.enrollmentId,\n initiationId: this.props.paymentMethodData?.initiationId,\n fidoAssertion\n };\n const { redirectResult } = await authorizePayment({\n payment,\n clientKey: this.props.clientKey,\n loadingContext: this.props.loadingContext\n });\n this.handleAdditionalDetails({ data: { details: { redirectResult } } });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Unknown error in the authorizePayment';\n this.handleError(error instanceof AdyenCheckoutError ? error : new AdyenCheckoutError(ERROR, errorMsg));\n }\n };\n\n /**\n * The enrollment flow is only rendered on the Adyen hosted page and it is always shown, regardless of the showPayButton configuration.\n */\n private readonly enrollmentPayButton = (props: PayButtonProps): h.JSX.Element => {\n return <PayButton {...props} showPayButton={true} disclaimerMessage={this.props.disclaimerMessage} onClick={this.submit} />;\n };\n\n protected override componentToRender(): h.JSX.Element {\n // Always render the redirect button on the merchant's page\n if (!this.props._isAdyenHosted) {\n return (\n <RedirectButton\n name={this.displayName}\n label={this.props.i18n.get('paybybankpix.redirectBtn.label')}\n payButton={this.payButton}\n onSubmit={this.submit}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n\n return this.props.storedPaymentMethodId != null ? (\n <StoredPayment\n txVariant={PayByBankPixElement.type}\n type={this.props.type}\n clientKey={this.props.clientKey}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n initiationId={this.props.paymentMethodData?.initiationId}\n setComponentRef={this.setComponentRef}\n onPay={this.payWithStoredPayment}\n onAuthorize={this.authorizePayment}\n />\n ) : (\n <Enrollment\n onError={this.handleError}\n txVariant={PayByBankPixElement.type}\n // Await\n type={this.props.type}\n clientKey={this.props.clientKey}\n enrollmentId={this.props.paymentMethodData?.enrollmentId}\n countdownTime={this.props.countdownTime}\n onEnroll={this.authorizeEnrollment}\n // Issuer List\n issuers={this.props.issuers}\n payButton={this.enrollmentPayButton}\n onChange={this.onIssuerSelected}\n onSubmitAnalytics={this.submitAnalytics}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n//\nexport default PayByBankPixElement;\n"],"names":["PayByBankPixElement","UIElement","isValid","_this_state","this","props","_isAdyenHosted","storedPaymentMethodId","state","additionalInfo","_this_props_payByBankPixDetails","_this_props","i18n","get","values","receiver","payByBankPixDetails","icon","resources","getImage","parentFolder","type","ispb","super","isAvailable","unsupportedReason","passkeyService","getWebAuthnUnsupportedReason","Promise","reject","AdyenCheckoutError","ERROR","resolve","initialize","canUseStoredCredential","error","Error","message","handleAction","action","paymentAction","core","createFromAction","_object_spread_props","_object_spread","elementRef","onAdditionalDetails","handleAdditionalDetails","unmount","then","mount","mountedNode","formatData","paymentMethod","TxVariants","paybybank_pix","isEnrollment","data","storePaymentMethod","componentToRender","_this_props_paymentMethodData","_this_props_paymentMethodData1","_this_props_paymentMethodData2","h","StoredPayment","txVariant","clientKey","enrollmentId","paymentMethodData","initiationId","setComponentRef","onPay","payWithStoredPayment","onAuthorize","authorizePayment","Enrollment","onError","handleError","countdownTime","onEnroll","authorizeEnrollment","issuers","payButton","enrollmentPayButton","onChange","onIssuerSelected","onSubmitAnalytics","submitAnalytics","RedirectButton","name","displayName","label","onSubmit","submit","constructor","checkout","_define_property","async","payload","issuer","_ref","captureRiskSignalsEnrollment","deviceId","riskSignals","setState","errorMsg","registrationOptions","fidoAssertion","createCredentialForEnrollment","enrollment","redirectResult","loadingContext","details","captureRiskSignalsAuthentication","executePaymentsCall","authenticationOptions","authenticateWithCredential","payment","PayButton","showPayButton","disclaimerMessage","onClick","PasskeyService","environment","analytics","TIMEOUT_MINUTES","defaultProps","URL","window","location","href","hostname","endsWith","e","isAdyenHosted"],"mappings":"8jEAwBA,MAAMA,UAA4BC,EA4B9B,WAAIC,GAKS,IAAAC,EAHT,QAAKC,KAAKC,MAAMC,iBAAkBF,KAAKC,MAAME,2BAG1B,QAAVJ,EAAAC,KAAKI,aAAL,IAAAL,SAAAA,EAAYD,QACzB,CAKA,kBAAIO,OAE8FC,EAAAC,EAD9F,OAAOP,KAAKC,MAAME,sBACZH,KAAKC,MAAMO,KAAKC,IAAI,6CAA8C,CAAEC,OAAQ,CAAEC,SAAoB,QAAVJ,EAAAP,KAAKC,iBAALM,GAA+B,QAA/BD,EAAAC,EAAYK,2BAAZ,IAAAN,OAAA,EAAAA,EAAiCK,YACzH,EACV,CAKA,QAAoBE,OAEgEP,EAAAC,EADhF,OAAOP,KAAKC,MAAME,sBACZH,KAAKc,UAAUC,SAAS,CAAEC,aAAc,GAAGpB,EAAoBqB,SAA/DjB,SAA0EO,EAAAP,KAAKC,iBAALM,WAAAD,EAAAC,EAAYK,2BAAZ,IAAAN,OAAA,EAAAA,EAAiCY,MAC3GC,MAAMN,IAChB,CAKA,iBAAsBO,GAClB,MAAMC,QAA0BrB,KAAKsB,eAAeC,+BACpD,GAAIF,EACA,OAAOG,QAAQC,OAAO,IAAIC,EAAmBC,EAAON,IAExD,IAAKrB,KAAKC,MAAMC,eACZ,OAAOsB,QAAQI,UAInB,IAGI,SAFM5B,KAAKsB,eAAeO,aAEtB7B,KAAKC,MAAME,sBAAuB,CAGlC,aAD4CH,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2C,UACAnD,UAAW9D,KAAKC,MAAM6D,UACtB6C,eAAgB3G,KAAKC,MAAM0G,iBAE/B3G,KAAK2C,wBAAwB,CAAEU,KAAM,CAAEuD,QAAS,CAAEF,oBACtD,CAAE,MAAO3E,GACL,MAAMsE,EAAWtE,aAAiBC,MAAQD,EAAME,QAAU,wCAC1DjC,KAAKyE,YAAY1C,aAAiBL,EAAqBK,EAAQ,IAAIL,EAAmBC,EAAO0E,GACjG,IAMJT,EAAA5F,KAAiB+E,sBAAuB9E,GAC7B0D,EAACuD,EAAAA,EAAAA,EAAAA,CAAAA,EAAcjH,GAAAA,CAAOkH,eAAe,EAAMC,kBAAmBpH,KAAKC,MAAMmH,kBAAmBC,QAASrH,KAAKyF,WAzLjH,MAAMS,EAAWlG,KAAKC,MAAME,sBAAkC,QAAVI,EAAAP,KAAKC,iBAALM,GAA+B,QAA/BD,EAAAC,EAAYK,2BAAZ,IAAAN,SAAAA,EAAiC4F,SAAWlG,KAAKC,MAAMiG,SAE3GlG,KAAKsB,eAAiB,IAAIgG,EACtB,CACIC,YAAavH,KAAKC,MAAMsH,YACxBrB,YAEJlG,KAAKwH,WAGLxH,KAAKC,MAAMC,gBACNF,KAAKsB,eAAeO,YAEjC,EAzBA+D,EADEhG,EACqBqB,OAAOiC,EAAWC,eACzCyC,EAFEhG,EAEsB6H,kBAAkB,GAG1C7B,EALEhG,EAKqB8H,eAA0C,CAC7DP,eAAe,EACfjH,eAhBc,MAClB,IAEI,OADmB,IAAIyH,IAAIC,OAAOC,SAASC,MACzBC,SAASC,SAAS,aACxC,CAAE,MAAOC,GAEL,OAAO,CACX,GASoBC,GAChBxD,cAAe9E,EAAoB6H"}
@@ -1,2 +1,2 @@
1
- import{useState as e,useEffect as t}from"../../../../external/preact/hooks/dist/hooks.js";import r from"../../../../utils/get-issuer-image.js";import{useCoreContext as o}from"../../../../core/Context/CoreProvider.js";import n from"../../../../core/Context/useImage.js";function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}const s=({issuers:s=[],txVariant:u})=>{const{loadingContext:p}=o(),a=n(),[f,l]=e(s);return t(()=>{if((null==s?void 0:s.length)>0){const e=r({loadingContext:p},u,a);l(s.map(t=>i(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){c(e,t,r[t])})}return e}({},t),{icon:e(t.id)})))}},[s,u]),f};export{s as useIssuerWithLogo};
1
+ import{useState as e,useEffect as t}from"../../../../external/preact/hooks/dist/hooks.js";import r from"../../../../utils/get-issuer-image.js";import o from"../../../../core/Context/useImage.js";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}const i=({issuers:i=[],txVariant:s})=>{const u=o(),[p,f]=e(i);return t(()=>{if((null==i?void 0:i.length)>0){const e=r({},s,u);f(i.map(t=>c(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}({},t),{icon:e(t.id)})))}},[i,s]),p};export{i as useIssuerWithLogo};
2
2
  //# sourceMappingURL=useIssuerWithLogo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIssuerWithLogo.js","sources":["../../../../../../src/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport { IssuerItem } from '../../../internal/IssuerList/types';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useImage from '../../../../core/Context/useImage';\n\ninterface UseIssuerWithLogoProps {\n txVariant: string;\n issuers: IssuerItem[];\n}\nexport const useIssuerWithLogo = ({ issuers = [], txVariant }: UseIssuerWithLogoProps): IssuerItem[] => {\n const { loadingContext } = useCoreContext();\n const getImage = useImage();\n const [issuersWithLogo, setIssuersWithLogo] = useState<IssuerItem[]>(issuers);\n\n useEffect(() => {\n if (issuers?.length > 0) {\n const getIssuerIcon = getIssuerImageUrl({ loadingContext }, txVariant, getImage);\n setIssuersWithLogo(\n issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }))\n );\n }\n }, [issuers, txVariant]);\n\n return issuersWithLogo;\n};\n"],"names":["useIssuerWithLogo","issuers","txVariant","loadingContext","useCoreContext","getImage","useImage","issuersWithLogo","setIssuersWithLogo","useState","useEffect","length","getIssuerIcon","getIssuerImageUrl","map","item","_object_spread_props","_object_spread","icon","id"],"mappings":"kvBAUO,MAAMA,EAAoB,EAAGC,UAAU,GAAIC,gBAC9C,MAAMC,eAAEA,GAAmBC,IACrBC,EAAWC,KACVC,EAAiBC,GAAsBC,EAAuBR,GAcrE,OAZAS,EAAU,KACN,IAAIT,eAAAA,EAASU,QAAS,EAAG,CACrB,MAAMC,EAAgBC,EAAkB,CAAEV,kBAAkBD,EAAWG,GACvEG,EACIP,EAAQa,IAAIC,GAASC,oUAAAC,CAAA,GACdF,GAAAA,CACHG,KAAMN,EAAcG,EAAKI,OAGrC,GACD,CAAClB,EAASC,IAENK"}
1
+ {"version":3,"file":"useIssuerWithLogo.js","sources":["../../../../../../src/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport { IssuerItem } from '../../../internal/IssuerList/types';\nimport getIssuerImageUrl from '../../../../utils/get-issuer-image';\nimport useImage from '../../../../core/Context/useImage';\n\ninterface UseIssuerWithLogoProps {\n txVariant: string;\n issuers: IssuerItem[];\n}\nexport const useIssuerWithLogo = ({ issuers = [], txVariant }: UseIssuerWithLogoProps): IssuerItem[] => {\n const getImage = useImage();\n const [issuersWithLogo, setIssuersWithLogo] = useState<IssuerItem[]>(issuers);\n\n useEffect(() => {\n if (issuers?.length > 0) {\n const getIssuerIcon = getIssuerImageUrl({}, txVariant, getImage);\n setIssuersWithLogo(\n issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }))\n );\n }\n }, [issuers, txVariant]);\n\n return issuersWithLogo;\n};\n"],"names":["useIssuerWithLogo","issuers","txVariant","getImage","useImage","issuersWithLogo","setIssuersWithLogo","useState","useEffect","length","getIssuerIcon","getIssuerImageUrl","map","item","_object_spread_props","_object_spread","icon","id"],"mappings":"wqBASO,MAAMA,EAAoB,EAAGC,UAAU,GAAIC,gBAC9C,MAAMC,EAAWC,KACVC,EAAiBC,GAAsBC,EAAuBN,GAcrE,OAZAO,EAAU,KACN,IAAIP,eAAAA,EAASQ,QAAS,EAAG,CACrB,MAAMC,EAAgBC,EAAkB,GAAIT,EAAWC,GACvDG,EACIL,EAAQW,IAAIC,GAASC,oUAAAC,CAAA,GACdF,GAAAA,CACHG,KAAMN,EAAcG,EAAKI,OAGrC,GACD,CAAChB,EAASC,IAENG"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../external/preact/dist/preact.js";import r from"../Redirect/Redirect.js";import o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as n}from"../tx-variants.js";import s from"../../utils/get-issuer-image.js";import a from"../internal/PayButton/PayButton.js";import{payAmountLabel as i}from"../internal/PayButton/utils.js";function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){p(e,t,r[t])})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}class y extends r{formatProps(e){return c({keepBrandsVisible:!0,showOtherInsteadOfNumber:!0},e)}formatData(){return{paymentMethod:c({type:this.type},this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId}),browserInfo:this.browserInfo}}get displayName(){return this.props.storedPaymentMethodId&&this.props.label?this.props.label:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.name:""}get brands(){const e=s({},"paybybank",e=>this.resources.getImage(e));return[{icon:e("US-1"),name:"Wells Fargo"},{icon:e("US-2"),name:"Bank of America"},{icon:e("US-3"),name:"Chase"},{icon:e("US-4"),name:"Citi"}]}componentToRender(){return this.props.storedPaymentMethodId?e(a,m(c({},this.props),{classNameModifiers:["standalone"],label:i(this.props.i18n,this.props.amount),showReview:!!this.props.onReview,onClick:this.submit})):e(t,null,e("div",{className:"adyen-checkout-paybybank_AIS_DD"},e("p",{className:"adyen-checkout-paybybank_AIS_DD__description-header"},this.props.i18n.get("payByBankAISDD.disclaimer.header")),e("p",{className:"adyen-checkout-paybybank_AIS_DD__description-body"},this.props.i18n.get("payByBankAISDD.disclaimer.body"))),e(o,m(c({},this.props),{name:this.displayName,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef})))}}p(y,"type",n.paybybank_AIS_DD);export{y as default};
1
+ import{createElement as e,Fragment as t}from"../../external/preact/dist/preact.js";import r from"../Redirect/Redirect.js";import o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as n}from"../tx-variants.js";import s from"../internal/PayButton/PayButton.js";import{payAmountLabel as a}from"../internal/PayButton/utils.js";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){i(e,t,r[t])})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}class m extends r{formatProps(e){return p({keepBrandsVisible:!0,showOtherInsteadOfNumber:!0},e)}formatData(){return{paymentMethod:p({type:this.type},this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId}),browserInfo:this.browserInfo}}get displayName(){return this.props.storedPaymentMethodId&&this.props.label?this.props.label:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.name:""}get brands(){const e=this.resources.getImage({parentFolder:"paybybank/"});return[{icon:e("US-1"),name:"Wells Fargo"},{icon:e("US-2"),name:"Bank of America"},{icon:e("US-3"),name:"Chase"},{icon:e("US-4"),name:"Citi"}]}componentToRender(){return this.props.storedPaymentMethodId?e(s,c(p({},this.props),{classNameModifiers:["standalone"],label:a(this.props.i18n,this.props.amount),showReview:!!this.props.onReview,onClick:this.submit})):e(t,null,e("div",{className:"adyen-checkout-paybybank_AIS_DD"},e("p",{className:"adyen-checkout-paybybank_AIS_DD__description-header"},this.props.i18n.get("payByBankAISDD.disclaimer.header")),e("p",{className:"adyen-checkout-paybybank_AIS_DD__description-body"},this.props.i18n.get("payByBankAISDD.disclaimer.body"))),e(o,c(p({},this.props),{name:this.displayName,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef})))}}i(m,"type",n.paybybank_AIS_DD);export{m as default};
2
2
  //# sourceMappingURL=PayByBankUS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayByBankUS.js","sources":["../../../../src/components/PayByBankUS/PayByBankUS.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport RedirectElement from '../Redirect';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport getIssuerImageUrl from '../../utils/get-issuer-image';\nimport PayButton from '../internal/PayButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\nimport { PaymentMethodBrand } from '../../types/global-types';\nimport './PayByBankUS.scss';\n\nexport default class PayByBankUS extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.paybybank_AIS_DD;\n\n protected formatProps(props) {\n return {\n // paymentMethodBrands configuration\n keepBrandsVisible: true,\n showOtherInsteadOfNumber: true,\n ...props\n };\n }\n\n public formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId\n })\n },\n browserInfo: this.browserInfo\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.label;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? this.props.name : '';\n }\n\n /*\n Hardcode US brands \n */\n get brands(): PaymentMethodBrand[] {\n const getImage = props => this.resources.getImage(props);\n // paybybank_AIS_DD / tx_variant not used here since images are kept in paybybank subfolder\n const getIssuerIcon = getIssuerImageUrl({}, 'paybybank', getImage);\n\n // hardcoding\n return [\n { icon: getIssuerIcon('US-1'), name: 'Wells Fargo' },\n { icon: getIssuerIcon('US-2'), name: 'Bank of America' },\n { icon: getIssuerIcon('US-3'), name: 'Chase' },\n { icon: getIssuerIcon('US-4'), name: 'Citi' }\n ];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <PayButton\n {...this.props}\n classNameModifiers={['standalone']}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n showReview={!!this.props.onReview}\n onClick={this.submit}\n />\n ) : (\n <Fragment>\n <div className=\"adyen-checkout-paybybank_AIS_DD\">\n <p className=\"adyen-checkout-paybybank_AIS_DD__description-header\">{this.props.i18n.get('payByBankAISDD.disclaimer.header')}</p>\n <p className=\"adyen-checkout-paybybank_AIS_DD__description-body\">{this.props.i18n.get('payByBankAISDD.disclaimer.body')}</p>\n </div>\n\n <RedirectButton\n {...this.props}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n </Fragment>\n );\n }\n}\n"],"names":["PayByBankUS","RedirectElement","formatProps","props","_object_spread","keepBrandsVisible","showOtherInsteadOfNumber","formatData","paymentMethod","type","this","storedPaymentMethodId","browserInfo","displayName","label","name","additionalInfo","brands","getIssuerIcon","getIssuerImageUrl","resources","getImage","icon","componentToRender","h","PayButton","classNameModifiers","payAmountLabel","i18n","amount","showReview","onReview","onClick","submit","Fragment","div","className","p","get","RedirectButton","onSubmit","payButton","setComponentRef","_define_property","TxVariants","paybybank_AIS_DD"],"mappings":"+qCAUe,MAAMA,UAAoBC,EAG3BC,WAAAA,CAAYC,GAClB,OAAOC,EAAA,CAEHC,mBAAmB,EACnBC,0BAA0B,GACvB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A5EAC,EADiB3C,EACeS,OAAmBmC,EAAWC"}
1
+ {"version":3,"file":"PayByBankUS.js","sources":["../../../../src/components/PayByBankUS/PayByBankUS.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport RedirectElement from '../Redirect';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport PayButton from '../internal/PayButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\nimport { PaymentMethodBrand } from '../../types/global-types';\nimport './PayByBankUS.scss';\n\nexport default class PayByBankUS extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.paybybank_AIS_DD;\n\n protected formatProps(props) {\n return {\n // paymentMethodBrands configuration\n keepBrandsVisible: true,\n showOtherInsteadOfNumber: true,\n ...props\n };\n }\n\n public formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId\n })\n },\n browserInfo: this.browserInfo\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.label;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? this.props.name : '';\n }\n\n /*\n Hardcode US brands \n */\n get brands(): PaymentMethodBrand[] {\n // paybybank_AIS_DD / tx_variant not used here since images are kept in paybybank subfolder\n const getIssuerIcon = this.resources.getImage({ parentFolder: 'paybybank/' });\n\n // hardcoding\n return [\n { icon: getIssuerIcon('US-1'), name: 'Wells Fargo' },\n { icon: getIssuerIcon('US-2'), name: 'Bank of America' },\n { icon: getIssuerIcon('US-3'), name: 'Chase' },\n { icon: getIssuerIcon('US-4'), name: 'Citi' }\n ];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <PayButton\n {...this.props}\n classNameModifiers={['standalone']}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n showReview={!!this.props.onReview}\n onClick={this.submit}\n />\n ) : (\n <Fragment>\n <div className=\"adyen-checkout-paybybank_AIS_DD\">\n <p className=\"adyen-checkout-paybybank_AIS_DD__description-header\">{this.props.i18n.get('payByBankAISDD.disclaimer.header')}</p>\n <p className=\"adyen-checkout-paybybank_AIS_DD__description-body\">{this.props.i18n.get('payByBankAISDD.disclaimer.body')}</p>\n </div>\n\n <RedirectButton\n {...this.props}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n </Fragment>\n );\n }\n}\n"],"names":["PayByBankUS","RedirectElement","formatProps","props","_object_spread","keepBrandsVisible","showOtherInsteadOfNumber","formatData","paymentMethod","type","this","storedPaymentMethodId","browserInfo","displayName","label","name","additionalInfo","brands","getIssuerIcon","resources","getImage","parentFolder","icon","componentToRender","h","PayButton","classNameModifiers","payAmountLabel","i18n","amount","showReview","onReview","onClick","submit","Fragment","div","className","p","get","RedirectButton","onSubmit","payButton","setComponentRef","_define_property","TxVariants","paybybank_AIS_DD"],"mappings":"goCASe,MAAMA,UAAoBC,EAG3BC,WAAAA,CAAYC,GAClB,OAAOC,EAAA,CAEHC,mBAAmB,EACnBC,0BAA0B,GACvBH,EAEX,CAEOI,UAAAA,GACH,MAAO,CACHC,cAAeJ,EAAA,CACXK,KAAMC,KAAKD,MACPC,KAAKP,MAAMQ,uBAAyB,CACpCA,sBAAuBD,KAAKP,MAAMQ,wBAG1CC,YAAaF,KAAKE,YAE1B,CAEA,eAAIC,GACA,OAAIH,KAAKP,MAAMQ,uBAAyBD,KAAKP,MAAMW,MACxCJ,KAAKP,MAAMW,MAEfJ,KAAKP,MAAMY,IACtB,CAEA,kBAAIC,GACA,OAAON,KAAKP,MAAMQ,sBAAwBD,KAAKP,MAAMY,KAAO,EAChE,CAKA,UAAIE,GAEA,MAAMC,EAAgBR,KAAKS,UAAUC,SAAS,CAAEC,aAAc,eAG9D,MAAO,CACH,CAAEC,KAAMJ,EAAc,QAASH,KAAM,eACrC,CAAEO,KAAMJ,EAAc,QAASH,KAAM,mBACrC,CAAEO,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