@paykka/card-checkout-ui 0.8.0 → 0.11.2

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 (308) hide show
  1. package/dist/card-checkout-ui.js +21 -14
  2. package/dist/card-checkout-ui.umd.cjs +21 -14
  3. package/dist/es/_commonjsHelpers.js +1 -0
  4. package/dist/es/api/http.js +19 -21
  5. package/dist/es/api/index.js +1 -1
  6. package/dist/es/api/modules/ali-pay/index.js +19 -11
  7. package/dist/es/api/modules/apple-pay/index.js +10 -26
  8. package/dist/es/api/modules/boost/index.js +56 -0
  9. package/dist/es/api/modules/card/index.js +17 -11
  10. package/dist/es/api/modules/checkout/index.js +6 -6
  11. package/dist/es/api/modules/checkout/map.js +23 -6
  12. package/dist/es/api/modules/gcash/index.js +56 -0
  13. package/dist/es/api/modules/get-browser-params.js +2 -2
  14. package/dist/es/api/modules/google-pay/index.js +10 -26
  15. package/dist/es/api/modules/grab-pay/index.js +56 -0
  16. package/dist/es/api/modules/index.js +1 -1
  17. package/dist/es/api/modules/line-pay/index.js +56 -0
  18. package/dist/es/api/modules/may-bank-qr-pay/index.js +56 -0
  19. package/dist/es/api/modules/nine-pay/index.js +56 -0
  20. package/dist/es/api/modules/paymaya/index.js +56 -0
  21. package/dist/es/api/modules/risk/index.js +13 -0
  22. package/dist/es/api/modules/sepa/index.js +19 -11
  23. package/dist/es/api/modules/shopee-pay/index.js +56 -0
  24. package/dist/es/api/modules/threeDS/index.js +1 -0
  25. package/dist/es/api/modules/tng-wallet/index.js +56 -0
  26. package/dist/es/api/modules/wechat-pay/index.js +18 -31
  27. package/dist/es/components/AccordionItem/AccordionItem.js +37 -0
  28. package/dist/es/components/AccountNameField/index.js +1 -0
  29. package/dist/es/components/AddressField/index.js +1 -0
  30. package/dist/es/components/AliPay/index.js +28 -40
  31. package/dist/es/components/ApplePay/index.js +18 -39
  32. package/dist/es/components/Boost/index.js +324 -0
  33. package/dist/es/components/Card/index.js +80 -48
  34. package/dist/es/components/CardBrands/index.js +3 -2
  35. package/dist/es/components/CardExpireDateField/index.js +1 -0
  36. package/dist/es/components/CardHolderNameField/index.js +1 -0
  37. package/dist/es/components/CardIBANField/index.js +1 -0
  38. package/dist/es/components/CardNo/index.js +1 -0
  39. package/dist/es/components/CardNumberField/index.js +124 -106
  40. package/dist/es/components/CardSecurityCodeField/index.js +1 -0
  41. package/dist/es/components/CardSelector/index.js +1 -0
  42. package/dist/es/components/CombinedCardInfo/index.js +4 -0
  43. package/dist/es/components/DropIn/index.js +206 -50
  44. package/dist/es/components/EmailField/EmailField.js +14 -15
  45. package/dist/es/components/EncryptedCard/index.js +1 -0
  46. package/dist/es/components/GooglePay/index.js +7 -6
  47. package/dist/es/components/GrabPay/index.js +324 -0
  48. package/dist/es/components/GuideCard/index.js +44 -0
  49. package/dist/es/components/LinePay/index.js +324 -0
  50. package/dist/es/components/MayBankQRPay/index.js +324 -0
  51. package/dist/es/components/NinePay/index.js +324 -0
  52. package/dist/es/components/RecurringTip/index.js +1 -0
  53. package/dist/es/components/SecuredFieldsProvider/index.js +2 -1
  54. package/dist/es/components/SecuredIframe/index.js +57 -4
  55. package/dist/es/components/Sepa/index.js +7 -10
  56. package/dist/es/components/ShopeePay/index.js +324 -0
  57. package/dist/es/components/SubmitButton/index.js +7 -20
  58. package/dist/es/components/TNGWallet/index.js +324 -0
  59. package/dist/es/components/ThreeDS/index.js +1 -0
  60. package/dist/es/components/WechatPay/index.js +30 -49
  61. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +42 -0
  62. package/dist/es/components/business/QRCodeModal/index.js +7 -0
  63. package/dist/es/components/business/QRCodeModal/qr-code-modal.js +1 -0
  64. package/dist/es/components/business/QRCodeModal/type.js +1 -0
  65. package/dist/es/components/business/index.js +7 -0
  66. package/dist/es/components/index.js +10 -0
  67. package/dist/es/components/internal/Accordion/Accordion.js +14 -0
  68. package/dist/es/components/internal/Accordion/accordion2.js +1 -0
  69. package/dist/es/components/internal/Accordion/accordionTransition.js +26 -0
  70. package/dist/es/components/internal/Accordion/index.js +8 -0
  71. package/dist/es/components/internal/Accordion/type.js +10 -0
  72. package/dist/es/components/internal/Button/Button.js +1 -0
  73. package/dist/es/components/internal/Button/index.js +1 -0
  74. package/dist/es/components/internal/CheckBox/CheckBox.js +1 -0
  75. package/dist/es/components/internal/CheckBox/index.js +1 -0
  76. package/dist/es/components/internal/Form/type.js +1 -0
  77. package/dist/es/components/internal/Info/Info.js +1 -0
  78. package/dist/es/components/internal/Info/index.js +1 -0
  79. package/dist/es/components/internal/Input/type.js +1 -0
  80. package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +1 -0
  81. package/dist/es/components/internal/LoadingCheck/index.js +1 -0
  82. package/dist/es/components/internal/Modal/Modal.js +18 -3
  83. package/dist/es/components/internal/Modal/index.js +1 -0
  84. package/dist/es/components/internal/Modal/type.js +1 -0
  85. package/dist/es/components/internal/QRCode/QRCode.js +32 -0
  86. package/dist/es/components/internal/QRCode/index.js +5 -0
  87. package/dist/es/components/internal/QRCode/type.js +1 -0
  88. package/dist/es/components/internal/Select/Select.js +11 -9
  89. package/dist/es/components/internal/Select/SelectMenu.js +1 -0
  90. package/dist/es/components/internal/Select/SelectMenuItem.js +1 -0
  91. package/dist/es/components/internal/icons/IconBoost.js +63 -0
  92. package/dist/es/components/internal/icons/IconCard.js +1 -40
  93. package/dist/es/components/internal/icons/IconCard2.js +60 -0
  94. package/dist/es/components/internal/icons/IconGCash.js +196 -0
  95. package/dist/es/components/internal/icons/IconGcashComplete.js +184 -0
  96. package/dist/es/components/internal/icons/IconGrabPay.js +59 -0
  97. package/dist/es/components/internal/icons/IconLinePay.js +99 -0
  98. package/dist/es/components/internal/icons/IconMayBankQRPay.js +69 -0
  99. package/dist/es/components/internal/icons/IconNinePay.js +255 -0
  100. package/dist/es/components/internal/icons/IconPaymaya.js +114 -0
  101. package/dist/es/components/internal/icons/IconRedirect.js +58 -0
  102. package/dist/es/components/internal/icons/IconScan.js +102 -0
  103. package/dist/es/components/internal/icons/IconShopeePay.js +108 -0
  104. package/dist/es/components/internal/icons/IconTNGWallet.js +119 -0
  105. package/dist/es/components/internal/icons/IconUnionPay.js +65 -0
  106. package/dist/es/components/wallets/GCash/GCash.js +368 -0
  107. package/dist/es/components/wallets/GCash/g-cash.js +1 -0
  108. package/dist/es/components/wallets/GCash/index.js +1 -0
  109. package/dist/es/components/wallets/GCash/type.js +1 -0
  110. package/dist/es/components/wallets/Paymaya/Paymaya.js +325 -0
  111. package/dist/es/components/wallets/Paymaya/index.js +1 -0
  112. package/dist/es/components/wallets/Paymaya/paymaya2.js +1 -0
  113. package/dist/es/components/wallets/Paymaya/type.js +1 -0
  114. package/dist/es/config.js +12 -12
  115. package/dist/es/constant.js +84 -4
  116. package/dist/es/core/PayKKaCheckout.js +35 -5
  117. package/dist/es/core/Session.js +24 -23
  118. package/dist/es/core/error.js +7 -0
  119. package/dist/es/core/index.js +1 -0
  120. package/dist/es/core/query.js +3 -3
  121. package/dist/es/core.js +2082 -70
  122. package/dist/es/hooks/index.js +1 -0
  123. package/dist/es/hooks/useI18n.js +1 -0
  124. package/dist/es/hooks/usePayState.js +7 -5
  125. package/dist/es/i18n/I18n.js +8 -2
  126. package/dist/es/i18n/locales/de-DE.js +16 -1
  127. package/dist/es/i18n/locales/en-GB.js +16 -1
  128. package/dist/es/i18n/locales/es-ES.js +16 -1
  129. package/dist/es/i18n/locales/fr-FR.js +16 -1
  130. package/dist/es/i18n/locales/index.js +2 -1
  131. package/dist/es/i18n/locales/ja-JP.js +16 -1
  132. package/dist/es/i18n/locales/ko-KR.js +16 -1
  133. package/dist/es/i18n/locales/nl-NL.js +88 -0
  134. package/dist/es/i18n/locales/pt-PT.js +16 -1
  135. package/dist/es/i18n/locales/ru-RU.js +16 -1
  136. package/dist/es/i18n/locales/zh-CN.js +16 -1
  137. package/dist/es/i18n/locales/zh-HK.js +16 -1
  138. package/dist/es/i18n/locales/zh-TW.js +16 -1
  139. package/dist/es/i18n/util.js +12 -3
  140. package/dist/es/index.js +22 -0
  141. package/dist/es/out/fraud-detection.js +39 -13
  142. package/dist/es/out/worldpay-ddc.js +143 -0
  143. package/dist/es/style.css +1 -1192
  144. package/dist/es/types/event.js +15 -0
  145. package/dist/es/types/fraud-detection.js +1 -0
  146. package/dist/es/types/index.js +1 -0
  147. package/dist/es/types/message.js +3 -0
  148. package/dist/es/utils/array.js +9 -0
  149. package/dist/es/utils/card-brand/brands.js +11 -1
  150. package/dist/es/utils/card-brand/index.js +4 -3
  151. package/dist/es/utils/card-brand/luhn.js +25 -0
  152. package/dist/es/utils/date.js +25 -0
  153. package/dist/es/utils/detect.js +6 -0
  154. package/dist/es/utils/format.js +28 -12
  155. package/dist/es/utils/iframe.js +1 -1
  156. package/dist/es/utils/index.js +9 -1
  157. package/dist/es/utils/location.js +37 -0
  158. package/dist/es/utils/object.js +14 -0
  159. package/dist/es/utils/redirect.js +32 -0
  160. package/dist/es/utils/reg-exp.js +4 -0
  161. package/dist/es/utils/system-info/get-browser-info.js +4 -4
  162. package/dist/es/utils/system-info/get-system-info.js +11 -7
  163. package/dist/es/utils/system-info/index.js +4 -4
  164. package/dist/style.css +1 -1
  165. package/dist/types/api/http.d.ts +4 -10
  166. package/dist/types/api/modules/ali-pay/index.d.ts +2 -1
  167. package/dist/types/api/modules/apple-pay/index.d.ts +2 -1
  168. package/dist/types/api/modules/boost/index.d.ts +24 -0
  169. package/dist/types/api/modules/card/index.d.ts +1 -1
  170. package/dist/types/api/modules/checkout/index.d.ts +2 -2
  171. package/dist/types/api/modules/checkout/type.d.ts +9 -0
  172. package/dist/types/api/modules/gcash/index.d.ts +24 -0
  173. package/dist/types/api/modules/get-browser-params.d.ts +2 -2
  174. package/dist/types/api/modules/google-pay/index.d.ts +2 -1
  175. package/dist/types/api/modules/grab-pay/index.d.ts +24 -0
  176. package/dist/types/api/modules/index.d.ts +11 -0
  177. package/dist/types/api/modules/line-pay/index.d.ts +24 -0
  178. package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +24 -0
  179. package/dist/types/api/modules/nine-pay/index.d.ts +24 -0
  180. package/dist/types/api/modules/paymaya/index.d.ts +24 -0
  181. package/dist/types/api/modules/risk/index.d.ts +8 -0
  182. package/dist/types/api/modules/sepa/index.d.ts +2 -1
  183. package/dist/types/api/modules/shopee-pay/index.d.ts +24 -0
  184. package/dist/types/api/modules/threeDS/index.d.ts +3 -0
  185. package/dist/types/api/modules/tng-wallet/index.d.ts +24 -0
  186. package/dist/types/api/modules/wechat-pay/index.d.ts +2 -1
  187. package/dist/types/components/Boost/Boost.d.ts +7 -0
  188. package/dist/types/components/Boost/index.d.ts +2 -0
  189. package/dist/types/components/Boost/type.d.ts +61 -0
  190. package/dist/types/components/CardNumberField/type.d.ts +7 -1
  191. package/dist/types/components/CombinedCardInfo/type.d.ts +1 -0
  192. package/dist/types/components/DropIn/components/PaymentTabs/type.d.ts +1 -1
  193. package/dist/types/components/DropIn/config.d.ts +7 -0
  194. package/dist/types/components/DropIn/type.d.ts +11 -3
  195. package/dist/types/components/GrabPay/GrabPay.d.ts +7 -0
  196. package/dist/types/components/GrabPay/index.d.ts +2 -0
  197. package/dist/types/components/GrabPay/type.d.ts +61 -0
  198. package/dist/types/components/GuideCard/GuideCard.d.ts +3 -0
  199. package/dist/types/components/GuideCard/index.d.ts +2 -0
  200. package/dist/types/components/GuideCard/type.d.ts +4 -0
  201. package/dist/types/components/LinePay/LinePay.d.ts +7 -0
  202. package/dist/types/components/LinePay/index.d.ts +2 -0
  203. package/dist/types/components/LinePay/type.d.ts +61 -0
  204. package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -0
  205. package/dist/types/components/MayBankQRPay/index.d.ts +2 -0
  206. package/dist/types/components/MayBankQRPay/type.d.ts +61 -0
  207. package/dist/types/components/NinePay/NinePay.d.ts +6 -0
  208. package/dist/types/components/NinePay/index.d.ts +2 -0
  209. package/dist/types/components/NinePay/type.d.ts +61 -0
  210. package/dist/types/components/SecuredFieldsProvider/type.d.ts +1 -1
  211. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +1 -1
  212. package/dist/types/components/ShopeePay/ShopeePay.d.ts +7 -0
  213. package/dist/types/components/ShopeePay/index.d.ts +2 -0
  214. package/dist/types/components/ShopeePay/type.d.ts +61 -0
  215. package/dist/types/components/SubmitButton/SubmitButton.d.ts +1 -1
  216. package/dist/types/components/TNGWallet/TNGWallet.d.ts +7 -0
  217. package/dist/types/components/TNGWallet/index.d.ts +2 -0
  218. package/dist/types/components/TNGWallet/type.d.ts +61 -0
  219. package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +1 -0
  220. package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -1
  221. package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +13 -3
  222. package/dist/types/components/business/QRCodeModal/QRCodeModal.d.ts +3 -0
  223. package/dist/types/components/business/QRCodeModal/index.d.ts +2 -0
  224. package/dist/types/components/business/QRCodeModal/type.d.ts +18 -0
  225. package/dist/types/components/business/index.d.ts +1 -0
  226. package/dist/types/components/index.d.ts +9 -0
  227. package/dist/types/components/internal/Accordion/Accordion.d.ts +3 -0
  228. package/dist/types/components/internal/Accordion/accordionTransition.d.ts +8 -0
  229. package/dist/types/components/internal/Accordion/components/AccordionItem/AccordionItem.d.ts +3 -0
  230. package/dist/types/components/internal/Accordion/components/AccordionItem/index.d.ts +2 -0
  231. package/dist/types/components/internal/Accordion/components/AccordionItem/type.d.ts +18 -0
  232. package/dist/types/components/internal/Accordion/index.d.ts +3 -0
  233. package/dist/types/components/internal/Accordion/type.d.ts +18 -0
  234. package/dist/types/components/internal/Modal/type.d.ts +2 -0
  235. package/dist/types/components/internal/QRCode/QRCode.d.ts +2 -0
  236. package/dist/types/components/internal/QRCode/index.d.ts +2 -0
  237. package/dist/types/components/internal/QRCode/type.d.ts +9 -0
  238. package/dist/types/components/internal/Select/Select.d.ts +1 -17
  239. package/dist/types/components/internal/Select/type.d.ts +26 -1
  240. package/dist/types/components/internal/icons/IconBoost.d.ts +2 -0
  241. package/dist/types/components/internal/icons/IconCard2.d.ts +2 -0
  242. package/dist/types/components/internal/icons/IconGCash.d.ts +2 -0
  243. package/dist/types/components/internal/icons/IconGcashComplete.d.ts +2 -0
  244. package/dist/types/components/internal/icons/IconGrabPay.d.ts +2 -0
  245. package/dist/types/components/internal/icons/IconLinePay.d.ts +2 -0
  246. package/dist/types/components/internal/icons/IconMayBankQRPay.d.ts +2 -0
  247. package/dist/types/components/internal/icons/IconNinePay.d.ts +2 -0
  248. package/dist/types/components/internal/icons/IconPaymaya.d.ts +2 -0
  249. package/dist/types/components/internal/icons/IconRedirect.d.ts +2 -0
  250. package/dist/types/components/internal/icons/IconScan.d.ts +2 -0
  251. package/dist/types/components/internal/icons/IconShopeePay.d.ts +2 -0
  252. package/dist/types/components/internal/icons/IconTNGWallet.d.ts +2 -0
  253. package/dist/types/components/internal/icons/IconUnionPay.d.ts +2 -0
  254. package/dist/types/components/internal/icons/index.d.ts +13 -0
  255. package/dist/types/components/wallets/GCash/GCash.d.ts +6 -0
  256. package/dist/types/components/wallets/GCash/index.d.ts +2 -0
  257. package/dist/types/components/wallets/GCash/type.d.ts +71 -0
  258. package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -0
  259. package/dist/types/components/wallets/Paymaya/index.d.ts +2 -0
  260. package/dist/types/components/wallets/Paymaya/type.d.ts +61 -0
  261. package/dist/types/config.d.ts +9 -9
  262. package/dist/types/constant.d.ts +28 -3
  263. package/dist/types/core/PayKKaCheckout.d.ts +10 -0
  264. package/dist/types/core/Session.d.ts +2 -0
  265. package/dist/types/core/error.d.ts +15 -2
  266. package/dist/types/core/query.d.ts +2 -2
  267. package/dist/types/hooks/usePayState.d.ts +5 -5
  268. package/dist/types/i18n/I18n.d.ts +1 -1
  269. package/dist/types/i18n/locales/de-DE.d.ts +13 -0
  270. package/dist/types/i18n/locales/en-GB.d.ts +13 -0
  271. package/dist/types/i18n/locales/es-ES.d.ts +13 -0
  272. package/dist/types/i18n/locales/fr-FR.d.ts +13 -0
  273. package/dist/types/i18n/locales/index.d.ts +2 -0
  274. package/dist/types/i18n/locales/ja-JP.d.ts +13 -0
  275. package/dist/types/i18n/locales/ko-KR.d.ts +13 -0
  276. package/dist/types/i18n/locales/nl-NL.d.ts +71 -0
  277. package/dist/types/i18n/locales/pt-PT.d.ts +13 -0
  278. package/dist/types/i18n/locales/ru-RU.d.ts +13 -0
  279. package/dist/types/i18n/locales/zh-CN.d.ts +13 -0
  280. package/dist/types/i18n/locales/zh-HK.d.ts +13 -0
  281. package/dist/types/i18n/locales/zh-TW.d.ts +13 -0
  282. package/dist/types/i18n/util.d.ts +5 -0
  283. package/dist/types/index.d.ts +2 -1
  284. package/dist/types/out/fraud-detection.d.ts +5 -1
  285. package/dist/types/out/types.d.ts +4 -0
  286. package/dist/types/out/worldpay-ddc-iframe.d.ts +1 -0
  287. package/dist/types/out/worldpay-ddc.d.ts +37 -0
  288. package/dist/types/types/event.d.ts +26 -0
  289. package/dist/types/types/fraud-detection.d.ts +3 -1
  290. package/dist/types/types/index.d.ts +23 -4
  291. package/dist/types/types/message.d.ts +22 -2
  292. package/dist/types/utils/array.d.ts +1 -0
  293. package/dist/types/utils/card-brand/brands.d.ts +4 -3
  294. package/dist/types/utils/card-brand/index.d.ts +9 -6
  295. package/dist/types/utils/card-brand/luhn.d.ts +9 -0
  296. package/dist/types/utils/date.d.ts +9 -0
  297. package/dist/types/utils/detect.d.ts +1 -0
  298. package/dist/types/utils/format.d.ts +7 -1
  299. package/dist/types/utils/iframe.d.ts +1 -1
  300. package/dist/types/utils/index.d.ts +8 -0
  301. package/dist/types/utils/location.d.ts +7 -0
  302. package/dist/types/utils/object.d.ts +1 -0
  303. package/dist/types/utils/redirect.d.ts +5 -0
  304. package/dist/types/utils/reg-exp.d.ts +1 -0
  305. package/dist/types/utils/system-info/get-browser-info.d.ts +1 -1
  306. package/dist/types/utils/system-info/get-system-info.d.ts +3 -2
  307. package/dist/types/utils/system-info/index.d.ts +3 -3
  308. package/package.json +6 -2
@@ -1,13 +1,14 @@
1
1
  import { w, A, h, F, y, q, T, u, b } from "../../core.js";
2
2
  import { isTimeoutError } from "../../api/http.js";
3
3
  import { PaymentType, SessionMode, CardPaymentMethods, COMMON_CLASS_NAME, PaymentMethod } from "../../constant.js";
4
+ import { intersection } from "../../utils/index.js";
4
5
  import { getBrowserParams } from "../../api/modules/get-browser-params.js";
5
6
  import { getCardPayInfo, cardPay } from "../../api/modules/card/index.js";
6
7
  import { CoreContext } from "../../core/context.js";
7
- import { intersection } from "../../utils/index.js";
8
8
  import { PayKKaError } from "../../core/error.js";
9
9
  import { hidePaymentButton } from "../../config.js";
10
10
  import { defaultInputStyleConfig } from "../../types/index.js";
11
+ import { WorldpayDDC } from "../../out/worldpay-ddc.js";
11
12
  import { createAddressCore } from "../../core/Address.js";
12
13
  import { useBEM } from "../../hooks/useBEM.js";
13
14
  import { usePayState } from "../../hooks/usePayState.js";
@@ -37,7 +38,6 @@ import { findCardBrand } from "../../utils/card-brand/index.js";
37
38
  import { separateInputStyle } from "../../utils/style.js";
38
39
  import { createPromise } from "../../utils/create-promise.js";
39
40
  import { cssVarPrefix, normalizedClass, trimAll, formatAmount } from "../../utils/format.js";
40
- import { isUndefined } from "../../utils/is.js";
41
41
  const { bem } = useBEM("card");
42
42
  const fieldClassNames = bem("field");
43
43
  const Card = w((props, ref) => {
@@ -52,11 +52,12 @@ const Card = w((props, ref) => {
52
52
  threeDSFrame,
53
53
  styles,
54
54
  enable3DSModal = true,
55
- isDropIn
55
+ isDropIn,
56
+ core
56
57
  } = props;
57
- let addressState = createAddressCore();
58
- let emailState = createEmailCore();
59
- const { i18n, fraudDetection, sessionReady } = usePayState(session);
58
+ const addressState = createAddressCore();
59
+ const emailState = createEmailCore();
60
+ const { i18n, fraudDetection, sessionReady } = usePayState(session, core);
60
61
  const addressFieldRef = A(null);
61
62
  const emailFieldRef = A(null);
62
63
  const combinedCardInfoRef = A(null);
@@ -103,8 +104,12 @@ const Card = w((props, ref) => {
103
104
  },
104
105
  updateEmail: () => {
105
106
  var _a2;
107
+ if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
108
+ return;
106
109
  setForm(Object.assign(form, { email: emailState.email }));
110
+ form.email = emailState.email;
107
111
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
112
+ validateForm();
108
113
  },
109
114
  payment: () => {
110
115
  hidePaymentButton && onSubmit();
@@ -117,18 +122,19 @@ const Card = w((props, ref) => {
117
122
  };
118
123
  };
119
124
  const initFieldStatus = () => {
120
- const field = session.checkout.field;
125
+ const { field, sessionMode } = session.checkout;
121
126
  const { email, address, holderName } = field;
122
- if (showEmail && !(email == null ? void 0 : email.show)) {
123
- email.show = true;
124
- email.disabled = true;
125
- }
126
- if (showAddress && !(address == null ? void 0 : address.show)) {
127
- address.show = true;
128
- }
129
- if (showHolderName && !(holderName == null ? void 0 : holderName.show)) {
130
- holderName.show = true;
131
- holderName.disabled = true;
127
+ if (sessionMode === SessionMode.COMPONENT) {
128
+ if (email.disabled) {
129
+ email.show = showEmail;
130
+ }
131
+ if (showAddress && !(address == null ? void 0 : address.show)) {
132
+ address.show = true;
133
+ }
134
+ if (showHolderName && !(holderName == null ? void 0 : holderName.show)) {
135
+ holderName.show = true;
136
+ holderName.disabled = true;
137
+ }
132
138
  }
133
139
  setFieldStatus({ ...field });
134
140
  };
@@ -148,7 +154,7 @@ const Card = w((props, ref) => {
148
154
  if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
149
155
  (_b2 = (_a2 = props.core.config).onInitError) == null ? void 0 : _b2.call(
150
156
  _a2,
151
- new PayKKaError("ERROR", "Please send the correct mode when creating the checkout")
157
+ new PayKKaError("ERROR", "Please send the correct session when creating the checkout")
152
158
  );
153
159
  return;
154
160
  }
@@ -172,6 +178,7 @@ const Card = w((props, ref) => {
172
178
  setErrorMsg(message || i18n.get("common.payTimeout"));
173
179
  setSubmitButtonStatus("unSubmit");
174
180
  (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
181
+ core.resetEnablePaymentMethod();
175
182
  },
176
183
  [i18n, props.onTimeout]
177
184
  );
@@ -179,6 +186,11 @@ const Card = w((props, ref) => {
179
186
  var _a2;
180
187
  (_a2 = props.onSuccess) == null ? void 0 : _a2.call(props, getPaymentSuccessData());
181
188
  };
189
+ const processOnError = (error) => {
190
+ var _a2;
191
+ (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
192
+ core.resetEnablePaymentMethod();
193
+ };
182
194
  const { start: startReFetchPayInfo } = useRetry((timeout) => pay(true, timeout), {
183
195
  onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
184
196
  });
@@ -231,7 +243,7 @@ const Card = w((props, ref) => {
231
243
  });
232
244
  }
233
245
  const getPaymentParams = async () => {
234
- var _a2;
246
+ var _a2, _b2, _c2;
235
247
  const cardNo = trimAll(form.number);
236
248
  const cardBrand = findCardBrand(cardNo);
237
249
  const [expMonth, expYear] = form.expireDate.split("/");
@@ -247,6 +259,10 @@ const Card = w((props, ref) => {
247
259
  paymentMethod = cardBrand.code;
248
260
  }
249
261
  }
262
+ let cardBin;
263
+ if (security) {
264
+ cardBin = splitCardInfo ? (_b2 = cardNumberFieldRef.current) == null ? void 0 : _b2.binValue() : (_c2 = combinedCardInfoRef.current) == null ? void 0 : _c2.binValue();
265
+ }
250
266
  return {
251
267
  sessionId: session.sessionId,
252
268
  clientKey: session.clientKey,
@@ -272,23 +288,35 @@ const Card = w((props, ref) => {
272
288
  email: form.email
273
289
  },
274
290
  browser: await getBrowserParams({
275
- fraudDetectionId: fraudDetection == null ? void 0 : fraudDetection.fraudDetectionID
291
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId({
292
+ bin: cardNo || cardBin || ""
293
+ }))
276
294
  })
277
295
  };
278
296
  };
279
297
  async function pay(search = false, timeout) {
280
- var _a2, _b2;
298
+ var _a2, _b2, _c2, _d2;
281
299
  try {
282
300
  const paymentParams = await getPaymentParams();
301
+ const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(
302
+ _a2,
303
+ "payment",
304
+ paymentParams.payment.paymentMethod
305
+ );
283
306
  if (!search && security) {
284
- (_a2 = SFPRef.current) == null ? void 0 : _a2.payment(paymentParams);
307
+ (_c2 = SFPRef.current) == null ? void 0 : _c2.payment(paymentParams, extraParams);
285
308
  return { end: true };
286
309
  }
287
310
  const options = { locale: i18n.locale, timeout };
288
- const res = search ? await getCardPayInfo(
289
- { sessionId: session.sessionId, clientKey: session.clientKey },
290
- options
291
- ) : await cardPay(paymentParams, options);
311
+ let res = {};
312
+ if (search) {
313
+ res = await getCardPayInfo(
314
+ { sessionId: session.sessionId, clientKey: session.clientKey },
315
+ options
316
+ );
317
+ } else {
318
+ res = await cardPay(paymentParams, extraParams, options);
319
+ }
292
320
  return processAfterPayment(res, search);
293
321
  } catch (error) {
294
322
  if (isTimeoutError(error)) {
@@ -301,7 +329,7 @@ const Card = w((props, ref) => {
301
329
  } else {
302
330
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
303
331
  setErrorMsg(message);
304
- (_b2 = props.onError) == null ? void 0 : _b2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
332
+ (_d2 = props.onError) == null ? void 0 : _d2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
305
333
  setSubmitButtonStatus("unSubmit");
306
334
  stopReFetchCardPay3DSInfo();
307
335
  return { end: true };
@@ -330,7 +358,7 @@ const Card = w((props, ref) => {
330
358
  checkThreeDS();
331
359
  };
332
360
  const processAfterPayment = (res, search = false) => {
333
- var _a2, _b2, _c2;
361
+ var _a2, _b2;
334
362
  const { status, orderStatus, errorMessage, errorCode, threeDSUrl } = res;
335
363
  if (status === "PROCESSING") {
336
364
  if (!orderStatus) {
@@ -344,10 +372,10 @@ const Card = w((props, ref) => {
344
372
  } else if (orderStatus === "FAILURE") {
345
373
  setErrorMsg(errorMessage);
346
374
  setSubmitButtonStatus("unSubmit");
347
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
375
+ processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
348
376
  } else if (orderStatus === "AUTHORIZED") {
349
377
  setSubmitButtonStatus("unSubmit");
350
- (_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props);
378
+ (_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
351
379
  } else if (orderStatus === "IN_THREED") {
352
380
  processThreeDS(threeDSUrl, false);
353
381
  } else if (orderStatus === "IN_PREVIOUS_THREED") {
@@ -360,19 +388,17 @@ const Card = w((props, ref) => {
360
388
  return { end: true };
361
389
  } else if (status === "EXPIRED") {
362
390
  setSubmitButtonStatus("unSubmit");
363
- (_c2 = props.onExpired) == null ? void 0 : _c2.call(props);
391
+ (_b2 = props.onExpired) == null ? void 0 : _b2.call(props);
364
392
  return { end: true };
365
393
  }
366
394
  setSubmitButtonStatus("unSubmit");
367
- processOnSuccess();
368
395
  return { end: true };
369
396
  };
370
397
  const processPaymentError = (error) => {
371
- var _a2;
372
398
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
373
399
  setErrorMsg(message);
374
400
  setSubmitButtonStatus("unSubmit");
375
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
401
+ processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
376
402
  };
377
403
  const validateForm = () => {
378
404
  var _a2;
@@ -386,12 +412,10 @@ const Card = w((props, ref) => {
386
412
  validateForm();
387
413
  }, [form]);
388
414
  const Button = () => {
389
- const { transAmount } = (session == null ? void 0 : session.checkout) ?? {};
390
- let { symbol = "", amount = "", digits } = transAmount ?? {};
391
- let amountStr = "";
392
- if (amount && !isUndefined(digits))
393
- amountStr = formatAmount(+amount, digits);
394
- const text = i18n.get("common.pay") + (Number(amount) ? ` ${symbol}${amountStr}` : "");
415
+ var _a2;
416
+ const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
417
+ const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
418
+ const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
395
419
  return /* @__PURE__ */ u(
396
420
  SubmitButton,
397
421
  {
@@ -420,7 +444,7 @@ const Card = w((props, ref) => {
420
444
  }
421
445
  );
422
446
  async function checkThreeDS(search = false, timeout = 2e4) {
423
- var _a2, _b2, _c2, _d2;
447
+ var _a2, _b2, _c2;
424
448
  if (!session)
425
449
  return { end: true };
426
450
  try {
@@ -441,10 +465,10 @@ const Card = w((props, ref) => {
441
465
  } else if (orderStatus === "FAILURE") {
442
466
  setErrorMsg(errorMessage);
443
467
  setSubmitButtonStatus("unSubmit");
444
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
468
+ processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
445
469
  } else if (orderStatus === "AUTHORIZED") {
446
470
  setSubmitButtonStatus("unSubmit");
447
- (_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props);
471
+ (_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
448
472
  } else if (orderStatus === "IN_THREED") {
449
473
  setSubmitButtonStatus("loading");
450
474
  !search && startReFetchCardPay3DSInfo();
@@ -464,7 +488,7 @@ const Card = w((props, ref) => {
464
488
  return { end: true };
465
489
  } else if (status === "EXPIRED") {
466
490
  setSubmitButtonStatus("unSubmit");
467
- (_c2 = props.onExpired) == null ? void 0 : _c2.call(props);
491
+ (_b2 = props.onExpired) == null ? void 0 : _b2.call(props);
468
492
  stopReFetchCardPay3DSInfo();
469
493
  return { end: true };
470
494
  }
@@ -483,7 +507,7 @@ const Card = w((props, ref) => {
483
507
  } else {
484
508
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
485
509
  setErrorMsg(message);
486
- (_d2 = props.onError) == null ? void 0 : _d2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
510
+ (_c2 = props.onError) == null ? void 0 : _c2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
487
511
  setSubmitButtonStatus("unSubmit");
488
512
  stopReFetchCardPay3DSInfo();
489
513
  return { end: true };
@@ -622,8 +646,15 @@ const Card = w((props, ref) => {
622
646
  };
623
647
  const onBinValueChanged = (data) => {
624
648
  var _a2;
625
- const field = splitCardInfo ? cardNumberFieldRef : combinedCardInfoRef;
626
- (_a2 = field.current) == null ? void 0 : _a2.binValueChanged(data.binValue);
649
+ let binValue = "";
650
+ if (typeof data === "string") {
651
+ binValue = data;
652
+ } else {
653
+ const field = splitCardInfo ? cardNumberFieldRef : combinedCardInfoRef;
654
+ (_a2 = field.current) == null ? void 0 : _a2.binValueChanged(data.binValue);
655
+ binValue = data.binValue;
656
+ }
657
+ binValue && new WorldpayDDC().getFraudDetectionId(binValue);
627
658
  };
628
659
  const onAfterPayment = (data) => {
629
660
  processAfterPayment(data.response);
@@ -666,7 +697,8 @@ const Card = w((props, ref) => {
666
697
  {
667
698
  supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentMethod) == null ? void 0 : _b2.filter(Boolean),
668
699
  security,
669
- ref: cardNumberFieldRef
700
+ ref: cardNumberFieldRef,
701
+ onBinValue: onBinValueChanged
670
702
  }
671
703
  ),
672
704
  changeBox()
@@ -3,6 +3,7 @@ import { COMMON_CLASS_NAME } from "../../constant.js";
3
3
  import { useBEM } from "../../hooks/useBEM.js";
4
4
  import "../../core/context.js";
5
5
  import { clamp } from "../../utils/index.js";
6
+ import "../../api/http.js";
6
7
  import { getSupportedCardBrands, getCardBrandInfo } from "../../utils/card-brand/index.js";
7
8
  import { normalizedClass } from "../../utils/format.js";
8
9
  const { bem } = useBEM("card-brands");
@@ -33,8 +34,8 @@ function CardBrands(props) {
33
34
  };
34
35
  }, []);
35
36
  return /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem(), className), style, children: [
36
- brands.slice(0, max - 1).map((brand) => /* @__PURE__ */ u(brand.icon, { size: 32 }, brand.code)),
37
- !!lastBrand && /* @__PURE__ */ u(lastBrand.icon, { size: 32 }, lastBrand.code),
37
+ brands.slice(0, max - 1).map((brand) => brand.icon && /* @__PURE__ */ u(brand.icon, { size: 32 }, brand.code)),
38
+ !!(lastBrand == null ? void 0 : lastBrand.icon) && /* @__PURE__ */ u(lastBrand.icon, { size: 32 }, lastBrand.code),
38
39
  left > 0 && /* @__PURE__ */ u("div", { className: bem("more"), children: [
39
40
  "+",
40
41
  left
@@ -1,6 +1,7 @@
1
1
  import { w, A, F, h, u } from "../../core.js";
2
2
  import { isExpired } from "../../utils/index.js";
3
3
  import { useI18n } from "../../hooks/useI18n.js";
4
+ import "../../api/http.js";
4
5
  import "../internal/Form/type.js";
5
6
  import "../internal/Form/context.js";
6
7
  import { FormItem } from "../internal/Form/FormItem.js";
@@ -2,6 +2,7 @@ import { u } from "../../core.js";
2
2
  import "../../utils/card-brand/brands.js";
3
3
  import "../../utils/system-info/get-browser-info.js";
4
4
  import { useI18n } from "../../hooks/useI18n.js";
5
+ import "../../api/http.js";
5
6
  import "../internal/Form/type.js";
6
7
  import "../internal/Form/context.js";
7
8
  import { FormItem } from "../internal/Form/FormItem.js";
@@ -1,6 +1,7 @@
1
1
  import { A, h, u } from "../../core.js";
2
2
  import { clamp } from "../../utils/index.js";
3
3
  import { useI18n } from "../../hooks/useI18n.js";
4
+ import "../../api/http.js";
4
5
  import "../internal/Form/type.js";
5
6
  import "../internal/Form/context.js";
6
7
  import { FormItem } from "../internal/Form/FormItem.js";
@@ -5,6 +5,7 @@ import "../../core/context.js";
5
5
  import "../../utils/card-brand/brands.js";
6
6
  import "../../utils/system-info/get-browser-info.js";
7
7
  import { normalizedClass } from "../../utils/format.js";
8
+ import "../../api/http.js";
8
9
  const { bem } = useBEM("card-no");
9
10
  const CardNo = (props) => {
10
11
  const { value, className, style } = props;
@@ -1,6 +1,7 @@
1
1
  import { w, A, F, h, y, u } from "../../core.js";
2
2
  import { clamp } from "../../utils/index.js";
3
3
  import { useI18n } from "../../hooks/useI18n.js";
4
+ import "../../api/http.js";
4
5
  import "../internal/Form/type.js";
5
6
  import "../internal/Form/context.js";
6
7
  import { FormItem } from "../internal/Form/FormItem.js";
@@ -11,118 +12,135 @@ import "../internal/Input/type.js";
11
12
  import { EFieldType } from "../SecuredFieldsProvider/index.js";
12
13
  import { getSupportedCardBrands, getSupportedCardBrandsLengths, finCardBrandInfoByCode, findCardBrandInfo } from "../../utils/card-brand/index.js";
13
14
  import { trimAll, limitedToNumber } from "../../utils/format.js";
14
- const CardNumberField = w((props, ref) => {
15
- const { supportedCardBrands = [], className, security, showLabel } = props;
16
- const inputRef = A(null);
17
- const formItemRef = A(null);
18
- F(ref, () => ({
19
- input: inputRef.current,
20
- focus: () => {
21
- var _a;
22
- (_a = inputRef.current) == null ? void 0 : _a.focus();
23
- },
24
- blur: () => {
25
- var _a;
26
- (_a = inputRef.current) == null ? void 0 : _a.blur();
27
- },
28
- resetValidation: (status, errorTip) => {
29
- var _a;
30
- (_a = formItemRef.current) == null ? void 0 : _a.resetValidation(status, [{ message: errorTip }]);
31
- },
32
- binValueChanged: (binValue) => {
33
- setValue(binValue);
34
- },
35
- brandChanged: (brand) => {
36
- if (brand) {
37
- const brandInfo = finCardBrandInfoByCode(brand);
38
- setBrandIcon(() => brandInfo == null ? void 0 : brandInfo.icon);
39
- } else {
40
- setBrandIcon(void 0);
41
- }
42
- },
43
- getCardBrand: () => findCardBrandInfo(trimAll(value), brands) || {}
44
- }));
45
- const { i18n } = useI18n();
46
- const [value, setValue] = h("");
47
- const [validationStatus, setValidationStatus] = h("");
48
- const brands = getSupportedCardBrands(supportedCardBrands);
49
- const brandLengths = getSupportedCardBrandsLengths(brands);
50
- const [brandIcon, setBrandIcon] = h(void 0);
51
- y(() => {
52
- setBrandIcon(value ? () => {
53
- var _a;
54
- return (_a = findCardBrandInfo(trimAll(value), brands)) == null ? void 0 : _a.icon;
55
- } : void 0);
56
- }, [value]);
57
- const rule = {
58
- trigger: ["blur", "submit"],
59
- validator(value2) {
60
- if (security) {
61
- const result = formItemRef.current.getValidateResult();
62
- if (result.status === "error") {
63
- throw new Error(result.errors[0].message);
64
- } else if (result.status === "success") {
65
- return true;
15
+ const CardNumberField = w(
16
+ (props, ref) => {
17
+ const { supportedCardBrands = [], className, security, showLabel, onBinValue } = props;
18
+ const inputRef = A(null);
19
+ const formItemRef = A(null);
20
+ F(ref, () => ({
21
+ input: inputRef.current,
22
+ focus: () => {
23
+ var _a;
24
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
25
+ },
26
+ blur: () => {
27
+ var _a;
28
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
29
+ },
30
+ resetValidation: (status, errorTip) => {
31
+ var _a;
32
+ (_a = formItemRef.current) == null ? void 0 : _a.resetValidation(status, [{ message: errorTip }]);
33
+ },
34
+ binValueChanged: (binValue) => {
35
+ setValue(binValue);
36
+ },
37
+ binValue: () => {
38
+ return value;
39
+ },
40
+ brandChanged: (brand2) => {
41
+ if (brand2) {
42
+ const brandInfo = finCardBrandInfoByCode(brand2);
43
+ setBrandIcon(() => brandInfo == null ? void 0 : brandInfo.icon);
44
+ setBrand(brandInfo == null ? void 0 : brandInfo.code);
45
+ } else {
46
+ setBrandIcon(void 0);
47
+ setBrand(void 0);
66
48
  }
49
+ },
50
+ getCardBrand: () => {
51
+ return findCardBrandInfo(trimAll(value), brands) || { code: brand };
67
52
  }
68
- value2 = trimAll(value2 ?? "");
69
- if (!brandLengths.includes(value2.length)) {
70
- throw new Error(i18n.get("card.cardNumber.incomplete"));
53
+ }));
54
+ const { i18n } = useI18n();
55
+ const [value, setValue] = h("");
56
+ const [validationStatus, setValidationStatus] = h("");
57
+ const brands = getSupportedCardBrands(supportedCardBrands);
58
+ const brandLengths = getSupportedCardBrandsLengths(brands);
59
+ const [brandIcon, setBrandIcon] = h(void 0);
60
+ const [brand, setBrand] = h(void 0);
61
+ const [cardBin, setCardBin] = h("");
62
+ y(() => {
63
+ const trimValue = trimAll(value);
64
+ setBrandIcon(value ? () => {
65
+ var _a;
66
+ return (_a = findCardBrandInfo(trimValue, brands)) == null ? void 0 : _a.icon;
67
+ } : void 0);
68
+ const newBin = trimValue.substring(0, 6);
69
+ setCardBin(newBin.length < 6 ? "" : newBin);
70
+ }, [value]);
71
+ y(() => {
72
+ onBinValue == null ? void 0 : onBinValue(cardBin);
73
+ }, [cardBin]);
74
+ const rule = {
75
+ trigger: ["blur", "submit"],
76
+ validator(value2) {
77
+ if (security) {
78
+ const result = formItemRef.current.getValidateResult();
79
+ if (result.status === "error") {
80
+ throw new Error(result.errors[0].message);
81
+ } else if (result.status === "success") {
82
+ return true;
83
+ }
84
+ }
85
+ value2 = trimAll(value2 ?? "");
86
+ if (!brandLengths.includes(value2.length)) {
87
+ throw new Error(i18n.get("card.cardNumber.incomplete"));
88
+ }
89
+ const cardBrand = findCardBrandInfo(value2, brands);
90
+ if (!cardBrand) {
91
+ throw new Error(i18n.get("card.cardNumber.invalid"));
92
+ }
93
+ return true;
71
94
  }
72
- const cardBrand = findCardBrandInfo(value2, brands);
73
- if (!cardBrand) {
74
- throw new Error(i18n.get("card.cardNumber.invalid"));
95
+ };
96
+ function onInput(event) {
97
+ var _a;
98
+ const { currentTarget, inputType } = event;
99
+ const selectionStart = currentTarget.selectionStart;
100
+ let val = limitedToNumber(currentTarget.value);
101
+ val = val.replace(/(\d{4})(?=\d)/g, "$1 ");
102
+ let pos = selectionStart;
103
+ if (pos % 5 === 0) {
104
+ pos = clamp(selectionStart + (inputType === "insertText" ? 1 : -1), 0);
75
105
  }
76
- return true;
77
- }
78
- };
79
- function onInput(event) {
80
- var _a;
81
- const { currentTarget, inputType } = event;
82
- const selectionStart = currentTarget.selectionStart;
83
- let val = limitedToNumber(currentTarget.value);
84
- val = val.replace(/(\d{4})(?=\d)/g, "$1 ");
85
- let pos = selectionStart;
86
- if (pos % 5 === 0) {
87
- pos = clamp(selectionStart + (inputType === "insertText" ? 1 : -1), 0);
106
+ setValue(currentTarget.value = val);
107
+ currentTarget.setSelectionRange(pos, pos);
108
+ (_a = props.onInput) == null ? void 0 : _a.call(props, event);
88
109
  }
89
- setValue(currentTarget.value = val);
90
- currentTarget.setSelectionRange(pos, pos);
91
- (_a = props.onInput) == null ? void 0 : _a.call(props, event);
110
+ const RightIcon = () => {
111
+ if (validationStatus !== "error") {
112
+ const Icon = brandIcon ?? IconCardNo;
113
+ return /* @__PURE__ */ u(Icon, { size: 32 });
114
+ }
115
+ };
116
+ return /* @__PURE__ */ u(
117
+ FormItem,
118
+ {
119
+ label: i18n.get("card.cardNumber.label"),
120
+ showLabel,
121
+ path: "number",
122
+ ref: formItemRef,
123
+ rule,
124
+ onValidationStatusChange: setValidationStatus,
125
+ className,
126
+ children: /* @__PURE__ */ u(
127
+ Input,
128
+ {
129
+ type: "text",
130
+ inputmode: "numeric",
131
+ ref: inputRef,
132
+ maxLength: 23,
133
+ value,
134
+ onInput,
135
+ rightIcon: RightIcon(),
136
+ placeholder: i18n.get("card.cardNumber.placeholder"),
137
+ children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf": EFieldType.CARD_NUMBER })
138
+ }
139
+ )
140
+ }
141
+ );
92
142
  }
93
- const RightIcon = () => {
94
- if (validationStatus !== "error") {
95
- const Icon = brandIcon ?? IconCardNo;
96
- return /* @__PURE__ */ u(Icon, { size: 32 });
97
- }
98
- };
99
- return /* @__PURE__ */ u(
100
- FormItem,
101
- {
102
- label: i18n.get("card.cardNumber.label"),
103
- showLabel,
104
- path: "number",
105
- ref: formItemRef,
106
- rule,
107
- onValidationStatusChange: setValidationStatus,
108
- className,
109
- children: /* @__PURE__ */ u(
110
- Input,
111
- {
112
- type: "text",
113
- inputmode: "numeric",
114
- ref: inputRef,
115
- maxLength: 23,
116
- value,
117
- onInput,
118
- rightIcon: RightIcon(),
119
- placeholder: i18n.get("card.cardNumber.placeholder"),
120
- children: security && /* @__PURE__ */ u("div", { style: "width:100%;height:100%", "data-sf": EFieldType.CARD_NUMBER })
121
- }
122
- )
123
- }
124
- );
125
- });
143
+ );
126
144
  export {
127
145
  CardNumberField
128
146
  };
@@ -5,6 +5,7 @@ import "../../utils/system-info/get-browser-info.js";
5
5
  import { limitedToNumber } from "../../utils/format.js";
6
6
  import { EFieldType } from "../SecuredFieldsProvider/index.js";
7
7
  import { useI18n } from "../../hooks/useI18n.js";
8
+ import "../../api/http.js";
8
9
  import "../internal/Form/type.js";
9
10
  import "../internal/Form/context.js";
10
11
  import { FormItem } from "../internal/Form/FormItem.js";
@@ -1,6 +1,7 @@
1
1
  import { A, h, y, u } from "../../core.js";
2
2
  import { useBEM } from "../../hooks/useBEM.js";
3
3
  import { useI18n } from "../../hooks/useI18n.js";
4
+ import "../../api/http.js";
4
5
  import { finCardBrandInfoByCode } from "../../utils/card-brand/index.js";
5
6
  import "../../utils/system-info/get-browser-info.js";
6
7
  import "../internal/Form/type.js";
@@ -12,6 +12,7 @@ import { trimAll } from "../../utils/format.js";
12
12
  import { IconCardNo } from "../internal/icons/IconCardNo.js";
13
13
  import { useBEM } from "../../hooks/useBEM.js";
14
14
  import { useI18n } from "../../hooks/useI18n.js";
15
+ import "../../api/http.js";
15
16
  const { bem } = useBEM("combined-card-info");
16
17
  const CombinedCardInfo = w(
17
18
  (props, ref) => {
@@ -36,6 +37,9 @@ const CombinedCardInfo = w(
36
37
  binValueChanged: (binValue2) => {
37
38
  setBinValue(binValue2);
38
39
  },
40
+ binValue: () => {
41
+ return binValue;
42
+ },
39
43
  brandChanged: (brand) => {
40
44
  if (brand) {
41
45
  const brandInfo = finCardBrandInfoByCode(brand);