@adyen/adyen-web 6.7.0 → 6.9.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 (378) hide show
  1. package/dist/cjs/adyen.css +50 -46
  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 +213 -50
  6. package/dist/es/_virtual/index.js +1 -1
  7. package/dist/es/_virtual/index2.js +2 -0
  8. package/dist/es/_virtual/index2.js.map +1 -0
  9. package/dist/es/adyen.css +50 -46
  10. package/dist/es/adyen.css.map +1 -1
  11. package/dist/es/components/Ach/components/AchInput/AchInput.js +1 -1
  12. package/dist/es/components/Ach/components/AchInput/AchInput.js.map +1 -1
  13. package/dist/es/components/Ach/components/AchInput/components/AchSFInput.js +1 -1
  14. package/dist/es/components/Ach/components/AchInput/components/AchSFInput.js.map +1 -1
  15. package/dist/es/components/ApplePay/components/ApplePayButton.js +1 -1
  16. package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
  17. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  18. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  19. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  20. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  21. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  22. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  23. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  24. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  25. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  26. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  27. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  28. package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
  29. package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  30. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  31. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  32. package/dist/es/components/Card/components/CardInput/components/CardNumber.js +1 -1
  33. package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  34. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  35. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  36. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  37. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  38. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  39. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  40. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  41. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  42. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  43. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  44. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  45. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  46. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  47. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  48. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  49. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  50. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  51. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  52. package/dist/es/components/Giftcard/components/GiftcardNumberField.js +1 -1
  53. package/dist/es/components/Giftcard/components/GiftcardNumberField.js.map +1 -1
  54. package/dist/es/components/Giftcard/components/GiftcardPinField.js +1 -1
  55. package/dist/es/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  56. package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
  57. package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
  58. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  59. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  60. package/dist/es/components/MBWay/MBWay.js +1 -1
  61. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  62. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  63. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  64. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  65. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  66. package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
  67. package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
  68. package/dist/es/components/PayTo/PayTo.js +2 -0
  69. package/dist/es/components/PayTo/PayTo.js.map +1 -0
  70. package/dist/es/components/PayTo/components/BSBInput.js +2 -0
  71. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -0
  72. package/dist/es/components/PayTo/components/IdentifierSelector.js +2 -0
  73. package/dist/es/components/PayTo/components/IdentifierSelector.js.map +1 -0
  74. package/dist/es/components/PayTo/components/MandateSummary.js +2 -0
  75. package/dist/es/components/PayTo/components/MandateSummary.js.map +1 -0
  76. package/dist/es/components/PayTo/components/PayIDInput.js +2 -0
  77. package/dist/es/components/PayTo/components/PayIDInput.js.map +1 -0
  78. package/dist/es/components/PayTo/components/PayToComponent.js +2 -0
  79. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -0
  80. package/dist/es/components/PayTo/components/PayToInstructions.js +2 -0
  81. package/dist/es/components/PayTo/components/PayToInstructions.js.map +1 -0
  82. package/dist/es/components/PayTo/components/PayToNameFields.js +2 -0
  83. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -0
  84. package/dist/es/components/PayTo/components/PayToPhone.js +2 -0
  85. package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -0
  86. package/dist/es/components/PayTo/components/validate.js +2 -0
  87. package/dist/es/components/PayTo/components/validate.js.map +1 -0
  88. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  89. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  90. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  91. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  92. package/dist/es/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +1 -1
  93. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  94. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  95. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  96. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  97. package/dist/es/components/components-name-map.js +1 -1
  98. package/dist/es/components/components-name-map.js.map +1 -1
  99. package/dist/es/components/index.js +1 -1
  100. package/dist/es/components/internal/Alert/Alert.js +1 -1
  101. package/dist/es/components/internal/Alert/Alert.js.map +1 -1
  102. package/dist/es/components/internal/Await/Await.js +1 -1
  103. package/dist/es/components/internal/Await/Await.js.map +1 -1
  104. package/dist/es/components/internal/Button/Button.js +1 -1
  105. package/dist/es/components/internal/Button/Button.js.map +1 -1
  106. package/dist/es/components/internal/ButtonGroup/ButtonGroup.js +1 -1
  107. package/dist/es/components/internal/ButtonGroup/ButtonGroup.js.map +1 -1
  108. package/dist/es/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js +1 -1
  109. package/dist/es/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js.map +1 -1
  110. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js +1 -1
  111. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js.map +1 -1
  112. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  113. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  114. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js +1 -1
  115. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js.map +1 -1
  116. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  117. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  118. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  119. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  120. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  121. package/dist/es/components/internal/ContentSeparator/ContentSeparator.js +1 -1
  122. package/dist/es/components/internal/ContentSeparator/ContentSeparator.js.map +1 -1
  123. package/dist/es/components/internal/DetailsTable/DetailsTable.js +2 -0
  124. package/dist/es/components/internal/DetailsTable/DetailsTable.js.map +1 -0
  125. package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
  126. package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  127. package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  128. package/dist/es/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  129. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  130. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  131. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  132. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  133. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  134. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  135. package/dist/es/components/internal/FormFields/RadioGroup/RadioGroup.js +1 -1
  136. package/dist/es/components/internal/FormFields/RadioGroup/RadioGroup.js.map +1 -1
  137. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  138. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  139. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  140. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  141. package/dist/es/components/internal/FormFields/Select/components/SelectList.js +1 -1
  142. package/dist/es/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  143. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  144. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  145. package/dist/es/components/internal/IFrame/Iframe.js +1 -1
  146. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  147. package/dist/es/components/internal/Icon/Icon.js +1 -1
  148. package/dist/es/components/internal/Icon/Icon.js.map +1 -1
  149. package/dist/es/components/internal/Img/Img.js +1 -1
  150. package/dist/es/components/internal/Img/Img.js.map +1 -1
  151. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js +1 -1
  152. package/dist/es/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js.map +1 -1
  153. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  154. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  155. package/dist/es/components/internal/Modal/Modal.js +1 -1
  156. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  157. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  158. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  159. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  160. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js +2 -0
  161. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js.map +1 -0
  162. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +2 -0
  163. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -0
  164. package/dist/es/components/internal/PhoneInput/validate.js +1 -1
  165. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  166. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  167. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  168. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  169. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  170. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  171. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  172. package/dist/es/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  173. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  174. package/dist/es/components/internal/Voucher/Voucher.js +1 -1
  175. package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
  176. package/dist/es/components/tx-variants.js +1 -1
  177. package/dist/es/components/tx-variants.js.map +1 -1
  178. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  179. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  180. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  181. package/dist/es/core/core.js +1 -1
  182. package/dist/es/core/utils.js +1 -1
  183. package/dist/es/core/utils.js.map +1 -1
  184. package/dist/es/external/classnames/index.js +2 -2
  185. package/dist/es/external/classnames/index.js.map +1 -1
  186. package/dist/es/index.d.ts +213 -50
  187. package/dist/es/index.js +1 -1
  188. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  189. package/dist/es/utils/Validator/Validator.js.map +1 -1
  190. package/dist/es-legacy/_virtual/index.js +1 -1
  191. package/dist/es-legacy/_virtual/index2.js +2 -0
  192. package/dist/es-legacy/_virtual/index2.js.map +1 -0
  193. package/dist/es-legacy/adyen.css +50 -46
  194. package/dist/es-legacy/adyen.css.map +1 -1
  195. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
  196. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
  197. package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js +1 -1
  198. package/dist/es-legacy/components/Ach/components/AchInput/components/AchSFInput.js.map +1 -1
  199. package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js +1 -1
  200. package/dist/es-legacy/components/ApplePay/components/ApplePayButton.js.map +1 -1
  201. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  202. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  203. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  204. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  205. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  206. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  207. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  208. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  209. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  210. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  211. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  212. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
  213. package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
  214. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  215. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  216. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js +1 -1
  217. package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
  218. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  219. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  220. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  221. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  222. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  223. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  224. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  225. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  226. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  227. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  228. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  229. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  230. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  231. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  232. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  233. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  234. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  235. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  236. package/dist/es-legacy/components/Giftcard/components/GiftcardNumberField.js +1 -1
  237. package/dist/es-legacy/components/Giftcard/components/GiftcardNumberField.js.map +1 -1
  238. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js +1 -1
  239. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  240. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
  241. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
  242. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  243. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  244. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  245. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  246. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  247. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  248. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  249. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  250. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  251. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  252. package/dist/es-legacy/components/PayTo/PayTo.js +2 -0
  253. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -0
  254. package/dist/es-legacy/components/PayTo/components/BSBInput.js +2 -0
  255. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -0
  256. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js +2 -0
  257. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js.map +1 -0
  258. package/dist/es-legacy/components/PayTo/components/MandateSummary.js +2 -0
  259. package/dist/es-legacy/components/PayTo/components/MandateSummary.js.map +1 -0
  260. package/dist/es-legacy/components/PayTo/components/PayIDInput.js +2 -0
  261. package/dist/es-legacy/components/PayTo/components/PayIDInput.js.map +1 -0
  262. package/dist/es-legacy/components/PayTo/components/PayToComponent.js +2 -0
  263. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -0
  264. package/dist/es-legacy/components/PayTo/components/PayToInstructions.js +2 -0
  265. package/dist/es-legacy/components/PayTo/components/PayToInstructions.js.map +1 -0
  266. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +2 -0
  267. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -0
  268. package/dist/es-legacy/components/PayTo/components/PayToPhone.js +2 -0
  269. package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -0
  270. package/dist/es-legacy/components/PayTo/components/validate.js +2 -0
  271. package/dist/es-legacy/components/PayTo/components/validate.js.map +1 -0
  272. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  273. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  274. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  275. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  276. package/dist/es-legacy/components/UPI/components/UPIComponent/useUpiSegmentedControlOptions.js.map +1 -1
  277. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  278. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  279. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  280. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  281. package/dist/es-legacy/components/components-name-map.js +1 -1
  282. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  283. package/dist/es-legacy/components/index.js +1 -1
  284. package/dist/es-legacy/components/internal/Alert/Alert.js +1 -1
  285. package/dist/es-legacy/components/internal/Alert/Alert.js.map +1 -1
  286. package/dist/es-legacy/components/internal/Await/Await.js +1 -1
  287. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  288. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  289. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  290. package/dist/es-legacy/components/internal/ButtonGroup/ButtonGroup.js +1 -1
  291. package/dist/es-legacy/components/internal/ButtonGroup/ButtonGroup.js.map +1 -1
  292. package/dist/es-legacy/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js +1 -1
  293. package/dist/es-legacy/components/internal/ClickToPay/components/CtPBrand/CtPBrand.js.map +1 -1
  294. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js +1 -1
  295. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.js.map +1 -1
  296. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  297. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  298. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js +1 -1
  299. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js.map +1 -1
  300. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  301. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  302. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  303. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  304. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  305. package/dist/es-legacy/components/internal/ContentSeparator/ContentSeparator.js +1 -1
  306. package/dist/es-legacy/components/internal/ContentSeparator/ContentSeparator.js.map +1 -1
  307. package/dist/es-legacy/components/internal/DetailsTable/DetailsTable.js +2 -0
  308. package/dist/es-legacy/components/internal/DetailsTable/DetailsTable.js.map +1 -0
  309. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
  310. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  311. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  312. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  313. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  314. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  315. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  316. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  317. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  318. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  319. package/dist/es-legacy/components/internal/FormFields/RadioGroup/RadioGroup.js +1 -1
  320. package/dist/es-legacy/components/internal/FormFields/RadioGroup/RadioGroup.js.map +1 -1
  321. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  322. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  323. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  324. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  325. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
  326. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  327. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  328. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  329. package/dist/es-legacy/components/internal/IFrame/Iframe.js +1 -1
  330. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  331. package/dist/es-legacy/components/internal/Icon/Icon.js +1 -1
  332. package/dist/es-legacy/components/internal/Icon/Icon.js.map +1 -1
  333. package/dist/es-legacy/components/internal/Img/Img.js +1 -1
  334. package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
  335. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js +1 -1
  336. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButton.js.map +1 -1
  337. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  338. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  339. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  340. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  341. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  342. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  343. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  344. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +2 -0
  345. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -0
  346. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +2 -0
  347. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -0
  348. package/dist/es-legacy/components/internal/PhoneInput/validate.js +1 -1
  349. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  350. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  351. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  352. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  353. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  354. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  355. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js +1 -1
  356. package/dist/es-legacy/components/internal/SendCopyToEmail/SendCopyToEmail.js.map +1 -1
  357. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  358. package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
  359. package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
  360. package/dist/es-legacy/components/tx-variants.js +1 -1
  361. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  362. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  363. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  364. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  365. package/dist/es-legacy/core/core.js +1 -1
  366. package/dist/es-legacy/core/utils.js +1 -1
  367. package/dist/es-legacy/core/utils.js.map +1 -1
  368. package/dist/es-legacy/external/classnames/index.js +2 -2
  369. package/dist/es-legacy/external/classnames/index.js.map +1 -1
  370. package/dist/es-legacy/index.js +1 -1
  371. package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
  372. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  373. package/package.json +23 -17
  374. package/styles/adyen.css +50 -46
  375. package/dist/es/components/internal/PhoneInput/PhoneInput.js +0 -2
  376. package/dist/es/components/internal/PhoneInput/PhoneInput.js.map +0 -1
  377. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js +0 -2
  378. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import s from"../../internal/Alert/Alert.js";import a from"./GiftcardResult.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{GIFT_CARD as n}from"../../internal/SecuredFields/lib/constants.js";import{GiftCardFields as i}from"./GiftcardFields.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}class u extends t{setStatus(t){this.setState({status:t})}render(t,{focusedElement:i,balance:c,transactionLimit:u}){const{i18n:l}=o(),d=u?.value<c?.value?u:c,p=d?.value>=this.props.amount?.value;if(d&&p)return e(a,{balance:c,transactionLimit:u,onSubmit:t.onSubmit,...t});const h=t=>{if(t.errors.encryptedCardNumber)return l.get(t.errors.encryptedCardNumber);switch(this.state.status){case"no-balance":return l.get("error.giftcard.no-balance");case"card-error":return l.get("error.giftcard.card-error");case"currency-error":return l.get("error.giftcard.currency-error");default:return null}};return e("div",{className:"adyen-checkout__giftcard"},"error"===this.state.status&&e(s,{icon:"cross"},l.get("error.message.unknown")),e(r,{...this.props,ref:t=>{this.sfp=t},onChange:this.onChange,onFocus:this.handleFocus,type:n,render:({setRootNode:t,setFocusOn:e},r)=>this.props.fieldsLayoutComponent({i18n:l,pinRequired:this.props.pinRequired,focusedElement:i,getCardErrorMessage:h,setRootNode:t,setFocusOn:e,sfpState:r})}),this.props.showPayButton&&this.props.payButton({status:this.state.status,onClick:this.props.onSubmit,label:l.get("applyGiftcard")}))}constructor(...t){super(...t),c(this,"state",{status:"ready",data:{},balance:null,transactionLimit:null,focusedElement:!1,isValid:!1}),c(this,"sfp",void 0),c(this,"onChange",(t=>{this.props.onChange({data:t.data,isValid:t.isSfpValid})})),c(this,"showValidation",(()=>{this.sfp.showValidation()})),c(this,"handleFocus",(t=>{this.setState({focusedElement:t.currentFocusObject});!0===t.focus?this.props.onFocus(t):this.props.onBlur(t)})),c(this,"setBalance",(({balance:t,transactionLimit:e})=>{this.setState({balance:t,transactionLimit:e})}))}}c(u,"defaultProps",{pinRequired:!0,expiryDateRequired:!1,onChange:()=>{},onFocus:()=>{},onBlur:()=>{},fieldsLayoutComponent:i});export{u as default};
1
+ import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import s from"../../internal/Alert/Alert.js";import a from"./GiftcardResult.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{GIFT_CARD as n}from"../../internal/SecuredFields/lib/constants.js";import{GiftCardFields as i}from"./GiftcardFields.js";function u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class c extends t{setStatus(t){this.setState({status:t})}render(t,{focusedElement:i,balance:u,transactionLimit:c}){const{i18n:l}=o(),p=c?.value<u?.value?c:u,d=p?.value>=this.props.amount?.value;if(p&&d)return e(a,{amount:this.props.amount,balance:u,transactionLimit:c,makePayment:t.makePayment,status:this.state.status,showPayButton:this.props.showPayButton,payButton:this.props.payButton});const h=t=>{if(t.errors.encryptedCardNumber)return l.get(t.errors.encryptedCardNumber);switch(this.state.status){case"no-balance":return l.get("error.giftcard.no-balance");case"card-error":return l.get("error.giftcard.card-error");case"currency-error":return l.get("error.giftcard.currency-error");default:return null}};return e("div",{className:"adyen-checkout__giftcard"},"error"===this.state.status&&e(s,{icon:"cross"},l.get("error.message.unknown")),e(r,{...this.props,ref:t=>{this.sfp=t},onChange:this.onChange,onFocus:this.handleFocus,type:n,render:({setRootNode:t,setFocusOn:e},r)=>this.props.fieldsLayoutComponent({i18n:l,pinRequired:this.props.pinRequired,focusedElement:i,getCardErrorMessage:h,setRootNode:t,setFocusOn:e,sfpState:r})}),this.props.showPayButton&&this.props.payButton({status:this.state.status,onClick:this.props.makeBalanceCheck,label:l.get("applyGiftcard")}))}constructor(...t){super(...t),u(this,"state",{status:"ready",data:{},balance:null,transactionLimit:null,focusedElement:!1,isValid:!1}),u(this,"sfp",void 0),u(this,"onChange",(t=>{this.props.onChange({data:t.data,isValid:t.isSfpValid})})),u(this,"showValidation",(()=>{this.sfp.showValidation()})),u(this,"handleFocus",(t=>{this.setState({focusedElement:t.currentFocusObject});!0===t.focus?this.props.onFocus(t):this.props.onBlur(t)})),u(this,"setBalance",(({balance:t,transactionLimit:e})=>{this.setState({balance:t,transactionLimit:e})}))}}u(c,"defaultProps",{pinRequired:!0,expiryDateRequired:!1,onChange:()=>{},onFocus:()=>{},onBlur:()=>{},fieldsLayoutComponent:i});export{c as default};
2
2
  //# sourceMappingURL=GiftcardComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GiftcardComponent.js","sources":["../../../../../src/components/Giftcard/components/GiftcardComponent.tsx"],"sourcesContent":["import { Component, FunctionComponent, h } from 'preact';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Alert from '../../internal/Alert';\nimport GiftcardResult from './GiftcardResult';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { PaymentAmount } from '../../../types/global-types';\nimport { GIFT_CARD } from '../../internal/SecuredFields/lib/constants';\nimport { GiftCardFields } from './GiftcardFields';\nimport { GiftcardFieldsProps, Placeholders } from './types';\n\ninterface GiftcardComponentProps {\n onChange: (state) => void;\n onFocus: (event) => void;\n onBlur: (event) => void;\n onSubmit: (event) => void;\n onBalanceCheck: (event) => void;\n\n amount?: PaymentAmount;\n showPayButton: boolean;\n payButton: (config) => any;\n\n pinRequired: boolean;\n expiryDateRequired?: boolean;\n fieldsLayoutComponent: FunctionComponent<GiftcardFieldsProps>;\n placeholders?: Placeholders;\n handleKeyPress?: (o: KeyboardEvent) => void;\n}\n\nclass Giftcard extends Component<GiftcardComponentProps> {\n public state = {\n status: 'ready',\n data: {},\n balance: null,\n transactionLimit: null,\n focusedElement: false,\n isValid: false\n };\n\n public static defaultProps = {\n pinRequired: true,\n expiryDateRequired: false,\n onChange: () => {},\n onFocus: () => {},\n onBlur: () => {},\n fieldsLayoutComponent: GiftCardFields\n };\n\n public sfp;\n\n public onChange = sfpState => {\n this.props.onChange({\n data: sfpState.data,\n isValid: sfpState.isSfpValid\n });\n };\n\n public showValidation = () => {\n this.sfp.showValidation();\n };\n\n setStatus(status) {\n this.setState({ status });\n }\n\n public handleFocus = e => {\n this.setState({ focusedElement: e.currentFocusObject });\n\n const isFocused = e.focus === true;\n if (isFocused) {\n this.props.onFocus(e);\n } else {\n this.props.onBlur(e);\n }\n };\n\n public setBalance = ({ balance, transactionLimit }) => {\n this.setState({ balance, transactionLimit });\n };\n\n render(props, { focusedElement, balance, transactionLimit }) {\n const { i18n } = useCoreContext();\n\n const transactionAmount = transactionLimit?.value < balance?.value ? transactionLimit : balance;\n const hasEnoughBalance = transactionAmount?.value >= this.props.amount?.value;\n\n if (transactionAmount && hasEnoughBalance) {\n return <GiftcardResult balance={balance} transactionLimit={transactionLimit} onSubmit={props.onSubmit} {...props} />;\n }\n\n const getCardErrorMessage = sfpState => {\n if (sfpState.errors.encryptedCardNumber) return i18n.get(sfpState.errors.encryptedCardNumber);\n\n switch (this.state.status) {\n case 'no-balance':\n return i18n.get('error.giftcard.no-balance');\n case 'card-error':\n return i18n.get('error.giftcard.card-error');\n case 'currency-error':\n return i18n.get('error.giftcard.currency-error');\n default:\n return null;\n }\n };\n\n return (\n <div className=\"adyen-checkout__giftcard\">\n {this.state.status === 'error' && <Alert icon={'cross'}>{i18n.get('error.message.unknown')}</Alert>}\n\n <SecuredFieldsProvider\n {...this.props}\n ref={ref => {\n this.sfp = ref;\n }}\n onChange={this.onChange}\n onFocus={this.handleFocus}\n type={GIFT_CARD}\n render={({ setRootNode, setFocusOn }, sfpState) =>\n this.props.fieldsLayoutComponent({\n i18n: i18n,\n pinRequired: this.props.pinRequired,\n focusedElement: focusedElement,\n getCardErrorMessage: getCardErrorMessage,\n setRootNode: setRootNode,\n setFocusOn: setFocusOn,\n sfpState: sfpState\n })\n }\n />\n\n {this.props.showPayButton &&\n this.props.payButton({\n status: this.state.status,\n onClick: this.props.onSubmit,\n label: i18n.get('applyGiftcard')\n })}\n </div>\n );\n }\n}\n\nexport default Giftcard;\n"],"names":["Giftcard","Component","setStatus","status","this","setState","render","props","focusedElement","balance","transactionLimit","i18n","useCoreContext","transactionAmount","value","hasEnoughBalance","amount","h","GiftcardResult","onSubmit","getCardErrorMessage","sfpState","errors","encryptedCardNumber","get","state","div","className","Alert","icon","SecuredFieldsProvider","ref","sfp","onChange","onFocus","handleFocus","type","GIFT_CARD","setRootNode","setFocusOn","fieldsLayoutComponent","pinRequired","showPayButton","payButton","onClick","label","super","args","_define_property","data","isValid","isSfpValid","showValidation","e","currentFocusObject","focus","onBlur","setBalance","defaultProps","expiryDateRequired","GiftCardFields"],"mappings":"8iBA4BA,MAAMA,UAAiBC,EAgCnBC,SAAAA,CAAUC,GACNC,KAAKC,SAAS,CAAEF,UACpB,CAiBAG,MAAAA,CAAOC,GAAOC,eAAEA,EAAcC,QAAEA,EAAOC,iBAAEA,IACrC,MAAMC,KAAEA,GAASC,IAEXC,EAAoBH,GAAkBI,MAAQL,GAASK,MAAQJ,EAAmBD,EAClFM,EAAmBF,GAAmBC,OAASV,KAAKG,MAAMS,QAAQF,MAExE,GAAID,GAAqBE,EACrB,OAAOE,EAACC,EAAAA,CAAeT,QAASA,EAASC,iBAAkBA,EAAkBS,SAAUZ,EAAMY,YAAcZ,IAG/G,MAAMa,EAAsBC,IACxB,GAAIA,EAASC,OAAOC,oBAAqB,OAAOZ,EAAKa,IAAIH,EAASC,OAAOC,qBAEzE,OAAQnB,KAAKqB,MAAMtB,QACf,IAAK,aACD,OAAOQ,EAAKa,IAAI,6BACpB,IAAK,aACD,OAAOb,EAAKa,IAAI,6BACpB,IAAK,iBACD,OAAOb,EAAKa,IAAI,iCACpB,QACI,OAAO,KACf,EAGJ,OACIP,EAACS,MAAAA,CAAIC,UAAU,4BACY,UAAtBvB,KAAKqB,MAAMtB,QAAsBc,EAACW,EAAAA,CAAMC,KAAM,SAAUlB,EAAKa,IAAI,0BAElEP,EAACa,EAAAA,IACO1B,KAAKG,MACTwB,IAAKA,IACD3B,KAAK4B,IAAMD,CAAAA,EAEfE,SAAU7B,KAAK6B,SACfC,QAAS9B,KAAK+B,YACdC,KAAMC,EACN/B,OAAQ,EAAGgC,cAAaC,cAAclB,IAClCjB,KAAKG,MAAMiC,sBAAsB,CAC7B7B,KAAMA,EACN8B,YAAarC,KAAKG,MAAMkC,YACxBjC,eAAgBA,EAChBY,oBAAqBA,EACrBkB,YAAaA,EACbC,WAAYA,EACZlB,SAAUA,MAKrBjB,KAAKG,MAAMmC,eACRtC,KAAKG,MAAMoC,UAAU,CACjBxC,OAAQC,KAAKqB,MAAMtB,OACnByC,QAASxC,KAAKG,MAAMY,SACpB0B,MAAOlC,EAAKa,IAAI,mBAIpC,mBA7GJsB,SAAAC,GACIC,OAAOvB,QAAQ,CACXtB,OAAQ,QACR8C,KAAM,CAAC,EACPxC,QAAS,KACTC,iBAAkB,KAClBF,gBAAgB,EAChB0C,SAAS,IAYbF,OAAOhB,WAAP,GAEAgB,EAAA5C,KAAO6B,YAAWZ,IACdjB,KAAKG,MAAM0B,SAAS,CAChBgB,KAAM5B,EAAS4B,KACfC,QAAS7B,EAAS8B,YACtB,IAGJH,OAAOI,kBAAiB,KACpBhD,KAAK4B,IAAIoB,gBAAc,IAO3BJ,EAAA5C,KAAO+B,eAAckB,IACjBjD,KAAKC,SAAS,CAAEG,eAAgB6C,EAAEC,sBAEJ,IAAZD,EAAEE,MAEhBnD,KAAKG,MAAM2B,QAAQmB,GAEnBjD,KAAKG,MAAMiD,OAAOH,EACtB,IAGJL,OAAOS,cAAa,EAAGhD,UAASC,uBAC5BN,KAAKC,SAAS,CAAEI,UAASC,oBAAiB,KAtC9CsC,EAVEhD,EAUY0D,eAAe,CACzBjB,aAAa,EACbkB,oBAAoB,EACpB1B,SAAU,OACVC,QAAS,OACTsB,OAAQ,OACRhB,sBAAuBoB"}
1
+ {"version":3,"file":"GiftcardComponent.js","sources":["../../../../../src/components/Giftcard/components/GiftcardComponent.tsx"],"sourcesContent":["import { Component, FunctionComponent, h } from 'preact';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Alert from '../../internal/Alert';\nimport GiftcardResult from './GiftcardResult';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { PaymentAmount } from '../../../types/global-types';\nimport { GIFT_CARD } from '../../internal/SecuredFields/lib/constants';\nimport { GiftCardFields } from './GiftcardFields';\nimport { GiftcardFieldsProps, Placeholders } from './types';\n\ninterface GiftcardComponentProps {\n onChange: (state) => void;\n onFocus: (event) => void;\n onBlur: (event) => void;\n\n makeBalanceCheck: (event) => void;\n makePayment: (event) => void;\n\n amount?: PaymentAmount;\n showPayButton: boolean;\n payButton: (config) => any;\n\n pinRequired: boolean;\n expiryDateRequired?: boolean;\n fieldsLayoutComponent: FunctionComponent<GiftcardFieldsProps>;\n placeholders?: Placeholders;\n handleKeyPress?: (o: KeyboardEvent) => void;\n}\n\nclass Giftcard extends Component<GiftcardComponentProps> {\n public state = {\n status: 'ready',\n data: {},\n balance: null,\n transactionLimit: null,\n focusedElement: false,\n isValid: false\n };\n\n public static defaultProps = {\n pinRequired: true,\n expiryDateRequired: false,\n onChange: () => {},\n onFocus: () => {},\n onBlur: () => {},\n fieldsLayoutComponent: GiftCardFields\n };\n\n public sfp;\n\n public onChange = sfpState => {\n this.props.onChange({\n data: sfpState.data,\n isValid: sfpState.isSfpValid\n });\n };\n\n public showValidation = () => {\n this.sfp.showValidation();\n };\n\n setStatus(status) {\n this.setState({ status });\n }\n\n public handleFocus = e => {\n this.setState({ focusedElement: e.currentFocusObject });\n\n const isFocused = e.focus === true;\n if (isFocused) {\n this.props.onFocus(e);\n } else {\n this.props.onBlur(e);\n }\n };\n\n public setBalance = ({ balance, transactionLimit }) => {\n this.setState({ balance, transactionLimit });\n };\n\n render(props, { focusedElement, balance, transactionLimit }) {\n const { i18n } = useCoreContext();\n\n const transactionAmount = transactionLimit?.value < balance?.value ? transactionLimit : balance;\n const hasEnoughBalance = transactionAmount?.value >= this.props.amount?.value;\n\n if (transactionAmount && hasEnoughBalance) {\n return (\n <GiftcardResult\n amount={this.props.amount}\n balance={balance}\n transactionLimit={transactionLimit}\n makePayment={props.makePayment}\n status={this.state.status}\n showPayButton={this.props.showPayButton}\n payButton={this.props.payButton}\n />\n );\n }\n\n const getCardErrorMessage = sfpState => {\n if (sfpState.errors.encryptedCardNumber) return i18n.get(sfpState.errors.encryptedCardNumber);\n\n switch (this.state.status) {\n case 'no-balance':\n return i18n.get('error.giftcard.no-balance');\n case 'card-error':\n return i18n.get('error.giftcard.card-error');\n case 'currency-error':\n return i18n.get('error.giftcard.currency-error');\n default:\n return null;\n }\n };\n\n return (\n <div className=\"adyen-checkout__giftcard\">\n {this.state.status === 'error' && <Alert icon={'cross'}>{i18n.get('error.message.unknown')}</Alert>}\n\n <SecuredFieldsProvider\n {...this.props}\n ref={ref => {\n this.sfp = ref;\n }}\n onChange={this.onChange}\n onFocus={this.handleFocus}\n type={GIFT_CARD}\n render={({ setRootNode, setFocusOn }, sfpState) =>\n this.props.fieldsLayoutComponent({\n i18n: i18n,\n pinRequired: this.props.pinRequired,\n focusedElement: focusedElement,\n getCardErrorMessage: getCardErrorMessage,\n setRootNode: setRootNode,\n setFocusOn: setFocusOn,\n sfpState: sfpState\n })\n }\n />\n\n {this.props.showPayButton &&\n this.props.payButton({\n status: this.state.status,\n onClick: this.props.makeBalanceCheck,\n label: i18n.get('applyGiftcard')\n })}\n </div>\n );\n }\n}\n\nexport default Giftcard;\n"],"names":["Giftcard","Component","setStatus","status","this","setState","render","props","focusedElement","balance","transactionLimit","i18n","useCoreContext","transactionAmount","value","hasEnoughBalance","amount","h","GiftcardResult","makePayment","state","showPayButton","payButton","getCardErrorMessage","sfpState","errors","encryptedCardNumber","get","div","className","Alert","icon","SecuredFieldsProvider","ref","sfp","onChange","onFocus","handleFocus","type","GIFT_CARD","setRootNode","setFocusOn","fieldsLayoutComponent","pinRequired","onClick","makeBalanceCheck","label","super","args","_define_property","data","isValid","isSfpValid","showValidation","e","currentFocusObject","focus","onBlur","setBalance","defaultProps","expiryDateRequired","GiftCardFields"],"mappings":"8iBA6BA,MAAMA,UAAiBC,EAgCnBC,SAAAA,CAAUC,GACNC,KAAKC,SAAS,CAAEF,UACpB,CAiBAG,MAAAA,CAAOC,GAAOC,eAAEA,EAAcC,QAAEA,EAAOC,iBAAEA,IACrC,MAAMC,KAAEA,GAASC,IAEXC,EAAoBH,GAAkBI,MAAQL,GAASK,MAAQJ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,KAAM,CAAC,EACPzC,QAAS,KACTC,iBAAkB,KAClBF,gBAAgB,EAChB2C,SAAS,IAYbF,OAAOf,WAAP,GAEAe,EAAA7C,KAAO+B,YAAWX,IACdpB,KAAKG,MAAM4B,SAAS,CAChBe,KAAM1B,EAAS0B,KACfC,QAAS3B,EAAS4B,YACtB,IAGJH,OAAOI,kBAAiB,KACpBjD,KAAK8B,IAAImB,gBAAc,IAO3BJ,EAAA7C,KAAOiC,eAAciB,IACjBlD,KAAKC,SAAS,CAAEG,eAAgB8C,EAAEC,sBAEJ,IAAZD,EAAEE,MAEhBpD,KAAKG,MAAM6B,QAAQkB,GAEnBlD,KAAKG,MAAMkD,OAAOH,EACtB,IAGJL,OAAOS,cAAa,EAAGjD,UAASC,uBAC5BN,KAAKC,SAAS,CAAEI,UAASC,oBAAiB,KAtC9CuC,EAVEjD,EAUY2D,eAAe,CACzBhB,aAAa,EACbiB,oBAAoB,EACpBzB,SAAU,OACVC,QAAS,OACTqB,OAAQ,OACRf,sBAAuBmB"}
@@ -1,2 +1,2 @@
1
- import e from"../../Card/components/CardInput/components/DataSfSpan.js";import r from"../../../external/classnames/index.js";import t from"../../internal/FormFields/Field/Field.js";import{createElement as a}from"../../../external/preact/dist/preact.js";import{alternativeLabelContent as n}from"../../Card/components/CardInput/components/FieldLabelAlternative.js";const d=({i18n:d,classNameModifiers:o,sfpState:c,getCardErrorMessage:s,focusedElement:m,setFocusOn:i})=>a(t,{label:d.get("giftcard.cardNumber.label"),classNameModifiers:["number",...o],errorMessage:s(c),focused:"encryptedCardNumber"===m,onFocusField:()=>i("encryptedCardNumber"),dir:"ltr",name:"encryptedCardNumber",contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:n},a(e,{encryptedFieldType:"encryptedCardNumber","data-info":'{"length":"15-32", "maskInterval":4}',className:r({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":s(c),"adyen-checkout__input--focus":"encryptedCardNumber"===m})}));export{d as GiftcardNumberField};
1
+ import e from"../../Card/components/CardInput/components/DataSfSpan.js";import r from"../../../_virtual/index.js";import t from"../../internal/FormFields/Field/Field.js";import{createElement as a}from"../../../external/preact/dist/preact.js";import{alternativeLabelContent as n}from"../../Card/components/CardInput/components/FieldLabelAlternative.js";const d=({i18n:d,classNameModifiers:o,sfpState:c,getCardErrorMessage:s,focusedElement:i,setFocusOn:m})=>a(t,{label:d.get("giftcard.cardNumber.label"),classNameModifiers:["number",...o],errorMessage:s(c),focused:"encryptedCardNumber"===i,onFocusField:()=>m("encryptedCardNumber"),dir:"ltr",name:"encryptedCardNumber",contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:n},a(e,{encryptedFieldType:"encryptedCardNumber","data-info":'{"length":"15-32", "maskInterval":4}',className:r({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cardNumber__input":!0,"adyen-checkout__input--error":s(c),"adyen-checkout__input--focus":"encryptedCardNumber"===i})}));export{d as GiftcardNumberField};
2
2
  //# sourceMappingURL=GiftcardNumberField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GiftcardNumberField.js","sources":["../../../../../src/components/Giftcard/components/GiftcardNumberField.tsx"],"sourcesContent":["import DataSfSpan from '../../Card/components/CardInput/components/DataSfSpan';\nimport classNames from 'classnames';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { GiftcardFieldProps } from './types';\nimport { alternativeLabelContent } from '../../Card/components/CardInput/components/FieldLabelAlternative';\n\nexport const GiftcardNumberField = ({ i18n, classNameModifiers, sfpState, getCardErrorMessage, focusedElement, setFocusOn }: GiftcardFieldProps) => {\n return (\n <Field\n label={i18n.get('giftcard.cardNumber.label')}\n classNameModifiers={['number', ...classNameModifiers]}\n errorMessage={getCardErrorMessage(sfpState)}\n focused={focusedElement === 'encryptedCardNumber'}\n onFocusField={() => setFocusOn('encryptedCardNumber')}\n dir={'ltr'}\n name={'encryptedCardNumber'}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType=\"encryptedCardNumber\"\n data-info='{\"length\":\"15-32\", \"maskInterval\":4}'\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': getCardErrorMessage(sfpState),\n 'adyen-checkout__input--focus': focusedElement === 'encryptedCardNumber'\n })}\n />\n </Field>\n );\n};\n"],"names":["GiftcardNumberField","i18n","classNameModifiers","sfpState","getCardErrorMessage","focusedElement","setFocusOn","h","Field","label","get","errorMessage","focused","onFocusField","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","data-info","className","classNames"],"mappings":"2WAOaA,MAAAA,EAAsB,EAAGC,OAAMC,qBAAoBC,WAAUC,sBAAqBC,iBAAgBC,gBAEvGC,EAACC,EAAAA,CACGC,MAAOR,EAAKS,IAAI,6BAChBR,mBAAoB,CAAC,YAAaA,GAClCS,aAAcP,EAAoBD,GAClCS,QAA4B,wBAAnBP,EACTQ,aAAc,IAAMP,EAAW,uBAC/BQ,IAAK,MACLC,KAAM,sBACNC,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1BZ,EAACa,EAAAA,CACGC,mBAAmB,sBACnBC,YAAU,uCACVC,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgCpB,EAAoBD,GACpD,+BAAmD,wBAAnBE"}
1
+ {"version":3,"file":"GiftcardNumberField.js","sources":["../../../../../src/components/Giftcard/components/GiftcardNumberField.tsx"],"sourcesContent":["import DataSfSpan from '../../Card/components/CardInput/components/DataSfSpan';\nimport classNames from 'classnames';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { GiftcardFieldProps } from './types';\nimport { alternativeLabelContent } from '../../Card/components/CardInput/components/FieldLabelAlternative';\n\nexport const GiftcardNumberField = ({ i18n, classNameModifiers, sfpState, getCardErrorMessage, focusedElement, setFocusOn }: GiftcardFieldProps) => {\n return (\n <Field\n label={i18n.get('giftcard.cardNumber.label')}\n classNameModifiers={['number', ...classNameModifiers]}\n errorMessage={getCardErrorMessage(sfpState)}\n focused={focusedElement === 'encryptedCardNumber'}\n onFocusField={() => setFocusOn('encryptedCardNumber')}\n dir={'ltr'}\n name={'encryptedCardNumber'}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType=\"encryptedCardNumber\"\n data-info='{\"length\":\"15-32\", \"maskInterval\":4}'\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cardNumber__input': true,\n 'adyen-checkout__input--error': getCardErrorMessage(sfpState),\n 'adyen-checkout__input--focus': focusedElement === 'encryptedCardNumber'\n })}\n />\n </Field>\n );\n};\n"],"names":["GiftcardNumberField","i18n","classNameModifiers","sfpState","getCardErrorMessage","focusedElement","setFocusOn","h","Field","label","get","errorMessage","focused","onFocusField","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","data-info","className","classNames"],"mappings":"gWAOaA,MAAAA,EAAsB,EAAGC,OAAMC,qBAAoBC,WAAUC,sBAAqBC,iBAAgBC,gBAEvGC,EAACC,EAAAA,CACGC,MAAOR,EAAKS,IAAI,6BAChBR,mBAAoB,CAAC,YAAaA,GAClCS,aAAcP,EAAoBD,GAClCS,QAA4B,wBAAnBP,EACTQ,aAAc,IAAMP,EAAW,uBAC/BQ,IAAK,MACLC,KAAM,sBACNC,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1BZ,EAACa,EAAAA,CACGC,mBAAmB,sBACnBC,YAAU,uCACVC,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,2CAA2C,EAC3C,+BAAgCpB,EAAoBD,GACpD,+BAAmD,wBAAnBE"}
@@ -1,2 +1,2 @@
1
- import e from"../../Card/components/CardInput/components/DataSfSpan.js";import r from"../../../external/classnames/index.js";import t from"../../internal/FormFields/Field/Field.js";import{createElement as n}from"../../../external/preact/dist/preact.js";import{alternativeLabelContent as o}from"../../Card/components/CardInput/components/FieldLabelAlternative.js";const c=({i18n:c,classNameModifiers:a,sfpState:d,focusedElement:i,setFocusOn:s,label:p=c.get("creditCard.pin.label")})=>n(t,{label:p,classNameModifiers:["pin",...a],errorMessage:d.errors.encryptedSecurityCode&&c.get(d.errors.encryptedSecurityCode),focused:"encryptedSecurityCode"===i,onFocusField:()=>s("encryptedSecurityCode"),dir:"ltr",name:"encryptedSecurityCode",contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:o},n(e,{encryptedFieldType:"encryptedSecurityCode","data-info":'{"length":"3-10", "maskInterval": 0}',className:r({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":d.errors.encryptedSecurityCode,"adyen-checkout__input--focus":"encryptedSecurityCode"===i})}));export{c as GiftcardPinField};
1
+ import e from"../../Card/components/CardInput/components/DataSfSpan.js";import r from"../../../_virtual/index.js";import t from"../../internal/FormFields/Field/Field.js";import{createElement as n}from"../../../external/preact/dist/preact.js";import{alternativeLabelContent as o}from"../../Card/components/CardInput/components/FieldLabelAlternative.js";const c=({i18n:c,classNameModifiers:d,sfpState:a,focusedElement:i,setFocusOn:s,label:p=c.get("creditCard.pin.label")})=>n(t,{label:p,classNameModifiers:["pin",...d],errorMessage:a.errors.encryptedSecurityCode&&c.get(a.errors.encryptedSecurityCode),focused:"encryptedSecurityCode"===i,onFocusField:()=>s("encryptedSecurityCode"),dir:"ltr",name:"encryptedSecurityCode",contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:o},n(e,{encryptedFieldType:"encryptedSecurityCode","data-info":'{"length":"3-10", "maskInterval": 0}',className:r({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":a.errors.encryptedSecurityCode,"adyen-checkout__input--focus":"encryptedSecurityCode"===i})}));export{c as GiftcardPinField};
2
2
  //# sourceMappingURL=GiftcardPinField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GiftcardPinField.js","sources":["../../../../../src/components/Giftcard/components/GiftcardPinField.tsx"],"sourcesContent":["import DataSfSpan from '../../Card/components/CardInput/components/DataSfSpan';\nimport classNames from 'classnames';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { GiftcardFieldProps } from './types';\nimport { alternativeLabelContent } from '../../Card/components/CardInput/components/FieldLabelAlternative';\n\nexport const GiftcardPinField = ({\n i18n,\n classNameModifiers,\n sfpState,\n focusedElement,\n setFocusOn,\n label = i18n.get('creditCard.pin.label')\n}: GiftcardFieldProps) => {\n return (\n <Field\n label={label}\n classNameModifiers={['pin', ...classNameModifiers]}\n errorMessage={sfpState.errors.encryptedSecurityCode && i18n.get(sfpState.errors.encryptedSecurityCode)}\n focused={focusedElement === 'encryptedSecurityCode'}\n onFocusField={() => setFocusOn('encryptedSecurityCode')}\n dir={'ltr'}\n name={'encryptedSecurityCode'}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType=\"encryptedSecurityCode\"\n data-info='{\"length\":\"3-10\", \"maskInterval\": 0}'\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': sfpState.errors.encryptedSecurityCode,\n 'adyen-checkout__input--focus': focusedElement === 'encryptedSecurityCode'\n })}\n />\n </Field>\n );\n};\n"],"names":["GiftcardPinField","i18n","classNameModifiers","sfpState","focusedElement","setFocusOn","label","get","h","Field","errorMessage","errors","encryptedSecurityCode","focused","onFocusField","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","data-info","className","classNames"],"mappings":"iXAOaA,EAAmB,EAC5BC,OACAC,qBACAC,WACAC,iBACAC,aACAC,QAAQL,EAAKM,IAAI,2BAGbC,EAACC,EAAAA,CACGH,MAAOA,EACPJ,mBAAoB,CAAC,SAAUA,GAC/BQ,aAAcP,EAASQ,OAAOC,uBAAyBX,EAAKM,IAAIJ,EAASQ,OAAOC,uBAChFC,QAA4B,0BAAnBT,EACTU,aAAc,IAAMT,EAAW,yBAC/BU,IAAK,MACLC,KAAM,wBACNC,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1BZ,EAACa,EAAAA,CACGC,mBAAmB,wBACnBC,YAAU,uCACVC,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCtB,EAASQ,OAAOC,sBAChD,+BAAmD,0BAAnBR"}
1
+ {"version":3,"file":"GiftcardPinField.js","sources":["../../../../../src/components/Giftcard/components/GiftcardPinField.tsx"],"sourcesContent":["import DataSfSpan from '../../Card/components/CardInput/components/DataSfSpan';\nimport classNames from 'classnames';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { GiftcardFieldProps } from './types';\nimport { alternativeLabelContent } from '../../Card/components/CardInput/components/FieldLabelAlternative';\n\nexport const GiftcardPinField = ({\n i18n,\n classNameModifiers,\n sfpState,\n focusedElement,\n setFocusOn,\n label = i18n.get('creditCard.pin.label')\n}: GiftcardFieldProps) => {\n return (\n <Field\n label={label}\n classNameModifiers={['pin', ...classNameModifiers]}\n errorMessage={sfpState.errors.encryptedSecurityCode && i18n.get(sfpState.errors.encryptedSecurityCode)}\n focused={focusedElement === 'encryptedSecurityCode'}\n onFocusField={() => setFocusOn('encryptedSecurityCode')}\n dir={'ltr'}\n name={'encryptedSecurityCode'}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType=\"encryptedSecurityCode\"\n data-info='{\"length\":\"3-10\", \"maskInterval\": 0}'\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': sfpState.errors.encryptedSecurityCode,\n 'adyen-checkout__input--focus': focusedElement === 'encryptedSecurityCode'\n })}\n />\n </Field>\n );\n};\n"],"names":["GiftcardPinField","i18n","classNameModifiers","sfpState","focusedElement","setFocusOn","label","get","h","Field","errorMessage","errors","encryptedSecurityCode","focused","onFocusField","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","data-info","className","classNames"],"mappings":"sWAOaA,EAAmB,EAC5BC,OACAC,qBACAC,WACAC,iBACAC,aACAC,QAAQL,EAAKM,IAAI,2BAGbC,EAACC,EAAAA,CACGH,MAAOA,EACPJ,mBAAoB,CAAC,SAAUA,GAC/BQ,aAAcP,EAASQ,OAAOC,uBAAyBX,EAAKM,IAAIJ,EAASQ,OAAOC,uBAChFC,QAA4B,0BAAnBT,EACTU,aAAc,IAAMT,EAAW,yBAC/BU,IAAK,MACLC,KAAM,wBACNC,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1BZ,EAACa,EAAAA,CACGC,mBAAmB,wBACnBC,YAAU,uCACVC,UAAWC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCtB,EAASQ,OAAOC,sBAChD,+BAAmD,0BAAnBR"}
@@ -1,2 +1,2 @@
1
- import{createElement as a}from"../../../external/preact/dist/preact.js";import{useCoreContext as e}from"../../../core/Context/CoreProvider.js";function t({brand:t,amount:c,balance:n,transactionLimit:l,...r}){const{i18n:_}=e(),u=c.value>l?.value?l:c,s=n?.value-u?.value;return a("div",{className:"adyen-checkout__giftcard-result"},a("ul",{className:"adyen-checkout__giftcard-result__balance"},a("li",{className:"adyen-checkout__giftcard-result__balance__item"},a("span",{className:"adyen-checkout__giftcard-result__balance__title"},_.get("giftcardBalance")),a("span",{className:"adyen-checkout__giftcard-result__balance__value adyen-checkout__giftcard-result__balance__value--amount"},_.amount(n.value,n.currency))),l&&l.value&&a("li",{className:"adyen-checkout__giftcard-result__balance__item"},a("span",{className:"adyen-checkout__giftcard-result__balance__title adyen-checkout__giftcard-result__balance__title--transactionLimit"},_.get("giftcardTransactionLimit",{values:{amount:_.amount(l.value,l.currency)}})))),this.props.showPayButton&&this.props.payButton({amount:u,status:r.status,onClick:r.onSubmit}),a("p",{className:"adyen-checkout__giftcard-result__remaining-balance"},_.get("partialPayment.remainingBalance",{values:{amount:_.amount(s,n.currency)}})))}export{t as default};
1
+ import{createElement as a}from"../../../external/preact/dist/preact.js";import{useCoreContext as e}from"../../../core/Context/CoreProvider.js";function t({amount:t,balance:c,transactionLimit:n,status:l,makePayment:_,showPayButton:u,payButton:r}){const{i18n:s}=e(),i=t.value>n?.value?n:t,o=c?.value-i?.value;return a("div",{className:"adyen-checkout__giftcard-result"},a("ul",{className:"adyen-checkout__giftcard-result__balance"},a("li",{className:"adyen-checkout__giftcard-result__balance__item"},a("span",{className:"adyen-checkout__giftcard-result__balance__title"},s.get("giftcardBalance")),a("span",{className:"adyen-checkout__giftcard-result__balance__value adyen-checkout__giftcard-result__balance__value--amount"},s.amount(c.value,c.currency))),n&&n.value&&a("li",{className:"adyen-checkout__giftcard-result__balance__item"},a("span",{className:"adyen-checkout__giftcard-result__balance__title adyen-checkout__giftcard-result__balance__title--transactionLimit"},s.get("giftcardTransactionLimit",{values:{amount:s.amount(n.value,n.currency)}})))),u&&r({amount:i,status:l,onClick:_}),a("p",{className:"adyen-checkout__giftcard-result__remaining-balance"},s.get("partialPayment.remainingBalance",{values:{amount:s.amount(o,c.currency)}})))}export{t as default};
2
2
  //# sourceMappingURL=GiftcardResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GiftcardResult.js","sources":["../../../../../src/components/Giftcard/components/GiftcardResult.tsx"],"sourcesContent":["import { h } from 'preact';\nimport './GiftcardResult.scss';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\nfunction GiftcardResult({ brand, amount, balance, transactionLimit, ...props }) {\n const { i18n } = useCoreContext();\n const transactionAmount = amount.value > transactionLimit?.value ? transactionLimit : amount;\n const remainingBalance = balance?.value - transactionAmount?.value;\n\n return (\n <div className=\"adyen-checkout__giftcard-result\">\n <ul className=\"adyen-checkout__giftcard-result__balance\">\n <li className=\"adyen-checkout__giftcard-result__balance__item\">\n <span className=\"adyen-checkout__giftcard-result__balance__title\">{i18n.get('giftcardBalance')}</span>\n <span className=\"adyen-checkout__giftcard-result__balance__value adyen-checkout__giftcard-result__balance__value--amount\">\n {i18n.amount(balance.value, balance.currency)}\n </span>\n </li>\n {transactionLimit && transactionLimit.value && (\n <li className=\"adyen-checkout__giftcard-result__balance__item\">\n <span className=\"adyen-checkout__giftcard-result__balance__title adyen-checkout__giftcard-result__balance__title--transactionLimit\">\n {i18n.get('giftcardTransactionLimit', {\n values: { amount: i18n.amount(transactionLimit.value, transactionLimit.currency) }\n })}\n </span>\n </li>\n )}\n </ul>\n\n {this.props.showPayButton &&\n this.props.payButton({\n amount: transactionAmount,\n status: props.status,\n onClick: props.onSubmit\n })}\n\n <p className=\"adyen-checkout__giftcard-result__remaining-balance\">\n {i18n.get('partialPayment.remainingBalance', {\n values: { amount: i18n.amount(remainingBalance, balance.currency) }\n })}\n </p>\n </div>\n );\n}\n\nexport default GiftcardResult;\n"],"names":["GiftcardResult","brand","amount","balance","transactionLimit","props","i18n","useCoreContext","transactionAmount","value","remainingBalance","h","div","className","ul","li","span","get","currency","values","this","showPayButton","payButton","status","onClick","onSubmit","p"],"mappings":"+IAIA,SAASA,GAAeC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,iBAAEA,KAAqBC,IACnE,MAAMC,KAAEA,GAASC,IACXC,EAAoBN,EAAOO,MAAQL,GAAkBK,MAAQL,EAAmBF,EAChFQ,EAAmBP,GAASM,MAAQD,GAAmBC,MAE7D,OACIE,EAACC,MAAAA,CAAIC,UAAU,mCACXF,EAACG,KAAAA,CAAGD,UAAU,4CACVF,EAACI,KAAAA,CAAGF,UAAU,kDACVF,EAACK,OAAAA,CAAKH,UAAU,mDAAmDP,EAAKW,IAAI,oBAC5EN,EAACK,OAAAA,CAAKH,UAAU,2GACXP,EAAKJ,OAAOC,EAAQM,MAAON,EAAQe,YAG3Cd,GAAoBA,EAAiBK,OAClCE,EAACI,KAAAA,CAAGF,UAAU,kDACVF,EAACK,OAAAA,CAAKH,UAAU,qHACXP,EAAKW,IAAI,2BAA4B,CAClCE,OAAQ,CAAEjB,OAAQI,EAAKJ,OAAOE,EAAiBK,MAAOL,EAAiBc,gBAO1FE,KAAKf,MAAMgB,eACRD,KAAKf,MAAMiB,UAAU,CACjBpB,OAAQM,EACRe,OAAQlB,EAAMkB,OACdC,QAASnB,EAAMoB,WAGvBd,EAACe,IAAAA,CAAEb,UAAU,sDACRP,EAAKW,IAAI,kCAAmC,CACzCE,OAAQ,CAAEjB,OAAQI,EAAKJ,OAAOQ,EAAkBP,EAAQe,cAK5E"}
1
+ {"version":3,"file":"GiftcardResult.js","sources":["../../../../../src/components/Giftcard/components/GiftcardResult.tsx"],"sourcesContent":["import { h } from 'preact';\nimport './GiftcardResult.scss';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { PaymentAmount } from '../../../types/global-types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\n\ninterface GiftcardResultProps {\n amount: PaymentAmount;\n balance: PaymentAmount;\n transactionLimit: PaymentAmount;\n status: string;\n makePayment: () => void;\n showPayButton: boolean;\n payButton(props?: PayButtonProps): h.JSX.Element;\n}\n\nfunction GiftcardResult({ amount, balance, transactionLimit, status, makePayment, showPayButton, payButton }: GiftcardResultProps) {\n const { i18n } = useCoreContext();\n const transactionAmount = amount.value > transactionLimit?.value ? transactionLimit : amount;\n const remainingBalance = balance?.value - transactionAmount?.value;\n\n return (\n <div className=\"adyen-checkout__giftcard-result\">\n <ul className=\"adyen-checkout__giftcard-result__balance\">\n <li className=\"adyen-checkout__giftcard-result__balance__item\">\n <span className=\"adyen-checkout__giftcard-result__balance__title\">{i18n.get('giftcardBalance')}</span>\n <span className=\"adyen-checkout__giftcard-result__balance__value adyen-checkout__giftcard-result__balance__value--amount\">\n {i18n.amount(balance.value, balance.currency)}\n </span>\n </li>\n {transactionLimit && transactionLimit.value && (\n <li className=\"adyen-checkout__giftcard-result__balance__item\">\n <span className=\"adyen-checkout__giftcard-result__balance__title adyen-checkout__giftcard-result__balance__title--transactionLimit\">\n {i18n.get('giftcardTransactionLimit', {\n values: { amount: i18n.amount(transactionLimit.value, transactionLimit.currency) }\n })}\n </span>\n </li>\n )}\n </ul>\n\n {showPayButton &&\n payButton({\n amount: transactionAmount,\n status: status,\n onClick: makePayment\n })}\n\n <p className=\"adyen-checkout__giftcard-result__remaining-balance\">\n {i18n.get('partialPayment.remainingBalance', {\n values: { amount: i18n.amount(remainingBalance, balance.currency) }\n })}\n </p>\n </div>\n );\n}\n\nexport default GiftcardResult;\n"],"names":["GiftcardResult","amount","balance","transactionLimit","status","makePayment","showPayButton","payButton","i18n","useCoreContext","transactionAmount","value","remainingBalance","h","div","className","ul","li","span","get","currency","values","onClick","p"],"mappings":"+IAgBA,SAASA,GAAeC,OAAEA,EAAMC,QAAEA,EAAOC,iBAAEA,EAAgBC,OAAEA,EAAMC,YAAEA,EAAWC,cAAEA,EAAaC,UAAEA,IAC7F,MAAMC,KAAEA,GAASC,IACXC,EAAoBT,EAAOU,MAAQR,GAAkBQ,MAAQR,EAAmBF,EAChFW,EAAmBV,GAASS,MAAQD,GAAmBC,MAE7D,OACIE,EAACC,MAAAA,CAAIC,UAAU,mCACXF,EAACG,KAAAA,CAAGD,UAAU,4CACVF,EAACI,KAAAA,CAAGF,UAAU,kDACVF,EAACK,OAAAA,CAAKH,UAAU,mDAAmDP,EAAKW,IAAI,oBAC5EN,EAACK,OAAAA,CAAKH,UAAU,2GACXP,EAAKP,OAAOC,EAAQS,MAAOT,EAAQkB,YAG3CjB,GAAoBA,EAAiBQ,OAClCE,EAACI,KAAAA,CAAGF,UAAU,kDACVF,EAACK,OAAAA,CAAKH,UAAU,qHACXP,EAAKW,IAAI,2BAA4B,CAClCE,OAAQ,CAAEpB,OAAQO,EAAKP,OAAOE,EAAiBQ,MAAOR,EAAiBiB,gBAO1Fd,GACGC,EAAU,CACNN,OAAQS,EACRN,OAAQA,EACRkB,QAASjB,IAGjBQ,EAACU,IAAAA,CAAER,UAAU,sDACRP,EAAKW,IAAI,kCAAmC,CACzCE,OAAQ,CAAEpB,OAAQO,EAAKP,OAAOW,EAAkBV,EAAQkB,cAK5E"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./GooglePayService.js";import s from"./components/GooglePayButton.js";import r from"./defaultProps.js";import{getGooglePayLocale as n,formatGooglePayContactToAdyenAddressFormat as i}from"./utils.js";import a from"../../utils/browserInfo.js";import l from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as h}from"../tx-variants.js";import{sanitizeResponse as p,verifyPaymentDidNotFail as d}from"../internal/UIElement/utils.js";import{ANALYTICS_SELECTED_STR as u,ANALYTICS_INSTANT_PAYMENT_BUTTON as y}from"../../core/Analytics/constants.js";function g(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class c extends e{formatProps(t){const e=t.buttonSizeMode??(t.isDropin?"fill":"static"),o=n(t.buttonLocale??t.i18n?.locale),s=[...t.callbackIntents,"PAYMENT_AUTHORIZATION"];return{...t,configuration:t.configuration,buttonSizeMode:e,buttonLocale:o,callbackIntents:s}}formatData(){const{googlePayCardNetwork:t,googlePayToken:e,billingAddress:o,deliveryAddress:s}=this.state,{isExpress:r}=this.props;return{paymentMethod:{type:this.type,googlePayCardNetwork:t,googlePayToken:e,...r&&{subtype:"express"}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin,...o&&{billingAddress:o},...s&&{deliveryAddress:s}}}submitAnalytics(t){super.submitAnalytics({...t},this.props)}async handleAuthorization(){return new Promise(((t,e)=>{this.props.onAuthorized||t();const{authorizedEvent:o,billingAddress:s,deliveryAddress:r}=this.state;this.props.onAuthorized({authorizedEvent:o,...s&&{billingAddress:s},...r&&{deliveryAddress:r}},{resolve:t,reject:e})})).catch((t=>{const e={error:{googlePayError:t}};return Promise.reject(e)}))}get isValid(){return!!this.state.googlePayToken}async isAvailable(){return this.isReadyToPay().then((t=>{if(!t.result)throw new l("ERROR","GooglePay is not available");if(!1===t.paymentMethodPresent)throw new l("ERROR","GooglePay - No paymentMethodPresent");return Promise.resolve()})).catch((t=>Promise.reject(t)))}get browserInfo(){return a()}get icon(){return this.props.icon??this.resources.getImage()("googlepay")}render(){return this.props.showPayButton?t(s,{buttonColor:this.props.buttonColor,buttonType:this.props.buttonType,buttonSizeMode:this.props.buttonSizeMode,buttonLocale:this.props.buttonLocale,buttonRootNode:this.props.buttonRootNode,buttonRadius:this.props.buttonRadius,paymentsClient:this.googlePay.paymentsClient,onClick:this.submit}):null}constructor(t,e){super(t,e),g(this,"googlePay",void 0),g(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:u,target:y}),new Promise(((t,e)=>this.props.onClick(t,e))).then((()=>this.googlePay.initiatePayment(this.props,this.core.options.countryCode))).catch((t=>{"CANCELED"===t.statusCode?this.handleError(new l("CANCEL",t.toString(),{cause:t})):this.handleError(new l("ERROR",t.toString(),{cause:t}))}))})),g(this,"onPaymentAuthorized",(async t=>{const e=i(t.paymentMethodData.info.billingAddress),o=i(t.shippingAddress,!0);return this.setState({authorizedEvent:t,googlePayToken:t.paymentMethodData.tokenizationData.token,googlePayCardNetwork:t.paymentMethodData.info.cardNetwork,...e&&{billingAddress:e},...o&&{deliveryAddress:o}}),new Promise((t=>{this.handleAuthorization().then(this.makePaymentsCall).then(p).then(d).then((e=>(t({transactionState:"SUCCESS"}),e))).then((t=>{this.handleResponse(t)})).catch((e=>{this.setElementStatus("ready");const o=e?.error?.googlePayError,s=this.props.i18n.get("error.subtitle.payment"),r="string"==typeof o?{intent:"PAYMENT_AUTHORIZATION",reason:"OTHER_ERROR",message:o||s}:{intent:o?.intent||"PAYMENT_AUTHORIZATION",reason:o?.reason||"OTHER_ERROR",message:o?.message||s};t({transactionState:"ERROR",error:r});const n={...e,error:{googlePayError:r}};this.handleFailedResult(n)}))}))})),g(this,"isReadyToPay",(()=>this.googlePay.isReadyToPay(this.props))),g(this,"prefetch",(()=>this.googlePay.prefetchPaymentData(this.props,this.core.options.countryCode))),this.handleAuthorization=this.handleAuthorization.bind(this);const{isExpress:s,paymentDataCallbacks:r}=this.props;if(!1===s&&r?.onPaymentDataChanged)throw new l("IMPLEMENTATION_ERROR",'GooglePay - You must set "isExpress" flag to "true" in order to use "onPaymentDataChanged" callback');this.googlePay=new o(this.props.environment,{...s&&r?.onPaymentDataChanged&&{onPaymentDataChanged:r.onPaymentDataChanged},onPaymentAuthorized:this.onPaymentAuthorized})}}g(c,"type",h.googlepay),g(c,"txVariants",[h.googlepay,h.paywithgoogle]),g(c,"defaultProps",r);export{c as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./GooglePayService.js";import s from"./components/GooglePayButton.js";import r from"./defaultProps.js";import{getGooglePayLocale as n,formatGooglePayContactToAdyenAddressFormat as i}from"./utils.js";import a from"../../utils/browserInfo.js";import h from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as l}from"../tx-variants.js";import{sanitizeResponse as p,verifyPaymentDidNotFail as d}from"../internal/UIElement/utils.js";import{ANALYTICS_SELECTED_STR as y,ANALYTICS_INSTANT_PAYMENT_BUTTON as u}from"../../core/Analytics/constants.js";function g(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class m extends e{formatProps(t){const e=t.buttonSizeMode??(t.isDropin?"fill":"static"),o=n(t.buttonLocale??t.i18n?.locale),s=[...t.callbackIntents,"PAYMENT_AUTHORIZATION"];return{...t,configuration:t.configuration,buttonSizeMode:e,buttonLocale:o,callbackIntents:s}}formatData(){const{googlePayCardNetwork:t,googlePayToken:e,billingAddress:o,deliveryAddress:s}=this.state,{isExpress:r}=this.props;return{paymentMethod:{type:this.type,googlePayCardNetwork:t,googlePayToken:e,...r&&{subtype:"express"}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin,...o&&{billingAddress:o},...s&&{deliveryAddress:s}}}submitAnalytics(t){super.submitAnalytics({...t},this.props)}showGooglePayPaymentSheet(){this.googlePay.initiatePayment(this.props,this.core.options.countryCode).catch((t=>{this.handleError(new h("CANCELED"===t.statusCode?"CANCEL":"ERROR",t.toString(),{cause:t}))}))}async handleAuthorization(){return new Promise(((t,e)=>{this.props.onAuthorized||t();const{authorizedEvent:o,billingAddress:s,deliveryAddress:r}=this.state;this.props.onAuthorized({authorizedEvent:o,...s&&{billingAddress:s},...r&&{deliveryAddress:r}},{resolve:t,reject:e})})).catch((t=>{const e={error:{googlePayError:t}};return Promise.reject(e)}))}get isValid(){return!!this.state.googlePayToken}async isAvailable(){return this.isReadyToPay().then((t=>{if(!t.result)throw new h("ERROR","GooglePay is not available");if(!1===t.paymentMethodPresent)throw new h("ERROR","GooglePay - No paymentMethodPresent");return Promise.resolve()})).catch((t=>Promise.reject(t)))}get browserInfo(){return a()}get icon(){return this.props.icon??this.resources.getImage()("googlepay")}render(){return this.props.showPayButton?t(s,{buttonColor:this.props.buttonColor,buttonType:this.props.buttonType,buttonSizeMode:this.props.buttonSizeMode,buttonLocale:this.props.buttonLocale,buttonRootNode:this.props.buttonRootNode,buttonRadius:this.props.buttonRadius,paymentsClient:this.googlePay.paymentsClient,onClick:this.submit}):null}constructor(t,e){super(t,e),g(this,"googlePay",void 0),g(this,"submit",(()=>{this.props.isInstantPayment&&this.submitAnalytics({type:y,target:u}),new Promise(((t,e)=>this.props.onClick(t,e))).then(this.showGooglePayPaymentSheet).catch((()=>{}))})),g(this,"onPaymentAuthorized",(async t=>{const e=i(t.paymentMethodData.info.billingAddress),o=i(t.shippingAddress,!0);return this.setState({authorizedEvent:t,googlePayToken:t.paymentMethodData.tokenizationData.token,googlePayCardNetwork:t.paymentMethodData.info.cardNetwork,...e&&{billingAddress:e},...o&&{deliveryAddress:o}}),new Promise((t=>{this.handleAuthorization().then(this.makePaymentsCall).then(p).then(d).then((e=>(t({transactionState:"SUCCESS"}),e))).then((t=>{this.handleResponse(t)})).catch((e=>{this.setElementStatus("ready");const o=e?.error?.googlePayError,s=this.props.i18n.get("error.subtitle.payment"),r="string"==typeof o?{intent:"PAYMENT_AUTHORIZATION",reason:"OTHER_ERROR",message:o||s}:{intent:o?.intent||"PAYMENT_AUTHORIZATION",reason:o?.reason||"OTHER_ERROR",message:o?.message||s};t({transactionState:"ERROR",error:r});const n={...e,error:{googlePayError:r}};this.handleFailedResult(n)}))}))})),g(this,"isReadyToPay",(()=>this.googlePay.isReadyToPay(this.props))),g(this,"prefetch",(()=>this.googlePay.prefetchPaymentData(this.props,this.core.options.countryCode))),this.handleAuthorization=this.handleAuthorization.bind(this),this.showGooglePayPaymentSheet=this.showGooglePayPaymentSheet.bind(this);const{isExpress:s,paymentDataCallbacks:r}=this.props;if(!1===s&&r?.onPaymentDataChanged)throw new h("IMPLEMENTATION_ERROR",'GooglePay - You must set "isExpress" flag to "true" in order to use "onPaymentDataChanged" callback');this.googlePay=new o(this.props.environment,{...s&&r?.onPaymentDataChanged&&{onPaymentDataChanged:r.onPaymentDataChanged},onPaymentAuthorized:this.onPaymentAuthorized})}}g(m,"type",l.googlepay),g(m,"txVariants",[l.googlepay,l.paywithgoogle]),g(m,"defaultProps",r);export{m as default};
2
2
  //# sourceMappingURL=GooglePay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GooglePay.js","sources":["../../../../src/components/GooglePay/GooglePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GooglePayService from './GooglePayService';\nimport GooglePayButton from './components/GooglePayButton';\nimport defaultProps from './defaultProps';\nimport { formatGooglePayContactToAdyenAddressFormat, getGooglePayLocale } from './utils';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { ANALYTICS_INSTANT_PAYMENT_BUTTON, ANALYTICS_SELECTED_STR } from '../../core/Analytics/constants';\nimport { SendAnalyticsObject } from '../../core/Analytics/types';\n\nimport type { AddressData, BrowserInfo, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\n\nclass GooglePay extends UIElement<GooglePayConfiguration> {\n public static type = TxVariants.googlepay;\n public static txVariants = [TxVariants.googlepay, TxVariants.paywithgoogle];\n public static defaultProps = defaultProps;\n\n protected readonly googlePay;\n\n constructor(checkout: ICore, props?: GooglePayConfiguration) {\n super(checkout, props);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n\n const { isExpress, paymentDataCallbacks } = this.props;\n\n if (isExpress === false && paymentDataCallbacks?.onPaymentDataChanged) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - You must set \"isExpress\" flag to \"true\" in order to use \"onPaymentDataChanged\" callback'\n );\n }\n\n this.googlePay = new GooglePayService(this.props.environment, {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n });\n }\n\n protected override formatProps(props): GooglePayConfiguration {\n const buttonSizeMode = props.buttonSizeMode ?? (props.isDropin ? 'fill' : 'static');\n const buttonLocale = getGooglePayLocale(props.buttonLocale ?? props.i18n?.locale);\n\n const callbackIntents: google.payments.api.CallbackIntent[] = [...props.callbackIntents, 'PAYMENT_AUTHORIZATION'];\n\n return {\n ...props,\n configuration: props.configuration,\n buttonSizeMode,\n buttonLocale,\n callbackIntents\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData() {\n const { googlePayCardNetwork, googlePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: this.type,\n googlePayCardNetwork,\n googlePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n // Analytics will need to know about this.props.isExpress & this.props.expressPage\n super.submitAnalytics({ ...analyticsObj }, this.props);\n }\n\n public override submit = () => {\n // Analytics\n if (this.props.isInstantPayment) {\n this.submitAnalytics({ type: ANALYTICS_SELECTED_STR, target: ANALYTICS_INSTANT_PAYMENT_BUTTON });\n }\n\n new Promise((resolve, reject) => this.props.onClick(resolve, reject))\n .then(() => this.googlePay.initiatePayment(this.props, this.core.options.countryCode))\n .catch((error: google.payments.api.PaymentsError) => {\n if (error.statusCode === 'CANCELED') {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n this.handleError(new AdyenCheckoutError('CANCEL', error.toString(), { cause: error }));\n } else {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n this.handleError(new AdyenCheckoutError('ERROR', error.toString(), { cause: error }));\n }\n });\n };\n\n /**\n * Method called when the payment is authorized in the payment sheet\n *\n * @see https://developers.google.com/pay/api/web/reference/client#onPaymentAuthorized\n **/\n private onPaymentAuthorized = async (paymentData: google.payments.api.PaymentData): Promise<google.payments.api.PaymentAuthorizationResult> => {\n const billingAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.paymentMethodData.info.billingAddress);\n const deliveryAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.shippingAddress, true);\n\n this.setState({\n authorizedEvent: paymentData,\n googlePayToken: paymentData.paymentMethodData.tokenizationData.token,\n googlePayCardNetwork: paymentData.paymentMethodData.info.cardNetwork,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<google.payments.api.PaymentAuthorizationResult>(resolve => {\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((paymentResponse: PaymentResponseData) => {\n resolve({ transactionState: 'SUCCESS' });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n this.setElementStatus('ready');\n\n const googlePayError = paymentResponse?.error?.googlePayError;\n const fallbackMessage = this.props.i18n.get('error.subtitle.payment');\n\n const error: google.payments.api.PaymentDataError =\n typeof googlePayError === 'string' || undefined\n ? {\n intent: 'PAYMENT_AUTHORIZATION',\n reason: 'OTHER_ERROR',\n message: (googlePayError as string) || fallbackMessage\n }\n : {\n intent: googlePayError?.intent || 'PAYMENT_AUTHORIZATION',\n reason: googlePayError?.reason || 'OTHER_ERROR',\n message: googlePayError?.message || fallbackMessage\n };\n\n resolve({\n transactionState: 'ERROR',\n error\n });\n\n const responseWithError = {\n ...paymentResponse,\n error: {\n googlePayError: error\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\n });\n };\n\n /**\n * Call the 'onAuthorized' callback if available.\n * Must be resolved/reject for the payment flow to continue\n */\n private async handleAuthorization(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.props.onAuthorized) {\n resolve();\n }\n\n const { authorizedEvent, billingAddress, deliveryAddress } = this.state;\n\n this.props.onAuthorized(\n {\n authorizedEvent,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n );\n }).catch((error?: google.payments.api.PaymentDataError | string) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { googlePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Validation\n */\n get isValid(): boolean {\n return !!this.state.googlePayToken;\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public override async isAvailable(): Promise<void> {\n return this.isReadyToPay()\n .then(response => {\n if (!response.result) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay is not available');\n }\n\n if (response.paymentMethodPresent === false) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay - No paymentMethodPresent');\n }\n\n return Promise.resolve();\n })\n .catch(error => {\n return Promise.reject(error);\n });\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public isReadyToPay = (): Promise<google.payments.api.IsReadyToPayResponse> => {\n return this.googlePay.isReadyToPay(this.props);\n };\n\n /**\n * Use this method to prefetch a PaymentDataRequest configuration to improve loadPaymentData execution time on later user interaction. No value is returned.\n */\n public prefetch = (): void => {\n return this.googlePay.prefetchPaymentData(this.props, this.core.options.countryCode);\n };\n\n get browserInfo(): BrowserInfo {\n return collectBrowserInfo();\n }\n\n get icon(): string {\n return this.props.icon ?? this.resources.getImage()('googlepay');\n }\n\n render() {\n if (this.props.showPayButton) {\n return (\n <GooglePayButton\n buttonColor={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonSizeMode={this.props.buttonSizeMode}\n buttonLocale={this.props.buttonLocale}\n buttonRootNode={this.props.buttonRootNode}\n buttonRadius={this.props.buttonRadius}\n paymentsClient={this.googlePay.paymentsClient}\n onClick={this.submit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default GooglePay;\n"],"names":["GooglePay","UIElement","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","this","state","isExpress","paymentMethod","type","subtype","browserInfo","origin","window","location","submitAnalytics","analyticsObj","super","handleAuthorization","Promise","resolve","reject","onAuthorized","authorizedEvent","catch","error","data","googlePayError","isValid","isAvailable","isReadyToPay","then","response","result","AdyenCheckoutError","paymentMethodPresent","collectBrowserInfo","icon","resources","getImage","render","showPayButton","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","googlePay","onClick","submit","constructor","checkout","_define_property","isInstantPayment","ANALYTICS_SELECTED_STR","target","ANALYTICS_INSTANT_PAYMENT_BUTTON","initiatePayment","core","options","countryCode","statusCode","handleError","toString","cause","onPaymentAuthorized","async","paymentData","formatGooglePayContactToAdyenAddressFormat","paymentMethodData","info","shippingAddress","setState","tokenizationData","token","cardNetwork","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","paymentResponse","transactionState","handleResponse","setElementStatus","fallbackMessage","get","intent","reason","message","responseWithError","handleFailedResult","prefetch","prefetchPaymentData","bind","paymentDataCallbacks","onPaymentDataChanged","GooglePayService","environment","TxVariants","googlepay","txVariants","paywithgoogle","defaultProps"],"mappings":"izBAiBA,MAAMA,UAAkBC,EA0BDC,WAAAA,CAAYC,GAC3B,MAAMC,EAAiBD,EAAMC,iBAAmBD,EAAME,SAAW,OAAS,UACpEC,EAAeC,EAAmBJ,EAAMG,cAAgBH,EAAMK,MAAMC,QAEpEC,EAAwD,IAAIP,EAAMO,gBAAiB,yBAEzF,MAAO,IACAP,EACHQ,cAAeR,EAAMQ,cACrBP,iBACAE,eACAI,kBAER,CAKA,UAAAE,GACI,MAAMC,qBAAEA,EAAoBC,eAAEA,EAAcC,eAAEA,EAAcC,gBAAEA,GAAoBC,KAAKC,OACjFC,UAAEA,GAAcF,KAAKd,MAE3B,MAAO,CACHiB,cAAe,CACXC,KAAMJ,KAAKI,KACXR,uBACAC,oBACIK,GAAa,CAAEG,QAAS,YAEhCC,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,UAChCT,GAAkB,CAAE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,cACRC,QAAS9D,GAA8B0D,GAE3C,CACIE,OAAQ5D,GAAgB4D,QAAU,wBAClCC,OAAQ7D,GAAgB6D,QAAU,cAClCC,QAAS9D,GAAgB8D,SAAWJ,GAGlDjE,EAAQ,CACJ8D,iBAAkB,QAClBzD,UAGJ,MAAMiE,EAAoB,IACnBT,EACHxD,MAAO,CACHE,eAAgBF,IAIxBpB,KAAKsF,mBAAmBD,EAAAA,GAC5B,GACR,IA6DJpC,OAAOxB,gBAAe,IACXzB,KAAK4C,UAAUnB,aAAazB,KAAKd,SAM5C+D,OAAOsC,YAAW,IACPvF,KAAK4C,UAAU4C,oBAAoBxF,KAAKd,MAAOc,KAAKuD,KAAKC,QAAQC,eAhNxEzD,KAAKa,oBAAsBb,KAAKa,oBAAoB4E,KAAKzF,MAEzD,MAAME,UAAEA,EAASwF,qBAAEA,GAAyB1F,KAAKd,MAEjD,IAAkB,IAAdgB,GAAuBwF,GAAsBC,qBAC7C,MAAM,IAAI9D,EACN,uBACA,uGAIR7B,KAAK4C,UAAY,IAAIgD,EAAiB5F,KAAKd,MAAM2G,YAAa,IACtD3F,GAAawF,GAAsBC,sBAAwB,CAAEA,qBAAsBD,EAAqBC,sBAC5G7B,oBAAqB9D,KAAK8D,qBAElC,EAvBAb,EADElE,EACYqB,OAAO0F,EAAWC,WAChC9C,EAFElE,EAEYiH,aAAa,CAACF,EAAWC,UAAWD,EAAWG,gBAC7DhD,EAHElE,EAGYmH,eAAeA"}
1
+ {"version":3,"file":"GooglePay.js","sources":["../../../../src/components/GooglePay/GooglePay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport GooglePayService from './GooglePayService';\nimport GooglePayButton from './components/GooglePayButton';\nimport defaultProps from './defaultProps';\nimport { formatGooglePayContactToAdyenAddressFormat, getGooglePayLocale } from './utils';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { TxVariants } from '../tx-variants';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { ANALYTICS_INSTANT_PAYMENT_BUTTON, ANALYTICS_SELECTED_STR } from '../../core/Analytics/constants';\nimport { SendAnalyticsObject } from '../../core/Analytics/types';\n\nimport type { AddressData, BrowserInfo, PaymentResponseData, RawPaymentResponse } from '../../types/global-types';\nimport type { GooglePayConfiguration } from './types';\nimport type { ICore } from '../../core/types';\n\nclass GooglePay extends UIElement<GooglePayConfiguration> {\n public static type = TxVariants.googlepay;\n public static txVariants = [TxVariants.googlepay, TxVariants.paywithgoogle];\n public static defaultProps = defaultProps;\n\n protected readonly googlePay;\n\n constructor(checkout: ICore, props?: GooglePayConfiguration) {\n super(checkout, props);\n this.handleAuthorization = this.handleAuthorization.bind(this);\n this.showGooglePayPaymentSheet = this.showGooglePayPaymentSheet.bind(this);\n\n const { isExpress, paymentDataCallbacks } = this.props;\n\n if (isExpress === false && paymentDataCallbacks?.onPaymentDataChanged) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'GooglePay - You must set \"isExpress\" flag to \"true\" in order to use \"onPaymentDataChanged\" callback'\n );\n }\n\n this.googlePay = new GooglePayService(this.props.environment, {\n ...(isExpress && paymentDataCallbacks?.onPaymentDataChanged && { onPaymentDataChanged: paymentDataCallbacks.onPaymentDataChanged }),\n onPaymentAuthorized: this.onPaymentAuthorized\n });\n }\n\n protected override formatProps(props): GooglePayConfiguration {\n const buttonSizeMode = props.buttonSizeMode ?? (props.isDropin ? 'fill' : 'static');\n const buttonLocale = getGooglePayLocale(props.buttonLocale ?? props.i18n?.locale);\n\n const callbackIntents: google.payments.api.CallbackIntent[] = [...props.callbackIntents, 'PAYMENT_AUTHORIZATION'];\n\n return {\n ...props,\n configuration: props.configuration,\n buttonSizeMode,\n buttonLocale,\n callbackIntents\n };\n }\n\n /**\n * Formats the component data output\n */\n protected override formatData() {\n const { googlePayCardNetwork, googlePayToken, billingAddress, deliveryAddress } = this.state;\n const { isExpress } = this.props;\n\n return {\n paymentMethod: {\n type: this.type,\n googlePayCardNetwork,\n googlePayToken,\n ...(isExpress && { subtype: 'express' })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n };\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n // Analytics will need to know about this.props.isExpress & this.props.expressPage\n super.submitAnalytics({ ...analyticsObj }, this.props);\n }\n\n /**\n * Displays the Google Pay payment sheet overlay\n */\n private showGooglePayPaymentSheet() {\n this.googlePay.initiatePayment(this.props, this.core.options.countryCode).catch((error: google.payments.api.PaymentsError) => {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n this.handleError(new AdyenCheckoutError(error.statusCode === 'CANCELED' ? 'CANCEL' : 'ERROR', error.toString(), { cause: error }));\n });\n }\n\n public override submit = () => {\n if (this.props.isInstantPayment) {\n this.submitAnalytics({ type: ANALYTICS_SELECTED_STR, target: ANALYTICS_INSTANT_PAYMENT_BUTTON });\n }\n\n new Promise<void>((resolve, reject) => this.props.onClick(resolve, reject)).then(this.showGooglePayPaymentSheet).catch(() => {\n // Swallow exception triggered by onClick reject\n });\n };\n\n /**\n * Method called when the payment is authorized in the payment sheet\n *\n * @see https://developers.google.com/pay/api/web/reference/client#onPaymentAuthorized\n **/\n private onPaymentAuthorized = async (paymentData: google.payments.api.PaymentData): Promise<google.payments.api.PaymentAuthorizationResult> => {\n const billingAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.paymentMethodData.info.billingAddress);\n const deliveryAddress: AddressData = formatGooglePayContactToAdyenAddressFormat(paymentData.shippingAddress, true);\n\n this.setState({\n authorizedEvent: paymentData,\n googlePayToken: paymentData.paymentMethodData.tokenizationData.token,\n googlePayCardNetwork: paymentData.paymentMethodData.info.cardNetwork,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n });\n\n return new Promise<google.payments.api.PaymentAuthorizationResult>(resolve => {\n this.handleAuthorization()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((paymentResponse: PaymentResponseData) => {\n resolve({ transactionState: 'SUCCESS' });\n return paymentResponse;\n })\n .then(paymentResponse => {\n this.handleResponse(paymentResponse);\n })\n .catch((paymentResponse?: RawPaymentResponse) => {\n this.setElementStatus('ready');\n\n const googlePayError = paymentResponse?.error?.googlePayError;\n const fallbackMessage = this.props.i18n.get('error.subtitle.payment');\n\n const error: google.payments.api.PaymentDataError =\n typeof googlePayError === 'string' || undefined\n ? {\n intent: 'PAYMENT_AUTHORIZATION',\n reason: 'OTHER_ERROR',\n message: (googlePayError as string) || fallbackMessage\n }\n : {\n intent: googlePayError?.intent || 'PAYMENT_AUTHORIZATION',\n reason: googlePayError?.reason || 'OTHER_ERROR',\n message: googlePayError?.message || fallbackMessage\n };\n\n resolve({\n transactionState: 'ERROR',\n error\n });\n\n const responseWithError = {\n ...paymentResponse,\n error: {\n googlePayError: error\n }\n };\n\n this.handleFailedResult(responseWithError);\n });\n });\n };\n\n /**\n * Call the 'onAuthorized' callback if available.\n * Must be resolved/reject for the payment flow to continue\n */\n private async handleAuthorization(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.props.onAuthorized) {\n resolve();\n }\n\n const { authorizedEvent, billingAddress, deliveryAddress } = this.state;\n\n this.props.onAuthorized(\n {\n authorizedEvent,\n ...(billingAddress && { billingAddress }),\n ...(deliveryAddress && { deliveryAddress })\n },\n { resolve, reject }\n );\n }).catch((error?: google.payments.api.PaymentDataError | string) => {\n // Format error in a way that the 'catch' of the 'onPaymentAuthorize' block accepts it\n const data = { error: { googlePayError: error } };\n return Promise.reject(data);\n });\n }\n\n /**\n * Validation\n */\n get isValid(): boolean {\n return !!this.state.googlePayToken;\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public override async isAvailable(): Promise<void> {\n return this.isReadyToPay()\n .then(response => {\n if (!response.result) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay is not available');\n }\n\n if (response.paymentMethodPresent === false) {\n throw new AdyenCheckoutError('ERROR', 'GooglePay - No paymentMethodPresent');\n }\n\n return Promise.resolve();\n })\n .catch(error => {\n return Promise.reject(error);\n });\n }\n\n /**\n * Determine a shopper's ability to return a form of payment from the Google Pay API.\n */\n public isReadyToPay = (): Promise<google.payments.api.IsReadyToPayResponse> => {\n return this.googlePay.isReadyToPay(this.props);\n };\n\n /**\n * Use this method to prefetch a PaymentDataRequest configuration to improve loadPaymentData execution time on later user interaction. No value is returned.\n */\n public prefetch = (): void => {\n return this.googlePay.prefetchPaymentData(this.props, this.core.options.countryCode);\n };\n\n get browserInfo(): BrowserInfo {\n return collectBrowserInfo();\n }\n\n get icon(): string {\n return this.props.icon ?? this.resources.getImage()('googlepay');\n }\n\n render() {\n if (this.props.showPayButton) {\n return (\n <GooglePayButton\n buttonColor={this.props.buttonColor}\n buttonType={this.props.buttonType}\n buttonSizeMode={this.props.buttonSizeMode}\n buttonLocale={this.props.buttonLocale}\n buttonRootNode={this.props.buttonRootNode}\n buttonRadius={this.props.buttonRadius}\n paymentsClient={this.googlePay.paymentsClient}\n onClick={this.submit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default GooglePay;\n"],"names":["GooglePay","UIElement","formatProps","props","buttonSizeMode","isDropin","buttonLocale","getGooglePayLocale","i18n","locale","callbackIntents","configuration","formatData","googlePayCardNetwork","googlePayToken","billingAddress","deliveryAddress","this","state","isExpress","paymentMethod","type","subtype","browserInfo","origin","window","location","submitAnalytics","analyticsObj","super","showGooglePayPaymentSheet","googlePay","initiatePayment","core","options","countryCode","catch","error","handleError","AdyenCheckoutError","statusCode","toString","cause","handleAuthorization","Promise","resolve","reject","onAuthorized","authorizedEvent","data","googlePayError","isValid","isAvailable","isReadyToPay","then","response","result","paymentMethodPresent","collectBrowserInfo","icon","resources","getImage","render","showPayButton","h","GooglePayButton","buttonColor","buttonType","buttonRootNode","buttonRadius","paymentsClient","onClick","submit","constructor","checkout","_define_property","isInstantPayment","ANALYTICS_SELECTED_STR","target","ANALYTICS_INSTANT_PAYMENT_BUTTON","onPaymentAuthorized","async","paymentData","formatGooglePayContactToAdyenAddressFormat","paymentMethodData","info","shippingAddress","setState","tokenizationData","token","cardNetwork","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","paymentResponse","transactionState","handleResponse","setElementStatus","fallbackMessage","get","intent","reason","message","responseWithError","handleFailedResult","prefetch","prefetchPaymentData","bind","paymentDataCallbacks","onPaymentDataChanged","GooglePayService","environment","TxVariants","googlepay","txVariants","paywithgoogle","defaultProps"],"mappings":"izBAiBA,MAAMA,UAAkBC,EA2BDC,WAAAA,CAAYC,GAC3B,MAAMC,EAAiBD,EAAMC,iBAAmBD,EAAME,SAAW,OAAS,UACpEC,EAAeC,EAAmBJ,EAAMG,cAAgBH,EAAMK,MAAMC,QAEpEC,EAAwD,IAAIP,EAAMO,gBAAiB,yBAEzF,MAAO,IACAP,EACHQ,cAAeR,EAAMQ,cACrBP,iBACAE,eACAI,kBAER,CAKA,UAAAE,GACI,MAAMC,qBAAEA,EAAoBC,eAAEA,EAAcC,eAAEA,EAAcC,gBAAEA,GAAoBC,KAAKC,OACjFC,UAAEA,GAAcF,KAAKd,MAE3B,MAAO,CACHiB,cAAe,CACXC,KAAMJ,KAAKI,KACXR,uBACAC,oBACIK,GAAa,CAAEG,QAAS,YAEhCC,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,UAChCT,GAAkB,CAAEA,qBACpBC,GAAmB,CAAEA,mBAEjC,CAEUW,eAAAA,CAAgBC,GAEtBC,MAAMF,gBAAgB,IAAKC,GAAgBX,KAAKd,MACpD,CAKA,yBAAA2B,GACIb,KAAKc,UAAUC,gBAAgBf,KAAKd,MAAOc,KAAKgB,KAAKC,QAAQC,aAAaC,OAAOC,IAE7EpB,KAAKqB,YAAY,IAAIC,EAAwC,aAArBF,EAAM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J5B,OAAOtB,gBAAe,IACXpC,KAAKc,UAAUsB,aAAapC,KAAKd,SAM5CwE,OAAO8B,YAAW,IACPxF,KAAKc,UAAU2E,oBAAoBzF,KAAKd,MAAOc,KAAKgB,KAAKC,QAAQC,eAlNxElB,KAAK0B,oBAAsB1B,KAAK0B,oBAAoBgE,KAAK1F,MACzDA,KAAKa,0BAA4Bb,KAAKa,0BAA0B6E,KAAK1F,MAErE,MAAME,UAAEA,EAASyF,qBAAEA,GAAyB3F,KAAKd,MAEjD,IAAkB,IAAdgB,GAAuByF,GAAsBC,qBAC7C,MAAM,IAAItE,EACN,uBACA,uGAIRtB,KAAKc,UAAY,IAAI+E,EAAiB7F,KAAKd,MAAM4G,YAAa,IACtD5F,GAAayF,GAAsBC,sBAAwB,CAAEA,qBAAsBD,EAAqBC,sBAC5G7B,oBAAqB/D,KAAK+D,qBAElC,EAxBAL,EADE3E,EACYqB,OAAO2F,EAAWC,WAChCtC,EAFE3E,EAEYkH,aAAa,CAACF,EAAWC,UAAWD,EAAWG,gBAC7DxC,EAHE3E,EAGYoH,eAAeA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import o from"./components/MBWayInput/MBWayInput.js";import{CoreProvider as r}from"../../core/Context/CoreProvider.js";import n from"./components/MBWayAwait/config.js";import s from"../internal/Await/Await.js";import a from"../../core/Errors/SRPanelProvider.js";import{TxVariants as i}from"../tx-variants.js";class p extends t{formatProps(e){const{data:t={},placeholders:o={}}=e;return{...e,data:{phoneNumber:t.telephoneNumber||t.phoneNumber,phonePrefix:t.phonePrefix||"+351"},placeholders:{phoneNumber:o.telephoneNumber||o.phoneNumber}}}formatData(){return{paymentMethod:{type:p.type,...this.state.data?.phoneNumber&&{telephoneNumber:this.state.data.phonePrefix+this.state.data.phoneNumber}}}}get isValid(){return!!this.state.isValid}get displayName(){return this.props.name}render(){return this.props.paymentData?e(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(a,{srPanel:this.props.modules.srPanel},e(s,{ref:e=>{this.componentRef=e},clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.props.onError,onComplete:this.onComplete,brandLogo:this.icon,type:n.type,messageText:this.props.i18n.get(n.messageTextId),awaitText:this.props.i18n.get(n.awaitTextId),showCountdownTimer:n.showCountdownTimer,delay:n.STATUS_INTERVAL,countdownTime:n.COUNTDOWN_MINUTES,throttleTime:n.THROTTLE_TIME,throttleInterval:n.THROTTLE_INTERVAL,onActionHandled:this.onActionHandled}))):e(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(o,{ref:e=>{this.componentRef=e},...this.props,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}}var m,h,l;m=p,h="type",l=i.mbway,h in m?Object.defineProperty(m,h,{value:l,enumerable:!0,configurable:!0,writable:!0}):m[h]=l;export{p as MBWayElement,p as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import o from"./components/MBWayInput/MBWayInput.js";import{CoreProvider as r}from"../../core/Context/CoreProvider.js";import n from"./components/MBWayAwait/config.js";import s from"../internal/Await/Await.js";import a from"../../core/Errors/SRPanelProvider.js";import{TxVariants as i}from"../tx-variants.js";class p extends t{formatProps(e){const{data:t={},placeholders:o={}}=e;return{...e,data:{phoneNumber:t.telephoneNumber||t.phoneNumber,phonePrefix:t.phonePrefix||"+351"},placeholders:{phoneNumber:o.telephoneNumber||o.phoneNumber}}}formatData(){return{paymentMethod:{type:p.type,...this.state.data?.phoneNumber&&{telephoneNumber:this.state.data.phonePrefix+this.state.data.phoneNumber}}}}get isValid(){return!!this.state.isValid}get displayName(){return this.props.name}render(){return this.props.paymentData?e(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(a,{srPanel:this.props.modules.srPanel},e(s,{ref:e=>{this.componentRef=e},clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.props.onError,onComplete:this.onComplete,brandLogo:this.icon,type:n.type,messageText:this.props.i18n.get(n.messageTextId),awaitText:this.props.i18n.get(n.awaitTextId),showCountdownTimer:n.showCountdownTimer,delay:n.STATUS_INTERVAL,countdownTime:n.COUNTDOWN_MINUTES,throttleTime:n.THROTTLE_TIME,throttleInterval:n.THROTTLE_INTERVAL,onActionHandled:this.onActionHandled}))):e(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(o,{ref:e=>{this.componentRef=e},...this.props,setComponentRef:this.setComponentRef,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}}var m,h,l;m=p,h="type",l=i.mbway,h in m?Object.defineProperty(m,h,{value:l,enumerable:!0,configurable:!0,writable:!0}):m[h]=l;export{p as MBWayElement,p as default};
2
2
  //# sourceMappingURL=MBWay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MBWay.js","sources":["../../../../src/components/MBWay/MBWay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport MBWayInput from './components/MBWayInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport config from './components/MBWayAwait/config';\nimport Await from '../../components/internal/Await';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport { AwaitConfiguration } from '../internal/Await/types';\n\nexport class MBWayElement extends UIElement<AwaitConfiguration> {\n public static type = TxVariants.mbway;\n\n formatProps(props) {\n const { data = {}, placeholders = {} } = props;\n\n return {\n ...props,\n data: {\n phoneNumber: data.telephoneNumber || data.phoneNumber,\n phonePrefix: data.phonePrefix || '+351' // if not specified default to Portuguese country code\n },\n placeholders: {\n phoneNumber: placeholders.telephoneNumber || placeholders.phoneNumber\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): object {\n return {\n paymentMethod: {\n type: MBWayElement.type,\n ...(this.state.data?.phoneNumber && { telephoneNumber: this.state.data.phonePrefix + this.state.data.phoneNumber })\n }\n };\n }\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n render() {\n if (this.props.paymentData) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <Await\n ref={ref => {\n this.componentRef = ref;\n }}\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={config.type}\n messageText={this.props.i18n.get(config.messageTextId)}\n awaitText={this.props.i18n.get(config.awaitTextId)}\n showCountdownTimer={config.showCountdownTimer}\n delay={config.STATUS_INTERVAL}\n countdownTime={config.COUNTDOWN_MINUTES}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <MBWayInput\n /* @ts-ignore ref handled internally by Component */\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default MBWayElement;\n"],"names":["MBWayElement","UIElement","formatProps","props","data","placeholders","phoneNumber","telephoneNumber","phonePrefix","formatData","paymentMethod","type","this","state","isValid","displayName","name","render","paymentData","h","CoreProvider","i18n","loadingContext","resources","SRPanelProvider","srPanel","modules","Await","ref","componentRef","clientKey","onError","onComplete","brandLogo","icon","config","messageText","get","messageTextId","awaitText","awaitTextId","showCountdownTimer","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","MBWayInput","onChange","setState","onSubmit","submit","payButton","TxVariants","mbway"],"mappings":"ybAUO,MAAMA,UAAqBC,EAG9BC,WAA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KAAMC,eAAgBV,KAAKT,MAAMmB,eAAgBC,UAAWX,KAAKW,WAC5FJ,EAACgC,EAAAA,CAEGvB,IAAKA,IACDhB,KAAKiB,aAAeD,CAAAA,KAEpBhB,KAAKT,MACTiD,SAAUxC,KAAKyC,SACfC,SAAU1C,KAAK2C,OACfC,UAAW5C,KAAK4C,YAIhC,cAjFSxD,IACKW,SAAO8C,EAAWC"}
1
+ {"version":3,"file":"MBWay.js","sources":["../../../../src/components/MBWay/MBWay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport MBWayInput from './components/MBWayInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport config from './components/MBWayAwait/config';\nimport Await from '../../components/internal/Await';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport { AwaitConfiguration } from '../internal/Await/types';\n\nexport class MBWayElement extends UIElement<AwaitConfiguration> {\n public static type = TxVariants.mbway;\n\n formatProps(props) {\n const { data = {}, placeholders = {} } = props;\n\n return {\n ...props,\n data: {\n phoneNumber: data.telephoneNumber || data.phoneNumber,\n phonePrefix: data.phonePrefix || '+351' // if not specified default to Portuguese country code\n },\n placeholders: {\n phoneNumber: placeholders.telephoneNumber || placeholders.phoneNumber\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): object {\n return {\n paymentMethod: {\n type: MBWayElement.type,\n ...(this.state.data?.phoneNumber && { telephoneNumber: this.state.data.phonePrefix + this.state.data.phoneNumber })\n }\n };\n }\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n render() {\n if (this.props.paymentData) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <Await\n ref={ref => {\n this.componentRef = ref;\n }}\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={config.type}\n messageText={this.props.i18n.get(config.messageTextId)}\n awaitText={this.props.i18n.get(config.awaitTextId)}\n showCountdownTimer={config.showCountdownTimer}\n delay={config.STATUS_INTERVAL}\n countdownTime={config.COUNTDOWN_MINUTES}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <MBWayInput\n /* @ts-ignore ref handled internally by Component */\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n setComponentRef={this.setComponentRef}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default MBWayElement;\n"],"names":["MBWayElement","UIElement","formatProps","props","data","placeholders","phoneNumber","telephoneNumber","phonePrefix","formatData","paymentMethod","type","this","state","isValid","displayName","name","render","paymentData","h","CoreProvider","i18n","loadingContext","resources","SRPanelProvider","srPanel","modules","Await","ref","componentRef","clientKey","onError","onComplete","brandLogo","icon","config","messageText","get","messageTextId","awaitText","awaitTextId","showCountdownTimer","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","MBWayInput","setComponentRef","onChange","setState","onSubmit","submit","payButton","TxVariants","mbway"],"mappings":"ybAUO,MAAMA,UAAqBC,EAG9BC,WAAAA,CAAYC,GACR,MAAMC,KAAEA,EAAO,CAAA,EAAEC,aAAEA,EAAe,CAAA,GAAOF,EAEzC,MAAO,IACAA,EACHC,KAAM,CACFE,YAAaF,EAAKG,iBAAmBH,EAAKE,YAC1CE,YAAaJ,EAAKI,aAAe,QAErCH,aAAc,CACVC,YAAaD,EAAaE,iBAAmBF,EAAaC,aAGtE,CAKAG,UAAAA,GACI,MAAO,C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W,SAAO+C,EAAWC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as r,useState as t}from"../../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../../core/Context/CoreProvider.js";import a from"../../../internal/PhoneInput/PhoneInput.js";import n from"../../../internal/LoadingWrapper/LoadingWrapper.js";import i from"../../../internal/PhoneInput/usePhonePrefixes.js";function s(s){const{i18n:l,loadingContext:d}=o(),u=r(null),{allowedCountries:m=[]}=s,[p,h]=t("ready");this.setStatus=h,this.showValidation=u?.current?.triggerValidation;const{loadingStatus:c,phonePrefixes:f}=i({allowedCountries:m,loadingContext:d,handleError:s.onError});return e(n,{status:c},e("div",{className:"adyen-checkout__mb-way"},e(a,{...s,items:f,ref:u,onChange:({data:e,valid:r,errors:t,isValid:o})=>{s.onChange({data:e,valid:r,errors:t,isValid:o})},data:s.data}),s.showPayButton&&s.payButton({status:p,label:l.get("confirmPurchase")})))}s.defaultProps={onChange:()=>{},phoneNumberKey:"mobileNumber",phoneNumberErrorKey:"mobileNumber.invalid"};export{s as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as o,useState as t}from"../../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as r}from"../../../../core/Context/CoreProvider.js";import a from"../../../internal/PhoneInput/PhoneInputForm.js";import n from"../../../internal/LoadingWrapper/LoadingWrapper.js";import s from"../../../internal/PhoneInput/usePhonePrefixes.js";function i(i){const{i18n:l,loadingContext:m}=r(),d=o(null),{allowedCountries:u=[]}=i,[p,h]=t("ready");this.setStatus=h;const{loadingStatus:f,phonePrefixes:c}=s({allowedCountries:u,loadingContext:m,handleError:i.onError});return e(n,{status:f},e("div",{className:"adyen-checkout__mb-way"},e(a,{setComponentRef:i.setComponentRef,...i,items:c,ref:d,onChange:({data:e,valid:o,errors:t,isValid:r})=>{i.onChange({data:e,valid:o,errors:t,isValid:r})},data:i.data}),i.showPayButton&&i.payButton({status:p,label:l.get("confirmPurchase")})))}i.defaultProps={onChange:()=>{},phoneNumberKey:"mobileNumber",phoneNumberErrorKey:"mobileNumber.invalid"};export{i as default};
2
2
  //# sourceMappingURL=MBWayInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MBWayInput.js","sources":["../../../../../../src/components/MBWay/components/MBWayInput/MBWayInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useRef } from 'preact/hooks';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { MBWayInputProps } from './types';\nimport './MBWayInput.scss';\nimport PhoneInput from '../../../internal/PhoneInput';\nimport LoadingWrapper from '../../../internal/LoadingWrapper';\nimport usePhonePrefixes from '../../../internal/PhoneInput/usePhonePrefixes';\n\nfunction MBWayInput(props: MBWayInputProps) {\n const { i18n, loadingContext } = useCoreContext();\n\n const phoneInputRef = useRef(null);\n\n const { allowedCountries = [] } = props;\n\n const [status, setStatus] = useState<string>('ready');\n\n this.setStatus = setStatus;\n this.showValidation = phoneInputRef?.current?.triggerValidation;\n\n const { loadingStatus: prefixLoadingStatus, phonePrefixes } = usePhonePrefixes({ allowedCountries, loadingContext, handleError: props.onError });\n\n const onChange = ({ data, valid, errors, isValid }) => {\n props.onChange({ data, valid, errors, isValid });\n };\n\n return (\n <LoadingWrapper status={prefixLoadingStatus}>\n <div className=\"adyen-checkout__mb-way\">\n <PhoneInput {...props} items={phonePrefixes} ref={phoneInputRef} onChange={onChange} data={props.data} />\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n </LoadingWrapper>\n );\n}\n\nMBWayInput.defaultProps = {\n onChange: () => {},\n phoneNumberKey: 'mobileNumber',\n phoneNumberErrorKey: 'mobileNumber.invalid'\n};\n\nexport default MBWayInput;\n"],"names":["MBWayInput","props","i18n","loadingContext","useCoreContext","phoneInputRef","useRef","allowedCountries","status","setStatus","useState","this","showValidation","current","triggerValidation","loadingStatus","prefixLoadingStatus","phonePrefixes","usePhonePrefixes","handleError","onError","h","LoadingWrapper","div","className","PhoneInput","items","ref","onChange","data","valid","errors","isValid","showPayButton","payButton","label","get","defaultProps","phoneNumberKey","phoneNumberErrorKey"],"mappings":"waASA,SAASA,EAAWC,GAChB,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,IAE3BC,EAAgBC,EAAO,OAEvBC,iBAAEA,EAAmB,IAAON,GAE3BO,EAAQC,GAAaC,EAAiB,SAE7CC,KAAKF,UAAYA,EACjBE,KAAKC,eAAiBP,GAAeQ,SAASC,kBAE9C,MAAQC,cAAeC,EAAmBC,cAAEA,GAAkBC,EAAiB,CAAEX,mBAAkBJ,iBAAgBgB,YAAalB,EAAMmB,UAMtI,OACIC,EAACC,EAAAA,CAAed,OAAQQ,GACpBK,EAACE,MAAAA,CAAIC,UAAU,0BACXH,EAACI,EAAAA,IAAexB,EAAOyB,MAAOT,EAAeU,IAAKtB,EAAeuB,SAP5D,EAAGC,OAAMC,QAAOC,SAAQC,cACrC/B,EAAM2B,SAAS,CAAEC,OAAMC,QAAOC,SAAQC,WAAQ,EAM+CH,KAAM5B,EAAM4B,OAEhG5B,EAAMgC,eAAiBhC,EAAMiC,UAAU,CAAE1B,SAAQ2B,MAAOjC,EAAKkC,IAAI,sBAIlF,CAEApC,EAAWqC,aAAe,CACtBT,SAAU,OACVU,eAAgB,eAChBC,oBAAqB"}
1
+ {"version":3,"file":"MBWayInput.js","sources":["../../../../../../src/components/MBWay/components/MBWayInput/MBWayInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useRef } from 'preact/hooks';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { MBWayInputProps } from './types';\nimport './MBWayInput.scss';\nimport PhoneInputForm from '../../../internal/PhoneInput';\nimport LoadingWrapper from '../../../internal/LoadingWrapper';\nimport usePhonePrefixes from '../../../internal/PhoneInput/usePhonePrefixes';\n\nfunction MBWayInput(props: MBWayInputProps) {\n const { i18n, loadingContext } = useCoreContext();\n\n const phoneInputRef = useRef(null);\n\n const { allowedCountries = [] } = props;\n\n const [status, setStatus] = useState<string>('ready');\n\n this.setStatus = setStatus;\n\n const { loadingStatus: prefixLoadingStatus, phonePrefixes } = usePhonePrefixes({ allowedCountries, loadingContext, handleError: props.onError });\n\n const onChange = ({ data, valid, errors, isValid }) => {\n props.onChange({ data, valid, errors, isValid });\n };\n\n return (\n <LoadingWrapper status={prefixLoadingStatus}>\n <div className=\"adyen-checkout__mb-way\">\n <PhoneInputForm\n setComponentRef={props.setComponentRef}\n {...props}\n items={phonePrefixes}\n ref={phoneInputRef}\n onChange={onChange}\n data={props.data}\n />\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('confirmPurchase') })}\n </div>\n </LoadingWrapper>\n );\n}\n\nMBWayInput.defaultProps = {\n onChange: () => {},\n phoneNumberKey: 'mobileNumber',\n phoneNumberErrorKey: 'mobileNumber.invalid'\n};\n\nexport default MBWayInput;\n"],"names":["MBWayInput","props","i18n","loadingContext","useCoreContext","phoneInputRef","useRef","allowedCountries","status","setStatus","useState","this","loadingStatus","prefixLoadingStatus","phonePrefixes","usePhonePrefixes","handleError","onError","h","LoadingWrapper","div","className","PhoneInputForm","setComponentRef","items","ref","onChange","data","valid","errors","isValid","showPayButton","payButton","label","get","defaultProps","phoneNumberKey","phoneNumberErrorKey"],"mappings":"4aASA,SAASA,EAAWC,GAChB,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,IAE3BC,EAAgBC,EAAO,OAEvBC,iBAAEA,EAAmB,IAAON,GAE3BO,EAAQC,GAAaC,EAAiB,SAE7CC,KAAKF,UAAYA,EAEjB,MAAQG,cAAeC,EAAmBC,cAAEA,GAAkBC,EAAiB,CAAER,mBAAkBJ,iBAAgBa,YAAaf,EAAMgB,UAMtI,OACIC,EAACC,EAAAA,CAAeX,OAAQK,GACpBK,EAACE,MAAAA,CAAIC,UAAU,0BACXH,EAACI,EAAAA,CACGC,gBAAiBtB,EAAMsB,mBACnBtB,EACJuB,MAAOV,EACPW,IAAKpB,EACLqB,SAZC,EAAGC,OAAMC,QAAOC,SAAQC,cACrC7B,EAAMyB,SAAS,CAAEC,OAAMC,QAAOC,SAAQC,WAAQ,EAYlCH,KAAM1B,EAAM0B,OAGf1B,EAAM8B,eAAiB9B,EAAM+B,UAAU,CAAExB,SAAQyB,MAAO/B,EAAKgC,IAAI,sBAIlF,CAEAlC,EAAWmC,aAAe,CACtBT,SAAU,OACVU,eAAgB,eAChBC,oBAAqB"}
@@ -1,2 +1,2 @@
1
- import e from"../../Card/components/CardInput/components/DataSfSpan.js";import r from"../../../external/classnames/index.js";import t from"../../internal/FormFields/Field/Field.js";import{createElement as a}from"../../../external/preact/dist/preact.js";import{alternativeLabelContent as n}from"../../Card/components/CardInput/components/FieldLabelAlternative.js";const p=({i18n:p,sfpState:i,focusedElement:c,setFocusOn:o})=>a(t,{label:p.get("giftcard.expiryDate.label"),classNameModifiers:["expireDate","50"],errorMessage:i.errors.encryptedExpiryDate&&p.get(i.errors.encryptedExpiryDate),focused:"encryptedExpiryDate"===c,onFocusField:()=>o("encryptedExpiryDate"),dir:"ltr",name:"encryptedExpiryDate",contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:n},a(e,{encryptedFieldType:"encryptedExpiryDate",className:r("adyen-checkout__input","adyen-checkout__input--small","adyen-checkout__card__exp-date__input",{"adyen-checkout__input--error":i.errors.encryptedExpiryDate,"adyen-checkout__input--focus":"encryptedExpiryDate"===c,"adyen-checkout__input--valid":!!i.valid.encryptedExpiryMonth&&!!i.valid.encryptedExpiryYear})}));export{p as MealVoucherExpiryField};
1
+ import e from"../../Card/components/CardInput/components/DataSfSpan.js";import r from"../../../_virtual/index.js";import t from"../../internal/FormFields/Field/Field.js";import{createElement as a}from"../../../external/preact/dist/preact.js";import{alternativeLabelContent as n}from"../../Card/components/CardInput/components/FieldLabelAlternative.js";const p=({i18n:p,sfpState:i,focusedElement:o,setFocusOn:c})=>a(t,{label:p.get("giftcard.expiryDate.label"),classNameModifiers:["expireDate","50"],errorMessage:i.errors.encryptedExpiryDate&&p.get(i.errors.encryptedExpiryDate),focused:"encryptedExpiryDate"===o,onFocusField:()=>c("encryptedExpiryDate"),dir:"ltr",name:"encryptedExpiryDate",contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:n},a(e,{encryptedFieldType:"encryptedExpiryDate",className:r("adyen-checkout__input","adyen-checkout__input--small","adyen-checkout__card__exp-date__input",{"adyen-checkout__input--error":i.errors.encryptedExpiryDate,"adyen-checkout__input--focus":"encryptedExpiryDate"===o,"adyen-checkout__input--valid":!!i.valid.encryptedExpiryMonth&&!!i.valid.encryptedExpiryYear})}));export{p as MealVoucherExpiryField};
2
2
  //# sourceMappingURL=MealVoucherExpiryField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MealVoucherExpiryField.js","sources":["../../../../../src/components/MealVoucherFR/components/MealVoucherExpiryField.tsx"],"sourcesContent":["import DataSfSpan from '../../Card/components/CardInput/components/DataSfSpan';\nimport classNames from 'classnames';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { GiftcardFieldProps } from '../../Giftcard/components/types';\nimport { alternativeLabelContent } from '../../Card/components/CardInput/components/FieldLabelAlternative';\n\nexport const MealVoucherExpiryField = ({ i18n, sfpState, focusedElement, setFocusOn }: GiftcardFieldProps) => {\n return (\n <Field\n label={i18n.get('giftcard.expiryDate.label')}\n classNameModifiers={['expireDate', '50']}\n errorMessage={sfpState.errors.encryptedExpiryDate && i18n.get(sfpState.errors.encryptedExpiryDate)}\n focused={focusedElement === 'encryptedExpiryDate'}\n onFocusField={() => setFocusOn('encryptedExpiryDate')}\n dir={'ltr'}\n name={'encryptedExpiryDate'}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType={'encryptedExpiryDate'}\n className={classNames('adyen-checkout__input', 'adyen-checkout__input--small', 'adyen-checkout__card__exp-date__input', {\n 'adyen-checkout__input--error': sfpState.errors.encryptedExpiryDate,\n 'adyen-checkout__input--focus': focusedElement === 'encryptedExpiryDate',\n 'adyen-checkout__input--valid': !!sfpState.valid.encryptedExpiryMonth && !!sfpState.valid.encryptedExpiryYear\n })}\n />\n </Field>\n );\n};\n"],"names":["MealVoucherExpiryField","i18n","sfpState","focusedElement","setFocusOn","h","Field","label","get","classNameModifiers","errorMessage","errors","encryptedExpiryDate","focused","onFocusField","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","className","classNames","valid","encryptedExpiryMonth","encryptedExpiryYear"],"mappings":"2WAOO,MAAMA,EAAyB,EAAGC,OAAMC,WAAUC,iBAAgBC,gBAEjEC,EAACC,EAAAA,CACGC,MAAON,EAAKO,IAAI,6BAChBC,mBAAoB,CAAC,aAAc,MACnCC,aAAcR,EAASS,OAAOC,qBAAuBX,EAAKO,IAAIN,EAASS,OAAOC,qBAC9EC,QAA4B,wBAAnBV,EACTW,aAAc,IAAMV,EAAW,uBAC/BW,IAAK,MACLC,KAAM,sBACNC,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1Bf,EAACgB,EAAAA,CACGC,mBAAoB,sBACpBC,UAAWC,EAAW,wBAAyB,+BAAgC,wCAAyC,CACpH,+BAAgCtB,EAASS,OAAOC,oBAChD,+BAAmD,wBAAnBT,EAChC,iCAAkCD,EAASuB,MAAMC,wBAA0BxB,EAASuB,MAAME"}
1
+ {"version":3,"file":"MealVoucherExpiryField.js","sources":["../../../../../src/components/MealVoucherFR/components/MealVoucherExpiryField.tsx"],"sourcesContent":["import DataSfSpan from '../../Card/components/CardInput/components/DataSfSpan';\nimport classNames from 'classnames';\nimport Field from '../../internal/FormFields/Field';\nimport { h } from 'preact';\nimport { GiftcardFieldProps } from '../../Giftcard/components/types';\nimport { alternativeLabelContent } from '../../Card/components/CardInput/components/FieldLabelAlternative';\n\nexport const MealVoucherExpiryField = ({ i18n, sfpState, focusedElement, setFocusOn }: GiftcardFieldProps) => {\n return (\n <Field\n label={i18n.get('giftcard.expiryDate.label')}\n classNameModifiers={['expireDate', '50']}\n errorMessage={sfpState.errors.encryptedExpiryDate && i18n.get(sfpState.errors.encryptedExpiryDate)}\n focused={focusedElement === 'encryptedExpiryDate'}\n onFocusField={() => setFocusOn('encryptedExpiryDate')}\n dir={'ltr'}\n name={'encryptedExpiryDate'}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType={'encryptedExpiryDate'}\n className={classNames('adyen-checkout__input', 'adyen-checkout__input--small', 'adyen-checkout__card__exp-date__input', {\n 'adyen-checkout__input--error': sfpState.errors.encryptedExpiryDate,\n 'adyen-checkout__input--focus': focusedElement === 'encryptedExpiryDate',\n 'adyen-checkout__input--valid': !!sfpState.valid.encryptedExpiryMonth && !!sfpState.valid.encryptedExpiryYear\n })}\n />\n </Field>\n );\n};\n"],"names":["MealVoucherExpiryField","i18n","sfpState","focusedElement","setFocusOn","h","Field","label","get","classNameModifiers","errorMessage","errors","encryptedExpiryDate","focused","onFocusField","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","className","classNames","valid","encryptedExpiryMonth","encryptedExpiryYear"],"mappings":"gWAOO,MAAMA,EAAyB,EAAGC,OAAMC,WAAUC,iBAAgBC,gBAEjEC,EAACC,EAAAA,CACGC,MAAON,EAAKO,IAAI,6BAChBC,mBAAoB,CAAC,aAAc,MACnCC,aAAcR,EAASS,OAAOC,qBAAuBX,EAAKO,IAAIN,EAASS,OAAOC,qBAC9EC,QAA4B,wBAAnBV,EACTW,aAAc,IAAMV,EAAW,uBAC/BW,IAAK,MACLC,KAAM,sBACNC,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,GAE1Bf,EAACgB,EAAAA,CACGC,mBAAoB,sBACpBC,UAAWC,EAAW,wBAAyB,+BAAgC,wCAAyC,CACpH,+BAAgCtB,EAASS,OAAOC,oBAChD,+BAAmD,wBAAnBT,EAChC,iCAAkCD,EAASuB,MAAMC,wBAA0BxB,EAASuB,MAAME"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as n,useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import t from"../../../external/classnames/index.js";import{getStyle as o}from"../utils/get-paypal-styles.js";import s from"../../internal/Spinner/Spinner.js";import{useCoreContext as p}from"../../../core/Context/CoreProvider.js";function c({onInit:c,onApprove:r,onClick:i,onCancel:l,onError:_,onShippingAddressChange:u,onShippingOptionsChange:y,onSubmit:d,isProcessingPayment:m,paypalRef:h,style:k,...g}){const{i18n:f}=p(),b="tokenize"===g.configuration?.intent,P=n(null),v=n(null),C=n(null),N=n(null),A=(e,n)=>{const a={...b&&{createBillingAgreement:d},...!b&&{createOrder:d},...!b&&"venmo"!==e&&u&&{onShippingAddressChange:u},...!b&&"venmo"!==e&&y&&{onShippingOptionsChange:y},fundingSource:e,style:o(e,k),onInit:c,onClick:i,onCancel:l,onError:_,onApprove:r},t=h.Buttons(a);t.isEligible()&&t.render(n.current)};a((()=>{const{PAYPAL:e,CREDIT:n,PAYLATER:a,VENMO:t}=h.FUNDING;A(e,P),g.blockPayPalCreditButton||A(n,v),g.blockPayPalPayLaterButton||A(a,C),g.blockPayPalVenmoButton||A(t,N)}),[]);const E=!0===g.commit;return e("div",{className:t("adyen-checkout__paypal__buttons",{"adyen-checkout__paypal-processing":m})},e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--paypal",ref:P}),e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--credit",ref:v}),e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--pay-later",ref:C}),e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--venmo",ref:N}),m&&e("div",{className:"adyen-checkout__paypal"},e("div",{className:"adyen-checkout__paypal__status adyen-checkout__paypal__status--processing"},e(s,{size:"medium",inline:!0}),E&&f.get("paypal.processingPayment"))))}export{c as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as n,useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import t from"../../../_virtual/index.js";import{getStyle as o}from"../utils/get-paypal-styles.js";import p from"../../internal/Spinner/Spinner.js";import{useCoreContext as c}from"../../../core/Context/CoreProvider.js";function r({onInit:r,onApprove:s,onClick:i,onCancel:l,onError:_,onShippingAddressChange:u,onShippingOptionsChange:y,onSubmit:d,isProcessingPayment:m,paypalRef:h,style:k,...g}){const{i18n:f}=c(),b="tokenize"===g.configuration?.intent,v=n(null),P=n(null),C=n(null),N=n(null),A=(e,n)=>{const a={...b&&{createBillingAgreement:d},...!b&&{createOrder:d},...!b&&"venmo"!==e&&u&&{onShippingAddressChange:u},...!b&&"venmo"!==e&&y&&{onShippingOptionsChange:y},fundingSource:e,style:o(e,k),onInit:r,onClick:i,onCancel:l,onError:_,onApprove:s},t=h.Buttons(a);t.isEligible()&&t.render(n.current)};a((()=>{const{PAYPAL:e,CREDIT:n,PAYLATER:a,VENMO:t}=h.FUNDING;A(e,v),g.blockPayPalCreditButton||A(n,P),g.blockPayPalPayLaterButton||A(a,C),g.blockPayPalVenmoButton||A(t,N)}),[]);const E=!0===g.commit;return e("div",{className:t("adyen-checkout__paypal__buttons",{"adyen-checkout__paypal-processing":m})},e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--paypal",ref:v}),e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--credit",ref:P}),e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--pay-later",ref:C}),e("div",{className:"adyen-checkout__paypal__button adyen-checkout__paypal__button--venmo",ref:N}),m&&e("div",{className:"adyen-checkout__paypal"},e("div",{className:"adyen-checkout__paypal__status adyen-checkout__paypal__status--processing"},e(p,{size:"medium",inline:!0}),E&&f.get("paypal.processingPayment"))))}export{r as default};
2
2
  //# sourceMappingURL=PaypalButtons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaypalButtons.js","sources":["../../../../../src/components/PayPal/components/PaypalButtons.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport classnames from 'classnames';\nimport { getStyle } from '../utils/get-paypal-styles';\nimport Spinner from '../../internal/Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\nimport type { PayPalButtonsProps } from './types';\nimport type { FundingSource } from '../types';\n\nexport default function PaypalButtons({\n onInit,\n onApprove,\n onClick,\n onCancel,\n onError,\n onShippingAddressChange,\n onShippingOptionsChange,\n onSubmit,\n isProcessingPayment,\n paypalRef,\n style,\n ...props\n}: PayPalButtonsProps) {\n const { i18n } = useCoreContext();\n const isTokenize = props.configuration?.intent === 'tokenize';\n const paypalButtonRef = useRef<HTMLDivElement>(null);\n const creditButtonRef = useRef<HTMLDivElement>(null);\n const payLaterButtonRef = useRef<HTMLDivElement>(null);\n const venmoButtonRef = useRef<HTMLDivElement>(null);\n\n const createButton = (fundingSource: FundingSource, buttonRef) => {\n const configuration = {\n ...(isTokenize && { createBillingAgreement: onSubmit }),\n ...(!isTokenize && { createOrder: onSubmit }),\n ...(!isTokenize && fundingSource !== 'venmo' && onShippingAddressChange && { onShippingAddressChange }),\n ...(!isTokenize && fundingSource !== 'venmo' && onShippingOptionsChange && { onShippingOptionsChange }),\n fundingSource,\n style: getStyle(fundingSource, style),\n onInit,\n onClick,\n onCancel,\n onError,\n onApprove\n };\n\n const button = paypalRef.Buttons(configuration);\n\n if (button.isEligible()) {\n button.render(buttonRef.current);\n }\n };\n\n useEffect(() => {\n const { PAYPAL, CREDIT, PAYLATER, VENMO } = paypalRef.FUNDING;\n createButton(PAYPAL, paypalButtonRef);\n\n if (!props.blockPayPalCreditButton) createButton(CREDIT, creditButtonRef);\n if (!props.blockPayPalPayLaterButton) createButton(PAYLATER, payLaterButtonRef);\n if (!props.blockPayPalVenmoButton) createButton(VENMO, venmoButtonRef);\n }, []);\n\n const isProcessingPaymentWithoutReviewPage = props.commit === true;\n\n return (\n <div className={classnames('adyen-checkout__paypal__buttons', { 'adyen-checkout__paypal-processing': isProcessingPayment })}>\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--paypal\" ref={paypalButtonRef} />\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--credit\" ref={creditButtonRef} />\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--pay-later\" ref={payLaterButtonRef} />\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--venmo\" ref={venmoButtonRef} />\n\n {isProcessingPayment && (\n <div className=\"adyen-checkout__paypal\">\n <div className=\"adyen-checkout__paypal__status adyen-checkout__paypal__status--processing\">\n <Spinner size=\"medium\" inline />\n {isProcessingPaymentWithoutReviewPage && i18n.get('paypal.processingPayment')}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"names":["PaypalButtons","onInit","onApprove","onClick","onCancel","onError","onShippingAddressChange","onShippingOptionsChange","onSubmit","isProcessingPayment","paypalRef","style","props","i18n","useCoreContext","isTokenize","configuration","intent","paypalButtonRef","useRef","creditButtonRef","payLaterButtonRef","venmoButtonRef","createButton","fundingSource","buttonRef","createBillingAgreement","createOrder","getStyle","button","Buttons","isEligible","render","current","useEffect","PAYPAL","CREDIT","PAYLATER","VENMO","FUNDING","blockPayPalCreditButton","blockPayPalPayLaterButton","blockPayPalVenmoButton","isProcessingPaymentWithoutReviewPage","commit","h","div","className","classnames","ref","Spinner","size","inline","get"],"mappings":"mYAUe,SAASA,GAAcC,OAClCA,EAAMC,UACNA,EAASC,QACTA,EAAOC,SACPA,EAAQC,QACRA,EAAOC,wBACPA,EAAuBC,wBACvBA,EAAuBC,SACvBA,EAAQC,oBACRA,EAAmBC,UACnBA,EAASC,MACTA,KACGC,IAEH,MAAMC,KAAEA,GAASC,IACXC,EAA6C,aAAhCH,EAAMI,eAAeC,OAClCC,EAAkBC,EAAuB,MACzCC,EAAkBD,EAAuB,MACzCE,EAAoBF,EAAuB,MAC3CG,EAAiBH,EAAuB,MAExCI,EAAe,CAACC,EAA8BC,KAChD,MAAMT,EAAgB,IACdD,GAAc,CAAEW,uBAAwBlB,OACvCO,GAAc,CAAEY,YAAanB,OAC7BO,GAAgC,UAAlBS,GAA6BlB,GAA2B,CAAEA,+BACxES,GAAgC,UAAlBS,GAA6BjB,GAA2B,CAAEA,2BAC7EiB,gBACAb,MAAOiB,EAASJ,EAAeb,GAC/BV,SACAE,UACAC,WACAC,UACAH,aAGE2B,EAASnB,EAAUoB,QAAQd,GAE7Ba,EAAOE,cACPF,EAAOG,OAAOP,EAAUQ,QAC5B,EAGJC,GAAU,KACN,MAAMC,OAAEA,EAAMC,OAAEA,EAAMC,SAAEA,EAAQC,MAAEA,GAAU5B,EAAU6B,QACtDhB,EAAaY,EAAQjB,GAEhBN,EAAM4B,yBAAyBjB,EAAaa,EAAQhB,GACpDR,EAAM6B,2BAA2BlB,EAAac,EAAUhB,GACxDT,EAAM8B,wBAAwBnB,EAAae,EAAOhB,EAAAA,GACxD,IAEH,MAAMqB,GAAwD,IAAjB/B,EAAMgC,OAEnD,OACIC,EAACC,MAAAA,CAAIC,UAAWC,EAAW,kCAAmC,CAAE,oCAAqCvC,KACjGoC,EAACC,MAAAA,CAAIC,UAAU,wEAAwEE,IAAK/B,IAC5F2B,EAACC,MAAAA,CAAIC,UAAU,wEAAwEE,IAAK7B,IAC5FyB,EAACC,MAAAA,CAAIC,UAAU,2EAA2EE,IAAK5B,IAC/FwB,EAACC,MAAAA,CAAIC,UAAU,uEAAuEE,IAAK3B,IAE1Fb,GACGoC,EAACC,MAAAA,CAAIC,UAAU,0BACXF,EAACC,MAAAA,CAAIC,UAAU,6EACXF,EAACK,EAAAA,CAAQC,KAAK,SAASC,QAAAA,IACtBT,GAAwC9B,EAAKwC,IAAI,8BAM1E"}
1
+ {"version":3,"file":"PaypalButtons.js","sources":["../../../../../src/components/PayPal/components/PaypalButtons.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport classnames from 'classnames';\nimport { getStyle } from '../utils/get-paypal-styles';\nimport Spinner from '../../internal/Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\nimport type { PayPalButtonsProps } from './types';\nimport type { FundingSource } from '../types';\n\nexport default function PaypalButtons({\n onInit,\n onApprove,\n onClick,\n onCancel,\n onError,\n onShippingAddressChange,\n onShippingOptionsChange,\n onSubmit,\n isProcessingPayment,\n paypalRef,\n style,\n ...props\n}: PayPalButtonsProps) {\n const { i18n } = useCoreContext();\n const isTokenize = props.configuration?.intent === 'tokenize';\n const paypalButtonRef = useRef<HTMLDivElement>(null);\n const creditButtonRef = useRef<HTMLDivElement>(null);\n const payLaterButtonRef = useRef<HTMLDivElement>(null);\n const venmoButtonRef = useRef<HTMLDivElement>(null);\n\n const createButton = (fundingSource: FundingSource, buttonRef) => {\n const configuration = {\n ...(isTokenize && { createBillingAgreement: onSubmit }),\n ...(!isTokenize && { createOrder: onSubmit }),\n ...(!isTokenize && fundingSource !== 'venmo' && onShippingAddressChange && { onShippingAddressChange }),\n ...(!isTokenize && fundingSource !== 'venmo' && onShippingOptionsChange && { onShippingOptionsChange }),\n fundingSource,\n style: getStyle(fundingSource, style),\n onInit,\n onClick,\n onCancel,\n onError,\n onApprove\n };\n\n const button = paypalRef.Buttons(configuration);\n\n if (button.isEligible()) {\n button.render(buttonRef.current);\n }\n };\n\n useEffect(() => {\n const { PAYPAL, CREDIT, PAYLATER, VENMO } = paypalRef.FUNDING;\n createButton(PAYPAL, paypalButtonRef);\n\n if (!props.blockPayPalCreditButton) createButton(CREDIT, creditButtonRef);\n if (!props.blockPayPalPayLaterButton) createButton(PAYLATER, payLaterButtonRef);\n if (!props.blockPayPalVenmoButton) createButton(VENMO, venmoButtonRef);\n }, []);\n\n const isProcessingPaymentWithoutReviewPage = props.commit === true;\n\n return (\n <div className={classnames('adyen-checkout__paypal__buttons', { 'adyen-checkout__paypal-processing': isProcessingPayment })}>\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--paypal\" ref={paypalButtonRef} />\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--credit\" ref={creditButtonRef} />\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--pay-later\" ref={payLaterButtonRef} />\n <div className=\"adyen-checkout__paypal__button adyen-checkout__paypal__button--venmo\" ref={venmoButtonRef} />\n\n {isProcessingPayment && (\n <div className=\"adyen-checkout__paypal\">\n <div className=\"adyen-checkout__paypal__status adyen-checkout__paypal__status--processing\">\n <Spinner size=\"medium\" inline />\n {isProcessingPaymentWithoutReviewPage && i18n.get('paypal.processingPayment')}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"names":["PaypalButtons","onInit","onApprove","onClick","onCancel","onError","onShippingAddressChange","onShippingOptionsChange","onSubmit","isProcessingPayment","paypalRef","style","props","i18n","useCoreContext","isTokenize","configuration","intent","paypalButtonRef","useRef","creditButtonRef","payLaterButtonRef","venmoButtonRef","createButton","fundingSource","buttonRef","createBillingAgreement","createOrder","getStyle","button","Buttons","isEligible","render","current","useEffect","PAYPAL","CREDIT","PAYLATER","VENMO","FUNDING","blockPayPalCreditButton","blockPayPalPayLaterButton","blockPayPalVenmoButton","isProcessingPaymentWithoutReviewPage","commit","h","div","className","classnames","ref","Spinner","size","inline","get"],"mappings":"wXAUe,SAASA,GAAcC,OAClCA,EAAMC,UACNA,EAASC,QACTA,EAAOC,SACPA,EAAQC,QACRA,EAAOC,wBACPA,EAAuBC,wBACvBA,EAAuBC,SACvBA,EAAQC,oBACRA,EAAmBC,UACnBA,EAASC,MACTA,KACGC,IAEH,MAAMC,KAAEA,GAASC,IACXC,EAA6C,aAAhCH,EAAMI,eAAeC,OAClCC,EAAkBC,EAAuB,MACzCC,EAAkBD,EAAuB,MACzCE,EAAoBF,EAAuB,MAC3CG,EAAiBH,EAAuB,MAExCI,EAAe,CAACC,EAA8BC,KAChD,MAAMT,EAAgB,IACdD,GAAc,CAAEW,uBAAwBlB,OACvCO,GAAc,CAAEY,YAAanB,OAC7BO,GAAgC,UAAlBS,GAA6BlB,GAA2B,CAAEA,+BACxES,GAAgC,UAAlBS,GAA6BjB,GAA2B,CAAEA,2BAC7EiB,gBACAb,MAAOiB,EAASJ,EAAeb,GAC/BV,SACAE,UACAC,WACAC,UACAH,aAGE2B,EAASnB,EAAUoB,QAAQd,GAE7Ba,EAAOE,cACPF,EAAOG,OAAOP,EAAUQ,QAC5B,EAGJC,GAAU,KACN,MAAMC,OAAEA,EAAMC,OAAEA,EAAMC,SAAEA,EAAQC,MAAEA,GAAU5B,EAAU6B,QACtDhB,EAAaY,EAAQjB,GAEhBN,EAAM4B,yBAAyBjB,EAAaa,EAAQhB,GACpDR,EAAM6B,2BAA2BlB,EAAac,EAAUhB,GACxDT,EAAM8B,wBAAwBnB,EAAae,EAAOhB,EAAAA,GACxD,IAEH,MAAMqB,GAAwD,IAAjB/B,EAAMgC,OAEnD,OACIC,EAACC,MAAAA,CAAIC,UAAWC,EAAW,kCAAmC,CAAE,oCAAqCvC,KACjGoC,EAACC,MAAAA,CAAIC,UAAU,wEAAwEE,IAAK/B,IAC5F2B,EAACC,MAAAA,CAAIC,UAAU,wEAAwEE,IAAK7B,IAC5FyB,EAACC,MAAAA,CAAIC,UAAU,2EAA2EE,IAAK5B,IAC/FwB,EAACC,MAAAA,CAAIC,UAAU,uEAAuEE,IAAK3B,IAE1Fb,GACGoC,EAACC,MAAAA,CAAIC,UAAU,0BACXF,EAACC,MAAAA,CAAIC,UAAU,6EACXF,EAACK,EAAAA,CAAQC,KAAK,SAASC,QAAAA,IACtBT,GAAwC9B,EAAKwC,IAAI,8BAM1E"}
@@ -0,0 +1,2 @@
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CoreProvider as o}from"../../core/Context/CoreProvider.js";import s from"../internal/Await/Await.js";import r from"../../core/Errors/SRPanelProvider.js";import{TxVariants as n}from"../tx-variants.js";import{PayToIdentifierEnum as a}from"./components/IdentifierSelector.js";import i from"./components/PayToComponent.js";import{PayToInstructions as p}from"./components/PayToInstructions.js";import m from"./components/MandateSummary.js";import h from"../internal/PayButton/PayButton.js";import{payAmountLabel as d}from"../internal/PayButton/utils.js";function l(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}const u=6e4,c=1e4,y=!1,f=t=>{if("bsb-option"===t.selectedInput)return`${t.bsb}-${t.bankAccountNumber}`;if("payid-option"===t.selectedInput)switch(t.selectedIdentifier){case a.email:return t.email;case a.abn:return t.abn;case a.orgid:return t.orgid;case a.phone:return`${t.phonePrefix}-${t.phoneNumber}`}};class P extends e{formatProps(t){return{...t,data:{...t.data,phonePrefix:"+61"}}}formatData(){return this.props.storedPaymentMethodId?{paymentMethod:{type:P.type,storedPaymentMethodId:this.props.storedPaymentMethodId}}:{paymentMethod:{type:P.type,shopperAccountIdentifier:f(this.state.data)},shopperName:{firstName:this.state.data.firstName,lastName:this.state.data.lastName}}}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.label?this.props.label:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.name:""}render(){return this.props.storedPaymentMethodId?t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showPayButton&&t(h,{...this.props,classNameModifiers:["standalone"],amount:this.props.amount,label:d(this.props.i18n,this.props.amount),onClick:this.submit})):this.props.paymentData?t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(r,{srPanel:this.props.modules.srPanel},t(s,{ref:t=>{this.componentRef=t},amount:this.props.amount,showAmount:!0,instructions:p,clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.props.onError,onComplete:this.onComplete,brandLogo:this.icon,type:this.constructor.type,messageText:this.props.i18n.get("payto.confirmPayment"),awaitText:this.props.i18n.get("payto.await.waitForConfirmation"),showCountdownTimer:y,throttleTime:u,throttleInterval:c,onActionHandled:this.onActionHandled,endSlot:()=>!!this.props.mandate&&t(m,{mandate:this.props.mandate,payee:this.props.payee,currencyCode:this.props.amount.currency})}))):t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(i,{data:this.props.data,placeholders:this.props.placeholders,setComponentRef:this.setComponentRef,onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton}))}}l(P,"type",n.payto),l(P,"defaultProps",{placeholders:{}});export{P as PayToElement,P as default};
2
+ //# sourceMappingURL=PayTo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayTo.js","sources":["../../../../src/components/PayTo/PayTo.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport Await from '../../components/internal/Await';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport { PayToIdentifierEnum } from './components/IdentifierSelector';\nimport PayToComponent from './components/PayToComponent';\nimport { PayToInstructions } from './components/PayToInstructions';\nimport MandateSummary from './components/MandateSummary';\nimport { PayToConfiguration, PayToData } from './types';\nimport PayButton, { payAmountLabel } from '../internal/PayButton';\n\n/*\nAwait Config (previously in its own file)\n */\nconst COUNTDOWN_MINUTES = 15; // min\nconst THROTTLE_TIME = 60000; // ms\nconst THROTTLE_INTERVAL = 10000; // ms\n\nconst config = {\n COUNTDOWN_MINUTES,\n THROTTLE_TIME,\n THROTTLE_INTERVAL,\n showCountdownTimer: false\n};\n\nconst getAccountIdentifier = (state: PayToData) => {\n // if it's BSB Input type merge bankAccount with BSB\n if (state.selectedInput === 'bsb-option') {\n return `${state.bsb}-${state.bankAccountNumber}`;\n } else if (state.selectedInput === 'payid-option') {\n // otherwise use the option in the dropdown\n switch (state.selectedIdentifier) {\n case PayToIdentifierEnum.email:\n return state.email;\n case PayToIdentifierEnum.abn:\n return state.abn;\n case PayToIdentifierEnum.orgid:\n return state.orgid;\n case PayToIdentifierEnum.phone:\n // merge the phone prefix and number - see comment in ticket\n return `${state.phonePrefix}-${state.phoneNumber}`;\n }\n }\n};\n/**\n *\n */\nexport class PayToElement extends UIElement<PayToConfiguration> {\n public static readonly type = TxVariants.payto;\n\n protected static defaultProps = {\n placeholders: {}\n };\n\n formatProps(props) {\n return {\n ...props,\n data: {\n ...props.data,\n phonePrefix: '+61' // hardcode +61\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n if (this.props.storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: PayToElement.type,\n storedPaymentMethodId: this.props.storedPaymentMethodId\n }\n };\n }\n\n return {\n paymentMethod: {\n type: PayToElement.type,\n shopperAccountIdentifier: getAccountIdentifier(this.state.data)\n },\n shopperName: {\n firstName: this.state.data.firstName,\n lastName: this.state.data.lastName\n }\n };\n }\n\n get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.label;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? this.props.name : '';\n }\n\n render() {\n // Stored\n if (this.props.storedPaymentMethodId) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showPayButton && (\n <PayButton\n {...this.props}\n classNameModifiers={['standalone']}\n amount={this.props.amount}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n onClick={this.submit}\n />\n )}\n </CoreProvider>\n );\n }\n // Await\n if (this.props.paymentData) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <Await\n ref={ref => {\n this.componentRef = ref;\n }}\n amount={this.props.amount}\n showAmount={true}\n instructions={PayToInstructions}\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={this.constructor['type']}\n messageText={this.props.i18n.get('payto.confirmPayment')}\n awaitText={this.props.i18n.get('payto.await.waitForConfirmation')}\n showCountdownTimer={config.showCountdownTimer}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n endSlot={() =>\n !!this.props.mandate && (\n <MandateSummary mandate={this.props.mandate} payee={this.props.payee} currencyCode={this.props.amount.currency} />\n )\n }\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n // Input\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <PayToComponent\n data={this.props.data}\n placeholders={this.props.placeholders}\n setComponentRef={this.setComponentRef}\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PayToElement;\n"],"names":["config","getAccountIdentifier","state","selectedInput","bsb","bankAccountNumber","selectedIdentifier","PayToIdentifierEnum","email","abn","orgid","phone","phonePrefix","phoneNumber","PayToElement","UIElement","formatProps","props","data","formatData","this","storedPaymentMethodId","paymentMethod","type","shopperAccountIdentifier","shopperName","firstName","lastName","isValid","displayName","label","name","additionalInfo","render","h","CoreProvider","i18n","loadingContext","resources","showPayButton","PayButton","classNameModifiers","amount","payAmountLabel","onClick","submit","paymentData","SRPanelProvider","srPanel","modules","Await","ref","componentRef","showAmount","instructions","PayToInstructions","clientKey","onError","onComplete","brandLogo","icon","constructor","messageText","get","awaitText","showCountdownTimer","throttleTime","throttleInterval","onActionHandled","endSlot","mandate","MandateSummary","payee","currencyCode","currency","PayToComponent","placeholders","setComponentRef","onChange","setState","payButton","_define_property","TxVariants","payto","defaultProps"],"mappings":"wyBAgBA,MAIMA,EAHgB,IAGhBA,EAFoB,IAEpBA,GAIkB,EAGlBC,EAAwBC,IAE1B,GAA4B,eAAxB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,EACcS,OAAO2D,EAAWC,OAEzCF,EAHSnE,EAGQsE,eAAe,CAC5BR,aAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import{useEffect as a,useRef as t}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../utils/useForm/useForm.js";import{getErrorMessage as s}from"../../../utils/getErrorMessage.js";import n from"../../internal/FormFields/Field/Field.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import l from"../../internal/FormFields/InputText.js";import{bsbValidationRules as b}from"./validate.js";import{phoneFormatters as m}from"../../internal/PhoneInput/validate.js";import u from"./PayToNameFields.js";const c=["bankAccountNumber","bsb","firstName","lastName"];function d({setComponentRef:d,defaultData:p,placeholders:f,onChange:N,setStatus:h}){const{i18n:k}=i(),F=o({schema:c,defaultData:p,rules:b,formatters:m}),{handleChangeFor:g,triggerValidation:j,data:A,errors:B,valid:v,isValid:C}=F;a((()=>{N({data:A,valid:v,errors:B,isValid:C})}),[A,v,B,C]);const M=t({setStatus:h,showValidation:j});return a((()=>{d(M.current)}),[d]),e(r,{classNameModifiers:["payto__bsb_input"],label:"BSB",description:"payto.bsb.description"},e(n,{label:k.get("payto.bsb.label.bankAccountNumber"),classNameModifiers:["col-60","bankAccountNumber"],errorMessage:s(k,B.bankAccountNumber,k.get("payto.bsb.label.bankAccountNumber")),name:"bankAccountNumber",i18n:k},e(l,{name:"bankAccountNumber",value:A.bankAccountNumber,onInput:g("bankAccountNumber","input"),onBlur:g("bankAccountNumber","blur"),placeholder:f?.bankAccountNumber,required:!0})),e(n,{label:k.get("Bank State Branch"),classNameModifiers:["col-40","bsb"],errorMessage:s(k,B.bsb,k.get("Bank State Branch")),name:"bsb",i18n:k},e(l,{name:"bsb",value:A.bsb,onInput:g("bsb","input"),onBlur:g("bsb","blur"),placeholder:f?.bsb,required:!0})),e(u,{i18n:k,data:A,handleChangeFor:g,errors:B,placeholders:f}))}export{d as default};
2
+ //# sourceMappingURL=BSBInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BSBInput.js","sources":["../../../../../src/components/PayTo/components/BSBInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport { useEffect, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport InputText from '../../internal/FormFields/InputText';\nimport { bsbValidationRules } from './validate';\nimport './PayIDInput.scss';\nimport { phoneFormatters } from '../../internal/PhoneInput/validate';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport PayToNameFields from './PayToNameFields';\nimport { PayToPlaceholdersType } from '../types';\n\nexport interface BSBFormData {\n bsb: string;\n bankAccountNumber: string;\n firstName: string;\n lastName: string;\n}\n\nexport interface BSBInputProps {\n status: UIElementStatus;\n setStatus: (status: UIElementStatus) => void;\n defaultData: BSBFormData;\n placeholders: PayToPlaceholdersType;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n}\n\nconst BASE_SCHEMA = ['bankAccountNumber', 'bsb', 'firstName', 'lastName'];\n\nexport default function BSBInput({ setComponentRef, defaultData, placeholders, onChange, setStatus }: BSBInputProps) {\n const { i18n } = useCoreContext();\n\n const form = useForm<BSBFormData>({\n schema: BASE_SCHEMA,\n defaultData: defaultData,\n rules: bsbValidationRules,\n formatters: phoneFormatters\n });\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = form;\n\n // standard onChange propagate to parent state\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const payToRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n setComponentRef(payToRef.current);\n }, [setComponentRef]);\n\n return (\n <Fieldset classNameModifiers={['payto__bsb_input']} label={'BSB'} description={'payto.bsb.description'}>\n <Field\n label={i18n.get('payto.bsb.label.bankAccountNumber')}\n classNameModifiers={['col-60', 'bankAccountNumber']}\n errorMessage={getErrorMessage(i18n, errors.bankAccountNumber, i18n.get('payto.bsb.label.bankAccountNumber'))}\n name={'bankAccountNumber'}\n i18n={i18n}\n >\n <InputText\n name={'bankAccountNumber'}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n placeholder={placeholders?.bankAccountNumber}\n required={true}\n />\n </Field>\n\n <Field\n label={i18n.get('Bank State Branch')}\n classNameModifiers={['col-40', 'bsb']}\n errorMessage={getErrorMessage(i18n, errors.bsb, i18n.get('Bank State Branch'))}\n name={'bsb'}\n i18n={i18n}\n >\n <InputText\n name={'bsb'}\n value={data.bsb}\n onInput={handleChangeFor('bsb', 'input')}\n onBlur={handleChangeFor('bsb', 'blur')}\n placeholder={placeholders?.bsb}\n required={true}\n />\n </Field>\n\n <PayToNameFields i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} placeholders={placeholders} />\n </Fieldset>\n );\n}\n"],"names":["BASE_SCHEMA","BSBInput","setComponentRef","defaultData","placeholders","onChange","setStatus","i18n","useCoreContext","form","useForm","schema","rules","bsbValidationRules","formatters","phoneFormatters","handleChangeFor","triggerValidation","data","errors","valid","isValid","useEffect","payToRef","useRef","showValidation","current","h","Fieldset","classNameModifiers","label","description","Field","get","errorMessage","getErrorMessage","bankAccountNumber","name","InputText","value","onInput","onBlur","placeholder","required","bsb","PayToNameFields"],"mappings":"oqBA+BA,MAAMA,EAAc,CAAC,oBAAqB,MAAO,YAAa,YAE/C,SAASC,GAASC,gBAAEA,EAAeC,YAAEA,EAAWC,aAAEA,EAAYC,SAAEA,EAAQC,UAAEA,IACrF,MAAMC,KAAEA,GAASC,IAEXC,EAAOC,EAAqB,CAC9BC,OAAQX,EACRG,YAAaA,EACbS,MAAOC,E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js";import i from"../../internal/FormFields/Select/Select.js";import t from"../../internal/FormFields/Field/Field.js";import{useCoreContext as a}from"../../../core/Context/CoreProvider.js";import{createEnumChecker as o}from"../../../core/utils.js";var n=function(e){return e.phone="phone",e.email="email",e.abn="abn",e.orgid="orgid",e}({});const r=o(n),l=[{id:"phone",nameKey:"payto.payid.option.phone"},{id:"email",nameKey:"payto.payid.option.email"},{id:"abn",nameKey:"ABN"},{id:"orgid",nameKey:"payto.payid.option.orgid"}];function d({selectedIdentifier:o,onSelectedIdentifier:n,classNameModifiers:d}){const{i18n:m}=a(),s=((e,i)=>i.map((i=>({id:i.id,name:e.get(i.nameKey)}))))(m,l);return e(t,{className:"",name:"payid-identifier",useLabelElement:!0,label:m.get("payto.payid.label.identifier"),showContextualElement:!1,classNameModifiers:d},e(i,{filterable:!1,items:s,selectedValue:o,onChange:e=>{const i=e.target.value+"";r(i)&&n(i)},name:"payid-identifier"}))}export{l as PAYID_IDENTIFIER_OPTIONS,n as PayToIdentifierEnum,d as default};
2
+ //# sourceMappingURL=IdentifierSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdentifierSelector.js","sources":["../../../../../src/components/PayTo/components/IdentifierSelector.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Select from '../../internal/FormFields/Select';\nimport { SelectTargetObject } from '../../internal/FormFields/Select/types';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Language from '../../../language';\nimport { createEnumChecker } from '../../../core/utils';\n\nexport enum PayToIdentifierEnum {\n phone = 'phone',\n email = 'email',\n abn = 'abn',\n orgid = 'orgid'\n}\n\nconst payToIdentifierEnumCheck = createEnumChecker(PayToIdentifierEnum);\n\nexport type PayToPayIDInputIdentifierValues = keyof typeof PayToIdentifierEnum;\n\ntype PayIdOptionsType = { id: PayToPayIDInputIdentifierValues; nameKey: string }[];\n\nexport const PAYID_IDENTIFIER_OPTIONS: PayIdOptionsType = [\n {\n id: PayToIdentifierEnum.phone,\n nameKey: 'payto.payid.option.phone'\n },\n {\n id: PayToIdentifierEnum.email,\n nameKey: 'payto.payid.option.email'\n },\n {\n id: PayToIdentifierEnum.abn,\n nameKey: 'ABN'\n },\n {\n id: PayToIdentifierEnum.orgid,\n nameKey: 'payto.payid.option.orgid'\n }\n];\n\ninterface IdentifierSelectorProps {\n classNameModifiers?: string[];\n selectedIdentifier: PayToPayIDInputIdentifierValues;\n onSelectedIdentifier: (value: PayToPayIDInputIdentifierValues) => void;\n}\n\nconst loadI18nForOptions = (i18n: Language, options: PayIdOptionsType) =>\n options.map(option => ({\n id: option.id,\n name: i18n.get(option.nameKey)\n }));\n\nexport default function IdentifierSelector({ selectedIdentifier, onSelectedIdentifier, classNameModifiers }: IdentifierSelectorProps) {\n const { i18n } = useCoreContext();\n\n const hydratedOptions = loadI18nForOptions(i18n, PAYID_IDENTIFIER_OPTIONS);\n\n const onChange = (e: { target: SelectTargetObject }) => {\n const valueStr = e.target.value + '';\n\n if (payToIdentifierEnumCheck(valueStr)) {\n onSelectedIdentifier(valueStr);\n }\n };\n\n return (\n <Field\n className={''}\n name={'payid-identifier'}\n useLabelElement={true}\n label={i18n.get('payto.payid.label.identifier')}\n showContextualElement={false}\n classNameModifiers={classNameModifiers}\n >\n <Select filterable={false} items={hydratedOptions} selectedValue={selectedIdentifier} onChange={onChange} name={'payid-identifier'} />\n </Field>\n );\n}\n"],"names":["PayToIdentifierEnum","payToIdentifierEnumCheck","createEnumChecker","PAYID_IDENTIFIER_OPTIONS","id","nameKey","IdentifierSelector","selectedIdentifier","onSelectedIdentifier","classNameModifiers","i18n","useCoreContext","hydratedOptions","options","map","option","name","get","loadI18nForOptions","h","Field","className","useLabelElement","label","showContextualElement","Select","filterable","items","selectedValue","onChange","e","valueStr","target","value"],"mappings":"4TAQO,IAAAA,EAAKA,SAAAA,GAAAA,mEAAAA,CAKX,CALWA,CAKX,CAAA,GAED,MAAMC,EAA2BC,EAAkBF,GAMtCG,EAA6C,CACtD,CACIC,GAAE,QACFC,QAAS,4BAEb,CACID,GAAE,QACFC,QAAS,4BAEb,CACID,GAAE,MACFC,QAAS,OAEb,CACID,GAAE,QACFC,QAAS,6BAgBF,SAASC,GAAmBC,mBAAEA,EAAkBC,qBAAEA,EAAoBC,mBAAEA,IACnF,MAAMC,KAAEA,GAASC,IAEXC,EATiB,EAACF,EAAgBG,IACxCA,EAAQC,KAAIC,IAAW,CACnBX,GAAIW,EAAOX,GACXY,KAAMN,EAAKO,IAAIF,EAAOV,aAMFa,CAAmBR,EAAMP,GAUjD,OACIgB,EAACC,EAAAA,CACGC,UAAW,GACXL,KAAM,mBACNM,iBAAiB,EACjBC,MAAOb,EAAKO,IAAI,gCAChBO,uBAAuB,EACvBf,mBAAoBA,GAEpBU,EAACM,EAAAA,CAAOC,YAAY,EAAOC,MAAOf,EAAiBgB,cAAerB,EAAoBsB,SAjB5EC,IACd,MAAMC,EAAWD,EAAEE,OAAOC,MAAQ,GAE9BhC,EAAyB8B,IACzBvB,EAAqBuB,EACzB,EAY8Gf,KAAM,qBAG5H"}
@@ -0,0 +1,2 @@
1
+ import e from"../../internal/DetailsTable/DetailsTable.js";import{createElement as a}from"../../../external/preact/dist/preact.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";const r=["payee","remarks","amount","frequency","startsAt","endsAt"];function n({mandate:n,currencyCode:l,payee:u}){const{i18n:o}=t(),s=r.map((e=>{const a=o.get(`payto.mandate.${e}.label`),t=Number(n.amount);switch(e){case"amount":{const e=o.amount(t,l);return"max"===n.amountRule?{label:a,value:o.get("payto.mandate.amount.max",{values:{amount:e}})}:{label:a,value:o.amount(t,l)}}case"frequency":return n.count?{label:a,value:o.get(`payto.mandate.frequency.${n.frequency}`,{values:{count:n.count}})}:{label:a,value:o.get("payto.mandate.frequency.adhoc-no-count")};case"remarks":return{label:a,value:n.remarks};case"startsAt":return{label:a,value:o.date(n.startsAt)};case"endsAt":return{label:a,value:o.date(n.endsAt)};case"payee":return{label:a,value:u}}}));return a(e,{tableFields:s})}export{n as default};
2
+ //# sourceMappingURL=MandateSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MandateSummary.js","sources":["../../../../../src/components/PayTo/components/MandateSummary.tsx"],"sourcesContent":["import DetailsTable from '../../internal/DetailsTable';\nimport { h } from 'preact';\nimport { MandateType } from '../types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { DetailsTableData } from '../../internal/DetailsTable/DetailsTable';\nimport './MandateSummary.scss';\n\nexport interface MandateSummaryProps {\n mandate: MandateType;\n currencyCode: string;\n payee?: string;\n}\n\n// this is the order the fields are going to be displayed in the UI\nconst orderedMandateTableFields = ['payee', 'remarks', 'amount', 'frequency', 'startsAt', 'endsAt'];\n\nexport default function MandateSummary({ mandate, currencyCode, payee }: MandateSummaryProps) {\n const { i18n } = useCoreContext();\n const tableFields: DetailsTableData = orderedMandateTableFields.map((key: keyof MandateType | 'payee') => {\n // get the label for the key, like payto.mandate.amount.label, payto.mandate.frequency.label\n const labelText = i18n.get(`payto.mandate.${key}.label`);\n const amountValue = Number(mandate.amount);\n switch (key) {\n case 'amount': {\n // it can be either show \"amount\" OR \"amount up to (max amount)\"\n const formatedAmount = i18n.amount(amountValue, currencyCode);\n if (mandate.amountRule === 'max') {\n return {\n label: labelText,\n value: i18n.get('payto.mandate.amount.max', { values: { amount: formatedAmount } })\n };\n } else {\n return {\n label: labelText,\n value: i18n.amount(amountValue, currencyCode)\n };\n }\n }\n case 'frequency': {\n if (!mandate.count) {\n // if there's no count we just say 'adhoc'\n return {\n label: labelText,\n value: i18n.get(`payto.mandate.frequency.adhoc-no-count`)\n };\n } else {\n // frequency can be: adhoc, daily, weekly, biWeekly, monthly, quarterly, halfYearly, yearly\n return {\n label: labelText,\n value: i18n.get(`payto.mandate.frequency.${mandate.frequency}`, { values: { count: mandate.count } })\n };\n }\n }\n case 'remarks':\n return {\n label: labelText,\n value: mandate.remarks\n };\n case 'startsAt':\n return {\n label: labelText,\n value: i18n.date(mandate.startsAt)\n };\n\n case 'endsAt':\n return {\n label: labelText,\n value: i18n.date(mandate.endsAt)\n };\n\n case 'payee':\n return {\n label: labelText,\n value: payee\n };\n }\n });\n\n return <DetailsTable tableFields={tableFields}></DetailsTable>;\n}\n"],"names":["orderedMandateTableFields","MandateSummary","mandate","currencyCode","payee","i18n","useCoreContext","tableFields","map","key","labelText","get","amountValue","Number","amount","formatedAmount","amountRule","label","value","values","count","frequency","remarks","date","startsAt","endsAt","h","DetailsTable"],"mappings":"0MAcA,MAAMA,EAA4B,CAAC,QAAS,UAAW,SAAU,YAAa,WAAY,UAE3E,SAASC,GAAeC,QAAEA,EAAOC,aAAEA,EAAYC,MAAEA,IAC5D,MAAMC,KAAEA,GAASC,IACXC,EAAgCP,EAA0BQ,KAAKC,IAEjE,MAAMC,EAAYL,EAAKM,IAAI,iBAAiBF,WACtCG,EAAcC,OAAOX,EAAQY,QACnC,OAAQL,GACJ,IAAK,SAAU,CAEX,MAAMM,EAAiBV,EAAKS,OAAOF,EAAaT,GAChD,MAA2B,QAAvBD,EAAQc,WACD,CACHC,MAAOP,EACPQ,MAAOb,EAAKM,IAAI,2BAA4B,CAAEQ,OAAQ,CAAEL,OAAQC,MAG7D,CACHE,MAAOP,EACPQ,MAAOb,EAAKS,OAAOF,EAAaT,GAG5C,CACA,IAAK,YACD,OAAKD,EAAQkB,MAQF,CACHH,MAAOP,EACPQ,MAAOb,EAAKM,IAAI,2BAA2BT,EAAQmB,YAAa,CAAEF,OAAQ,CAAEC,MAAOlB,EAAQkB,UARxF,CACHH,MAAOP,EACPQ,MAAOb,EAAKM,IAAI,2CAU5B,IAAK,UACD,MAAO,CACHM,MAAOP,EACPQ,MAAOhB,EAAQoB,SAEvB,IAAK,WACD,MAAO,CACHL,MAAOP,EACPQ,MAAOb,EAAKkB,KAAKrB,EAAQsB,WAGjC,IAAK,SACD,MAAO,CACHP,MAAOP,EACPQ,MAAOb,EAAKkB,KAAKrB,EAAQuB,SAGjC,IAAK,QACD,MAAO,CACHR,MAAOP,EACPQ,MAAOd,GAEnB,IAGJ,OAAOsB,EAACC,EAAAA,CAAapB,YAAaA,GACtC"}