@adyen/adyen-web 6.29.0 → 6.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (515) hide show
  1. package/dist/cjs/adyen.css +8 -9
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +705 -641
  6. package/dist/es/adyen.css +8 -9
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  9. package/dist/es/components/Ach/Ach.js +1 -1
  10. package/dist/es/components/Ach/Ach.js.map +1 -1
  11. package/dist/es/components/Ach/components/AccountTypeSelector.js.map +1 -1
  12. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  13. package/dist/es/components/Affirm/Affirm.js.map +1 -1
  14. package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
  15. package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
  16. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  17. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  18. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  19. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  20. package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
  21. package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
  22. package/dist/es/components/AmazonPay/utils.js +1 -1
  23. package/dist/es/components/AmazonPay/utils.js.map +1 -1
  24. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  25. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  26. package/dist/es/components/ApplePay/services/ApplePayService.js +1 -1
  27. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  28. package/dist/es/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
  29. package/dist/es/components/ApplePay/utils/payment-request.js.map +1 -1
  30. package/dist/es/components/Atome/Atome.js.map +1 -1
  31. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  32. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  33. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  34. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  35. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  36. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  37. package/dist/es/components/Blik/Blik.js +1 -1
  38. package/dist/es/components/Blik/Blik.js.map +1 -1
  39. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  40. package/dist/es/components/Card/Card.js +1 -1
  41. package/dist/es/components/Card/Card.js.map +1 -1
  42. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  43. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  44. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  45. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  46. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  47. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  48. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  49. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  50. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  51. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  52. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  53. package/dist/es/components/Card/components/ClickToPayWrapper.js +1 -1
  54. package/dist/es/components/Card/components/ClickToPayWrapper.js.map +1 -1
  55. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  56. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  57. package/dist/es/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
  58. package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
  59. package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
  60. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  61. package/dist/es/components/ClickToPay/ClickToPay.js +1 -1
  62. package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
  63. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  64. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  65. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  66. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  67. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  68. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  69. package/dist/es/components/Dropin/Dropin.js +1 -1
  70. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  71. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  72. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  73. package/dist/es/components/Dropin/components/DropinSuccessState.js +2 -0
  74. package/dist/es/components/Dropin/components/DropinSuccessState.js.map +1 -0
  75. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  76. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  77. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  78. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  79. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  80. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  81. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  82. package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
  83. package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
  84. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  85. package/dist/es/components/Iris/Iris.js +1 -1
  86. package/dist/es/components/Iris/Iris.js.map +1 -1
  87. package/dist/es/components/Iris/components/IrisGenerateQRCode.js +1 -1
  88. package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  89. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  90. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  91. package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  92. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  93. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  94. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  95. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  96. package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
  97. package/dist/es/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
  98. package/dist/es/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  99. package/dist/es/components/PayByBankPix/services/PasskeyService.js.map +1 -1
  100. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  101. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  102. package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  103. package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  104. package/dist/es/components/PayTo/PayTo.js +1 -1
  105. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  106. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  107. package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
  108. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  109. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  110. package/dist/es/components/Pix/components/PixQRDetails.js +1 -1
  111. package/dist/es/components/Pix/components/PixQRDetails.js.map +1 -1
  112. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  113. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  114. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  115. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  116. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  117. package/dist/es/components/Twint/Twint.js +1 -1
  118. package/dist/es/components/Twint/Twint.js.map +1 -1
  119. package/dist/es/components/UPI/UPI.js +1 -1
  120. package/dist/es/components/UPI/UPI.js.map +1 -1
  121. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  122. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  123. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  124. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  125. package/dist/es/components/UPI/constants.js +1 -1
  126. package/dist/es/components/UPI/constants.js.map +1 -1
  127. package/dist/es/components/components-name-map.js +1 -1
  128. package/dist/es/components/components-name-map.js.map +1 -1
  129. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  130. package/dist/es/components/internal/Await/Await.js +1 -1
  131. package/dist/es/components/internal/Await/Await.js.map +1 -1
  132. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  133. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  134. package/dist/es/components/internal/Button/Button.js +1 -1
  135. package/dist/es/components/internal/Button/Button.js.map +1 -1
  136. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  137. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  138. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  139. package/dist/es/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  140. package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
  141. package/dist/es/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
  142. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  143. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  144. package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  145. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  146. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  147. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  148. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  149. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  150. package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  151. package/dist/es/components/internal/Countdown/index.js +1 -1
  152. package/dist/es/components/internal/Countdown/index.js.map +1 -1
  153. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  154. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  155. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  156. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  157. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  158. package/dist/es/components/internal/PayButton/utils.js +1 -1
  159. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  160. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  161. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  162. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  163. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  164. package/dist/es/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  165. package/dist/es/components/internal/QRLoader/components/QRDetails.js +1 -1
  166. package/dist/es/components/internal/QRLoader/components/QRDetails.js.map +1 -1
  167. package/dist/es/components/internal/QRLoader/components/QRImage.js +1 -1
  168. package/dist/es/components/internal/QRLoader/components/QRImage.js.map +1 -1
  169. package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
  170. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  171. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  172. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  173. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  174. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  175. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  176. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  177. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  178. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  179. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  180. package/dist/es/components/internal/SecuredFields/utils.js.map +1 -1
  181. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  182. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  183. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  184. package/dist/es/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  185. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  186. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  187. package/dist/es/components/tx-variants.js +1 -1
  188. package/dist/es/components/tx-variants.js.map +1 -1
  189. package/dist/es/core/Analytics/Analytics.js +1 -1
  190. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  191. package/dist/es/core/Analytics/AnalyticsService.js.map +1 -1
  192. package/dist/es/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
  193. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  194. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  195. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  196. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  197. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  198. package/dist/es/core/Analytics/utils.js +1 -1
  199. package/dist/es/core/Analytics/utils.js.map +1 -1
  200. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  201. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  202. package/dist/es/core/Context/AmountProvider.js +2 -0
  203. package/dist/es/core/Context/AmountProvider.js.map +1 -0
  204. package/dist/es/core/Context/Resources.js.map +1 -1
  205. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  206. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  207. package/dist/es/core/config.js +1 -1
  208. package/dist/es/core/core.js +1 -1
  209. package/dist/es/core/core.js.map +1 -1
  210. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  211. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  212. package/dist/es/external/preact/dist/preact.js +1 -1
  213. package/dist/es/external/preact/dist/preact.js.map +1 -1
  214. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  215. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  216. package/dist/es/index.d.ts +705 -641
  217. package/dist/es/language/Language.js.map +1 -1
  218. package/dist/es/utils/Script.js.map +1 -1
  219. package/dist/es/utils/Storage.js +1 -1
  220. package/dist/es/utils/Storage.js.map +1 -1
  221. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  222. package/dist/es/utils/Validator/Validator.js.map +1 -1
  223. package/dist/es/utils/amount-util.js +1 -1
  224. package/dist/es/utils/amount-util.js.map +1 -1
  225. package/dist/es/utils/browserInfo.js +1 -1
  226. package/dist/es/utils/browserInfo.js.map +1 -1
  227. package/dist/es/utils/constants/currency-minor-units.js.map +1 -1
  228. package/dist/es/utils/createSdkData.js.map +1 -1
  229. package/dist/es/utils/getErrorMessage.js.map +1 -1
  230. package/dist/es/utils/getProp.js +1 -1
  231. package/dist/es/utils/getProp.js.map +1 -1
  232. package/dist/es/utils/hasOwnProperty.js.map +1 -1
  233. package/dist/es/utils/isValidURL.js.map +1 -1
  234. package/dist/es/utils/listenerUtils.js.map +1 -1
  235. package/dist/es/utils/promiseTimeout.js.map +1 -1
  236. package/dist/es/utils/textUtils.js.map +1 -1
  237. package/dist/es/utils/validator-utils.js.map +1 -1
  238. package/dist/es-legacy/adyen.css +8 -9
  239. package/dist/es-legacy/adyen.css.map +1 -1
  240. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  241. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  242. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  243. package/dist/es-legacy/components/Ach/components/AccountTypeSelector.js.map +1 -1
  244. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  245. package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
  246. package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
  247. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
  248. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  249. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  250. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  251. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  252. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
  253. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
  254. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  255. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  256. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  257. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  258. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js +1 -1
  259. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  260. package/dist/es-legacy/components/ApplePay/utils/map-adyen-brands-to-applepay-brands.js.map +1 -1
  261. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  262. package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
  263. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  264. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  265. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  266. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  267. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  268. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  269. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  270. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  271. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  272. package/dist/es-legacy/components/Card/Card.js +1 -1
  273. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  274. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  275. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  276. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  277. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  278. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  279. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  280. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  281. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  282. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  283. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  284. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  285. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  286. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  287. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  288. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  289. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  290. package/dist/es-legacy/components/Card/components/Fastlane/USOnlyPhoneInput.js.map +1 -1
  291. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  292. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  293. package/dist/es-legacy/components/CashAppPay/services/CashAppSdkLoader.js.map +1 -1
  294. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
  295. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
  296. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  297. package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
  298. package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
  299. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  300. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  301. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  302. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  303. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  304. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  305. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  306. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  307. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  308. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  309. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  310. package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js +2 -0
  311. package/dist/es-legacy/components/Dropin/components/DropinSuccessState.js.map +1 -0
  312. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  313. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  314. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  315. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  316. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  317. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  318. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  319. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
  320. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
  321. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  322. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  323. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  324. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  325. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +1 -1
  326. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  327. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  328. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  329. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  330. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  331. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  332. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  333. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  334. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  335. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  336. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
  337. package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js +1 -1
  338. package/dist/es-legacy/components/PayByBankPix/components/StoredPayment/StoredPayment.js.map +1 -1
  339. package/dist/es-legacy/components/PayByBankPix/services/PasskeySdkLoader.js.map +1 -1
  340. package/dist/es-legacy/components/PayByBankPix/services/PasskeyService.js.map +1 -1
  341. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  342. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  343. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  344. package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  345. package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  346. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  347. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  348. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  349. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
  350. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  351. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
  352. package/dist/es-legacy/components/Pix/components/PixQRDetails.js +1 -1
  353. package/dist/es-legacy/components/Pix/components/PixQRDetails.js.map +1 -1
  354. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  355. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  356. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  357. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  358. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  359. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  360. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  361. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  362. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  363. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  364. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  365. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  366. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  367. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  368. package/dist/es-legacy/components/UPI/constants.js +1 -1
  369. package/dist/es-legacy/components/UPI/constants.js.map +1 -1
  370. package/dist/es-legacy/components/components-name-map.js +1 -1
  371. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  372. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  373. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  374. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  375. package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
  376. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  377. package/dist/es-legacy/components/internal/Await/Await.js +1 -1
  378. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  379. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  380. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  381. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  382. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  383. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  384. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  385. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  386. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js +1 -1
  387. package/dist/es-legacy/components/internal/ClickToPay/components/CtPInfo/CtPInfoModal/CtPInfoModal.js.map +1 -1
  388. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  389. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  390. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js +1 -1
  391. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayContext.js.map +1 -1
  392. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  393. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  394. package/dist/es-legacy/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  395. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  396. package/dist/es-legacy/components/internal/ClickToPay/services/create-clicktopay-service.js.map +1 -1
  397. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  398. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  399. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  400. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  401. package/dist/es-legacy/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  402. package/dist/es-legacy/components/internal/Countdown/index.js +1 -1
  403. package/dist/es-legacy/components/internal/Countdown/index.js.map +1 -1
  404. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  405. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  406. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  407. package/dist/es-legacy/components/internal/FormFields/RadioGroupExtended/RadioGroupExtended.js.map +1 -1
  408. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  409. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  410. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  411. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  412. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  413. package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
  414. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  415. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  416. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  417. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  418. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  419. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  420. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  421. package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js +1 -1
  422. package/dist/es-legacy/components/internal/QRLoader/components/QRDetails.js.map +1 -1
  423. package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js +1 -1
  424. package/dist/es-legacy/components/internal/QRLoader/components/QRImage.js.map +1 -1
  425. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  426. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  427. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  428. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  429. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  430. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  431. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  432. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  433. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  434. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
  435. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  436. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  437. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  438. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  439. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  440. package/dist/es-legacy/components/internal/SecuredFields/utils.js.map +1 -1
  441. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  442. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  443. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js +1 -1
  444. package/dist/es-legacy/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js.map +1 -1
  445. package/dist/es-legacy/components/internal/Tooltip/Tooltip.js.map +1 -1
  446. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  447. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  448. package/dist/es-legacy/components/tx-variants.js +1 -1
  449. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  450. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  451. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  452. package/dist/es-legacy/core/Analytics/AnalyticsService.js.map +1 -1
  453. package/dist/es-legacy/core/Analytics/events/AbstractAnalyticsEvent.js.map +1 -1
  454. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  455. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  456. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  457. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  458. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  459. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  460. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  461. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
  462. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
  463. package/dist/es-legacy/core/Context/AmountProvider.js +2 -0
  464. package/dist/es-legacy/core/Context/AmountProvider.js.map +1 -0
  465. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  466. package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
  467. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  468. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  469. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  470. package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  471. package/dist/es-legacy/core/Services/http.js.map +1 -1
  472. package/dist/es-legacy/core/config.js +1 -1
  473. package/dist/es-legacy/core/core.js +1 -1
  474. package/dist/es-legacy/core/core.js.map +1 -1
  475. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  476. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  477. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  478. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  479. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  480. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  481. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  482. package/dist/es-legacy/language/Language.js.map +1 -1
  483. package/dist/es-legacy/utils/Script.js.map +1 -1
  484. package/dist/es-legacy/utils/Storage.js +1 -1
  485. package/dist/es-legacy/utils/Storage.js.map +1 -1
  486. package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
  487. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  488. package/dist/es-legacy/utils/amount-util.js +1 -1
  489. package/dist/es-legacy/utils/amount-util.js.map +1 -1
  490. package/dist/es-legacy/utils/browserInfo.js +1 -1
  491. package/dist/es-legacy/utils/browserInfo.js.map +1 -1
  492. package/dist/es-legacy/utils/constants/currency-minor-units.js.map +1 -1
  493. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  494. package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
  495. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  496. package/dist/es-legacy/utils/getProp.js +1 -1
  497. package/dist/es-legacy/utils/getProp.js.map +1 -1
  498. package/dist/es-legacy/utils/hasOwnProperty.js.map +1 -1
  499. package/dist/es-legacy/utils/isValidURL.js.map +1 -1
  500. package/dist/es-legacy/utils/listenerUtils.js.map +1 -1
  501. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  502. package/dist/es-legacy/utils/textUtils.js.map +1 -1
  503. package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
  504. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  505. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  506. package/package.json +11 -11
  507. package/styles/adyen.css +8 -9
  508. package/dist/es/components/UPI/components/VpaInput/VpaInput.js +0 -2
  509. package/dist/es/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
  510. package/dist/es/components/UPI/components/VpaInput/validate.js +0 -2
  511. package/dist/es/components/UPI/components/VpaInput/validate.js.map +0 -1
  512. package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js +0 -2
  513. package/dist/es-legacy/components/UPI/components/VpaInput/VpaInput.js.map +0 -1
  514. package/dist/es-legacy/components/UPI/components/VpaInput/validate.js +0 -2
  515. package/dist/es-legacy/components/UPI/components/VpaInput/validate.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as l,useEffect as n}from"../../../../../../external/preact/hooks/dist/hooks.js";import t from"../../../../../internal/FormFields/Field/Field.js";import{useCoreContext as a}from"../../../../../../core/Context/CoreProvider.js";import s from"../../../../../internal/FormFields/Fieldset/Fieldset.js";import i from"../../../../../internal/FormFields/RadioGroup/RadioGroup.js";import o from"../../../../../internal/FormFields/Select/Select.js";import{alternativeLabelContent as r}from"../FieldLabelAlternative.js";function m(e,l,n){return l in e?Object.defineProperty(e,l,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[l]=n,e}function u(u){var d,v;const{i18n:c}=a(),{amount:p,brand:f,onChange:b,type:g}=u,h=u.installmentOptions[f]||u.installmentOptions.card,y=1===(null==h||null===(d=h.values)||void 0===d?void 0:d.length),[j,F]=l((null==h?void 0:h.preselectedValue)||(null==h?void 0:h.values[0])),[O,C]=l("onetime"),E=null==h||null===(v=h.plans)||void 0===v?void 0:v.includes("revolving"),N=e=>{const l=e.target.value;F(Number(l))},_=e=>{const l=e.currentTarget.getAttribute("value");C(l)},w=e=>{let l,n;var t;return"amount"===g?(l="installmentOption",n={count:e,values:{times:e,partialValue:(t=e,c.amount(p.value/t,p.currency))}}):(l="installmentOptionMonths",n={count:e,values:{times:e}}),{id:e,name:p.value?c.get(l,n):`${e}`}};return n(()=>{var e,l;(null==h||null===(l=h.values)||void 0===l?void 0:l.includes(j))||F(null!==(e=null==h?void 0:h.preselectedValue)&&void 0!==e?e:null==h?void 0:h.values[0])},[f]),n(()=>{const e=function(e){for(var l=1;l<arguments.length;l++){var n=null!=arguments[l]?arguments[l]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(l){m(e,l,n[l])})}return e}({value:j},E&&"revolving"===O&&{plan:O,value:1},E&&"onetime"===O&&{value:1});b(h?e:{value:null})},[j,h,O]),h?0===p.value?null:E?e("div",{className:"adyen-checkout__installments adyen-checkout__installments--revolving-plan"},e(t,{label:c.get("installments"),classNameModifiers:["installments"],name:"installmentsPseudoLabel",useLabelElement:!1,showContextualElement:!1,renderAlternativeToLabel:r},e(s,{classNameModifiers:["revolving-plan"],label:""},e(i,{items:[{id:"onetime",name:"installments.oneTime"},{id:"installments",name:"installments.installments"},{id:"revolving",name:"installments.revolving"}],onChange:_,value:O,ariaLabel:c.get("installments")}),e(t,{className:"installments"!==O?"revolving-plan-installments__disabled":"revolving-plan-installments",classNameModifiers:["revolving-plan-installments"],name:"",useLabelElement:!1,showContextualElement:!1},e(o,{filterable:!1,items:h.values.map(w),selectedValue:j,onChange:N,name:"installments",disabled:"installments"!==O}))))):e("div",{className:"adyen-checkout__installments"},e(t,{label:c.get("installments"),classNameModifiers:["installments"],name:"installments",showContextualElement:!1},e(o,{filterable:!1,items:h.values.map(w),selectedValue:j,onChange:N,name:"installments",readonly:y,disabled:y}))):null}u.defaultProps={brand:"",amount:{},onChange:()=>{}};export{u as default};
1
+ import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as l,useMemo as n,useEffect as t}from"../../../../../../external/preact/hooks/dist/hooks.js";import a from"../../../../../internal/FormFields/Field/Field.js";import{useCoreContext as s}from"../../../../../../core/Context/CoreProvider.js";import i from"../../../../../internal/FormFields/Fieldset/Fieldset.js";import o from"../../../../../internal/FormFields/RadioGroup/RadioGroup.js";import r from"../../../../../internal/FormFields/Select/Select.js";import{alternativeLabelContent as u}from"../FieldLabelAlternative.js";import{useAmount as m}from"../../../../../../core/Context/AmountProvider.js";function d(e,l,n){return l in e?Object.defineProperty(e,l,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[l]=n,e}function v(v){var c,p,b;const{i18n:f}=s(),{amount:g}=m(),{brand:h,onChange:j,type:y}=v,F=v.installmentOptions[h]||v.installmentOptions.card,O=1===(null==F||null===(c=F.values)||void 0===c?void 0:c.length),[C,x]=l((null==F?void 0:F.preselectedValue)||(null==F?void 0:F.values[0])),[E,N]=l("onetime"),P=(null==F||null===(p=F.plans)||void 0===p?void 0:p.includes("revolving"))||(null==F||null===(b=F.plans)||void 0===b?void 0:b.includes("bonus")),_=n(()=>function(e,l){return e?[{id:"onetime",name:"installments.oneTime"},{id:"installments",name:"installments.installments"},...(null==l?void 0:l.includes("revolving"))?[{id:"revolving",name:"installments.revolving"}]:[],...(null==l?void 0:l.includes("bonus"))?[{id:"bonus",name:"installments.bonus"}]:[]]:[]}(P,null==F?void 0:F.plans),[P,F]),w=e=>{const l=e.target.value;x(Number(l))},k=e=>{const l=e.currentTarget.getAttribute("value");N(l)},L=e=>{let l,n;if("amount"===y){l="installmentOption",n={count:e,values:{times:e,partialValue:(e=>f.amount(g.value/e,g.currency))(e)}}}else l="installmentOptionMonths",n={count:e,values:{times:e}};return{id:e,name:g.value?f.get(l,n):`${e}`}};return t(()=>{var e,l;(null==F||null===(l=F.values)||void 0===l?void 0:l.includes(C))||x(null!==(e=null==F?void 0:F.preselectedValue)&&void 0!==e?e:null==F?void 0:F.values[0])},[h]),t(()=>{const e=function(e){for(var l=1;l<arguments.length;l++){var n=null!=arguments[l]?arguments[l]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(l){d(e,l,n[l])})}return e}({value:C},P&&"onetime"===E&&{value:1},P&&"revolving"===E&&{value:1,plan:"revolving"},P&&"bonus"===E&&{value:1,plan:"bonus"});j(F?e:{value:null})},[j,P,C,F,E]),F?0===g.value?null:P?e("div",{className:"adyen-checkout__installments adyen-checkout__installments--revolving-plan"},e(a,{label:f.get("installments"),classNameModifiers:["installments"],name:"installmentsPseudoLabel",useLabelElement:!1,showContextualElement:!1,renderAlternativeToLabel:u},e(i,{classNameModifiers:["revolving-plan"],label:""},e(o,{items:_,onChange:k,value:E,ariaLabel:f.get("installments")}),e(a,{className:"installments"!==E?"revolving-plan-installments__disabled":"revolving-plan-installments",classNameModifiers:["revolving-plan-installments"],name:"",useLabelElement:!1,showContextualElement:!1},e(r,{filterable:!1,items:F.values.map(L),selectedValue:C,onChange:w,name:"installments",disabled:"installments"!==E}))))):e("div",{className:"adyen-checkout__installments"},e(a,{label:f.get("installments"),classNameModifiers:["installments"],name:"installments",showContextualElement:!1},e(r,{filterable:!1,items:F.values.map(L),selectedValue:C,onChange:w,name:"installments",readonly:O,disabled:O}))):null}v.defaultProps={brand:"",onChange:()=>{}};export{v as default};
2
2
  //# sourceMappingURL=Installments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Installments.js","sources":["../../../../../../../../src/components/Card/components/CardInput/components/Installments/Installments.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport Field from '../../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { InstallmentsItem, InstallmentsProps } from '../types';\nimport Fieldset from '../../../../../internal/FormFields/Fieldset/Fieldset';\nimport RadioGroup from '../../../../../internal/FormFields/RadioGroup';\nimport Select from '../../../../../internal/FormFields/Select';\nimport { alternativeLabelContent } from '../FieldLabelAlternative';\nimport './Installments.scss';\n\nexport interface InstallmentsObj {\n value: number;\n plan?: 'revolving';\n}\n\n/**\n * Installments generic dropdown\n */\nfunction Installments(props: InstallmentsProps) {\n const { i18n } = useCoreContext();\n const { amount, brand, onChange, type } = props;\n const installmentOptions = props.installmentOptions[brand] || props.installmentOptions.card;\n const readOnly = installmentOptions?.values?.length === 1;\n const [installmentAmount, setInstallmentAmount] = useState(installmentOptions?.preselectedValue || installmentOptions?.values[0]);\n const [radioBtnValue, setRadioBtnValue] = useState('onetime');\n\n // hasRadioButtonUI determines if we have 3 radio buttons in the UI ('onetime', 'installments' and 'revolving')\n const hasRadioButtonUI = installmentOptions?.plans?.includes('revolving');\n const getPartialAmount = (divider: number): string => i18n.amount(amount.value / divider, amount.currency);\n\n const onSelectInstallment = e => {\n const selectedInstallments = e.target.value;\n setInstallmentAmount(Number(selectedInstallments));\n };\n\n const onRadioSelect = e => {\n const selectedBtn = e.currentTarget.getAttribute('value');\n setRadioBtnValue(selectedBtn);\n };\n\n const installmentItemsMapper = (value: number): InstallmentsItem => {\n let translationKey;\n let translationObj;\n\n if (type === 'amount') {\n translationKey = 'installmentOption';\n translationObj = { count: value, values: { times: value, partialValue: getPartialAmount(value) } };\n } else {\n translationKey = `installmentOptionMonths`;\n translationObj = { count: value, values: { times: value } };\n }\n\n return {\n id: value,\n name: amount.value ? i18n.get(translationKey, translationObj) : `${value}`\n };\n };\n\n useEffect(() => {\n if (installmentOptions?.values?.includes(installmentAmount)) {\n return;\n }\n\n setInstallmentAmount(installmentOptions?.preselectedValue ?? installmentOptions?.values[0]);\n }, [brand]);\n\n useEffect(() => {\n const stateObj: InstallmentsObj = {\n value: installmentAmount, // No radio button interface or \"installments\" radio button selected\n ...(hasRadioButtonUI && radioBtnValue === 'revolving' && { plan: radioBtnValue, value: 1 }),\n ...(hasRadioButtonUI && radioBtnValue === 'onetime' && { value: 1 })\n };\n\n onChange(installmentOptions ? stateObj : { value: null });\n }, [installmentAmount, installmentOptions, radioBtnValue]);\n\n if (!installmentOptions) return null;\n if (amount.value === 0) return null;\n\n // Alternate interface for installments with the possibility of a \"revolving\" plan\n if (hasRadioButtonUI) {\n return (\n <div className=\"adyen-checkout__installments adyen-checkout__installments--revolving-plan\">\n <Field\n label={i18n.get('installments')}\n classNameModifiers={['installments']}\n name={'installmentsPseudoLabel'}\n useLabelElement={false}\n showContextualElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <Fieldset classNameModifiers={['revolving-plan']} label={''}>\n <RadioGroup\n items={[\n { id: 'onetime', name: 'installments.oneTime' },\n { id: 'installments', name: 'installments.installments' },\n { id: 'revolving', name: 'installments.revolving' }\n ]}\n onChange={onRadioSelect}\n value={radioBtnValue}\n ariaLabel={i18n.get('installments')}\n />\n\n <Field\n className={radioBtnValue !== 'installments' ? 'revolving-plan-installments__disabled' : 'revolving-plan-installments'}\n classNameModifiers={['revolving-plan-installments']}\n name={''}\n useLabelElement={false}\n showContextualElement={false}\n >\n <Select\n filterable={false}\n items={installmentOptions.values.map(installmentItemsMapper)}\n selectedValue={installmentAmount}\n onChange={onSelectInstallment}\n name={'installments'}\n disabled={radioBtnValue !== 'installments'}\n />\n </Field>\n </Fieldset>\n </Field>\n </div>\n );\n }\n\n return (\n <div className=\"adyen-checkout__installments\">\n <Field label={i18n.get('installments')} classNameModifiers={['installments']} name={'installments'} showContextualElement={false}>\n <Select\n filterable={false}\n items={installmentOptions.values.map(installmentItemsMapper)}\n selectedValue={installmentAmount}\n onChange={onSelectInstallment}\n name={'installments'}\n readonly={readOnly}\n disabled={readOnly}\n />\n </Field>\n </div>\n );\n}\n\nInstallments.defaultProps = {\n brand: '',\n amount: {},\n onChange: () => {}\n};\n\nexport default Installments;\n"],"names":["Installments","props","installmentOptions","i18n","useCoreContext","amount","brand","onChange","type","card","readOnly","values","length","installmentAmount","setInstallmentAmount","useState","preselectedValue","radioBtnValue","setRadioBtnValue","hasRadioButtonUI","plans","includes","onSelectInstallment","e","selectedInstallments","target","value","Number","onRadioSelect","selectedBtn","currentTarget","getAttribute","installmentItemsMapper","translationKey","translationObj","divider","count","times","partialValue","currency","id","name","get","useEffect","_ref","stateObj","_object_spread","plan","h","div","className","Field","label","classNameModifiers","useLabelElement","showContextualElement","renderAlternativeToLabel","alternativeLabelContent","Fieldset","RadioGroup","items","ariaLabel","Select","filterable","map","selectedValue","disabled","readonly","defaultProps"],"mappings":"qtBAmBA,SAASA,EAAaC,OAIDC,EAKQA,EARzB,MAAMC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0B,SAAUzD,EACVwD,SAAUxD,MA3DM,IAgEpC,CAEAV,EAAaoE,aAAe,CACxB9D,MAAO,GACPD,OAAQ,CAAA,EACRE,SAAU"}
1
+ {"version":3,"file":"Installments.js","sources":["../../../../../../../../src/components/Card/components/CardInput/components/Installments/Installments.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useEffect, useMemo } from 'preact/hooks';\nimport Field from '../../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { InstallmentsItem } from '../types';\nimport Fieldset from '../../../../../internal/FormFields/Fieldset/Fieldset';\nimport RadioGroup from '../../../../../internal/FormFields/RadioGroup';\nimport Select from '../../../../../internal/FormFields/Select';\nimport { alternativeLabelContent } from '../FieldLabelAlternative';\nimport { useAmount } from '../../../../../../core/Context/AmountProvider';\n\nimport './Installments.scss';\n\nexport type InstallmentPlan = 'revolving' | 'bonus' | 'regular';\n\nexport interface InstallmentsState {\n value: number | null;\n plan?: InstallmentPlan;\n}\n\nexport interface InstallmentOption {\n values: number[];\n plans?: InstallmentPlan[];\n preselectedValue?: number;\n}\n\nexport interface InstallmentOptions {\n [key: string]: InstallmentOption;\n}\nexport interface InstallmentsProps {\n brand?: string;\n onChange?: (installmentObject: InstallmentsState) => void;\n installmentOptions: InstallmentOptions;\n type?: string;\n}\n\nfunction createRadioGroupItems(hasRadioButtonUI: boolean, plans?: InstallmentPlan[]): { id: string; name: string }[] {\n if (!hasRadioButtonUI) {\n return [];\n }\n\n return [\n { id: 'onetime', name: 'installments.oneTime' },\n { id: 'installments', name: 'installments.installments' },\n ...(plans?.includes('revolving') ? [{ id: 'revolving', name: 'installments.revolving' }] : []),\n ...(plans?.includes('bonus') ? [{ id: 'bonus', name: 'installments.bonus' }] : [])\n ];\n}\n\nfunction Installments(props: Readonly<InstallmentsProps>) {\n const { i18n } = useCoreContext();\n const { amount } = useAmount();\n const { brand, onChange, type } = props;\n const installmentOptions = props.installmentOptions[brand] || props.installmentOptions.card;\n const readOnly = installmentOptions?.values?.length === 1;\n const [installmentAmount, setInstallmentAmount] = useState(installmentOptions?.preselectedValue || installmentOptions?.values[0]);\n const [radioBtnValue, setRadioBtnValue] = useState('onetime');\n\n const hasRadioButtonUI = installmentOptions?.plans?.includes('revolving') || installmentOptions?.plans?.includes('bonus');\n const radioGroupItems = useMemo(() => createRadioGroupItems(hasRadioButtonUI, installmentOptions?.plans), [hasRadioButtonUI, installmentOptions]);\n\n const onSelectInstallment = e => {\n const selectedInstallments = e.target.value;\n setInstallmentAmount(Number(selectedInstallments));\n };\n\n const onRadioSelect = e => {\n const selectedBtn = e.currentTarget.getAttribute('value');\n setRadioBtnValue(selectedBtn);\n };\n\n const installmentItemsMapper = (value: number): InstallmentsItem => {\n let translationKey;\n let translationObj;\n\n if (type === 'amount') {\n const getPartialAmount = (divider: number): string => i18n.amount(amount.value / divider, amount.currency);\n\n translationKey = 'installmentOption';\n translationObj = { count: value, values: { times: value, partialValue: getPartialAmount(value) } };\n } else {\n translationKey = `installmentOptionMonths`;\n translationObj = { count: value, values: { times: value } };\n }\n\n return {\n id: value,\n name: amount.value ? i18n.get(translationKey, translationObj) : `${value}`\n };\n };\n\n useEffect(() => {\n if (installmentOptions?.values?.includes(installmentAmount)) {\n return;\n }\n\n setInstallmentAmount(installmentOptions?.preselectedValue ?? installmentOptions?.values[0]);\n }, [brand]);\n\n useEffect(() => {\n const state: InstallmentsState = {\n value: installmentAmount,\n ...(hasRadioButtonUI && radioBtnValue === 'onetime' && { value: 1 }),\n ...(hasRadioButtonUI && radioBtnValue === 'revolving' && { value: 1, plan: 'revolving' }),\n ...(hasRadioButtonUI && radioBtnValue === 'bonus' && { value: 1, plan: 'bonus' })\n };\n\n onChange(installmentOptions ? state : { value: null });\n }, [onChange, hasRadioButtonUI, installmentAmount, installmentOptions, radioBtnValue]);\n\n if (!installmentOptions) return null;\n if (amount.value === 0) return null;\n\n if (hasRadioButtonUI) {\n return (\n <div className=\"adyen-checkout__installments adyen-checkout__installments--revolving-plan\">\n <Field\n label={i18n.get('installments')}\n classNameModifiers={['installments']}\n name={'installmentsPseudoLabel'}\n useLabelElement={false}\n showContextualElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <Fieldset classNameModifiers={['revolving-plan']} label={''}>\n <RadioGroup items={radioGroupItems} onChange={onRadioSelect} value={radioBtnValue} ariaLabel={i18n.get('installments')} />\n\n <Field\n className={radioBtnValue !== 'installments' ? 'revolving-plan-installments__disabled' : 'revolving-plan-installments'}\n classNameModifiers={['revolving-plan-installments']}\n name={''}\n useLabelElement={false}\n showContextualElement={false}\n >\n <Select\n filterable={false}\n items={installmentOptions.values.map(installmentItemsMapper)}\n selectedValue={installmentAmount}\n onChange={onSelectInstallment}\n name={'installments'}\n disabled={radioBtnValue !== 'installments'}\n />\n </Field>\n </Fieldset>\n </Field>\n </div>\n );\n }\n\n return (\n <div className=\"adyen-checkout__installments\">\n <Field label={i18n.get('installments')} classNameModifiers={['installments']} name={'installments'} showContextualElement={false}>\n <Select\n filterable={false}\n items={installmentOptions.values.map(installmentItemsMapper)}\n selectedValue={installmentAmount}\n onChange={onSelectInstallment}\n name={'installments'}\n readonly={readOnly}\n disabled={readOnly}\n />\n </Field>\n </div>\n );\n}\n\nInstallments.defaultProps = {\n brand: '',\n onChange: () => {}\n};\n\nexport default Installments;\n"],"names":["Installments","props","installmentOptions","i18n","useCoreContext","amount","useAmount","brand","onChange","type","card","readOnly","values","length","installmentAmount","setInstallmentAmount","useState","preselectedValue","radioBtnValue","setRadioBtnValue","hasRadioButtonUI","plans","includes","radioGroupItems","useMemo","id","name","createRadioGroupItems","onSelectInstallment","e","selectedInstallments","target","value","Number","onRadioSelect","selectedBtn","currentTarget","getAttribute","installmentItemsMapper","translationKey","translationObj","count","times","partialValue","divider","currency","getPartialAmount","get","useEffect","_ref","state","_object_spread","plan","h","div","className","Field","label","classNameModifiers","useLabelElement","showContextualElement","renderAlternativeToLabel","alternativeLabelContent","Fieldset","RadioGroup","items","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B,EAAeF,MAAOd,EAAegD,UAAW/D,EAAK4C,IAAI,kBAEvGM,EAACG,EAAAA,CACGD,UAA6B,iBAAlBrC,EAAmC,wCAA0C,8BACxFwC,mBAAoB,CAAC,+BACrBhC,KAAM,GACNiC,iBAAiB,EACjBC,uBAAuB,GAEvBP,EAACc,EAAAA,CACGC,YAAY,EACZH,MAAO/D,EAAmBU,OAAOyD,IAAI/B,GACrCgC,cAAexD,EACfN,SAAUoB,EACVF,KAAM,eACN6C,SAA4B,iBAAlBrD,QAUlCmC,EAACC,MAAAA,CAAIC,UAAU,gCACXF,EAACG,EAAAA,CAAMC,MAAOtD,EAAK4C,IAAI,gBAAiBW,mBAAoB,CAAC,gBAAiBhC,KAAM,eAAgBkC,uBAAuB,GACvHP,EAACc,EAAAA,CACGC,YAAY,EACZH,MAAO/D,EAAmBU,OAAOyD,IAAI/B,GACrCgC,cAAexD,EACfN,SAAUoB,EACVF,KAAM,eACN8C,SAAU7D,EACV4D,SAAU5D,MAjDM,IAsDpC,CAEAX,EAAayE,aAAe,CACxBlE,MAAO,GACPC,SAAU"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import s from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import t from"./StoredCardFields.js";import a from"./Installments/Installments.js";import n from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";const r=({sfpState:r,setFocusOn:l,cvcPolicy:o,focusedElement:i,hasInstallments:m,handleInstallments:p,showAmountsInInstallments:c,showContextualElement:d,amount:u,hasCVC:h,installmentOptions:x,lastFour:f,expiryMonth:g,expiryYear:C,disclaimerMessage:y})=>e(s,{status:r.status},e(t,{errors:r.errors,brand:r.brand,hasCVC:h,cvcPolicy:o,onFocusField:l,focusedElement:i,valid:r.valid,lastFour:f,expiryMonth:g,expiryYear:C,showContextualElement:d}),m&&e(a,{amount:u,brand:r.brand,installmentOptions:x,onChange:p,type:c?"amount":"months"}),y&&e(n,{message:y.message.replace("%{linkText}",`%#${y.linkText}%#`),urls:[y.link]}));export{r as StoredCardFieldsWrapper};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import s from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import t from"./StoredCardFields.js";import a from"./Installments/Installments.js";import n from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";const r=({sfpState:r,setFocusOn:l,cvcPolicy:o,focusedElement:i,hasInstallments:m,handleInstallments:p,showAmountsInInstallments:c,showContextualElement:d,hasCVC:u,installmentOptions:h,lastFour:x,expiryMonth:f,expiryYear:g,disclaimerMessage:C})=>e(s,{status:r.status},e(t,{errors:r.errors,brand:r.brand,hasCVC:u,cvcPolicy:o,onFocusField:l,focusedElement:i,valid:r.valid,lastFour:x,expiryMonth:f,expiryYear:g,showContextualElement:d}),m&&e(a,{brand:r.brand,installmentOptions:h,onChange:p,type:c?"amount":"months"}),C&&e(n,{message:C.message.replace("%{linkText}",`%#${C.linkText}%#`),urls:[C.link]}));export{r as StoredCardFieldsWrapper};
2
2
  //# sourceMappingURL=StoredCardFieldsWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoredCardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/StoredCardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport StoredCardFields from './StoredCardFields';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\n\nexport const StoredCardFieldsWrapper = ({\n // base (shared)\n // n/a\n // vars created in CardInput:\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n showContextualElement,\n // props passed through from CardInput:\n amount,\n hasCVC,\n installmentOptions,\n lastFour,\n expiryMonth,\n expiryYear,\n // Card\n disclaimerMessage\n}) => {\n return (\n <LoadingWrapper status={sfpState.status}>\n <StoredCardFields\n errors={sfpState.errors}\n brand={sfpState.brand}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n valid={sfpState.valid}\n lastFour={lastFour}\n expiryMonth={expiryMonth}\n expiryYear={expiryYear}\n showContextualElement={showContextualElement}\n />\n\n {hasInstallments && (\n <Installments\n amount={amount}\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["StoredCardFieldsWrapper","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","showContextualElement","amount","hasCVC","installmentOptions","lastFour","expiryMonth","expiryYear","disclaimerMessage","h","LoadingWrapper","status","StoredCardFields","errors","brand","onFocusField","valid","Installments","onChange","type","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"iTAMO,MAAMA,EAA0B,EAInCC,WACAC,aACAC,YACAC,iBACAC,kBACAC,qBACAC,4BACAC,wBAEAC,SACAC,SACAC,qBACAC,WACAC,cACAC,aAEAC,uBAGIC,EAACC,EAAAA,CAAeC,OAAQjB,EAASiB,QAC7BF,EAACG,EAAAA,CACGC,OAAQnB,EAASmB,OACjBC,MAAOpB,EAASoB,MAChBX,OAAQA,EACRP,UAAWA,EACXmB,aAAcpB,EACdE,eAAgBA,EAChBmB,MAAOtB,EAASsB,MAChBX,SAAUA,EACVC,YAAaA,EACbC,WAAYA,EACZN,sBAAuBA,IAG1BH,GACGW,EAACQ,EAAAA,CACGf,OAAQA,EACRY,MAAOpB,EAASoB,MAChBV,mBAAoBA,EACpBc,SAAUnB,EACVoB,KAAMnB,EAA4B,SAAW,WAIpDQ,GACGC,EAACW,EAAAA,CACGC,QAASb,EAAkBa,QAAQC,QAAQ,cAAe,KAAKd,EAAkBe,cACjFC,KAAM,CAAChB,EAAkBiB"}
1
+ {"version":3,"file":"StoredCardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/StoredCardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport StoredCardFields from './StoredCardFields';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\n\nexport const StoredCardFieldsWrapper = ({\n // base (shared)\n // n/a\n // vars created in CardInput:\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n showContextualElement,\n // props passed through from CardInput:\n hasCVC,\n installmentOptions,\n lastFour,\n expiryMonth,\n expiryYear,\n // Card\n disclaimerMessage\n}) => {\n return (\n <LoadingWrapper status={sfpState.status}>\n <StoredCardFields\n errors={sfpState.errors}\n brand={sfpState.brand}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n valid={sfpState.valid}\n lastFour={lastFour}\n expiryMonth={expiryMonth}\n expiryYear={expiryYear}\n showContextualElement={showContextualElement}\n />\n\n {hasInstallments && (\n <Installments\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["StoredCardFieldsWrapper","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","showContextualElement","hasCVC","installmentOptions","lastFour","expiryMonth","expiryYear","disclaimerMessage","h","LoadingWrapper","status","StoredCardFields","errors","brand","onFocusField","valid","Installments","onChange","type","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"iTAMO,MAAMA,EAA0B,EAInCC,WACAC,aACAC,YACAC,iBACAC,kBACAC,qBACAC,4BACAC,wBAEAC,SACAC,qBACAC,WACAC,cACAC,aAEAC,uBAGIC,EAACC,EAAAA,CAAeC,OAAQhB,EAASgB,QAC7BF,EAACG,EAAAA,CACGC,OAAQlB,EAASkB,OACjBC,MAAOnB,EAASmB,MAChBX,OAAQA,EACRN,UAAWA,EACXkB,aAAcnB,EACdE,eAAgBA,EAChBkB,MAAOrB,EAASqB,MAChBX,SAAUA,EACVC,YAAaA,EACbC,WAAYA,EACZL,sBAAuBA,IAG1BH,GACGU,EAACQ,EAAAA,CACGH,MAAOnB,EAASmB,MAChBV,mBAAoBA,EACpBc,SAAUlB,EACVmB,KAAMlB,EAA4B,SAAW,WAIpDO,GACGC,EAACW,EAAAA,CACGC,QAASb,EAAkBa,QAAQC,QAAQ,cAAe,KAAKd,EAAkBe,cACjFC,KAAM,CAAChB,EAAkBiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { InstallmentOptions } from './components/types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData, PaymentAmount } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n amount?: PaymentAmount;\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration?: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: string;\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: (o: CardAllValidData) => {};\n onAutoComplete?: (o: CardAutoCompleteData) => {};\n onBinValue?: (o: CardBinValueData) => {};\n onBlur?: (e) => {};\n onBrand?: (o: CardBrandData) => {};\n onConfigSuccess?: (O: CardConfigSuccessData) => {};\n onChange?: (state) => {};\n onError?: () => {};\n onFieldValid?: (o: CardFieldValidData) => {};\n onFocus?: (e) => {};\n onLoad?: (o: CardLoadData) => {};\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (obj) => {};\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: any;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n"],"names":["AddressModeOptions"],"mappings":"AA2MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport type {\n BinLookupResponse,\n BrandConfiguration,\n CardBrandsConfiguration,\n CardBackendConfiguration,\n DualBrandSelectElement,\n CardPlaceholders\n} from '../../types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData } from '../../../../types/global-types';\nimport type { FastlaneSignupConfiguration } from '../../../PayPalFastlane/types';\nimport type { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { IAnalytics } from '../../../../core/Analytics/Analytics';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { h } from 'preact';\nimport { InstallmentOptions } from './components/Installments/Installments';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration?: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n fastlaneConfiguration?: FastlaneSignupConfiguration;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: string;\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: IAnalytics;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: (o: CardAllValidData) => {};\n onAutoComplete?: (o: CardAutoCompleteData) => {};\n onBinValue?: (o: CardBinValueData) => {};\n onBlur?: (e) => {};\n onBrand?: (o: CardBrandData) => {};\n onConfigSuccess?: (O: CardConfigSuccessData) => {};\n onChange?: (state) => {};\n onError?: () => {};\n onFieldValid?: (o: CardFieldValidData) => {};\n onFocus?: (e) => {};\n onLoad?: (o: CardLoadData) => {};\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (props: PayButtonProps) => h.JSX.Element;\n placeholders?: CardPlaceholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: any;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n"],"names":["AddressModeOptions"],"mappings":"AA4MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSRPanelForCardInputErrors.js","sources":["../../../../../../src/components/Card/components/CardInput/useSRPanelForCardInputErrors.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport { handlePartialAddressMode, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport { setFocusOnFirstField } from './handlers';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\n\nconst useSRPanelForCardInputErrors = ({ errors, props, isValidating, retrieveLayout, specifications, billingAddress, sfp }) => {\n // Extract fns from context\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n // Get the previous list of errors\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n const sfStateErrorsObj = sfp.current?.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj };\n\n useEffect(() => {\n try {\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n setSortedErrorList(currentErrorsSortedByLayout);\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors]);\n\n return { sortedErrorList, previousSortedErrors, clearSRPanel };\n};\n\nexport default useSRPanelForCardInputErrors;\n"],"names":["useSRPanelForCardInputErrors","errors","props","isValidating","retrieveLayout","specifications","billingAddress","sfp","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","partialAddressSchema","handlePartialAddressMode","billingAddressMode","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","mergedErrors","_object_spread","current","mapErrorsToValidationRuleResult","useEffect","extractedAddressErrors","errorsForPanel","errorsWithoutAddress","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","country","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","_"],"mappings":"6kDAUA,MAAMA,EAA+B,EAAGC,SAAQC,QAAOC,eAAcC,iBAAgBC,iBAAgBC,iBAAgBC,UAgBxFA,IAAAA,EAdzB,MAAMC,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAG1FC,EAAuCL,aAAAA,EAAAA,EAA2B,CACpEM,mBAAoBC,IAGlBC,EAAuBC,EAAyBf,EAAMgB,qBAErDC,EAAiBC,GAAsBC,EAA8B,MAGtEC,EAAuBC,EAAYJ,GAGnCK,EAAeC,KAAKxB,EADU,QAAXM,EAAAA,EAAImB,eAAJnB,IAAAA,OAAAA,EAAAA,EAAaoB,mCAsEtC,OAnEAC,EAAU,KACN,IAY+BvB,IAAAA,EAAsEW,EAVjG,MAAQV,eAAgBuB,GAAoDL,EAEtEM,EAAiBL,KAF4BM,EAAyBP,EAAAA,oBAEvBK,GAG/CG,EAAyCnB,aAAAA,EAAAA,EAAgB,CAC3DZ,OAAQ6B,EACR3B,aAAcA,EAAauB,QAC3BO,OAAQ7B,IAER8B,sBAAwF,QAAjE7B,EAAAA,EAAe8B,2BAA2B7B,aAAAA,EAAAA,EAAgB8B,oBAA1D/B,EAAAA,EAAsEW,SAA6B,QAA7BA,EAAAA,EAAsBqB,eAAtBrB,IAAAA,SAAAA,EAA+BsB,SAI1HC,EAA8BP,aAAAA,EAAAA,EAAaO,4BAMjD,OALAnB,EAAmBmB,GAKXP,aAAAA,EAAAA,EAAaQ,QAEjB,KAAKC,EACG9B,GAAmB+B,EAAqBvC,EAAauB,QAASnB,EAAKyB,aAAAA,EAAAA,EAAaW,cAEpFC,WAAW,KACPzC,EAAauB,SAAU,GACxB,KACH,MAKJ,KAAKmB,EAA4B,CAC7B,MAAMC,EAAaC,EAA+CR,EAA6BjB,EAAsB,SAE/G0B,EAAiBF,aAAAA,EAAAA,EAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAMMC,EANmBC,EAAsBF,EAAeG,WAMrBH,EAAeI,aAAe,KAEvE3C,EAAyBwC,EAC7B,MAGIvC,IAEJ,KACJ,EAIR,CAAE,MAAO2C,GAET,GACD,CAACpD,IAEG,CAAEkB,kBAAiBG,uBAAsBZ"}
1
+ {"version":3,"file":"useSRPanelForCardInputErrors.js","sources":["../../../../../../src/components/Card/components/CardInput/useSRPanelForCardInputErrors.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport { handlePartialAddressMode, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport { setFocusOnFirstField } from './handlers';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\n\nconst useSRPanelForCardInputErrors = ({ errors, props, isValidating, retrieveLayout, specifications, billingAddress, sfp }) => {\n // Extract fns from context\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n // Get the previous list of errors\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n const sfStateErrorsObj = sfp.current?.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj };\n\n useEffect(() => {\n try {\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n setSortedErrorList(currentErrorsSortedByLayout);\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors]);\n\n return { sortedErrorList, previousSortedErrors, clearSRPanel };\n};\n\nexport default useSRPanelForCardInputErrors;\n"],"names":["useSRPanelForCardInputErrors","errors","props","isValidating","retrieveLayout","specifications","billingAddress","sfp","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","partialAddressSchema","handlePartialAddressMode","billingAddressMode","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","mergedErrors","_object_spread","current","mapErrorsToValidationRuleResult","useEffect","extractedAddressErrors","errorsForPanel","errorsWithoutAddress","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","country","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","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AA,EAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAMMC,EANmBC,EAAsBF,EAAeG,WAMrBH,EAAeI,aAAe,KAEvE3C,EAAyBwC,EAC7B,MAGIvC,IAEJ,KACJ,EAIR,CAAE,MAAO2C,GAET,GACD,CAACpD,IAEG,CAAEkB,kBAAiBG,uBAAsBZ"}
@@ -1,2 +1,2 @@
1
- import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as i,KCP_CARD_NAME_BOTTOM as r,SSN_CARD_NAME_TOP as t,SSN_CARD_NAME_BOTTOM as a,CREDIT_CARD as l,KCP_CARD as s,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as u}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as c}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),h=e=>"revolving"===(null==e?void 0:e.plan)||(null==e?void 0:e.value)>1,g=({props:e,showKCP:u,showBrazilianSSN:c,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=l;const h=e.hasHolderName&&e.holderNameRequired;if(h&&(C=e.positionHolderNameOnTop?o:n),u&&(C=s,h&&(C=e.positionHolderNameOnTop?i:r)),c&&(C=d,h&&(C=e.positionHolderNameOnTop?t:a)),m){const i=m.flat(2).filter(e=>"number"!=typeof e);let r=i;p&&(r=i.filter(e=>p.includes(e))),C=l.concat(r),h&&(C=e.positionHolderNameOnTop?o.concat(r):n.concat(r))}return C},R=(e,o,n)=>{switch(e){case"socialSecurityNumber":return o.get(`boleto.${e}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return(null==n?void 0:n[e])?o.get(null==n?void 0:n[e]):o.get(e);default:return null}},y=e=>({amount:e.amount,billingAddressRequired:e.billingAddressRequired,billingAddressRequiredFields:e.billingAddressRequiredFields,billingAddressAllowedCountries:e.billingAddressAllowedCountries,brandsConfiguration:e.brandsConfiguration,showStoreDetailsCheckbox:e.showStoreDetailsCheckbox,hasCVC:e.hasCVC,hasHolderName:e.hasHolderName,holderNameRequired:e.holderNameRequired,installmentOptions:e.installmentOptions,placeholders:e.placeholders,positionHolderNameOnTop:e.positionHolderNameOnTop,showBrandIcon:e.showBrandIcon,showContextualElement:e.showContextualElement,lastFour:e.lastFour,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear,disclaimerMessage:e.disclaimerMessage}),O=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,countryCode:e.countryCode,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,maskSecurityCode:e.maskSecurityCode,exposeExpiryDate:e.exposeExpiryDate,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onConfigSuccess:e.onConfigSuccess,handleKeyPress:e.handleKeyPress,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),b=o=>o==e.partial?u:null;function f(e){return![p.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,p.ERROR_MSG_CARD_TOO_OLD,p.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,p.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(e)}function S(e){var o;return null!==(o=c[e])&&void 0!==o?o:e}const x=(e,o)=>e.map(e=>{var n,i;const r=e.id,t=m(),a="card"===r?"nocard":r,l=null!==(n=null===(i=o[r])||void 0===i?void 0:i.icon)&&void 0!==n?n:C(a,t);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:l,altName:S(r)}}),A=(e,o,n)=>o.some(o=>e.includes(o[n]));export{y as extractPropsForCardFields,O as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,g as getLayout,b as handlePartialAddressMode,h as hasValidInstallmentsObject,f as lookupBlurBasedErrors,x as mapDualBrandButtons,R as mapFieldKey,A as mustHandleDualBrandingAccordingToEURegulations};
1
+ import{AddressModeOptions as e}from"./types.js";import{CREDIT_CARD_NAME_TOP as o,CREDIT_CARD_NAME_BOTTOM as n,KCP_CARD_NAME_TOP as i,KCP_CARD_NAME_BOTTOM as r,SSN_CARD_NAME_TOP as l,SSN_CARD_NAME_BOTTOM as t,CREDIT_CARD as a,KCP_CARD as s,SSN_CARD as d}from"./layouts.js";import{PARTIAL_ADDRESS_SCHEMA as c}from"../../../internal/Address/constants.js";import{BRAND_READABLE_NAME_MAP as u}from"../../../internal/SecuredFields/lib/constants.js";import m from"../../../../core/Context/useImage.js";import{SF_ErrorCodes as p}from"../../../../core/Errors/constants.js";const C=(e,o)=>o({type:"card"===e?"nocard":e||"nocard",extension:"svg"})(e),h=e=>["revolving","bonus"].includes(null==e?void 0:e.plan)||(null==e?void 0:e.value)>1,g=({props:e,showKCP:c,showBrazilianSSN:u,countrySpecificSchemas:m=null,billingAddressRequiredFields:p=null})=>{let C=a;const h=e.hasHolderName&&e.holderNameRequired;if(h&&(C=e.positionHolderNameOnTop?o:n),c&&(C=s,h&&(C=e.positionHolderNameOnTop?i:r)),u&&(C=d,h&&(C=e.positionHolderNameOnTop?l:t)),m){const i=m.flat(2).filter(e=>"number"!=typeof e);let r=i;p&&(r=i.filter(e=>p.includes(e))),C=a.concat(r),h&&(C=e.positionHolderNameOnTop?o.concat(r):n.concat(r))}return C},R=(e,o,n)=>{switch(e){case"socialSecurityNumber":return o.get(`boleto.${e}`);case"street":case"houseNumberOrName":case"postalCode":case"stateOrProvince":case"city":case"country":return(null==n?void 0:n[e])?o.get(null==n?void 0:n[e]):o.get(e);default:return null}},y=e=>({billingAddressRequired:e.billingAddressRequired,billingAddressRequiredFields:e.billingAddressRequiredFields,billingAddressAllowedCountries:e.billingAddressAllowedCountries,brandsConfiguration:e.brandsConfiguration,showStoreDetailsCheckbox:e.showStoreDetailsCheckbox,hasCVC:e.hasCVC,hasHolderName:e.hasHolderName,holderNameRequired:e.holderNameRequired,installmentOptions:e.installmentOptions,placeholders:e.placeholders,positionHolderNameOnTop:e.positionHolderNameOnTop,showBrandIcon:e.showBrandIcon,showContextualElement:e.showContextualElement,lastFour:e.lastFour,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear,disclaimerMessage:e.disclaimerMessage}),b=e=>({autoFocus:e.autoFocus,brands:e.brands,brandsConfiguration:e.brandsConfiguration,clientKey:e.clientKey,countryCode:e.countryCode,forceCompat:e.forceCompat,i18n:e.i18n,implementationType:e.implementationType,keypadFix:e.keypadFix,legacyInputMode:e.legacyInputMode,loadingContext:e.loadingContext,maskSecurityCode:e.maskSecurityCode,exposeExpiryDate:e.exposeExpiryDate,minimumExpiryDate:e.minimumExpiryDate,onAdditionalSFConfig:e.onAdditionalSFConfig,onAdditionalSFRemoved:e.onAdditionalSFRemoved,onAllValid:e.onAllValid,onAutoComplete:e.onAutoComplete,onBinValue:e.onBinValue,onConfigSuccess:e.onConfigSuccess,handleKeyPress:e.handleKeyPress,onError:e.onError,onFieldValid:e.onFieldValid,onLoad:e.onLoad,placeholders:e.placeholders,resources:e.resources,showContextualElement:e.showContextualElement,showWarnings:e.showWarnings,trimTrailingSeparator:e.trimTrailingSeparator}),O=o=>o==e.partial?c:null;function f(e){return![p.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,p.ERROR_MSG_CARD_TOO_OLD,p.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,p.ERROR_MSG_CARD_EXPIRES_TOO_SOON].includes(e)}function S(e){var o;return null!==(o=u[e])&&void 0!==o?o:e}const x=(e,o)=>e.map(e=>{var n,i;const r=e.id,l=m(),t="card"===r?"nocard":r,a=null!==(n=null===(i=o[r])||void 0===i?void 0:i.icon)&&void 0!==n?n:C(t,l);return{id:e.id,name:e.brandObject.localeBrand||e.brandObject.brand,imageURL:a,altName:S(r)}}),A=(e,o,n)=>o.some(o=>e.includes(o[n]));export{y as extractPropsForCardFields,b as extractPropsForSFP,C as getCardImageUrl,S as getFullBrandName,g as getLayout,O as handlePartialAddressMode,f as lookupBlurBasedErrors,x as mapDualBrandButtons,R as mapFieldKey,A as mustHandleDualBrandingAccordingToEURegulations,h as shouldIncludeInstallmentsInPaymentData};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement } from '../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * Verifies that installment object is valid to send to the Backend.\n * Valid means that it has 'revolving' plan set, or the number of installments is bigger than one\n */\nexport const hasValidInstallmentsObject = (installments?: InstallmentsObj) => {\n return installments?.plan === 'revolving' || installments?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs amount, hasCVC, installmentOptions)\n amount: props.amount,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const mapDualBrandButtons = (dualBrandSelectElements: DualBrandSelectElement[], brandsConfiguration: CardBrandsConfiguration): any => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Only if the brands in EU_BrandArray are present in the binLookup response should we handle dual branding based on EU regulations\n *\n * If the result from Array.some is true - then we are in a EU dual branding regulation scenario, i.e.\n * - Show the new dualBranding UI Buttons\n * - Preselect a card brand\n */\nexport const mustHandleDualBrandingAccordingToEURegulations = (\n EU_BrandArray: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => EU_BrandArray.includes(item[key]));\n"],"names":["getCardImageUrl","brand","getImage","type","extension","hasValidInstallmentsObject","installments","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","includes","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","amount","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyPress","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","_ref","name","brandObject","localeBrand","altName","mustHandleDualBrandingAccordingToEURegulations","EU_BrandArray","returnedDualBrandingObjects","some"],"mappings":"ojBAsBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GAOrBI,EAA8BC,GACT,eAAvBA,aAAAA,EAAAA,EAAcC,QAAwBD,aAAAA,EAAAA,EAAcE,OAAQ,EAG1DC,EAAY,EACrBC,QACAC,UACAC,mBACAC,yBAAyB,KACzBC,+BAA+B,SAE/B,IAAIC,EAASC,EACb,MAAMC,EAAwBP,EAAMQ,eAAiBR,EAAMS,mBAqB3D,GAnBIF,IACAF,EAASL,EAAMU,wBAA0BC,EAAuBC,GAGhEX,IACAI,EAASQ,EACLN,IACAF,EAASL,EAAMU,wBAA0BI,EAAoBC,IAIjEb,IACAG,EAASW,EACLT,IACAF,EAASL,EAAMU,wBAA0BO,EAAoBC,IAKjEf,EAAwB,CAExB,MAAMgB,EAAuChB,EAAuB,KAAQ,GAAGiB,OAAOC,GAAwB,iBAATA,GAErG,IAAIC,EAA4BH,EAE5Bf,IAEAkB,EAA4BH,EAA2BC,OAAOG,GAAKnB,EAA6BoB,SAASD,KAG7GlB,EAASC,EAAYmB,OAAOH,GACxBf,IACAF,EAASL,EAAMU,wBACTC,EAAqBc,OAAOH,GAC5BV,EAAwBa,OAAOH,GAG7C,CACA,OAAOjB,GAMEqB,EAAc,CAACC,EAAaC,EAAgBC,KAErD,OAAQF,GACJ,IAAK,uBACD,OAAOC,EAAKE,I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BACvBC,eAAgBjE,EAAMiE,eACtBC,QAASlE,EAAMkE,QACfC,aAAcnE,EAAMmE,aACpBC,OAAQpE,EAAMoE,OACd7B,aAAcvC,EAAMuC,aACpB8B,UAAWrE,EAAMqE,UACjB5B,sBAAuBzC,EAAMyC,sBAC7B6B,aAActE,EAAMsE,aACpBC,sBAAuBvE,EAAMuE,wBAIxBC,EAA4BC,GAC9BA,GAAeC,EAAmBC,QAAUC,EAAyB,KAIzE,SAASC,EAAsBC,GAElC,OAAQ,CACJC,EAAcC,mCACdD,EAAcE,uBACdF,EAAcG,iCACdH,EAAcI,iCAChB3D,SAASsD,EACf,CAEO,SAASM,EAAiB7F,GACtB8F,IAAAA,EAAP,OAAqC,QAA9BA,EAAAA,EAAwB9F,cAAxB8F,EAAAA,EAAkC9F,CAC7C,CAEO,MAAM+F,EAAsB,CAACC,EAAmDpD,IAC5EoD,EAAwBC,IAAInE,UAIdc,EAHjB,MAAM5C,EAAQ8B,EAAKoE,GACbjG,EAAWkG,IACXC,EAAsB,SAAVpG,EAAmB,SAAWA,EAC1CqG,EAA2C,QAA3CA,EAAqC,QAA1BzD,EAAAA,EAAoB5C,UAApB4C,IAAAA,OAAAA,EAAAA,EAA4B0D,YAAI,IAAAC,EAAAA,EAAIxG,EAAgBqG,EAAWnG,GAIhF,MAAO,CACHiG,GAAIpE,EAAKoE,GACTM,KAAM1E,EAAK2E,YAAYC,aAAe5E,EAAK2E,YAAYzG,MACvDqG,WACAM,QAASd,EAAiB7F,MAYzB4G,EAAiD,CAC1DC,EACAC,EACA1E,IACC0E,EAA4BC,KAAKjF,GAAQ+E,EAAc5E,SAASH,EAAKM"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport useImage, { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BrandObject, CardBrandsConfiguration, DualBrandSelectElement } from '../../types';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * 'installments' should be added to the payload if it has plan as revolving or bonus\n * or value greater than 1.\n *\n * More about it here: COWEB-1070\n */\nexport const shouldIncludeInstallmentsInPaymentData = (installment?: InstallmentsState): boolean => {\n return ['revolving', 'bonus'].includes(installment?.plan) || installment?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs hasCVC, installmentOptions)\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n handleKeyPress: props.handleKeyPress,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n // If it's NOT one of these, then it's a blur based error\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n\nexport const mapDualBrandButtons = (dualBrandSelectElements: DualBrandSelectElement[], brandsConfiguration: CardBrandsConfiguration): any => {\n return dualBrandSelectElements.map(item => {\n const brand = item.id;\n const getImage = useImage();\n const imageName = brand === 'card' ? 'nocard' : brand;\n const imageURL = brandsConfiguration[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n\n // TODO - check below if we have to still generate altName through the mapping function or whether it just\n // corresponds to item.brandObject.localeBrand\n return {\n id: item.id,\n name: item.brandObject.localeBrand || item.brandObject.brand,\n imageURL,\n altName: getFullBrandName(brand)\n };\n });\n};\n\n/**\n * Only if the brands in EU_BrandArray are present in the binLookup response should we handle dual branding based on EU regulations\n *\n * If the result from Array.some is true - then we are in a EU dual branding regulation scenario, i.e.\n * - Show the new dualBranding UI Buttons\n * - Preselect a card brand\n */\nexport const mustHandleDualBrandingAccordingToEURegulations = (\n EU_BrandArray: readonly string[],\n returnedDualBrandingObjects: DualBrandSelectElement[] | BrandObject[],\n key: string\n) => returnedDualBrandingObjects.some(item => EU_BrandArray.includes(item[key]));\n"],"names":["getCardImageUrl","brand","getImage","type","extension","shouldIncludeInstallmentsInPaymentData","installment","includes","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","handleKeyPress","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP","mapDualBrandButtons","dualBrandSelectElements","map","id","useImage","imageName","imageURL","icon","_ref","name","brandObject","localeBrand","altName","mustHandleDualBrandingAccordingToEURegulations","EU_BrandArray","returnedDualBrandingObjects","some"],"mappings":"ojBAsBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GASrBI,EAA0CC,GAC5C,CAAC,YAAa,SAASC,SAASD,aAAAA,EAAAA,EAAaE,QAASF,eAAAA,EAAaG,OAAQ,EAGzEC,EAAY,EACrBC,QACAC,UACAC,mBACAC,yBAAyB,KACzBC,+BAA+B,SAE/B,IAAIC,EAASC,EACb,MAAMC,EAAwBP,EAA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,EAA2C,QAA3CA,EAAqC,QAA1BzD,EAAAA,EAAoB3C,UAApB2C,IAAAA,OAAAA,EAAAA,EAA4B0D,YAAI,IAAAC,EAAAA,EAAIvG,EAAgBoG,EAAWlG,GAIhF,MAAO,CACHgG,GAAIlE,EAAKkE,GACTM,KAAMxE,EAAKyE,YAAYC,aAAe1E,EAAKyE,YAAYxG,MACvDoG,WACAM,QAASd,EAAiB5F,MAYzB2G,EAAiD,CAC1DC,EACAC,EACAzE,IACCyE,EAA4BC,KAAK/E,GAAQ6E,EAActG,SAASyB,EAAKK"}
@@ -1,2 +1,2 @@
1
- import e from"../../internal/ClickToPay/context/ClickToPayProvider.js";import t from"./ClickToPayHolder.js";import{createElement as o}from"../../../external/preact/dist/preact.js";function n(e,t){if(null==e)return{};var o,n,r,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(e),r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var o,n,r={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)o=l[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}(e,t),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}const r=r=>{let{amount:l,configuration:a,clickToPayService:i,setClickToPayRef:c,onSetStatus:u,onSubmit:f,onError:p,isStandaloneComponent:s}=r,y=n(r,["amount","configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent"]);return o(e,{isStandaloneComponent:s,configuration:a,amount:l,clickToPayService:i,setClickToPayRef:c,onSetStatus:u,onSubmit:f,onError:p},o(t,null,y.children))};export{r as default};
1
+ import e from"../../internal/ClickToPay/context/ClickToPayProvider.js";import t from"./ClickToPayHolder.js";import{createElement as o}from"../../../external/preact/dist/preact.js";function r(e,t){if(null==e)return{};var o,r,n,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(o=Reflect.ownKeys(e),n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var o,r,n={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)o=l[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o]);return n}(e,t),Object.getOwnPropertySymbols)for(o=Object.getOwnPropertySymbols(e),n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}const n=n=>{let{configuration:l,clickToPayService:i,setClickToPayRef:a,onSetStatus:c,onSubmit:f,onError:p,isStandaloneComponent:u}=n,s=r(n,["configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent"]);return o(e,{isStandaloneComponent:u,configuration:l,clickToPayService:i,setClickToPayRef:a,onSetStatus:c,onSubmit:f,onError:p},o(t,null,s.children))};export{n as default};
2
2
  //# sourceMappingURL=ClickToPayWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClickToPayWrapper.js","sources":["../../../../../src/components/Card/components/ClickToPayWrapper.tsx"],"sourcesContent":["import ClickToPayProvider, { ClickToPayProviderProps } from '../../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayHolder from './ClickToPayHolder';\nimport { h } from 'preact';\n\nconst ClickToPayWrapper = ({\n amount,\n configuration,\n clickToPayService,\n setClickToPayRef,\n onSetStatus,\n onSubmit,\n onError,\n isStandaloneComponent,\n ...props\n}: ClickToPayProviderProps) => {\n return (\n <ClickToPayProvider\n isStandaloneComponent={isStandaloneComponent}\n configuration={configuration}\n amount={amount}\n clickToPayService={clickToPayService}\n setClickToPayRef={setClickToPayRef}\n onSetStatus={onSetStatus}\n onSubmit={onSubmit}\n onError={onError}\n >\n <ClickToPayHolder>{props.children}</ClickToPayHolder>\n </ClickToPayProvider>\n );\n};\n\nexport default ClickToPayWrapper;\n"],"names":["ClickToPayWrapper","_0","amount","configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent","props","h","ClickToPayProvider","ClickToPayHolder","children"],"mappings":"qyBAIA,MAAMA,EAAoBC,IAAC,IAAAC,OACvBA,EAAMC,cACNA,EAAaC,kBACbA,EAAiBC,iBACjBA,EAAgBC,YAChBA,EAAWC,SACXA,EAAQC,QACRA,EAAOC,sBACPA,GAEsBR,EADnBS,EAAAA,EAAAA,EAAAA,8HAEH,OACIC,EAACC,EAAAA,CACGH,sBAAuBA,EACvBN,cAAeA,EACfD,OAAQA,EACRE,kBAAmBA,EACnBC,iBAAkBA,EAClBC,YAAaA,EACbC,SAAUA,EACVC,QAASA,GAETG,EAACE,EAAAA,KAAkBH,EAAMI"}
1
+ {"version":3,"file":"ClickToPayWrapper.js","sources":["../../../../../src/components/Card/components/ClickToPayWrapper.tsx"],"sourcesContent":["import ClickToPayProvider, { ClickToPayProviderProps } from '../../internal/ClickToPay/context/ClickToPayProvider';\nimport ClickToPayHolder from './ClickToPayHolder';\nimport { h } from 'preact';\n\nconst ClickToPayWrapper = ({\n configuration,\n clickToPayService,\n setClickToPayRef,\n onSetStatus,\n onSubmit,\n onError,\n isStandaloneComponent,\n ...props\n}: ClickToPayProviderProps) => {\n return (\n <ClickToPayProvider\n isStandaloneComponent={isStandaloneComponent}\n configuration={configuration}\n clickToPayService={clickToPayService}\n setClickToPayRef={setClickToPayRef}\n onSetStatus={onSetStatus}\n onSubmit={onSubmit}\n onError={onError}\n >\n <ClickToPayHolder>{props.children}</ClickToPayHolder>\n </ClickToPayProvider>\n );\n};\n\nexport default ClickToPayWrapper;\n"],"names":["ClickToPayWrapper","_0","configuration","clickToPayService","setClickToPayRef","onSetStatus","onSubmit","onError","isStandaloneComponent","props","h","ClickToPayProvider","ClickToPayHolder","children"],"mappings":"qyBAIA,MAAMA,EAAoBC,IAAC,IAAAC,cACvBA,EAAaC,kBACbA,EAAiBC,iBACjBA,EAAgBC,YAChBA,EAAWC,SACXA,EAAQC,QACRA,EAAOC,sBACPA,GAEsBP,EADnBQ,EAAAA,EAAAA,EAAAA,qHAEH,OACIC,EAACC,EAAAA,CACGH,sBAAuBA,EACvBN,cAAeA,EACfC,kBAAmBA,EACnBC,iBAAkBA,EAClBC,YAAaA,EACbC,SAAUA,EACVC,QAASA,GAETG,EAACE,EAAAA,KAAkBH,EAAMI"}
@@ -1 +1 @@
1
- {"version":3,"file":"USOnlyPhoneInput.js","sources":["../../../../../../src/components/Card/components/Fastlane/USOnlyPhoneInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef } from 'preact/hooks';\nimport Field from '../../../internal/FormFields/Field';\nimport useForm from '../../../../utils/useForm';\nimport InputTelephone from '../../../internal/FormFields/InputTelephone';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport mobileNumberFormatter from './utils/mobile-number-formatter';\n\ninterface USOnlyPhoneInputStateData {\n mobileNumber?: string;\n}\n\ninterface USOnlyPhoneInputProps {\n onChange(mobileNumber: string): void;\n initialValue?: string;\n}\n\nconst USOnlyPhoneInput = ({ initialValue, onChange }: USOnlyPhoneInputProps) => {\n const { i18n } = useCoreContext();\n const formSchema = ['mobileNumber'];\n const { handleChangeFor, data } = useForm<USOnlyPhoneInputStateData>({\n schema: formSchema,\n defaultData: {\n mobileNumber: initialValue\n },\n formatters: {\n mobileNumber: mobileNumberFormatter\n }\n });\n const inputRef = useRef<HTMLInputElement>(null);\n\n const focusInput = useCallback(() => {\n inputRef.current?.focus();\n }, [inputRef.current]);\n\n useEffect(() => {\n onChange(data.mobileNumber?.replaceAll(' ', ''));\n }, [data.mobileNumber, onChange]);\n\n return (\n <Field name=\"mobile-number\" label={i18n.get('card.fastlane.mobileInputLabel')} staticValue=\"+1\" onInputContainerClick={focusInput}>\n <InputTelephone\n name={'mobile-number'}\n autocorrect={'off'}\n spellcheck={false}\n maxlength={12}\n value={data.mobileNumber}\n onInput={handleChangeFor('mobileNumber', 'input')}\n onBlur={handleChangeFor('mobileNumber', 'blur')}\n setRef={inputRef}\n />\n </Field>\n );\n};\n\nexport default USOnlyPhoneInput;\n"],"names":["USOnlyPhoneInput","initialValue","onChange","i18n","useCoreContext","handleChangeFor","data","useForm","schema","defaultData","mobileNumber","formatters","mobileNumberFormatter","inputRef","useRef","focusInput","useCallback","current","focus","useEffect","replaceAll","h","Field","name","label","get","staticValue","onInputContainerClick","InputTelephone","autocorrect","spellcheck","maxlength","value","onInput","onBlur","setRef"],"mappings":"6dAiBA,MAAMA,EAAmB,EAAGC,eAAcC,eACtC,MAAMC,KAAEA,GAASC,KAEXC,gBAAEA,EAAeC,KAAEA,GAASC,EAAmC,CACjEC,OAFe,CAAC,gBAGhBC,YAAa,CACTC,aAAcT,GAElBU,WAAY,CACRD,aAAcE,KAGhBC,EAAWC,EAAyB,MAEpCC,EAAaC,EAAY,KAC3BH,IAAAA,EAAgB,QAAhBA,EAAAA,EAASI,eAATJ,IAAAA,GAAAA,EAAkBK,SACnB,CAACL,EAASI,UAMb,OAJAE,EAAU,KACGb,IAAAA,EAATJ,EAA0B,QAAjBI,EAAAA,EAAKI,wBAALJ,SAAAA,EAAmBc,WAAW,IAAK,MAC7C,CAACd,EAAKI,aAAcR,IAGnBmB,EAACC,EAAAA,CAAMC,KAAK,gBAAgBC,MAAOrB,EAAKsB,IAAI,kCAAmCC,YAAY,KAAKC,sBAAuBZ,GACnHM,EAACO,EAAAA,CACGL,KAAM,gBACNM,YAAa,MACbC,YAAY,EACZC,UAAW,GACXC,MAAO1B,EAAKI,aACZuB,QAAS5B,EAAgB,eAAgB,SACzC6B,OAAQ7B,EAAgB,eAAgB,QACxC8B,OAAQtB"}
1
+ {"version":3,"file":"USOnlyPhoneInput.js","sources":["../../../../../../src/components/Card/components/Fastlane/USOnlyPhoneInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef } from 'preact/hooks';\nimport Field from '../../../internal/FormFields/Field';\nimport useForm from '../../../../utils/useForm';\nimport InputTelephone from '../../../internal/FormFields/InputTelephone';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport mobileNumberFormatter from './utils/mobile-number-formatter';\n\ninterface USOnlyPhoneInputStateData {\n mobileNumber?: string;\n}\n\ninterface USOnlyPhoneInputProps {\n onChange(mobileNumber: string): void;\n initialValue?: string;\n}\n\nconst USOnlyPhoneInput = ({ initialValue, onChange }: USOnlyPhoneInputProps) => {\n const { i18n } = useCoreContext();\n const formSchema = ['mobileNumber'];\n const { handleChangeFor, data } = useForm<USOnlyPhoneInputStateData>({\n schema: formSchema,\n defaultData: {\n mobileNumber: initialValue\n },\n formatters: {\n mobileNumber: mobileNumberFormatter\n }\n });\n const inputRef = useRef<HTMLInputElement>(null);\n\n const focusInput = useCallback(() => {\n inputRef.current?.focus();\n }, [inputRef.current]);\n\n useEffect(() => {\n onChange(data.mobileNumber?.replaceAll(' ', ''));\n }, [data.mobileNumber, onChange]);\n\n return (\n <Field name=\"mobile-number\" label={i18n.get('card.fastlane.mobileInputLabel')} staticValue=\"+1\" onInputContainerClick={focusInput}>\n <InputTelephone\n name={'mobile-number'}\n autocorrect={'off'}\n spellcheck={false}\n maxlength={12}\n value={data.mobileNumber}\n onInput={handleChangeFor('mobileNumber', 'input')}\n onBlur={handleChangeFor('mobileNumber', 'blur')}\n setRef={inputRef}\n />\n </Field>\n );\n};\n\nexport default USOnlyPhoneInput;\n"],"names":["USOnlyPhoneInput","initialValue","onChange","i18n","useCoreContext","handleChangeFor","data","useForm","schema","defaultData","mobileNumber","formatters","mobileNumberFormatter","inputRef","useRef","focusInput","useCallback","current","focus","useEffect","replaceAll","h","Field","name","label","get","staticValue","onInputContainerClick","InputTelephone","autocorrect","spellcheck","maxlength","value","onInput","onBlur","setRef"],"mappings":"6dAiBA,MAAMA,EAAmB,EAAGC,eAAcC,eACtC,MAAMC,KAAEA,GAASC,KAEXC,gBAAEA,EAAeC,KAAEA,GAASC,EAAmC,CACjEC,OAFe,CAAC,gBAGhBC,YAAa,CACTC,aAAcT,GAElBU,WAAY,CACRD,aAAcE,KAGhBC,EAAWC,EAAyB,MAEpCC,EAAaC,EAAY,KAC3BH,IAAAA,EAAgB,QAAhBA,EAAAA,EAASI,mBAATJ,GAAAA,EAAkBK,SACnB,CAACL,EAASI,UAMb,OAJAE,EAAU,KACGb,IAAAA,EAATJ,EAA0B,QAAjBI,EAAAA,EAAKI,wBAALJ,SAAAA,EAAmBc,WAAW,IAAK,MAC7C,CAACd,EAAKI,aAAcR,IAGnBmB,EAACC,EAAAA,CAAMC,KAAK,gBAAgBC,MAAOrB,EAAKsB,IAAI,kCAAmCC,YAAY,KAAKC,sBAAuBZ,GACnHM,EAACO,EAAAA,CACGL,KAAM,gBACNM,YAAa,MACbC,YAAY,EACZC,UAAW,GACXC,MAAO1B,EAAKI,aACZuB,QAAS5B,EAAgB,eAAgB,SACzC6B,OAAQ7B,EAAgB,eAAgB,QACxC8B,OAAQtB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CashAppComponent as r}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as s}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import"../internal/Button/Button.js";import"../../core/Context/CoreProvider.js";import{payAmountLabel as a}from"../internal/PayButton/utils.js";import{TxVariants as p}from"../tx-variants.js";import{PREFIX as h}from"../internal/Icon/constants.js";function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){c(t,e,r[e])})}return t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class u extends e{formatProps(t){var e,r;return l(d({},t),{enableStoreDetails:(null===(r=t.session)||void 0===r||null===(e=r.configuration)||void 0===e?void 0:e.enableStoreDetails)||t.enableStoreDetails})}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:r,cashTag:o,customerId:s}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:u.type,storedPaymentMethodId:i}};return d({paymentMethod:d({type:u.type},e&&{grantId:e},s&&{customerId:s},r&&o&&{onFileGrantId:r,cashtag:o})},a&&{storePaymentMethod:n||t})}get displayName(){return this.props.storedPaymentMethodId&&this.props.cashtag?this.props.cashtag:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?"Cash App Pay":""}get isValid(){return!0}componentToRender(){var e;return this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,label:a(this.props.i18n,this.props.amount),icon:null===(e=this.resources)||void 0===e?void 0:e.getImage({imageFolder:"components/"})(`${h}lock`),name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(r,{ref:t=>{this.componentRef=t},enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize})}constructor(t,e){var r,n;if(super(t,e),c(this,"cashAppService",void 0),c(this,"submit",()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let r=!1;new Promise((e,r)=>t({resolve:e,reject:r})).catch(()=>{throw r=!0,Error("onClick rejected")}).then(()=>this.cashAppService.createCustomerRequest()).then(()=>{this.cashAppService.begin()}).catch(t=>{r||this.handleError(t)})}),c(this,"handleOnChangeStoreDetails",t=>{const e=l(d({},this.state.data),{shopperWantsToStore:t});this.setState({data:e})}),c(this,"handleAuthorize",t=>{const e=d({},this.state.data,t);this.setState({data:e,valid:{},errors:{},isValid:!0}),super.submit()}),this.props.enableStoreDetails&&this.props.storePaymentMethod&&console.warn("CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior."),this.props.storedPaymentMethodId)return;const i=new s({environment:this.props.environment,analytics:this.analytics});this.cashAppService=new o(i,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,amount:this.props.amount,redirectURL:this.props.redirectURL,clientId:null===(r=this.props.configuration)||void 0===r?void 0:r.clientId,scopeId:null===(n=this.props.configuration)||void 0===n?void 0:n.scopeId,button:this.props.button,referenceId:this.props.referenceId})}}c(u,"type",p.cashapp),c(u,"defaultProps",n);export{u as CashAppPay,u as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CashAppComponent as r}from"./components/CashAppComponent.js";import o from"./services/CashAppService.js";import{CashAppSdkLoader as s}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import{payAmountLabel as a}from"../internal/PayButton/utils.js";import{TxVariants as p}from"../tx-variants.js";import{PREFIX as h}from"../internal/Icon/constants.js";function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){c(t,e,r[e])})}return t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class u extends e{formatProps(t){var e,r;return l(d({},t),{enableStoreDetails:(null===(r=t.session)||void 0===r||null===(e=r.configuration)||void 0===e?void 0:e.enableStoreDetails)||t.enableStoreDetails})}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:r,cashTag:o,customerId:s}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:u.type,storedPaymentMethodId:i}};return d({paymentMethod:d({type:u.type},e&&{grantId:e},s&&{customerId:s},r&&o&&{onFileGrantId:r,cashtag:o})},a&&{storePaymentMethod:n||t})}get displayName(){return this.props.storedPaymentMethodId&&this.props.cashtag?this.props.cashtag:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?"Cash App Pay":""}get isValid(){return!0}componentToRender(){var e;return this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,label:a(this.props.i18n,this.props.amount),icon:null===(e=this.resources)||void 0===e?void 0:e.getImage({imageFolder:"components/"})(`${h}lock`),name:this.displayName,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(r,{ref:t=>{this.componentRef=t},enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize})}constructor(t,e){var r,n;if(super(t,e),c(this,"cashAppService",void 0),c(this,"submit",()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let r=!1;new Promise((e,r)=>t({resolve:e,reject:r})).catch(()=>{throw r=!0,Error("onClick rejected")}).then(()=>this.cashAppService.createCustomerRequest(this.props.amount)).then(()=>{this.cashAppService.begin()}).catch(t=>{r||this.handleError(t)})}),c(this,"handleOnChangeStoreDetails",t=>{const e=l(d({},this.state.data),{shopperWantsToStore:t});this.setState({data:e})}),c(this,"handleAuthorize",t=>{const e=d({},this.state.data,t);this.setState({data:e,valid:{},errors:{},isValid:!0}),super.submit()}),this.props.enableStoreDetails&&this.props.storePaymentMethod&&console.warn("CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior."),this.props.storedPaymentMethodId)return;const i=new s({environment:this.props.environment,analytics:this.analytics});this.cashAppService=new o(i,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,redirectURL:this.props.redirectURL,clientId:null===(r=this.props.configuration)||void 0===r?void 0:r.clientId,scopeId:null===(n=this.props.configuration)||void 0===n?void 0:n.scopeId,button:this.props.button,referenceId:this.props.referenceId})}}c(u,"type",p.cashapp),c(u,"defaultProps",n);export{u as CashAppPay,u as default};
2
2
  //# sourceMappingURL=CashAppPay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n const sdkLoader = new CashAppSdkLoader({\n environment: this.props.environment,\n analytics: this.analytics\n });\n\n this.cashAppService = new CashAppService(sdkLoader, {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","_object_spread_props","_object_spread","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","_this_resources","h","RedirectButton","showPayButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","_this_props_configuration","_this_props_configuration1","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","sdkLoader","CashAppSdkLoader","environment","analytics","CashAppService","useCashAppButtonUi","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"k7CAcO,MAAMA,UAAmBC,EAsCrBC,WAAAA,CAAYC,OAGSA,EAAAA,EAFxB,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,4BAAoBH,EAAAA,EAAMI,eAANJ,IAAAA,WAAAA,EAAAA,EAAeK,qBAAfL,IAAAA,OAAAA,EAAAA,EAA8BG,qBAAsBH,EAAMG,oBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAeC,KAAKC,MAAMC,MAAQ,CAAA,GACxFC,mBAAoBC,EAA+BC,sBAAEA,GAA0BL,KAAKZ,MAKtFkB,EAA4BN,KAAKZ,MAAMG,qBAAwBS,KAAKZ,MAAMI,SAAWY,EAE3F,GAAIC,EACA,MAAO,CACHE,cAAe,CACXC,KAAMvB,EAAWuB,KACjBH,0BAOZ,OAAOf,EAAA,CAC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AAAA,EAA0B4B,QACnCC,OAAQ1E,KAAKZ,MAAMsF,OACnBC,YAAa3E,KAAKZ,MAAMuF,aAEhC,EAnCA5B,EADS9D,EACKuB,OAAOoE,EAAWC,SAIhC9B,EALS9D,EAKQ6F,eAAeA"}
1
+ {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n const sdkLoader = new CashAppSdkLoader({\n environment: this.props.environment,\n analytics: this.analytics\n });\n\n this.cashAppService = new CashAppService(sdkLoader, {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest(this.props.amount);\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","_object_spread_props","_object_spread","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","componentToRender","_this_resources","h","RedirectButton","showPayButton","label","payAmountLabel","i18n","amount","icon","resources","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","_this_props_configuration","_this_props_configuration1","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","sdkLoader","CashAppSdkLoader","environment","analytics","CashAppService","useCashAppButtonUi","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"k2CAcO,MAAMA,UAAmBC,EAqC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Me,oBAC5C4D,QAAQC,KACJ,oJAIJhE,KAAKZ,MAAMiB,sBACX,OAGJ,MAAM4D,EAAY,IAAIC,EAAiB,CACnCC,YAAanE,KAAKZ,MAAM+E,YACxBC,UAAWpE,KAAKoE,YAGpBpE,KAAKkC,eAAiB,IAAImC,EAAeJ,EAAW,CAChD9D,mBAAoBH,KAAKZ,MAAMe,mBAC/BmE,mBAAoBtE,KAAKZ,MAAM8B,cAC/BiD,YAAanE,KAAKZ,MAAM+E,YACxBI,YAAavE,KAAKZ,MAAMmF,YACxBC,SAAkC,QAAxB5B,EAAA5C,KAAKZ,MAAMK,qBAAX,IAAAmD,OAAA,EAAAA,EAA0B4B,SACpCC,QAAiC,QAAxB5B,EAAA7C,KAAKZ,MAAMK,qBAAX,IAAAoD,OAAA,EAAAA,EAA0B4B,QACnCC,OAAQ1E,KAAKZ,MAAMsF,OACnBC,YAAa3E,KAAKZ,MAAMuF,aAEhC,EAlCA5B,EADS9D,EACKuB,OAAOoE,EAAWC,SAIhC9B,EALS9D,EAKQ6F,eAAeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppSdkLoader.js","sources":["../../../../../src/components/CashAppPay/services/CashAppSdkLoader.ts"],"sourcesContent":["import { CASHAPPPAY_PROD_SDK, CASHAPPPAY_SANDBOX_SDK } from './config';\nimport Script from '../../../utils/Script';\nimport { ICashAppWindowObject } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface ICashAppSdkLoader {\n load(environment: string): Promise<ICashAppWindowObject>;\n}\n\nclass CashAppSdkLoader implements ICashAppSdkLoader {\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore CashApp is created by the Cash App SDK\n return !!window.CashApp;\n }\n\n public async load(): Promise<ICashAppWindowObject> {\n const src = this.environment.toLowerCase().includes('live') ? CASHAPPPAY_PROD_SDK : CASHAPPPAY_SANDBOX_SDK;\n\n if (!this.isSdkIsAvailableOnWindow()) {\n const scriptElement = new Script({\n src,\n component: 'cashapppay',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n }\n\n // @ts-ignore CashApp is created by the Cash App SDK\n return window.CashApp;\n }\n}\n\nexport { CashAppSdkLoader };\n"],"names":["CashAppSdkLoader","isSdkIsAvailableOnWindow","window","CashApp","load","src","this","environment","toLowerCase","includes","CASHAPPPAY_PROD_SDK","CASHAPPPAY_SANDBOX_SDK","scriptElement","Script","component","analytics","constructor","_define_property"],"mappings":"8OASA,MAAMA,EASMC,wBAAAA,GAEJ,QAASC,OAAOC,OACpB,CAEA,UAAaC,GACT,MAAMC,EAAMC,KAAKC,YAAYC,cAAcC,SAAS,QAAUC,EAAsBC,EAEpF,IAAKL,KAAKL,2BAA4B,CAClC,MAAMW,EAAgB,IAAIC,EAAO,CAC7BR,MACAS,UAAW,aACXC,UAAWT,KAAKS,kBAGdH,EAAcR,MACxB,CAGA,OAAOF,OAAOC,OAClB,CAzBA,WAAAa,EAAYD,UAAEA,EAASR,YAAEA,IAHzBU,EAAAX,KAAiBS,iBAAjB,GACAE,EAAAX,KAAiBC,mBAAjB,GAGID,KAAKS,UAAYA,EACjBT,KAAKC,YAAcA,CACvB"}
1
+ {"version":3,"file":"CashAppSdkLoader.js","sources":["../../../../../src/components/CashAppPay/services/CashAppSdkLoader.ts"],"sourcesContent":["import { CASHAPPPAY_PROD_SDK, CASHAPPPAY_SANDBOX_SDK } from './config';\nimport Script from '../../../utils/Script';\nimport { ICashAppWindowObject } from './types';\nimport type { IAnalytics } from '../../../core/Analytics/Analytics';\n\nexport interface ICashAppSdkLoader {\n load(environment: string): Promise<ICashAppWindowObject>;\n}\n\nclass CashAppSdkLoader implements ICashAppSdkLoader {\n private readonly analytics: IAnalytics;\n private readonly environment: string;\n\n constructor({ analytics, environment }: { analytics: IAnalytics; environment: string }) {\n this.analytics = analytics;\n this.environment = environment;\n }\n\n private isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore CashApp is created by the Cash App SDK\n return !!window.CashApp;\n }\n\n public async load(): Promise<ICashAppWindowObject> {\n const src = this.environment.toLowerCase().includes('live') ? CASHAPPPAY_PROD_SDK : CASHAPPPAY_SANDBOX_SDK;\n\n if (!this.isSdkIsAvailableOnWindow()) {\n const scriptElement = new Script({\n src,\n component: 'cashapppay',\n analytics: this.analytics\n });\n\n await scriptElement.load();\n }\n\n // @ts-ignore CashApp is created by the Cash App SDK\n return window.CashApp;\n }\n}\n\nexport { CashAppSdkLoader };\n"],"names":["CashAppSdkLoader","isSdkIsAvailableOnWindow","window","CashApp","load","src","this","environment","toLowerCase","includes","CASHAPPPAY_PROD_SDK","CASHAPPPAY_SANDBOX_SDK","scriptElement","Script","component","analytics","constructor","_define_property"],"mappings":"8OASA,MAAMA,EASMC,wBAAAA,GAEJ,QAASC,OAAOC,OACpB,CAEA,UAAaC,GACT,MAAMC,EAAMC,KAAKC,YAAYC,cAAcC,SAAS,QAAUC,EAAsBC,EAEpF,IAAKL,KAAKL,2BAA4B,CAClC,MAAMW,EAAgB,IAAIC,EAAO,CAC7BR,MACAS,UAAW,aACXC,UAAWT,KAAKS,kBAGdH,EAAcR,MACxB,CAGA,OAAOF,OAAOC,OAClB,CAzBA,WAAAa,EAAYD,UAAEA,EAASR,YAAEA,IAHzBU,EAAAX,KAAiBS,oBACjBE,EAAAX,KAAiBC,sBAGbD,KAAKS,UAAYA,EACjBT,KAAKC,YAAcA,CACvB"}
@@ -1,2 +1,2 @@
1
- import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,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{get hasOneTimePayment(){const{amount:t}=this.configuration;return(null==t?void 0:t.value)>0}get hasOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,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(){try{const{referenceId:t,amount:e,scopeId:i,redirectURL:r=window.location.href}=this.configuration,o={referenceId:t,redirectURL:r,actions:n({},this.hasOneTimePayment&&{payment:{amount:e,scopeId:i}},this.hasOnFilePayment&&{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){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};
2
2
  //# sourceMappingURL=CashAppService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n get hasOneTimePayment() {\n const { amount } = this.configuration;\n return amount?.value > 0;\n }\n\n get hasOnFilePayment() {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(): Promise<void> {\n try {\n const { referenceId, amount, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.hasOneTimePayment && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.hasOnFilePayment && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","hasOneTimePayment","amount","this","configuration","value","hasOnFilePayment","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","clientId","cashApp","sdkLoader","load","pay","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","_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":"sfAIe,MAAMA,EAoBjB,qBAAIC,GACA,MAAMC,OAAEA,GAAWC,KAAKC,cACxB,OAAOF,aAAAA,EAAAA,EAAQG,OAAQ,CAC3B,CAEA,oBAAIC,GACA,OAAOH,KAAKC,cAAcG,kBAC9B,CAEOC,qBAAAA,CAAsBC,GACzBN,KAAKC,cAAcG,mBAAqBE,CAC5C,CAEA,gBAAaC,GACT,IACI,MAAMC,YAAEA,EAAWC,SAAEA,GAAaT,KAAKC,cACjCS,QAAgBV,KAAKW,UAAUC,KAAKJ,GAC1CR,KAAKa,UAAYH,EAAQG,IAAI,CAAEJ,YACnC,CAAE,MAAOK,GACL,MAAM,IAAIC,EAAmB,QAAS,8BAA+B,CAAEC,MAAOF,GAClF,CACJ,CAEA,kBAAaG,CAAaC,GACtB,IACI,MAAMC,OAAEA,EAAMC,mBAAEA,GAAuBpB,KAAKC,eAEtCoB,MAAEA,SAAgBrB,KAAKa,IAAIS,OAAOJ,EAAQ,CAC5CK,QAAQ,EACRJ,SAAQC,GAAqBI,EAAA,CAAEC,MAAO,OAAQC,MAAO,aAAgBP,KAEzEnB,KAAK2B,mBAAqBN,CAC9B,CAAE,MAAOP,GACL,MAAM,IAAIC,EAAmB,QAAS,oCAAqC,CAAEC,MAAOF,GACxF,CACJ,CAEOO,KAAAA,GACErB,KAAK2B,mBACL3B,KAAK2B,qBADoBC,QAAQC,KAAK,yCAE/C,CAEOC,gBAAAA,CAAiBC,EAA6BC,GAEjD,OADAhC,KAAKa,IAAIoB,iBAAiBF,EAAWC,GAC9B,KACHhC,KAAKa,IAAIqB,oBAAoBH,EAAWC,GAEhD,CAEA,2BAAaG,GACT,IACI,MAAMC,YAAEA,EAAWrC,OAAEA,EAAMsC,QAAEA,EAAOC,YAAEA,EAAcC,OAAOC,SAASC,MAASzC,KAAKC,cAE5EyC,EAAkB,CACpBN,cACAE,cACAK,QAASnB,EAAA,GACDxB,KAAKF,mBAAqB,CAC1B8C,QAAS,CACL7C,SACAsC,YAGJrC,KAAKG,kBAAoB,CACzB0C,OAAQ,CACJR,oBAKVrC,KAAKa,IAAI6B,gBAAgBA,EACnC,CAAE,MAAO5B,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAagC,SACH9C,KAAKa,IAAIiC,SACnB,CAvFA,WAAAC,CAAYpC,EAA8BV,GAV1C+C,EAAAhD,KAAiBW,iBAAjB,GACAqC,EAAAhD,KAAiBC,qBAAjB,GAEA+C,EAAAhD,KAAQa,WAAR,GAKAmC,EAAAhD,KAAQ2B,0BAAR,GAGI3B,KAAKC,cAAgBA,EACrBD,KAAKW,UAAYA,EAEZV,EAAcQ,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;\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 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types/global-types';\n\nexport interface ICashAppWindowObject {\n pay({ clientId }: { clientId: string }): Promise<ICashAppSDK>;\n}\n\n/**\n * https://developers.cash.app/docs/api/technical-documentation/sdks/pay-kit/technical-reference\n */\nexport interface ICashAppSDK {\n render(target: string | HTMLElement, options?: any): Promise<{ begin?: () => void }>;\n addEventListener(eventType: CashAppPayEvents, callback: Function): void;\n removeEventListener(eventType: CashAppPayEvents, callback: Function): void;\n customerRequest(customerRequest: any): Promise<void>;\n restart(): Promise<void>;\n}\n\nexport enum CashAppPayEvents {\n CustomerDismissed = 'CUSTOMER_DISMISSED',\n CustomerRequestApproved = 'CUSTOMER_REQUEST_APPROVED',\n CustomerRequestDeclined = 'CUSTOMER_REQUEST_DECLINED',\n CustomerRequestFailed = 'CUSTOMER_REQUEST_FAILED'\n}\n\nexport interface ICashAppService {\n begin(): void;\n initialize(): Promise<void>;\n setStorePaymentMethod(store: boolean): void;\n renderButton(target: HTMLElement): Promise<void>;\n restart(): Promise<void>;\n createCustomerRequest(): Promise<void>;\n subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function;\n}\n\nexport type CashAppServiceConfig = {\n useCashAppButtonUi: boolean;\n storePaymentMethod: boolean;\n environment: string;\n clientId: string;\n scopeId: string;\n amount: PaymentAmount;\n referenceId?: string;\n redirectURL?: string;\n button?: {\n shape?: 'semiround' | 'round';\n size?: 'medium' | 'small';\n theme?: 'dark' | 'light';\n width?: 'static' | 'full';\n };\n};\n"],"names":["CashAppPayEvents"],"mappings":"AAiBO,IAAAA,EAAKA,SAAAA,GAAAA,8MAAAA,CAKX,CALWA,CAKX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/components/CashAppPay/services/types.ts"],"sourcesContent":["import { PaymentAmount } from '../../../types';\n\nexport interface ICashAppWindowObject {\n pay({ clientId }: { clientId: string }): Promise<ICashAppSDK>;\n}\n\n/**\n * https://developers.cash.app/docs/api/technical-documentation/sdks/pay-kit/technical-reference\n */\nexport interface ICashAppSDK {\n render(target: string | HTMLElement, options?: any): Promise<{ begin?: () => void }>;\n addEventListener(eventType: CashAppPayEvents, callback: Function): void;\n removeEventListener(eventType: CashAppPayEvents, callback: Function): void;\n customerRequest(customerRequest: any): Promise<void>;\n restart(): Promise<void>;\n}\n\nexport enum CashAppPayEvents {\n CustomerDismissed = 'CUSTOMER_DISMISSED',\n CustomerRequestApproved = 'CUSTOMER_REQUEST_APPROVED',\n CustomerRequestDeclined = 'CUSTOMER_REQUEST_DECLINED',\n CustomerRequestFailed = 'CUSTOMER_REQUEST_FAILED'\n}\n\nexport interface ICashAppService {\n begin(): void;\n initialize(): Promise<void>;\n setStorePaymentMethod(store: boolean): void;\n renderButton(target: HTMLElement): Promise<void>;\n restart(): Promise<void>;\n createCustomerRequest(amount: PaymentAmount): Promise<void>;\n subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function;\n}\n\nexport type CashAppServiceConfig = {\n useCashAppButtonUi: boolean;\n storePaymentMethod: boolean;\n environment: string;\n clientId: string;\n scopeId: string;\n referenceId?: string;\n redirectURL?: string;\n button?: {\n shape?: 'semiround' | 'round';\n size?: 'medium' | 'small';\n theme?: 'dark' | 'light';\n width?: 'static' | 'full';\n };\n};\n"],"names":["CashAppPayEvents"],"mappings":"AAiBO,IAAAA,EAAKA,SAAAA,GAAAA,8MAAAA,CAKX,CALWA,CAKX,CAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import t from"../../utils/browserInfo.js";import r from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as i}from"../internal/ClickToPay/services/ClickToPayService.js";import n from"../internal/ClickToPay/context/ClickToPayProvider.js";import s from"../internal/ClickToPay/ClickToPayComponent.js";import c from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as a}from"../tx-variants.js";function l(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}function p(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(o){l(e,o,t[o])})}return e}function u(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);o.push.apply(o,t)}return o}(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}),e}class h extends o{get isValid(){return!0}get browserInfo(){return t()}formatData(){var e,o;const{srcScheme:t,srcCorrelationId:r,srcTokenReference:i,srcCheckoutPayload:n,srcDigitalCardId:s}=this.state.data;return{paymentMethod:p({type:h.type},t&&{srcScheme:t},r&&{srcCorrelationId:r},i&&{srcTokenReference:i},n&&{srcCheckoutPayload:n},s&&{srcDigitalCardId:s}),browserInfo:this.browserInfo,origin:null===(o=window)||void 0===o||null===(e=o.location)||void 0===e?void 0:e.origin}}formatProps(e){var o,t,r,i,n,s;return u(p({},e),{disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||(null===(t=this.core.options)||void 0===t||null===(o=t.session)||void 0===o?void 0:o.shopperEmail),telephoneNumber:e.telephoneNumber||(null===(i=this.core.options)||void 0===i||null===(r=i.session)||void 0===r?void 0:r.telephoneNumber),locale:e.locale||(null===(s=e.i18n)||void 0===s||null===(n=s.locale)||void 0===n?void 0:n.replace("-","_"))})}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise((e,o)=>{this.clickToPayService.subscribeOnStateChange(t=>{this.clickToPayService.shopperAccountFound&&e(),t!==i.NotAvailable&&t!==i.Login&&t!==i.Idle||o()})}):Promise.reject()}componentToRender(){return e(n,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,amount:this.props.amount,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(s,null))}constructor(e,o){var t;super(e,o),l(this,"clickToPayService",void 0),l(this,"ctpConfiguration",void 0),l(this,"handleClickToPaySubmit",e=>{this.setState({data:p({},e),valid:{},errors:{},isValid:!0}),this.submit()}),this.ctpConfiguration={shopperEmail:this.props.shopperEmail,telephoneNumber:this.props.telephoneNumber,merchantDisplayName:this.props.merchantDisplayName,locale:this.props.locale,onReady:this.props.onReady,onTimeout:this.props.onTimeout},this.clickToPayService=r(this.props.configuration,this.ctpConfiguration,this.props.environment,this.analytics),null===(t=this.clickToPayService)||void 0===t||t.initialize().catch(e=>{this.handleError(new c("ERROR",e.toString(),{cause:e}))}),this.clickToPayService||console.warn("ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing")}}l(h,"type",a.clicktopay);export{h as ClickToPayElement,h as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import t from"../../utils/browserInfo.js";import r from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as i}from"../internal/ClickToPay/services/ClickToPayService.js";import n from"../internal/ClickToPay/context/ClickToPayProvider.js";import s from"../internal/ClickToPay/ClickToPayComponent.js";import c from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as a}from"../tx-variants.js";function l(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}function p(e){for(var o=1;o<arguments.length;o++){var t=null!=arguments[o]?arguments[o]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(o){l(e,o,t[o])})}return e}function u(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);o.push.apply(o,t)}return o}(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}),e}class h extends o{get isValid(){return!0}get browserInfo(){return t()}formatData(){var e,o;const{srcScheme:t,srcCorrelationId:r,srcTokenReference:i,srcCheckoutPayload:n,srcDigitalCardId:s}=this.state.data;return{paymentMethod:p({type:h.type},t&&{srcScheme:t},r&&{srcCorrelationId:r},i&&{srcTokenReference:i},n&&{srcCheckoutPayload:n},s&&{srcDigitalCardId:s}),browserInfo:this.browserInfo,origin:null===(o=window)||void 0===o||null===(e=o.location)||void 0===e?void 0:e.origin}}formatProps(e){var o,t,r,i,n,s;return u(p({},e),{disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||(null===(t=this.core.options)||void 0===t||null===(o=t.session)||void 0===o?void 0:o.shopperEmail),telephoneNumber:e.telephoneNumber||(null===(i=this.core.options)||void 0===i||null===(r=i.session)||void 0===r?void 0:r.telephoneNumber),locale:e.locale||(null===(s=e.i18n)||void 0===s||null===(n=s.locale)||void 0===n?void 0:n.replace("-","_"))})}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise((e,o)=>{this.clickToPayService.subscribeOnStateChange(t=>{this.clickToPayService.shopperAccountFound&&e(),t!==i.NotAvailable&&t!==i.Login&&t!==i.Idle||o()})}):Promise.reject()}componentToRender(){return e(n,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(s,null))}constructor(e,o){var t;super(e,o),l(this,"clickToPayService",void 0),l(this,"ctpConfiguration",void 0),l(this,"handleClickToPaySubmit",e=>{this.setState({data:p({},e),valid:{},errors:{},isValid:!0}),this.submit()}),this.ctpConfiguration={shopperEmail:this.props.shopperEmail,telephoneNumber:this.props.telephoneNumber,merchantDisplayName:this.props.merchantDisplayName,locale:this.props.locale,onReady:this.props.onReady,onTimeout:this.props.onTimeout},this.clickToPayService=r(this.props.configuration,this.ctpConfiguration,this.props.environment,this.analytics),null===(t=this.clickToPayService)||void 0===t||t.initialize().catch(e=>{this.handleError(new c("ERROR",e.toString(),{cause:e}))}),this.clickToPayService||console.warn("ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing")}}l(h,"type",a.clicktopay);export{h as ClickToPayElement,h as default};
2
2
  //# sourceMappingURL=ClickToPay.js.map