@paykka/card-checkout-ui 0.13.8 → 0.13.13

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 (175) hide show
  1. package/dist/card-checkout-ui.js +20 -20
  2. package/dist/card-checkout-ui.umd.cjs +21 -21
  3. package/dist/es/_commonjsHelpers.js +1 -82
  4. package/dist/es/api/index.js +2 -1
  5. package/dist/es/api/modules/checkout/map.js +1 -0
  6. package/dist/es/api/modules/get-browser-params.js +20 -8
  7. package/dist/es/api/modules/index.js +2 -1
  8. package/dist/es/api/modules/map.js +2 -1
  9. package/dist/es/api/modules/risk/index.js +21 -18
  10. package/dist/es/api/modules/threeDS/index.js +2 -1
  11. package/dist/es/api/modules/vietqr/index.js +2 -1
  12. package/dist/es/api/utils/index.js +4 -1
  13. package/dist/es/components/AccordionItem/AccordionItem.js +0 -1
  14. package/dist/es/components/AccountNameField/index.js +1 -1
  15. package/dist/es/components/AddressField/index.js +1 -2
  16. package/dist/es/components/AliPay/index.js +4 -2
  17. package/dist/es/components/ApplePay/index.js +201 -135
  18. package/dist/es/components/Boost/index.js +4 -2
  19. package/dist/es/components/CPFField/index.js +88 -0
  20. package/dist/es/components/Card/index.js +5 -11
  21. package/dist/es/components/CardBrands/index.js +0 -1
  22. package/dist/es/components/CardExpireDateField/index.js +1 -1
  23. package/dist/es/components/CardHolderNameField/index.js +1 -1
  24. package/dist/es/components/CardIBANField/index.js +1 -1
  25. package/dist/es/components/CardNo/index.js +0 -1
  26. package/dist/es/components/CardNumberField/index.js +1 -1
  27. package/dist/es/components/CardSecurityCodeField/index.js +1 -1
  28. package/dist/es/components/CardSelector/index.js +1 -1
  29. package/dist/es/components/CombinedCardInfo/index.js +1 -1
  30. package/dist/es/components/DropIn/index.js +0 -1
  31. package/dist/es/components/EmailField/EmailField.js +1 -1
  32. package/dist/es/components/EncryptedCard/index.js +12 -11
  33. package/dist/es/components/GooglePay/index.js +1 -0
  34. package/dist/es/components/GrabPay/index.js +4 -2
  35. package/dist/es/components/GuideCard/index.js +1 -1
  36. package/dist/es/components/LinePay/index.js +4 -2
  37. package/dist/es/components/MayBankQRPay/index.js +4 -2
  38. package/dist/es/components/NinePay/index.js +4 -2
  39. package/dist/es/components/RecurringTip/index.js +1 -2
  40. package/dist/es/components/SecuredFieldsProvider/index.js +20 -3
  41. package/dist/es/components/SecuredIframe/index.js +50 -22
  42. package/dist/es/components/Sepa/index.js +4 -2
  43. package/dist/es/components/ShopeePay/index.js +4 -2
  44. package/dist/es/components/SubmitButton/index.js +1 -1
  45. package/dist/es/components/TNGWallet/index.js +4 -2
  46. package/dist/es/components/ThreeDS/index.js +1 -2
  47. package/dist/es/components/Tip/index.js +18 -0
  48. package/dist/es/components/WechatPay/index.js +4 -2
  49. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +1 -1
  50. package/dist/es/components/business/QRCodeModal/index.js +0 -1
  51. package/dist/es/components/business/index.js +0 -1
  52. package/dist/es/components/index.js +0 -1
  53. package/dist/es/components/internal/Accordion/index.js +0 -1
  54. package/dist/es/components/internal/Button/Button.js +0 -1
  55. package/dist/es/components/internal/Button/index.js +0 -1
  56. package/dist/es/components/internal/CheckBox/CheckBox.js +0 -1
  57. package/dist/es/components/internal/CheckBox/index.js +0 -1
  58. package/dist/es/components/internal/Form/type.js +0 -1
  59. package/dist/es/components/internal/Info/Info.js +0 -1
  60. package/dist/es/components/internal/Info/index.js +0 -1
  61. package/dist/es/components/internal/Input/Input.js +1 -1
  62. package/dist/es/components/internal/Input/type.js +0 -1
  63. package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -1
  64. package/dist/es/components/internal/LoadingCheck/index.js +0 -1
  65. package/dist/es/components/internal/Modal/Modal.js +1 -1
  66. package/dist/es/components/internal/QRCode/QRCode.js +0 -1
  67. package/dist/es/components/internal/QRCode/index.js +0 -1
  68. package/dist/es/components/internal/Select/Select.js +14 -17
  69. package/dist/es/components/internal/Select/SelectMenu.js +2 -3
  70. package/dist/es/components/internal/Select/SelectMenuItem.js +0 -1
  71. package/dist/es/components/wallets/GCash/GCash.js +4 -2
  72. package/dist/es/components/wallets/OpayWallet/OpayWallet.js +8 -9
  73. package/dist/es/components/wallets/PagaWallet/PagaWallet.js +8 -9
  74. package/dist/es/components/wallets/Paymaya/Paymaya.js +4 -2
  75. package/dist/es/components/wallets/PicPay/PicPay.js +136 -72
  76. package/dist/es/components/wallets/Pix/Pix.js +136 -72
  77. package/dist/es/components/wallets/Vietqr/Vietqr.js +4 -2
  78. package/dist/es/components/wallets/Zalopay/Zalopay.js +4 -2
  79. package/dist/es/config.js +1 -1
  80. package/dist/es/constant.js +2 -0
  81. package/dist/es/core/checkout.js +15 -3
  82. package/dist/es/core/environment.js +10 -2
  83. package/dist/es/core/index.js +0 -1
  84. package/dist/es/core/query.js +2 -1
  85. package/dist/es/core/session.js +6 -2
  86. package/dist/es/core/theme.js +0 -1
  87. package/dist/es/core.js +585 -4
  88. package/dist/es/hooks/index.js +0 -1
  89. package/dist/es/hooks/useI18n.js +0 -1
  90. package/dist/es/hooks/usePayState.js +13 -6
  91. package/dist/es/i18n/locales/de-DE.js +6 -1
  92. package/dist/es/i18n/locales/en-GB.js +6 -1
  93. package/dist/es/i18n/locales/es-ES.js +6 -1
  94. package/dist/es/i18n/locales/fr-FR.js +7 -2
  95. package/dist/es/i18n/locales/ja-JP.js +6 -1
  96. package/dist/es/i18n/locales/ko-KR.js +6 -1
  97. package/dist/es/i18n/locales/nl-NL.js +6 -1
  98. package/dist/es/i18n/locales/pt-PT.js +6 -1
  99. package/dist/es/i18n/locales/ru-RU.js +6 -1
  100. package/dist/es/i18n/locales/zh-CN.js +6 -1
  101. package/dist/es/i18n/locales/zh-HK.js +7 -2
  102. package/dist/es/i18n/locales/zh-TW.js +7 -2
  103. package/dist/es/index.js +6 -3
  104. package/dist/es/out/base-fraud-detection.js +134 -0
  105. package/dist/es/out/config.js +16 -0
  106. package/dist/es/out/fraud-detection.js +118 -27
  107. package/dist/es/out/paykka-detection.js +63 -0
  108. package/dist/es/out/stripe-radar.js +25 -51
  109. package/dist/es/out/worldpay-ddc.js +52 -99
  110. package/dist/es/out/worldpay-jsc-origin.js +0 -1
  111. package/dist/es/out/worldpay-jsc.js +21 -43
  112. package/dist/es/style.css +1 -1
  113. package/dist/es/types/event.js +33 -13
  114. package/dist/es/types/index.js +14 -0
  115. package/dist/es/utils/cpf.js +48 -0
  116. package/dist/es/utils/encrypt.js +18 -0
  117. package/dist/es/utils/iframe.js +1 -1
  118. package/dist/es/utils/location.js +4 -2
  119. package/dist/es/utils/redirect.js +8 -5
  120. package/dist/es/utils/system-info/index.js +1 -3
  121. package/dist/style.css +1 -1
  122. package/dist/types/api/modules/checkout/type.d.ts +2 -0
  123. package/dist/types/api/modules/get-browser-params.d.ts +25 -1
  124. package/dist/types/api/modules/risk/index.d.ts +28 -12
  125. package/dist/types/api/modules/type.d.ts +5 -0
  126. package/dist/types/api/utils/index.d.ts +3 -0
  127. package/dist/types/components/ApplePay/config.d.ts +9 -0
  128. package/dist/types/components/ApplePay/hooks/useApplePay.d.ts +15 -0
  129. package/dist/types/components/ApplePay/type.d.ts +53 -10
  130. package/dist/types/components/ApplePay/utils.d.ts +8 -2
  131. package/dist/types/components/CPFField/CPFField.d.ts +4 -0
  132. package/dist/types/components/CPFField/index.d.ts +2 -0
  133. package/dist/types/components/CPFField/type.d.ts +21 -0
  134. package/dist/types/components/SecuredFieldsProvider/type.d.ts +8 -3
  135. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +2 -5
  136. package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +6 -0
  137. package/dist/types/components/Tip/Tip.d.ts +3 -0
  138. package/dist/types/components/Tip/index.d.ts +2 -0
  139. package/dist/types/components/Tip/type.d.ts +12 -0
  140. package/dist/types/constant.d.ts +3 -1
  141. package/dist/types/core/checkout.d.ts +1 -1
  142. package/dist/types/core/environment.d.ts +12 -0
  143. package/dist/types/core/session.d.ts +1 -0
  144. package/dist/types/i18n/locales/de-DE.d.ts +4 -0
  145. package/dist/types/i18n/locales/en-GB.d.ts +4 -0
  146. package/dist/types/i18n/locales/es-ES.d.ts +4 -0
  147. package/dist/types/i18n/locales/fr-FR.d.ts +4 -0
  148. package/dist/types/i18n/locales/ja-JP.d.ts +4 -0
  149. package/dist/types/i18n/locales/ko-KR.d.ts +4 -0
  150. package/dist/types/i18n/locales/nl-NL.d.ts +4 -0
  151. package/dist/types/i18n/locales/pt-PT.d.ts +4 -0
  152. package/dist/types/i18n/locales/ru-RU.d.ts +4 -0
  153. package/dist/types/i18n/locales/zh-CN.d.ts +4 -0
  154. package/dist/types/i18n/locales/zh-HK.d.ts +4 -0
  155. package/dist/types/i18n/locales/zh-TW.d.ts +4 -0
  156. package/dist/types/out/base-fraud-detection.d.ts +53 -0
  157. package/dist/types/out/config.d.ts +11 -0
  158. package/dist/types/out/fraud-detection.d.ts +14 -3
  159. package/dist/types/out/paykka-detection.d.ts +20 -0
  160. package/dist/types/out/stripe-radar.d.ts +7 -9
  161. package/dist/types/out/types.d.ts +8 -2
  162. package/dist/types/out/worldpay-ddc.d.ts +7 -19
  163. package/dist/types/out/worldpay-jsc.d.ts +8 -18
  164. package/dist/types/types/event.d.ts +86 -39
  165. package/dist/types/types/fraud-detection.d.ts +1 -1
  166. package/dist/types/types/index.d.ts +22 -2
  167. package/dist/types/types/message.d.ts +12 -12
  168. package/dist/types/utils/app-payment.d.ts +2 -0
  169. package/dist/types/utils/cpf.d.ts +32 -0
  170. package/dist/types/utils/encrypt.d.ts +9 -0
  171. package/dist/types/utils/location.d.ts +1 -0
  172. package/dist/types/utils/system-info/index.d.ts +0 -1
  173. package/package.json +5 -4
  174. package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +0 -3
  175. package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +0 -6
@@ -1,7 +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
+ import "../../core/context.js";
5
5
  import "../../out/worldpay-jsc-origin.js";
6
6
  import "../internal/Form/type.js";
7
7
  import "../internal/Form/context.js";
@@ -5,7 +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
+ import "../../core/context.js";
9
9
  import "../../out/worldpay-jsc-origin.js";
10
10
  import "../internal/Form/type.js";
11
11
  import "../internal/Form/context.js";
@@ -3,7 +3,7 @@ import { useBEM } from "../../hooks/useBEM.js";
3
3
  import { useI18n } from "../../hooks/useI18n.js";
4
4
  import { finCardBrandInfoByCode } from "../../utils/card-brand/index.js";
5
5
  import "../../utils/system-info/get-browser-info.js";
6
- import "../../api/http.js";
6
+ import "../../core/context.js";
7
7
  import "../../out/worldpay-jsc-origin.js";
8
8
  import "../internal/Form/type.js";
9
9
  import "../internal/Form/context.js";
@@ -12,7 +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
+ import "../../core/context.js";
16
16
  import "../../out/worldpay-jsc-origin.js";
17
17
  const { bem } = useBEM("combined-card-info");
18
18
  const CombinedCardInfo = w(
@@ -2,7 +2,6 @@ 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";
6
5
  import "../../out/worldpay-jsc-origin.js";
7
6
  import { CardPaymentMethods, PaymentMethod, PaymentCategory, SessionMode, PaymentMethod2CategoryMap } from "../../constant.js";
8
7
  import { Card } from "../Card/index.js";
@@ -10,7 +10,7 @@ import "../../utils/card-brand/brands.js";
10
10
  import "../../utils/system-info/get-browser-info.js";
11
11
  import { EMAIL_REG } from "../../utils/reg-exp.js";
12
12
  import { useI18n } from "../../hooks/useI18n.js";
13
- import "../../api/http.js";
13
+ import "../../core/context.js";
14
14
  import "../../out/worldpay-jsc-origin.js";
15
15
  import "../internal/Form/type.js";
16
16
  import "../internal/Form/context.js";
@@ -2,14 +2,13 @@ import { setApiUrl, setCDNUrl } from "../../config.js";
2
2
  import { CoreContext } from "../../core/context.js";
3
3
  import { create } from "../../core/create.js";
4
4
  import { w, F, h, A, y, u } from "../../core.js";
5
- import "../../api/http.js";
6
5
  import "../../utils/card-brand/brands.js";
7
6
  import { getBrowserInfo } from "../../utils/system-info/get-browser-info.js";
8
7
  import "../../out/worldpay-jsc-origin.js";
9
8
  import { useBEM } from "../../hooks/useBEM.js";
10
9
  import { useI18n } from "../../hooks/useI18n.js";
11
- import { defaultInputStyleConfig } from "../../types/index.js";
12
10
  import { intersection } from "../../utils/index.js";
11
+ import { defaultInputStyleConfig } from "../../types/index.js";
13
12
  import { createPromise } from "../../utils/create-promise.js";
14
13
  import { EFieldType, SecuredFieldsProvider } from "../SecuredFieldsProvider/index.js";
15
14
  import { CardNumberField } from "../CardNumberField/index.js";
@@ -273,15 +272,16 @@ const EncryptedCard = w((props, ref) => {
273
272
  };
274
273
  const onFieldsFocus = (data) => {
275
274
  var _a, _b, _c, _d;
276
- const fieldRef = single ? combinedEncryptedFieldRef : fieldRefMap[data.fieldType];
275
+ const fieldType = data.fieldType;
276
+ const fieldRef = single ? combinedEncryptedFieldRef : fieldRefMap[fieldType];
277
277
  if (data.focus) {
278
278
  (_a = fieldRef.current) == null ? void 0 : _a.focus();
279
- (_b = props.onFocus) == null ? void 0 : _b.call(props, data.fieldType);
280
- updateFieldStyles(data.fieldType, "focus");
279
+ (_b = props.onFocus) == null ? void 0 : _b.call(props, fieldType);
280
+ updateFieldStyles(fieldType, "focus");
281
281
  } else {
282
282
  (_c = fieldRef.current) == null ? void 0 : _c.blur();
283
- (_d = props.onBlur) == null ? void 0 : _d.call(props, data.fieldType);
284
- updateFieldStyles(data.fieldType, "blur");
283
+ (_d = props.onBlur) == null ? void 0 : _d.call(props, fieldType);
284
+ updateFieldStyles(fieldType, "blur");
285
285
  }
286
286
  };
287
287
  const onBinValueChanged = (data) => {
@@ -320,13 +320,14 @@ const EncryptedCard = w((props, ref) => {
320
320
  };
321
321
  const onFieldValidStatusChanged = (data) => {
322
322
  var _a, _b, _c, _d, _e;
323
- const fieldRef = single ? combinedEncryptedFieldRef : fieldRefMap[data.fieldType];
323
+ const fieldType = data.fieldType;
324
+ const fieldRef = single ? combinedEncryptedFieldRef : fieldRefMap[fieldType];
324
325
  const error = data.errorTip && i18n.get(data.errorTip);
325
326
  (_a = props.onValidationChanged) == null ? void 0 : _a.call(props, {
326
- fieldType: data.fieldType,
327
+ fieldType,
327
328
  status: data.status
328
329
  });
329
- fieldValidStatusMap.current[data.fieldType] = {
330
+ fieldValidStatusMap.current[fieldType] = {
330
331
  status: data.status,
331
332
  errorTip: error
332
333
  };
@@ -349,7 +350,7 @@ const EncryptedCard = w((props, ref) => {
349
350
  } else {
350
351
  (_e = fieldRef.current) == null ? void 0 : _e.resetValidation(data.status, error);
351
352
  const type = data.status === "success" ? "valid" : data.status === "error" ? "invalid" : "base";
352
- updateFieldStyles(data.fieldType, type);
353
+ updateFieldStyles(fieldType, type);
353
354
  }
354
355
  };
355
356
  const onFrameActivated = (data) => {
@@ -110,6 +110,7 @@ function createGooglePay(checkout, googlePayConfig, pay, onClick, onCanUse) {
110
110
  postalCode,
111
111
  phoneNumber
112
112
  } = ((_b = paymentData.paymentMethodData.info) == null ? void 0 : _b.billingAddress) ?? {};
113
+ console.warn("GooglePay Res", paymentData.paymentMethodData);
113
114
  pay(paymentData.paymentMethodData.tokenizationData.token, {
114
115
  email: paymentData.email,
115
116
  name,
@@ -72,7 +72,7 @@ const GrabPay = w((props, ref) => {
72
72
  const addressFieldRef = A(null);
73
73
  const emailFieldRef = A(null);
74
74
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
75
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
75
+ const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
76
76
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
77
77
  const formRef = A(null);
78
78
  const [form, setForm] = h({
@@ -164,7 +164,9 @@ const GrabPay = w((props, ref) => {
164
164
  state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
165
165
  city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
166
166
  },
167
- browser: await getBrowserParams()
167
+ browser: await getBrowserParams({
168
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
169
+ })
168
170
  };
169
171
  };
170
172
  const pay = async (search = false, timeout) => {
@@ -5,7 +5,7 @@ import { useI18n } from "../../hooks/useI18n.js";
5
5
  import "../../utils/card-brand/brands.js";
6
6
  import "../../utils/system-info/get-browser-info.js";
7
7
  import { isMobile } from "../../utils/system-info/get-system-info.js";
8
- import "../../api/http.js";
8
+ import "../../core/context.js";
9
9
  import "../../out/worldpay-jsc-origin.js";
10
10
  import { IconRedirect } from "../internal/icons/IconRedirect.js";
11
11
  import { IconScan } from "../internal/icons/IconScan.js";
@@ -72,7 +72,7 @@ const LinePay = w((props, ref) => {
72
72
  const addressFieldRef = A(null);
73
73
  const emailFieldRef = A(null);
74
74
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
75
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
75
+ const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
76
76
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
77
77
  const formRef = A(null);
78
78
  const [form, setForm] = h({
@@ -164,7 +164,9 @@ const LinePay = w((props, ref) => {
164
164
  state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
165
165
  city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
166
166
  },
167
- browser: await getBrowserParams()
167
+ browser: await getBrowserParams({
168
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
169
+ })
168
170
  };
169
171
  };
170
172
  const pay = async (search = false, timeout) => {
@@ -73,7 +73,7 @@ const MayBankQRPay = w(
73
73
  const addressFieldRef = A(null);
74
74
  const emailFieldRef = A(null);
75
75
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
76
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
76
+ const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
77
77
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
78
78
  const formRef = A(null);
79
79
  const [form, setForm] = h({
@@ -165,7 +165,9 @@ const MayBankQRPay = w(
165
165
  state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
166
166
  city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
167
167
  },
168
- browser: await getBrowserParams()
168
+ browser: await getBrowserParams({
169
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
170
+ })
169
171
  };
170
172
  };
171
173
  const pay = async (search = false, timeout) => {
@@ -72,7 +72,7 @@ const NinePay = w((props, ref) => {
72
72
  const addressFieldRef = A(null);
73
73
  const emailFieldRef = A(null);
74
74
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
75
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
75
+ const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
76
76
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
77
77
  const formRef = A(null);
78
78
  const [form, setForm] = h({
@@ -164,7 +164,9 @@ const NinePay = w((props, ref) => {
164
164
  state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
165
165
  city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
166
166
  },
167
- browser: await getBrowserParams()
167
+ browser: await getBrowserParams({
168
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
169
+ })
168
170
  };
169
171
  };
170
172
  const pay = async (search = false, timeout) => {
@@ -2,7 +2,6 @@ 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";
6
5
  import "../../out/worldpay-jsc-origin.js";
7
6
  import { useBEM } from "../../hooks/useBEM.js";
8
7
  import { IconInfo } from "../internal/icons/IconInfo.js";
@@ -12,7 +11,7 @@ function RecurringTip() {
12
11
  var _a;
13
12
  return /* @__PURE__ */ u("div", { className: bem(), children: [
14
13
  /* @__PURE__ */ u("div", { className: bem("icon"), children: IconInfo({ size: 16 }) }),
15
- /* @__PURE__ */ u("div", { children: (_a = value == null ? void 0 : value.i18n) == null ? void 0 : _a.get("common.recurringTip") })
14
+ /* @__PURE__ */ u("div", { className: bem("text"), children: (_a = value == null ? void 0 : value.i18n) == null ? void 0 : _a.get("common.recurringTip") })
16
15
  ] });
17
16
  } });
18
17
  }
@@ -18,6 +18,10 @@ var EFieldType = /* @__PURE__ */ ((EFieldType2) => {
18
18
  EFieldType2["EXPIRE_DATE"] = "EXPIRE_DATE";
19
19
  return EFieldType2;
20
20
  })(EFieldType || {});
21
+ var EInternalFieldType = /* @__PURE__ */ ((EInternalFieldType2) => {
22
+ EInternalFieldType2["CPF"] = "CPF";
23
+ return EInternalFieldType2;
24
+ })(EInternalFieldType || {});
21
25
  const SECURED_FILED_ATTR = "data-sf";
22
26
  const SECURED_IFRAME_CLASS_NAME = "secured-iframe";
23
27
  const HIDDEN_IFRAME_NAME = "hidden-pay-iframe";
@@ -126,7 +130,8 @@ const SecuredFieldsProvider = w((props, ref) => {
126
130
  const securedFieldPlaceholderMap = {
127
131
  [EFieldType.CARD_NUMBER]: i18n.get("card.cardNumber.placeholder"),
128
132
  [EFieldType.CVV]: i18n.get("card.cardSecurityCode.placeholder"),
129
- [EFieldType.EXPIRE_DATE]: i18n.get("card.cardExpireDate.placeholder")
133
+ [EFieldType.EXPIRE_DATE]: i18n.get("card.cardExpireDate.placeholder"),
134
+ [EInternalFieldType.CPF]: i18n.get("cpf.placeholder")
130
135
  };
131
136
  y(() => {
132
137
  init();
@@ -174,7 +179,7 @@ const SecuredFieldsProvider = w((props, ref) => {
174
179
  fieldType,
175
180
  placeholder: securedFieldPlaceholderMap[fieldType],
176
181
  style: props.style,
177
- supportedCardBrands: props.supportedCardBrands,
182
+ supportedCardBrands: props.supportedCardBrands || [],
178
183
  onFocus: props.onFocus,
179
184
  onBinValue: props.onBinValue,
180
185
  onAfterPayment: props.onAfterPayment,
@@ -185,12 +190,23 @@ const SecuredFieldsProvider = w((props, ref) => {
185
190
  });
186
191
  });
187
192
  };
193
+ const isOwnIframe = (source) => {
194
+ var _a;
195
+ const isFieldIframe = Object.values(securedFieldMap.current).some(
196
+ (field) => field.iframe.contentWindow === source
197
+ );
198
+ const isHiddenIframe = ((_a = hiddenIframe.current) == null ? void 0 : _a.contentWindow) === source;
199
+ return isFieldIframe || isHiddenIframe;
200
+ };
188
201
  const onReceiveMessage = q((event) => {
189
202
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
190
- const { data, origin } = event;
203
+ const { data, origin, source } = event;
191
204
  if (origin !== cdnOrigin) {
192
205
  return;
193
206
  }
207
+ if (!source || !isOwnIframe(source)) {
208
+ return;
209
+ }
194
210
  const feedbackData = safeParse(data);
195
211
  if (!Reflect.has(feedbackData, "action")) {
196
212
  return;
@@ -242,6 +258,7 @@ const SecuredFieldsProvider = w((props, ref) => {
242
258
  });
243
259
  export {
244
260
  EFieldType,
261
+ EInternalFieldType,
245
262
  FIELD_IFRAME_NAME,
246
263
  HIDDEN_IFRAME_NAME,
247
264
  SECURED_FILED_ATTR,
@@ -1,7 +1,8 @@
1
1
  import { A, h, y, u, b } from "../../core.js";
2
2
  import { clamp, isExpired, safeParse } from "../../utils/index.js";
3
- import { EFieldType } from "../SecuredFieldsProvider/index.js";
3
+ import { EInternalFieldType, EFieldType } from "../SecuredFieldsProvider/index.js";
4
4
  import { formatExpireDateOnInsert, formatExpireDateOnPaste } from "../../utils/expire-data.js";
5
+ import { CNPJ_FULL_LENGTH, formatCPFOnInsert, CPF_FULL_LENGTH } from "../../utils/cpf.js";
5
6
  import { getSupportedCardBrands, getSupportedCardBrandsLengths, findCardBrand } from "../../utils/card-brand/index.js";
6
7
  import { limitedToNumber, trimAll } from "../../utils/format.js";
7
8
  import { isUndefined, isNil } from "../../utils/is.js";
@@ -11,10 +12,12 @@ import { generateClassNameMap, style2String, createPlaceholderStyle, loadStyle }
11
12
  import { postMessageToIframe } from "../../utils/iframe.js";
12
13
  import { isTimeoutError } from "../../api/http.js";
13
14
  import { cardPay } from "../../api/modules/card/index.js";
15
+ import { PaymentMethod } from "../../constant.js";
16
+ import { pixPay } from "../../api/modules/pix/index.js";
17
+ import { picPay } from "../../api/modules/pic-pay/index.js";
14
18
  import { encryptCard } from "../../api/modules/encrypted-card/index.js";
15
19
  const useSecuredInput = () => {
16
20
  let fieldType;
17
- let supportedCardBrands;
18
21
  const value = A("");
19
22
  const [cardBin, setCardBin] = h("");
20
23
  let brands;
@@ -22,8 +25,7 @@ const useSecuredInput = () => {
22
25
  const [brand, setBrand] = h(void 0);
23
26
  const initSecuredInput = (options) => {
24
27
  fieldType = options.fieldType;
25
- supportedCardBrands = options.supportedCardBrands;
26
- brands = getSupportedCardBrands(supportedCardBrands);
28
+ brands = getSupportedCardBrands(options.supportedCardBrands);
27
29
  brandLengths = getSupportedCardBrandsLengths(brands);
28
30
  };
29
31
  const getConfigByFieldType = () => {
@@ -60,6 +62,15 @@ const useSecuredInput = () => {
60
62
  };
61
63
  break;
62
64
  }
65
+ case EInternalFieldType.CPF: {
66
+ config = {
67
+ maxLength: CNPJ_FULL_LENGTH,
68
+ inputMode: "numeric",
69
+ onInput: onInputCPF,
70
+ validator: cpfValidator
71
+ };
72
+ break;
73
+ }
63
74
  }
64
75
  return config;
65
76
  };
@@ -132,6 +143,12 @@ const useSecuredInput = () => {
132
143
  currentTarget.setSelectionRange(selectionStart + 1, selectionStart + 1);
133
144
  }
134
145
  };
146
+ const onInputCPF = (event) => {
147
+ const currentTarget = event.currentTarget;
148
+ const { value: val, cursorPosition } = formatCPFOnInsert(event);
149
+ value.current = currentTarget.value = val;
150
+ currentTarget.setSelectionRange(cursorPosition, cursorPosition);
151
+ };
135
152
  const cvvValidator = () => {
136
153
  if (isUndefined(value.current) || value.current.length < 3) {
137
154
  throw new Error("card.cardSecurityCode.incomplete");
@@ -156,27 +173,24 @@ const useSecuredInput = () => {
156
173
  if (isExpired(value.current)) {
157
174
  throw new Error("card.cardExpireDate.expired");
158
175
  }
176
+ return true;
177
+ };
178
+ const cpfValidator = () => {
179
+ if (isUndefined(value.current) || ![CPF_FULL_LENGTH, CNPJ_FULL_LENGTH].includes(value.current.length)) {
180
+ throw new Error("cpf.incomplete");
181
+ }
182
+ return true;
159
183
  };
160
184
  const getCurrCardBrand = (realValue) => {
161
185
  return findCardBrand(realValue, brands);
162
186
  };
163
- const validate = () => {
164
- if (fieldType === EFieldType.CARD_NUMBER) {
165
- return cardNumberValidator();
166
- } else if (fieldType === EFieldType.CVV) {
167
- return cvvValidator();
168
- } else if (fieldType === EFieldType.EXPIRE_DATE) {
169
- return expireDateValidator();
170
- }
171
- };
172
187
  return {
173
188
  value,
174
189
  cardBin,
175
190
  initSecuredInput,
176
191
  getConfigByFieldType,
177
192
  getCurrCardBrand,
178
- brand,
179
- validate
193
+ brand
180
194
  };
181
195
  };
182
196
  const inputClassNameMap = generateClassNameMap("input");
@@ -190,10 +204,7 @@ const FieldIframe = (props) => {
190
204
  const initInput = () => {
191
205
  initSecuredInput({
192
206
  fieldType: props.fieldType,
193
- supportedCardBrands: props.supportedCardBrands,
194
- sendMessage: (message) => {
195
- postMessageToIframe(message, window.parent);
196
- }
207
+ supportedCardBrands: props.supportedCardBrands
197
208
  });
198
209
  processInputStyleConfig(props.style);
199
210
  };
@@ -405,7 +416,8 @@ const HiddenIframe = ({ checkoutId }) => {
405
416
  expYear: "",
406
417
  expMonth: "",
407
418
  cardNo: "",
408
- cvv: ""
419
+ cvv: "",
420
+ cpf: void 0
409
421
  };
410
422
  const onReceiveMessage = async (event) => {
411
423
  const { data } = event;
@@ -434,6 +446,10 @@ const HiddenIframe = ({ checkoutId }) => {
434
446
  formData.expYear = `20${expYear}`;
435
447
  break;
436
448
  }
449
+ case EInternalFieldType.CPF: {
450
+ formData.cpf = limitedToNumber(trimAll(feedbackData.value));
451
+ break;
452
+ }
437
453
  }
438
454
  } else if (parsedData.action === MessageAction.PAYMENT) {
439
455
  const feedbackData = parsedData;
@@ -454,12 +470,24 @@ const HiddenIframe = ({ checkoutId }) => {
454
470
  window.addEventListener("message", onReceiveMessage);
455
471
  }, []);
456
472
  const pay = (params, locale, extraParams) => {
457
- cardPay(
473
+ const paymentMethod = params.payment.paymentMethod;
474
+ const payMap = {
475
+ [PaymentMethod.PIX]: pixPay,
476
+ [PaymentMethod.PIC_PAY]: picPay
477
+ };
478
+ const payFn = payMap[paymentMethod] || cardPay;
479
+ payFn(
458
480
  {
459
481
  ...params,
460
482
  payment: {
461
483
  ...params.payment,
462
- ...formData
484
+ cvv: formData.cvv,
485
+ cardNo: formData.cardNo,
486
+ expYear: formData.expYear,
487
+ expMonth: formData.expMonth
488
+ },
489
+ customer: {
490
+ document: formData.cpf
463
491
  }
464
492
  },
465
493
  extraParams,
@@ -30,7 +30,7 @@ const Sepa = w((props, ref) => {
30
30
  const { session, core } = props;
31
31
  const addressCore = core.getAddressCore();
32
32
  let emailState = createEmailCore();
33
- const { i18n, sessionReady } = usePayState(session, props.core);
33
+ const { i18n, fraudDetection, sessionReady } = usePayState(session, props.core);
34
34
  const addressFieldRef = A(null);
35
35
  const emailFieldRef = A(null);
36
36
  const formRef = A(null);
@@ -178,7 +178,9 @@ const Sepa = w((props, ref) => {
178
178
  } : {
179
179
  email: form.email
180
180
  },
181
- browser: await getBrowserParams()
181
+ browser: await getBrowserParams({
182
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
183
+ })
182
184
  };
183
185
  };
184
186
  async function pay(search = false, timeout) {
@@ -72,7 +72,7 @@ const ShopeePay = w((props, ref) => {
72
72
  const addressFieldRef = A(null);
73
73
  const emailFieldRef = A(null);
74
74
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
75
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
75
+ const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
76
76
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
77
77
  const formRef = A(null);
78
78
  const [form, setForm] = h({
@@ -164,7 +164,9 @@ const ShopeePay = w((props, ref) => {
164
164
  state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
165
165
  city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
166
166
  },
167
- browser: await getBrowserParams()
167
+ browser: await getBrowserParams({
168
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
169
+ })
168
170
  };
169
171
  };
170
172
  const pay = async (search = false, timeout) => {
@@ -4,7 +4,7 @@ import { useI18n } from "../../hooks/useI18n.js";
4
4
  import "../../utils/card-brand/brands.js";
5
5
  import "../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../utils/format.js";
7
- import "../../api/http.js";
7
+ import "../../core/context.js";
8
8
  import "../../out/worldpay-jsc-origin.js";
9
9
  import { Button } from "../internal/Button/Button.js";
10
10
  import { IconSafe } from "../internal/icons/IconSafe.js";
@@ -72,7 +72,7 @@ const TNGWallet = w((props, ref) => {
72
72
  const addressFieldRef = A(null);
73
73
  const emailFieldRef = A(null);
74
74
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
75
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
75
+ const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
76
76
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
77
77
  const formRef = A(null);
78
78
  const [form, setForm] = h({
@@ -164,7 +164,9 @@ const TNGWallet = w((props, ref) => {
164
164
  state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
165
165
  city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
166
166
  },
167
- browser: await getBrowserParams()
167
+ browser: await getBrowserParams({
168
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
169
+ })
168
170
  };
169
171
  };
170
172
  const pay = async (search = false, timeout) => {
@@ -2,15 +2,14 @@ import { h, A, T, y, 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 "../../core/context.js";
5
- import "../../api/http.js";
6
5
  import "../../out/worldpay-jsc-origin.js";
7
6
  import { Modal } from "../internal/Modal/Modal.js";
8
7
  import "../internal/Button/button2.js";
9
8
  import { useBEM } from "../../hooks/useBEM.js";
10
9
  import { useI18n } from "../../hooks/useI18n.js";
10
+ import { safeParse } from "../../utils/index.js";
11
11
  import { cdnOrigin } from "../../config.js";
12
12
  import { MessageAction } from "../../types/message.js";
13
- import { safeParse } from "../../utils/index.js";
14
13
  import { useBreakpoints } from "../../hooks/useBreakpoints.js";
15
14
  import { Icon3DSInfo } from "../internal/icons/Icon3DSInfo.js";
16
15
  import { Button } from "../internal/Button/Button.js";
@@ -0,0 +1,18 @@
1
+ import { u } from "../../core.js";
2
+ import { useBEM } from "../../hooks/useBEM.js";
3
+ import "../../core/context.js";
4
+ import "../../utils/card-brand/brands.js";
5
+ import "../../utils/system-info/get-browser-info.js";
6
+ import "../../out/worldpay-jsc-origin.js";
7
+ import { IconInfo } from "../internal/icons/IconInfo.js";
8
+ const { bem } = useBEM("tip");
9
+ function Tip(props) {
10
+ const { text, icon, showIcon = true } = props;
11
+ return /* @__PURE__ */ u("div", { className: bem(), children: [
12
+ showIcon && /* @__PURE__ */ u("div", { className: bem("icon"), children: icon || IconInfo({ size: 16 }) }),
13
+ /* @__PURE__ */ u("div", { className: bem("text"), children: text })
14
+ ] });
15
+ }
16
+ export {
17
+ Tip
18
+ };
@@ -60,7 +60,7 @@ const WechatPay = w((props, ref) => {
60
60
  validateForm();
61
61
  }
62
62
  }));
63
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
63
+ const { setErrorMsg, fraudDetection, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
64
64
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
65
65
  const formRef = A(null);
66
66
  const [form, setForm] = h({
@@ -165,7 +165,9 @@ const WechatPay = w((props, ref) => {
165
165
  payment: {
166
166
  paymentMethod: PaymentMethod.WECHAT_PAY
167
167
  },
168
- browser: await getBrowserParams()
168
+ browser: await getBrowserParams({
169
+ fraudDetectionId: await (fraudDetection == null ? void 0 : fraudDetection.getFraudDetectionId())
170
+ })
169
171
  };
170
172
  };
171
173
  async function pay(search = false, timeout) {
@@ -5,7 +5,7 @@ import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { formatAmount } from "../../../utils/format.js";
7
7
  import { formatTime } from "../../../utils/date.js";
8
- import "../../../api/http.js";
8
+ import "../../../core/context.js";
9
9
  import "../../../out/worldpay-jsc-origin.js";
10
10
  import { useBreakpoints } from "../../../hooks/useBreakpoints.js";
11
11
  import { Modal } from "../../internal/Modal/Modal.js";
@@ -2,7 +2,6 @@ import "../../../core.js";
2
2
  import "../../../utils/card-brand/brands.js";
3
3
  import "../../../utils/system-info/get-browser-info.js";
4
4
  import "../../../core/context.js";
5
- import "../../../api/http.js";
6
5
  import "../../../out/worldpay-jsc-origin.js";
7
6
  import "../../internal/Modal/Modal.js";
8
7
  import "./qr-code-modal.js";
@@ -2,7 +2,6 @@ import "../../core.js";
2
2
  import "../../utils/card-brand/brands.js";
3
3
  import "../../utils/system-info/get-browser-info.js";
4
4
  import "../../core/context.js";
5
- import "../../api/http.js";
6
5
  import "../../out/worldpay-jsc-origin.js";
7
6
  import "../internal/Modal/Modal.js";
8
7
  import "./QRCodeModal/qr-code-modal.js";
@@ -6,7 +6,6 @@ import "./CardBrands/index.js";
6
6
  import "../utils/card-brand/brands.js";
7
7
  import "../utils/system-info/get-browser-info.js";
8
8
  import "../core/context.js";
9
- import "../api/http.js";
10
9
  import "../out/worldpay-jsc-origin.js";
11
10
  import "./CardExpireDateField/index.js";
12
11
  import "./internal/Form/type.js";
@@ -4,6 +4,5 @@ import "./accordion2.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import "../../../core/context.js";
7
- import "../../../api/http.js";
8
7
  import "../../../out/worldpay-jsc-origin.js";
9
8
  import "../../AccordionItem/AccordionItem.js";