@paykka/card-checkout-ui 0.9.2 → 0.11.4

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 (108) hide show
  1. package/dist/card-checkout-ui.js +16 -16
  2. package/dist/card-checkout-ui.umd.cjs +16 -16
  3. package/dist/es/api/index.js +1 -2
  4. package/dist/es/api/modules/index.js +1 -2
  5. package/dist/es/api/modules/risk/index.js +13 -0
  6. package/dist/es/api/modules/threeDS/index.js +1 -0
  7. package/dist/es/components/AccordionItem/AccordionItem.js +1 -0
  8. package/dist/es/components/AccountNameField/index.js +1 -0
  9. package/dist/es/components/AddressField/index.js +1 -0
  10. package/dist/es/components/AliPay/index.js +1 -1
  11. package/dist/es/components/ApplePay/index.js +2 -2
  12. package/dist/es/components/Boost/index.js +3 -1
  13. package/dist/es/components/Card/index.js +29 -8
  14. package/dist/es/components/CardBrands/index.js +1 -0
  15. package/dist/es/components/CardExpireDateField/index.js +1 -0
  16. package/dist/es/components/CardHolderNameField/index.js +1 -0
  17. package/dist/es/components/CardIBANField/index.js +1 -0
  18. package/dist/es/components/CardNo/index.js +1 -0
  19. package/dist/es/components/CardNumberField/index.js +13 -2
  20. package/dist/es/components/CardSecurityCodeField/index.js +1 -0
  21. package/dist/es/components/CardSelector/index.js +1 -0
  22. package/dist/es/components/CombinedCardInfo/index.js +4 -0
  23. package/dist/es/components/DropIn/index.js +2 -1
  24. package/dist/es/components/EmailField/EmailField.js +14 -15
  25. package/dist/es/components/EncryptedCard/index.js +1 -0
  26. package/dist/es/components/GooglePay/index.js +2 -2
  27. package/dist/es/components/GrabPay/index.js +3 -1
  28. package/dist/es/components/GuideCard/index.js +1 -0
  29. package/dist/es/components/LinePay/index.js +3 -1
  30. package/dist/es/components/MayBankQRPay/index.js +3 -1
  31. package/dist/es/components/NinePay/index.js +3 -1
  32. package/dist/es/components/RecurringTip/index.js +1 -0
  33. package/dist/es/components/SecuredFieldsProvider/index.js +2 -1
  34. package/dist/es/components/SecuredIframe/index.js +54 -2
  35. package/dist/es/components/Sepa/index.js +1 -1
  36. package/dist/es/components/ShopeePay/index.js +3 -1
  37. package/dist/es/components/SubmitButton/index.js +1 -0
  38. package/dist/es/components/TNGWallet/index.js +3 -1
  39. package/dist/es/components/ThreeDS/index.js +1 -0
  40. package/dist/es/components/WechatPay/index.js +1 -1
  41. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +1 -0
  42. package/dist/es/components/business/QRCodeModal/index.js +1 -0
  43. package/dist/es/components/business/index.js +1 -0
  44. package/dist/es/components/index.js +1 -0
  45. package/dist/es/components/internal/Accordion/index.js +1 -0
  46. package/dist/es/components/internal/Button/Button.js +1 -0
  47. package/dist/es/components/internal/Button/index.js +1 -0
  48. package/dist/es/components/internal/CheckBox/CheckBox.js +1 -0
  49. package/dist/es/components/internal/CheckBox/index.js +1 -0
  50. package/dist/es/components/internal/Form/type.js +1 -0
  51. package/dist/es/components/internal/Info/Info.js +1 -0
  52. package/dist/es/components/internal/Info/index.js +1 -0
  53. package/dist/es/components/internal/Input/type.js +1 -0
  54. package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +1 -0
  55. package/dist/es/components/internal/LoadingCheck/index.js +1 -0
  56. package/dist/es/components/internal/Modal/Modal.js +1 -0
  57. package/dist/es/components/internal/QRCode/QRCode.js +1 -0
  58. package/dist/es/components/internal/QRCode/index.js +1 -0
  59. package/dist/es/components/internal/Select/Select.js +11 -9
  60. package/dist/es/components/internal/Select/SelectMenu.js +1 -0
  61. package/dist/es/components/internal/Select/SelectMenuItem.js +1 -0
  62. package/dist/es/components/wallets/GCash/GCash.js +15 -3
  63. package/dist/es/components/wallets/Paymaya/Paymaya.js +3 -1
  64. package/dist/es/core/PayKKaCheckout.js +7 -2
  65. package/dist/es/core/index.js +1 -0
  66. package/dist/es/core/query.js +1 -2
  67. package/dist/es/hooks/index.js +1 -0
  68. package/dist/es/hooks/useI18n.js +1 -0
  69. package/dist/es/hooks/usePayState.js +7 -2
  70. package/dist/es/i18n/locales/index.js +2 -1
  71. package/dist/es/i18n/locales/nl-NL.js +88 -0
  72. package/dist/es/index.js +2 -0
  73. package/dist/es/out/fraud-detection.js +39 -13
  74. package/dist/es/out/worldpay-ddc.js +143 -0
  75. package/dist/es/types/event.js +15 -0
  76. package/dist/es/types/fraud-detection.js +1 -0
  77. package/dist/es/types/message.js +3 -0
  78. package/dist/es/utils/iframe.js +1 -1
  79. package/dist/es/utils/reg-exp.js +4 -0
  80. package/dist/types/api/modules/index.d.ts +2 -0
  81. package/dist/types/api/modules/risk/index.d.ts +8 -0
  82. package/dist/types/api/modules/threeDS/index.d.ts +3 -0
  83. package/dist/types/components/CardNumberField/type.d.ts +7 -1
  84. package/dist/types/components/CombinedCardInfo/type.d.ts +1 -0
  85. package/dist/types/components/SecuredFieldsProvider/type.d.ts +1 -1
  86. package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +1 -0
  87. package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -1
  88. package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +13 -3
  89. package/dist/types/components/internal/Select/Select.d.ts +1 -17
  90. package/dist/types/components/internal/Select/type.d.ts +26 -1
  91. package/dist/types/components/wallets/GCash/type.d.ts +5 -0
  92. package/dist/types/core/error.d.ts +12 -1
  93. package/dist/types/hooks/usePayState.d.ts +5 -2
  94. package/dist/types/i18n/locales/index.d.ts +2 -0
  95. package/dist/types/i18n/locales/nl-NL.d.ts +71 -0
  96. package/dist/types/index.d.ts +1 -0
  97. package/dist/types/out/fraud-detection.d.ts +5 -1
  98. package/dist/types/out/types.d.ts +4 -0
  99. package/dist/types/out/worldpay-ddc-iframe.d.ts +1 -0
  100. package/dist/types/out/worldpay-ddc.d.ts +37 -0
  101. package/dist/types/types/event.d.ts +26 -0
  102. package/dist/types/types/fraud-detection.d.ts +3 -1
  103. package/dist/types/types/index.d.ts +13 -1
  104. package/dist/types/types/message.d.ts +21 -2
  105. package/dist/types/utils/iframe.d.ts +1 -1
  106. package/dist/types/utils/index.d.ts +1 -0
  107. package/dist/types/utils/reg-exp.d.ts +1 -0
  108. package/package.json +3 -1
@@ -1,4 +1,3 @@
1
+ import "./http.js";
1
2
  import "../utils/card-brand/brands.js";
2
3
  import "../utils/system-info/get-browser-info.js";
3
- import "../core.js";
4
- import "../core/context.js";
@@ -1,4 +1,3 @@
1
1
  import "../../utils/card-brand/brands.js";
2
2
  import "../../utils/system-info/get-browser-info.js";
3
- import "../../core.js";
4
- import "../../core/context.js";
3
+ import "../http.js";
@@ -0,0 +1,13 @@
1
+ import { http } from "../../http.js";
2
+ const getRiskAuthorization = async (params, options) => {
3
+ return http.post("/session/fraud-detection/component/authorization", params, options).then((res) => {
4
+ return {
5
+ authCode: res.auth_code,
6
+ channel: res.channel,
7
+ expireTime: res.expire_time
8
+ };
9
+ });
10
+ };
11
+ export {
12
+ getRiskAuthorization
13
+ };
@@ -0,0 +1 @@
1
+ import "../../http.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
  import { AccordionContext } from "../internal/Accordion/type.js";
9
10
  import { accordionTransition } from "../internal/Accordion/accordionTransition.js";
10
11
  const { bem } = useBEM("accordion-item");
@@ -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";
@@ -4,6 +4,7 @@ import { EAddressType } from "../../constant.js";
4
4
  import { createAddressCore } from "../../core/Address.js";
5
5
  import { useBEM } from "../../hooks/useBEM.js";
6
6
  import { useI18n } from "../../hooks/useI18n.js";
7
+ import "../../api/http.js";
7
8
  import { isArray, isNil } from "../../utils/is.js";
8
9
  import "../../utils/card-brand/brands.js";
9
10
  import "../../utils/system-info/get-browser-info.js";
@@ -26,7 +26,7 @@ const AliPay = w((props, ref) => {
26
26
  const { session } = props;
27
27
  const addressState = createAddressCore();
28
28
  const emailState = createEmailCore();
29
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
29
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
30
30
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
31
31
  const formRef = A(null);
32
32
  const [form, setForm] = h({
@@ -45,7 +45,7 @@ const { bem } = useBEM("apple-pay");
45
45
  const ApplePay = w((props) => {
46
46
  const { session, isDropIn } = props;
47
47
  let applePaySession;
48
- const { i18n, sessionReady, fraudDetection } = usePayState(session);
48
+ const { i18n, sessionReady, fraudDetection } = usePayState(session, props.core);
49
49
  const [errorMsg, setErrorMsg] = h("");
50
50
  const [showApplePay, setShowApplePay] = h(false);
51
51
  const getPaymentSuccessData = () => ({
@@ -139,7 +139,7 @@ const ApplePay = w((props) => {
139
139
  country: billingContact == null ? void 0 : billingContact.countryCode
140
140
  },
141
141
  browser: await getBrowserParams({
142
- fraudDetectionId: fraudDetection == null ? void 0 : fraudDetection.fraudDetectionID
142
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
143
143
  })
144
144
  },
145
145
  props.core,
@@ -57,7 +57,9 @@ const Boost = w((props, ref) => {
57
57
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
58
  return;
59
59
  setForm(Object.assign(form, { email: emailState.email }));
60
+ form.email = emailState.email;
60
61
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ validateForm();
61
63
  },
62
64
  payment: () => {
63
65
  hidePaymentButton && onSubmit();
@@ -68,7 +70,7 @@ const Boost = w((props, ref) => {
68
70
  const addressFieldRef = A(null);
69
71
  const emailFieldRef = A(null);
70
72
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
72
74
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
75
  const formRef = A(null);
74
76
  const [form, setForm] = h({
@@ -8,6 +8,7 @@ import { CoreContext } from "../../core/context.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";
@@ -56,7 +57,7 @@ const Card = w((props, ref) => {
56
57
  } = props;
57
58
  const addressState = createAddressCore();
58
59
  const emailState = createEmailCore();
59
- const { i18n, fraudDetection, sessionReady } = usePayState(session);
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);
@@ -106,7 +107,9 @@ const Card = w((props, ref) => {
106
107
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
107
108
  return;
108
109
  setForm(Object.assign(form, { email: emailState.email }));
110
+ form.email = emailState.email;
109
111
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
112
+ validateForm();
110
113
  },
111
114
  payment: () => {
112
115
  hidePaymentButton && onSubmit();
@@ -240,7 +243,7 @@ const Card = w((props, ref) => {
240
243
  });
241
244
  }
242
245
  const getPaymentParams = async () => {
243
- var _a2;
246
+ var _a2, _b2, _c2;
244
247
  const cardNo = trimAll(form.number);
245
248
  const cardBrand = findCardBrand(cardNo);
246
249
  const [expMonth, expYear] = form.expireDate.split("/");
@@ -256,6 +259,10 @@ const Card = w((props, ref) => {
256
259
  paymentMethod = cardBrand.code;
257
260
  }
258
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
+ }
259
266
  return {
260
267
  sessionId: session.sessionId,
261
268
  clientKey: session.clientKey,
@@ -281,7 +288,9 @@ const Card = w((props, ref) => {
281
288
  email: form.email
282
289
  },
283
290
  browser: await getBrowserParams({
284
- fraudDetectionId: fraudDetection == null ? void 0 : fraudDetection.fraudDetectionID
291
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId({
292
+ bin: cardNo || cardBin || ""
293
+ }))
285
294
  })
286
295
  };
287
296
  };
@@ -289,8 +298,13 @@ const Card = w((props, ref) => {
289
298
  var _a2, _b2, _c2, _d2;
290
299
  try {
291
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
+ );
292
306
  if (!search && security) {
293
- (_a2 = SFPRef.current) == null ? void 0 : _a2.payment(paymentParams);
307
+ (_c2 = SFPRef.current) == null ? void 0 : _c2.payment(paymentParams, extraParams);
294
308
  return { end: true };
295
309
  }
296
310
  const options = { locale: i18n.locale, timeout };
@@ -301,7 +315,6 @@ const Card = w((props, ref) => {
301
315
  options
302
316
  );
303
317
  } else {
304
- const extraParams = (_c2 = (_b2 = core.config)._getExtraParams) == null ? void 0 : _c2.call(_b2, "payment", paymentParams.payment.paymentMethod);
305
318
  res = await cardPay(paymentParams, extraParams, options);
306
319
  }
307
320
  return processAfterPayment(res, search);
@@ -633,8 +646,15 @@ const Card = w((props, ref) => {
633
646
  };
634
647
  const onBinValueChanged = (data) => {
635
648
  var _a2;
636
- const field = splitCardInfo ? cardNumberFieldRef : combinedCardInfoRef;
637
- (_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);
638
658
  };
639
659
  const onAfterPayment = (data) => {
640
660
  processAfterPayment(data.response);
@@ -677,7 +697,8 @@ const Card = w((props, ref) => {
677
697
  {
678
698
  supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentMethod) == null ? void 0 : _b2.filter(Boolean),
679
699
  security,
680
- ref: cardNumberFieldRef
700
+ ref: cardNumberFieldRef,
701
+ onBinValue: onBinValueChanged
681
702
  }
682
703
  ),
683
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");
@@ -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";
@@ -13,7 +14,7 @@ import { getSupportedCardBrands, getSupportedCardBrandsLengths, finCardBrandInfo
13
14
  import { trimAll, limitedToNumber } from "../../utils/format.js";
14
15
  const CardNumberField = w(
15
16
  (props, ref) => {
16
- const { supportedCardBrands = [], className, security, showLabel } = props;
17
+ const { supportedCardBrands = [], className, security, showLabel, onBinValue } = props;
17
18
  const inputRef = A(null);
18
19
  const formItemRef = A(null);
19
20
  F(ref, () => ({
@@ -33,6 +34,9 @@ const CardNumberField = w(
33
34
  binValueChanged: (binValue) => {
34
35
  setValue(binValue);
35
36
  },
37
+ binValue: () => {
38
+ return value;
39
+ },
36
40
  brandChanged: (brand2) => {
37
41
  if (brand2) {
38
42
  const brandInfo = finCardBrandInfoByCode(brand2);
@@ -54,12 +58,19 @@ const CardNumberField = w(
54
58
  const brandLengths = getSupportedCardBrandsLengths(brands);
55
59
  const [brandIcon, setBrandIcon] = h(void 0);
56
60
  const [brand, setBrand] = h(void 0);
61
+ const [cardBin, setCardBin] = h("");
57
62
  y(() => {
63
+ const trimValue = trimAll(value);
58
64
  setBrandIcon(value ? () => {
59
65
  var _a;
60
- return (_a = findCardBrandInfo(trimAll(value), brands)) == null ? void 0 : _a.icon;
66
+ return (_a = findCardBrandInfo(trimValue, brands)) == null ? void 0 : _a.icon;
61
67
  } : void 0);
68
+ const newBin = trimValue.substring(0, 6);
69
+ setCardBin(newBin.length < 6 ? "" : newBin);
62
70
  }, [value]);
71
+ y(() => {
72
+ onBinValue == null ? void 0 : onBinValue(cardBin);
73
+ }, [cardBin]);
63
74
  const rule = {
64
75
  trigger: ["blur", "submit"],
65
76
  validator(value2) {
@@ -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);
@@ -2,6 +2,7 @@ import { u, w, h, A, F, y, b } from "../../core.js";
2
2
  import "../../utils/card-brand/brands.js";
3
3
  import "../../utils/system-info/get-browser-info.js";
4
4
  import { CoreContext } from "../../core/context.js";
5
+ import "../../api/http.js";
5
6
  import { CardPaymentMethods, PaymentMethod, PaymentCategory, SessionMode, PaymentMethod2CategoryMap } from "../../constant.js";
6
7
  import { Card } from "../Card/index.js";
7
8
  import { ApplePay } from "../ApplePay/index.js";
@@ -144,7 +145,7 @@ const DropIn = w((props, ref) => {
144
145
  core,
145
146
  enableAccordionTransition = true
146
147
  } = props;
147
- const { i18n, sessionReady } = usePayState(session);
148
+ const { i18n, sessionReady } = usePayState(session, props.core);
148
149
  const [paymentCategoryOptions, setPaymentCategoryOptions] = h([]);
149
150
  const [activePaymentCategory, setActivePaymentCategory] = h();
150
151
  const [enablePaymentMethod, setEnablePaymentMethod] = h();
@@ -8,7 +8,9 @@ import { w, h, A, F, y, u } from "../../core.js";
8
8
  import { isValuable } from "../../utils/is.js";
9
9
  import "../../utils/card-brand/brands.js";
10
10
  import "../../utils/system-info/get-browser-info.js";
11
+ import { EMAIL_REG } from "../../utils/reg-exp.js";
11
12
  import { useI18n } from "../../hooks/useI18n.js";
13
+ import "../../api/http.js";
12
14
  import "../internal/Form/type.js";
13
15
  import "../internal/Form/context.js";
14
16
  import { FormItem } from "../internal/Form/FormItem.js";
@@ -50,42 +52,39 @@ const EmailField = w((props, ref) => {
50
52
  const emailCore = createEmailCore(props.value ?? "");
51
53
  F(ref, () => ({
52
54
  update: (value2) => {
53
- var _a, _b;
54
- setValue(value2 ?? "");
55
- emailCore.email = value2 ?? "";
56
- if (emailCore.isValid) {
55
+ var _a;
56
+ updateEmail(value2);
57
+ if (emailCore.isValid || isValuable(value2)) {
57
58
  (_a = formItemRef.current) == null ? void 0 : _a.validate(value2, { trigger: "submit", setResult: true });
58
- } else {
59
- isValuable(value2) && ((_b = formItemRef.current) == null ? void 0 : _b.validate(value2, { trigger: "submit", setResult: true }));
60
59
  }
61
60
  }
62
61
  }));
63
62
  y(() => {
64
- setValue(props.value ?? "");
65
- emailCore.email = props.value ?? "";
63
+ updateEmail(props.value);
66
64
  }, [props.value]);
67
- y(() => {
68
- emailCore.email = value ?? "";
69
- }, [value]);
65
+ const updateEmail = (value2) => {
66
+ emailCore.email = value2 ?? "";
67
+ setValue(value2 ?? "");
68
+ };
70
69
  const rule = {
71
70
  trigger: ["blur", "submit"],
72
71
  validator(value2) {
73
72
  if (!value2) {
74
73
  throw new Error(i18n.get("common.email.incomplete"));
75
74
  }
76
- const emailReg = new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$");
75
+ const emailReg = new RegExp(EMAIL_REG);
77
76
  if (!emailReg.test(value2)) {
78
77
  throw new Error(i18n.get("common.email.incorrect"));
79
78
  }
80
79
  return true;
81
80
  }
82
81
  };
83
- function onInput(event) {
82
+ const onInput = (event) => {
84
83
  var _a;
85
84
  const { currentTarget } = event;
86
- setValue(currentTarget.value);
85
+ updateEmail(currentTarget.value);
87
86
  (_a = props.onInput) == null ? void 0 : _a.call(props, event);
88
- }
87
+ };
89
88
  return /* @__PURE__ */ u(
90
89
  FormItem,
91
90
  {
@@ -1,6 +1,7 @@
1
1
  import { setApiUrl, setCDNUrl } from "../../config.js";
2
2
  import { CoreContext } from "../../core/context.js";
3
3
  import { create } from "../../core/create.js";
4
+ import "../../api/http.js";
4
5
  import "../../utils/card-brand/brands.js";
5
6
  import { getBrowserInfo } from "../../utils/system-info/get-browser-info.js";
6
7
  import { w, F, h, A, y, u } from "../../core.js";
@@ -180,7 +180,7 @@ const GooglePay = w((props, ref) => {
180
180
  F(ref, () => ({
181
181
  checkThreeDS
182
182
  }));
183
- const { sessionReady, i18n, fraudDetection } = usePayState(session);
183
+ const { sessionReady, i18n, fraudDetection } = usePayState(session, props.core);
184
184
  const [errorMsg, setErrorMsg] = h("");
185
185
  const [showGooglePay, setShowGooglePay] = h(false);
186
186
  const [showThreeDSModal, setShowThreeDSModal] = h(false);
@@ -290,7 +290,7 @@ const GooglePay = w((props, ref) => {
290
290
  areaCode: phone == null ? void 0 : phone.areaCode
291
291
  },
292
292
  browser: await getBrowserParams({
293
- fraudDetectionId: fraudDetection == null ? void 0 : fraudDetection.fraudDetectionID
293
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
294
294
  })
295
295
  },
296
296
  props.core,
@@ -57,7 +57,9 @@ const GrabPay = w((props, ref) => {
57
57
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
58
  return;
59
59
  setForm(Object.assign(form, { email: emailState.email }));
60
+ form.email = emailState.email;
60
61
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ validateForm();
61
63
  },
62
64
  payment: () => {
63
65
  hidePaymentButton && onSubmit();
@@ -68,7 +70,7 @@ const GrabPay = w((props, ref) => {
68
70
  const addressFieldRef = A(null);
69
71
  const emailFieldRef = A(null);
70
72
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
72
74
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
75
  const formRef = A(null);
74
76
  const [form, setForm] = h({
@@ -2,6 +2,7 @@ import { u, b } from "../../core.js";
2
2
  import { PaymentCategory } from "../../constant.js";
3
3
  import { useBEM } from "../../hooks/useBEM.js";
4
4
  import { useI18n } from "../../hooks/useI18n.js";
5
+ import "../../api/http.js";
5
6
  import "../../utils/card-brand/brands.js";
6
7
  import "../../utils/system-info/get-browser-info.js";
7
8
  import { isMobile } from "../../utils/system-info/get-system-info.js";
@@ -57,7 +57,9 @@ const LinePay = w((props, ref) => {
57
57
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
58
  return;
59
59
  setForm(Object.assign(form, { email: emailState.email }));
60
+ form.email = emailState.email;
60
61
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ validateForm();
61
63
  },
62
64
  payment: () => {
63
65
  hidePaymentButton && onSubmit();
@@ -68,7 +70,7 @@ const LinePay = w((props, ref) => {
68
70
  const addressFieldRef = A(null);
69
71
  const emailFieldRef = A(null);
70
72
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
72
74
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
75
  const formRef = A(null);
74
76
  const [form, setForm] = h({
@@ -57,7 +57,9 @@ const MayBankQRPay = w((props, ref) => {
57
57
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
58
  return;
59
59
  setForm(Object.assign(form, { email: emailState.email }));
60
+ form.email = emailState.email;
60
61
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ validateForm();
61
63
  },
62
64
  payment: () => {
63
65
  hidePaymentButton && onSubmit();
@@ -68,7 +70,7 @@ const MayBankQRPay = w((props, ref) => {
68
70
  const addressFieldRef = A(null);
69
71
  const emailFieldRef = A(null);
70
72
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
72
74
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
75
  const formRef = A(null);
74
76
  const [form, setForm] = h({
@@ -57,7 +57,9 @@ const NinePay = w((props, ref) => {
57
57
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
58
  return;
59
59
  setForm(Object.assign(form, { email: emailState.email }));
60
+ form.email = emailState.email;
60
61
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ validateForm();
61
63
  },
62
64
  payment: () => {
63
65
  hidePaymentButton && onSubmit();
@@ -68,7 +70,7 @@ const NinePay = w((props, ref) => {
68
70
  const addressFieldRef = A(null);
69
71
  const emailFieldRef = A(null);
70
72
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
72
74
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
75
  const formRef = A(null);
74
76
  const [form, setForm] = h({
@@ -2,6 +2,7 @@ import { u } from "../../core.js";
2
2
  import { CoreContext } from "../../core/context.js";
3
3
  import "../../utils/card-brand/brands.js";
4
4
  import "../../utils/system-info/get-browser-info.js";
5
+ import "../../api/http.js";
5
6
  import { useBEM } from "../../hooks/useBEM.js";
6
7
  import { IconInfo } from "../internal/icons/IconInfo.js";
7
8
  const { bem } = useBEM("recurring-tip");
@@ -71,10 +71,11 @@ const SecuredFieldsProvider = w((props, ref) => {
71
71
  const { sessionMode, i18n, targetElement } = props;
72
72
  const rootNodeRef = A(null);
73
73
  const hiddenIframe = A(null);
74
- const payment = (formData) => {
74
+ const payment = (formData, extraParams) => {
75
75
  const data = {
76
76
  action: MessageAction.PAYMENT,
77
77
  formData,
78
+ extraParams,
78
79
  locale: props.i18n.locale
79
80
  };
80
81
  postMessageToIframe(data, hiddenIframe.current.contentWindow, cdnOrigin);