@paykka/card-checkout-ui 0.5.17 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/card-checkout-ui.js +22 -0
  2. package/dist/card-checkout-ui.umd.cjs +19 -5
  3. package/dist/es/api/index.js +0 -2
  4. package/dist/es/api/modules/checkout/index.js +1 -15
  5. package/dist/es/api/modules/checkout/map.js +22 -4
  6. package/dist/es/api/modules/encrypted-card/index.js +54 -0
  7. package/dist/es/api/modules/get-browser-params.js +2 -2
  8. package/dist/es/api/modules/index.js +0 -2
  9. package/dist/es/components/AccountNameField/index.js +2 -3
  10. package/dist/es/components/AddressField/index.js +4 -7
  11. package/dist/es/components/AliPay/index.js +13 -12
  12. package/dist/es/components/ApplePay/index.js +75 -19
  13. package/dist/es/components/Card/index.js +335 -143
  14. package/dist/es/components/CardBrands/index.js +0 -2
  15. package/dist/es/components/CardExpireDateField/index.js +6 -6
  16. package/dist/es/components/CardHolderNameField/index.js +5 -5
  17. package/dist/es/components/CardIBANField/index.js +2 -3
  18. package/dist/es/components/CardNo/index.js +0 -2
  19. package/dist/es/components/CardNumberField/index.js +32 -20
  20. package/dist/es/components/CardSecurityCodeField/index.js +6 -6
  21. package/dist/es/components/CardSelector/index.js +1 -3
  22. package/dist/es/components/CombinedCardInfo/index.js +99 -0
  23. package/dist/es/components/EmailField/EmailField.js +2 -3
  24. package/dist/es/components/EncryptedCard/index.js +408 -0
  25. package/dist/es/components/GooglePay/index.js +108 -36
  26. package/dist/es/components/RecurringTip/index.js +0 -2
  27. package/dist/es/components/SecuredFieldsProvider/index.js +230 -1
  28. package/dist/es/components/SecuredIframe/index.js +192 -22
  29. package/dist/es/components/Sepa/index.js +36 -32
  30. package/dist/es/components/SubmitButton/index.js +0 -2
  31. package/dist/es/components/ThreeDS/index.js +94 -0
  32. package/dist/es/components/WechatPay/index.js +31 -30
  33. package/dist/es/components/index.js +4 -2
  34. package/dist/es/components/internal/Button/Button.js +0 -2
  35. package/dist/es/components/internal/Button/index.js +0 -2
  36. package/dist/es/components/internal/CheckBox/CheckBox.js +0 -2
  37. package/dist/es/components/internal/CheckBox/index.js +0 -2
  38. package/dist/es/components/internal/Form/FormItem.js +28 -24
  39. package/dist/es/components/internal/Form/index.js +1 -0
  40. package/dist/es/components/internal/Form/type.js +13 -1
  41. package/dist/es/components/internal/Info/Info.js +0 -2
  42. package/dist/es/components/internal/Info/index.js +0 -2
  43. package/dist/es/components/internal/Input/Input.js +11 -13
  44. package/dist/es/components/internal/Input/index.js +1 -0
  45. package/dist/es/components/internal/Input/type.js +11 -1
  46. package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -2
  47. package/dist/es/components/internal/LoadingCheck/index.js +0 -2
  48. package/dist/es/components/internal/Modal/Modal.js +40 -0
  49. package/dist/es/components/internal/Modal/modal2.js +1 -0
  50. package/dist/es/components/internal/Select/Select.js +2 -2
  51. package/dist/es/components/internal/Select/SelectMenu.js +0 -2
  52. package/dist/es/components/internal/Select/SelectMenuItem.js +0 -2
  53. package/dist/es/components/internal/icons/Icon3DSFail.js +3 -0
  54. package/dist/es/components/internal/icons/Icon3DSInfo.js +62 -0
  55. package/dist/es/components/internal/icons/Icon3DSSuccess.js +3 -0
  56. package/dist/es/config.js +12 -8
  57. package/dist/es/constant.js +13 -2
  58. package/dist/es/core/PayKKaCheckout.js +116 -0
  59. package/dist/es/core/Session.js +7 -6
  60. package/dist/es/core/environment.js +26 -0
  61. package/dist/es/core/error.js +21 -0
  62. package/dist/es/core/index.js +0 -2
  63. package/dist/es/core/query.js +1 -8
  64. package/dist/es/hooks/index.js +0 -2
  65. package/dist/es/hooks/useBreakpoints.js +57 -0
  66. package/dist/es/hooks/useI18n.js +0 -1
  67. package/dist/es/hooks/usePayState.js +20 -33
  68. package/dist/es/i18n/index.js +0 -2
  69. package/dist/es/i18n/locales/de-DE.js +11 -1
  70. package/dist/es/i18n/locales/en-GB.js +11 -1
  71. package/dist/es/i18n/locales/es-ES.js +11 -1
  72. package/dist/es/i18n/locales/fr-FR.js +11 -1
  73. package/dist/es/i18n/locales/index.js +8 -6
  74. package/dist/es/i18n/locales/ja-JP.js +11 -1
  75. package/dist/es/i18n/locales/ko-KR.js +11 -1
  76. package/dist/es/i18n/locales/pt-PT.js +11 -1
  77. package/dist/es/i18n/locales/ru-RU.js +11 -1
  78. package/dist/es/i18n/locales/zh-CN.js +11 -1
  79. package/dist/es/i18n/locales/zh-HK.js +11 -1
  80. package/dist/es/i18n/locales/zh-TW.js +11 -1
  81. package/dist/es/i18n/util.js +11 -8
  82. package/dist/es/index.js +15 -2
  83. package/dist/es/out/fraud-detection.js +99 -0
  84. package/dist/es/style.css +194 -4
  85. package/dist/es/types/{radar.js → fraud-detection.js} +1 -1
  86. package/dist/es/types/index.js +49 -1
  87. package/dist/es/types/message.js +28 -0
  88. package/dist/es/utils/card-brand/brands.js +21 -45
  89. package/dist/es/utils/card-brand/index.js +3 -2
  90. package/dist/es/utils/iframe.js +23 -0
  91. package/dist/es/utils/index.js +11 -1
  92. package/dist/es/utils/load.js +14 -0
  93. package/dist/es/utils/style.js +84 -0
  94. package/dist/style.css +1 -1
  95. package/dist/types/api/modules/checkout/map.d.ts +1 -0
  96. package/dist/types/api/modules/checkout/type.d.ts +14 -1
  97. package/dist/types/api/modules/encrypted-card/index.d.ts +6 -0
  98. package/dist/types/api/modules/encrypted-card/type.d.ts +31 -0
  99. package/dist/types/api/modules/get-browser-params.d.ts +3 -3
  100. package/dist/types/components/AddressField/type.d.ts +1 -0
  101. package/dist/types/components/AliPay/type.d.ts +4 -4
  102. package/dist/types/components/ApplePay/type.d.ts +19 -7
  103. package/dist/types/components/ApplePay/utils.d.ts +3 -0
  104. package/dist/types/components/Card/type.d.ts +64 -6
  105. package/dist/types/components/CardExpireDateField/type.d.ts +1 -0
  106. package/dist/types/components/CardHolderNameField/type.d.ts +1 -1
  107. package/dist/types/components/CardNumberField/type.d.ts +3 -0
  108. package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -0
  109. package/dist/types/components/CombinedCardInfo/CombinedCardInfo.d.ts +5 -0
  110. package/dist/types/components/CombinedCardInfo/index.d.ts +2 -0
  111. package/dist/types/components/CombinedCardInfo/type.d.ts +16 -0
  112. package/dist/types/components/EncryptedCard/EncryptedCard.d.ts +4 -0
  113. package/dist/types/components/EncryptedCard/index.d.ts +4 -0
  114. package/dist/types/components/EncryptedCard/output.d.ts +9 -0
  115. package/dist/types/components/EncryptedCard/type.d.ts +85 -0
  116. package/dist/types/components/GooglePay/type.d.ts +20 -8
  117. package/dist/types/components/GooglePay/utils.d.ts +2 -0
  118. package/dist/types/components/SecuredFieldsProvider/index.d.ts +1 -0
  119. package/dist/types/components/SecuredFieldsProvider/type.d.ts +29 -100
  120. package/dist/types/components/SecuredFieldsProvider/utils/index.d.ts +1 -1
  121. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +7 -2
  122. package/dist/types/components/Sepa/type.d.ts +4 -4
  123. package/dist/types/components/ThreeDS/components/ThreeDSAuth/ThreeDSAuth.d.ts +3 -0
  124. package/dist/types/components/ThreeDS/components/ThreeDSAuth/index.d.ts +2 -0
  125. package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +17 -0
  126. package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +2 -0
  127. package/dist/types/components/ThreeDS/components/ThreeDSIframe/index.d.ts +1 -0
  128. package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -0
  129. package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +5 -0
  130. package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +3 -0
  131. package/dist/types/components/ThreeDS/components/ThreeDSStatus/output.d.ts +1 -0
  132. package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +6 -0
  133. package/dist/types/components/ThreeDS/index.d.ts +1 -0
  134. package/dist/types/components/WechatPay/type.d.ts +4 -4
  135. package/dist/types/components/index.d.ts +2 -0
  136. package/dist/types/components/internal/Form/FormItem.d.ts +1 -1
  137. package/dist/types/components/internal/Form/type.d.ts +7 -0
  138. package/dist/types/components/internal/Input/Input.d.ts +1 -1
  139. package/dist/types/components/internal/Input/type.d.ts +7 -0
  140. package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
  141. package/dist/types/components/internal/Loading/index.d.ts +1 -0
  142. package/dist/types/components/internal/Modal/Modal.d.ts +5 -0
  143. package/dist/types/components/internal/Modal/index.d.ts +0 -0
  144. package/dist/types/components/internal/Modal/type.d.ts +20 -0
  145. package/dist/types/components/internal/icons/Icon3DSFail.d.ts +2 -0
  146. package/dist/types/components/internal/icons/Icon3DSInfo.d.ts +2 -0
  147. package/dist/types/components/internal/icons/Icon3DSSuccess.d.ts +2 -0
  148. package/dist/types/components/internal/icons/index.d.ts +3 -0
  149. package/dist/types/config.d.ts +7 -3
  150. package/dist/types/constant.d.ts +7 -2
  151. package/dist/types/core/PayKKaCheckout.d.ts +28 -0
  152. package/dist/types/core/Session.d.ts +1 -1
  153. package/dist/types/core/context.d.ts +1 -0
  154. package/dist/types/core/environment.d.ts +4 -0
  155. package/dist/types/core/error.d.ts +16 -0
  156. package/dist/types/core/index.d.ts +2 -0
  157. package/dist/types/core/query.d.ts +2 -2
  158. package/dist/types/hooks/index.d.ts +1 -0
  159. package/dist/types/hooks/useBreakpoints.d.ts +15 -0
  160. package/dist/types/hooks/usePayState.d.ts +6 -25
  161. package/dist/types/i18n/locales/de-DE.d.ts +8 -0
  162. package/dist/types/i18n/locales/en-GB.d.ts +8 -0
  163. package/dist/types/i18n/locales/es-ES.d.ts +8 -0
  164. package/dist/types/i18n/locales/fr-FR.d.ts +8 -0
  165. package/dist/types/i18n/locales/index.d.ts +2 -2
  166. package/dist/types/i18n/locales/ja-JP.d.ts +8 -0
  167. package/dist/types/i18n/locales/ko-KR.d.ts +8 -0
  168. package/dist/types/i18n/locales/pt-PT.d.ts +8 -0
  169. package/dist/types/i18n/locales/ru-RU.d.ts +8 -0
  170. package/dist/types/i18n/locales/zh-CN.d.ts +8 -0
  171. package/dist/types/i18n/locales/zh-HK.d.ts +8 -0
  172. package/dist/types/i18n/locales/zh-TW.d.ts +8 -0
  173. package/dist/types/index.d.ts +2 -2
  174. package/dist/types/out/fraud-detection.d.ts +9 -0
  175. package/dist/types/types/{radar.d.ts → fraud-detection.d.ts} +3 -2
  176. package/dist/types/types/index.d.ts +100 -1
  177. package/dist/types/types/message.d.ts +170 -0
  178. package/dist/types/utils/card-brand/brands.d.ts +4 -18
  179. package/dist/types/utils/card-brand/index.d.ts +10 -9
  180. package/dist/types/utils/format.d.ts +0 -1
  181. package/dist/types/utils/index.d.ts +4 -0
  182. package/dist/types/utils/load.d.ts +7 -0
  183. package/dist/types/utils/style.d.ts +29 -0
  184. package/package.json +63 -63
  185. package/dist/card-checkout-ui.iife.js +0 -8
  186. package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +0 -222
  187. package/dist/es/out/radar.js +0 -123
  188. package/dist/types/out/radar.d.ts +0 -14
  189. /package/dist/types/{components/SecuredFieldsProvider/utils → utils}/iframe.d.ts +0 -0
@@ -16,6 +16,7 @@ export declare enum PaymentMethod {
16
16
  BOC = "BOC",
17
17
  SEPA_DEBIT = "SEPA_DEBIT"
18
18
  }
19
+ export declare const CardPaymentMethods: PaymentMethod[];
19
20
  export declare enum PaymentType {
20
21
  PURCHASE = "PURCHASE",
21
22
  PREPARE_AUTHORIZE = "PREPARE_AUTHORIZE",
@@ -31,6 +32,10 @@ export declare enum EAddressType {
31
32
  ADDRESS_2 = "ADDRESS_2"
32
33
  }
33
34
  export declare enum SessionMode {
34
- HOSTED = "HOST",
35
- EMBEDDED = "EMBEDDED"
35
+ /** 单页面收银台 */
36
+ HOSTED = "HOSTED",
37
+ /** 嵌入式收银台 */
38
+ DROP_IN = "DROP_IN",
39
+ /** 组件式收银台 */
40
+ COMPONENT = "COMPONENT"
36
41
  }
@@ -0,0 +1,28 @@
1
+ import type { ComponentType, JSX } from 'preact';
2
+ import type { CoreProps, PayKKaEnvConfig, PayKKaInitConfiguration } from '../types';
3
+ import { type ComponentInst } from './create';
4
+ import { Session } from './Session';
5
+ import getFraudDetectionInstance from '../out/fraud-detection';
6
+ export type FraudDetectionType = ReturnType<typeof getFraudDetectionInstance>;
7
+ /**
8
+ * 收银台实例
9
+ * 不能用单例,如果使用单页面应用,在路由切换时不会重新初始化,会导致收银台配置和状态相互影响
10
+ */
11
+ export declare class PayKKaCheckout {
12
+ #private;
13
+ constructor(config: PayKKaInitConfiguration);
14
+ private init;
15
+ private initSession;
16
+ /**
17
+ * 初始化环境配置
18
+ * _envConfig 优先级高于 env
19
+ */
20
+ private initEnv;
21
+ private initLocale;
22
+ private initExtraParams;
23
+ get session(): Session;
24
+ get envConfig(): PayKKaEnvConfig;
25
+ /** 创建组件,把 session 作为组件的 props 传递 */
26
+ create<P extends Recordable>(component: ComponentType<P> | ((props: P) => JSX.Element), props?: Partial<P> | null): ComponentInst<P>;
27
+ getCoreProps(): CoreProps;
28
+ }
@@ -3,7 +3,7 @@ export declare class Session {
3
3
  #private;
4
4
  readonly sessionId: string;
5
5
  readonly clientKey?: string;
6
- checkout: CheckoutRes;
6
+ checkout?: CheckoutRes;
7
7
  colors: {
8
8
  primary: string;
9
9
  primaryHover: string;
@@ -3,4 +3,5 @@ import type { Session } from './Session';
3
3
  export declare const CoreContext: import("preact").Context<{
4
4
  i18n?: I18n | null | undefined;
5
5
  session?: Session | null | undefined;
6
+ threeDSMessageListenerInit?: boolean | undefined;
6
7
  } | null>;
@@ -0,0 +1,4 @@
1
+ import type { FraudDetectionEnv, PayKKaEnvType } from '../types';
2
+ export declare const apiEnv: Record<PayKKaEnvType, string>;
3
+ export declare const cdnEnv: Record<PayKKaEnvType, string>;
4
+ export declare const fraudDetectionEnv: Record<PayKKaEnvType, FraudDetectionEnv>;
@@ -0,0 +1,16 @@
1
+ export declare enum EPayKKaError {
2
+ /** 普通错误,基本是前端错误 */
3
+ ERROR = "ERROR",
4
+ /** 请求错误 */
5
+ API_ERROR = "API_ERROR"
6
+ }
7
+ export declare class PayKKaError extends Error {
8
+ /** 错误类型 */
9
+ type: keyof typeof EPayKKaError;
10
+ /** 错误代码 */
11
+ code?: string;
12
+ constructor(type: keyof typeof EPayKKaError, message?: string, info?: {
13
+ code?: string;
14
+ cause?: any;
15
+ });
16
+ }
@@ -2,3 +2,5 @@ export * from './context';
2
2
  export * from './create';
3
3
  export * from './Session';
4
4
  export * from './query';
5
+ export * from './PayKKaCheckout';
6
+ export * from './error';
@@ -1,2 +1,2 @@
1
- import { type CheckoutRes, type RequestOptions, type QueryCheckoutParams } from '../api';
2
- export declare function querySession({ sessionId, clientKey }: QueryCheckoutParams, options?: RequestOptions): Promise<CheckoutRes>;
1
+ import { type RequestOptions, type QueryCheckoutParams } from '../api';
2
+ export declare function querySession({ sessionId, clientKey }: QueryCheckoutParams, options?: RequestOptions): Promise<import("../api").CheckoutRes>;
@@ -2,3 +2,4 @@ export * from './useBEM';
2
2
  export * from './useI18n';
3
3
  export * from './usePayState';
4
4
  export * from './useRetry';
5
+ export * from './useBreakpoints';
@@ -0,0 +1,15 @@
1
+ declare enum EBreakpoint {
2
+ xs = "xs",
3
+ sm = "sm",
4
+ md = "md",
5
+ lg = "lg",
6
+ xl = "xl",
7
+ xxl = "xxl"
8
+ }
9
+ export type BreakpointType = keyof typeof EBreakpoint;
10
+ export declare const useBreakpoints: () => {
11
+ matches: Record<"xs" | "sm" | "md" | "lg" | "xl" | "xxl", boolean>;
12
+ current: string | null;
13
+ smaller: (breakpointName: BreakpointType) => boolean;
14
+ };
15
+ export {};
@@ -1,35 +1,16 @@
1
1
  import type { SubmitButtonStatus } from '../components';
2
- import { Session } from '../core';
3
- export declare function usePayState(props: {
4
- sessionId: string;
5
- clientKey?: string;
6
- }): {
2
+ import type { Session } from '../core';
3
+ export declare function usePayState(session: Session): {
7
4
  validated: boolean;
8
5
  setValidated: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<boolean>>;
9
6
  submitButtonStatus: SubmitButtonStatus;
10
7
  setSubmitButtonStatus: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<SubmitButtonStatus>>;
11
8
  errorMsg: string;
12
9
  setErrorMsg: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<string>>;
13
- session: Session | null;
14
- setSession: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<Session | null>>;
15
- sessionReady: boolean;
16
- setSessionReady: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<boolean>>;
17
10
  i18n: import("../i18n").I18n;
18
- payKKaRadar: {
19
- "__#3@#PayKKaRadar": {
20
- s: string;
21
- };
22
- "__#3@#collMap": {
23
- STRIPE_RADAR: () => Promise<unknown>;
24
- };
25
- "__#3@#p": Promise<unknown[]> | undefined;
26
- "__#3@#realMode": "STRIPE_RADAR"[];
27
- "__#3@#keyMap": {
28
- STRIPE_RADAR?: string | undefined;
29
- };
30
- "__#3@#transferRes"(): string;
31
- readonly radarId: string;
32
- "__#3@#stripeRadarColl"(): Promise<unknown>;
33
- createPayKKaRadar(): Promise<void>;
11
+ fraudDetection: {
12
+ fraudDetectionID: string;
13
+ createFraudDetection: () => Promise<void>;
34
14
  } | null;
15
+ sessionReady: boolean;
35
16
  };
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -1,4 +1,4 @@
1
- declare const locales: Recordable<() => Promise<typeof import('./zh-CN')>>;
1
+ declare const getLocales: () => Recordable<() => Promise<typeof import('./zh-CN')>>;
2
2
  export type Translation = typeof import('./zh-CN')['default'];
3
3
  export type CustomLocales = DeepPartial<Recordable<Translation>>;
4
4
  export declare enum LocaleKey {
@@ -26,4 +26,4 @@ export declare enum LocaleKey {
26
26
  zhTW = "zh-TW"
27
27
  }
28
28
  export type LocaleKeyType = LocaleKey | `${LocaleKey}`;
29
- export default locales;
29
+ export default getLocales;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  'card.cardSelector.change': string;
17
17
  'card.cardSelector.useOtherCard': string;
18
18
  'card.storeInfo': string;
19
+ 'card.info.label': string;
19
20
  'common.pay': string;
20
21
  'common.payProcessing': string;
21
22
  'common.paySuccess': string;
@@ -27,6 +28,8 @@ declare const _default: {
27
28
  'common.noData': string;
28
29
  'common.netError': string;
29
30
  'common.unknownError': string;
31
+ 'common.cancel': string;
32
+ 'common.confirm': string;
30
33
  'common.email.label': string;
31
34
  'common.email.incomplete': string;
32
35
  'common.email.incorrect': string;
@@ -44,5 +47,10 @@ declare const _default: {
44
47
  'sepa.iban.label': string;
45
48
  'sepa.iban.placeholder': string;
46
49
  'sepa.iban.invalid': string;
50
+ 'threeDS.paymentIncomplete': string;
51
+ 'threeDS.completeFirst': string;
52
+ 'threeDS.authenticationSuccessful': string;
53
+ 'threeDS.authenticationFailed': string;
54
+ 'threeDS.returnToCheckout': string;
47
55
  };
48
56
  export default _default;
@@ -1,5 +1,5 @@
1
1
  export * from './components';
2
- export { type ComponentInst, create, querySession, Session } from './core';
2
+ export { type ComponentInst, create, querySession, Session, PayKKaCheckout, PayKKaError } from './core';
3
3
  export { I18n, LocaleKey } from './i18n';
4
- export { setApiUrl, setCDNUrl, setRadarEnv, setCustomReqHeaders, setCustomLocale } from './config';
4
+ export { setApiUrl, setCDNUrl, setFraudDetectionEnv, setCustomReqHeaders, setCustomLocale, setCheckoutConfig } from './config';
5
5
  export { getFingerprint } from './utils';
@@ -0,0 +1,9 @@
1
+ import { type CollModeType, type envType } from '../types';
2
+ type FraudDetectionType = {
3
+ fraudDetectionID: string;
4
+ createFraudDetection: () => Promise<void>;
5
+ };
6
+ export default function getFraudDetectionInstance(env?: envType | {
7
+ [k in CollModeType]?: string;
8
+ }, mode?: CollModeType[]): FraudDetectionType;
9
+ export {};
@@ -1,8 +1,9 @@
1
1
  export type envType = 'eu' | 'hk' | 'us';
2
2
  export declare const enum ECollMode {
3
- STRIPE_RADAR = "STRIPE_RADAR"
3
+ /** Stripe Radar */
4
+ SR = "SR"
4
5
  }
5
6
  export type CollModeType = keyof typeof ECollMode;
6
- export type RadarEnv = envType | {
7
+ export type FraudDetectionEnv = envType | {
7
8
  [k in CollModeType]?: string;
8
9
  };
@@ -1,3 +1,102 @@
1
1
  import type { HTMLAttributes } from 'preact/compat';
2
- export * from './radar';
2
+ import type { LocaleKeyType } from '../i18n';
3
+ import type { PayKKaError, Session } from '../core';
4
+ import type { FraudDetectionEnv } from './fraud-detection';
5
+ export * from './fraud-detection';
6
+ export * from './message';
3
7
  export type CustomAttributes<T extends EventTarget, K extends keyof HTMLAttributes<T> = 'style' | 'className'> = Pick<HTMLAttributes<T>, K>;
8
+ /** 收银台初始化参数 */
9
+ export interface PayKKaInitConfiguration {
10
+ sessionId: string;
11
+ /** 环境配置,必传! */
12
+ env: PayKKaEnvType;
13
+ /** 嵌入式收银台必传,需要商户进行配置 */
14
+ clientKey?: string;
15
+ /** 国际化语言 */
16
+ locale?: LocaleKeyType;
17
+ /** 是否隐藏支付按钮 */
18
+ hidePaymentButton?: boolean;
19
+ /** 定义 3DS 所需配置 */
20
+ threeDSFrame?: ThreeDSFrameConfig;
21
+ /** 收银台已经获取到可用支付方式时调用 */
22
+ onPaymentMethodsReady?: (methods: string[]) => void;
23
+ /** 收银台创建时报错触发 */
24
+ onInitError?: (error: PayKKaError) => void;
25
+ /**
26
+ * 内部参数
27
+ */
28
+ /** 环境配置,优先级大于 env 参数 */
29
+ _envConfig?: PayKKaEnvConfig;
30
+ }
31
+ export interface CoreProps {
32
+ session?: Session;
33
+ /** 定义 3DS 所需配置 */
34
+ threeDSFrame?: ThreeDSFrameConfig;
35
+ }
36
+ export interface ThreeDSFrameConfig {
37
+ /** 3DS 页面宽度 */
38
+ modalWidth?: number | string;
39
+ /** 3DS 页面高度 */
40
+ modalHeight?: number | string;
41
+ }
42
+ export declare enum EPayKKaEnv {
43
+ /** 沙箱环境 */
44
+ SANDBOX = "sandbox",
45
+ /** 欧洲生产环境 */
46
+ EU = "eu",
47
+ /** 香港生产环境 */
48
+ HK = "hk"
49
+ }
50
+ export interface PayKKaEnvConfig {
51
+ api?: string;
52
+ cdn?: string;
53
+ fraudDetection?: FraudDetectionEnv;
54
+ }
55
+ export type PayKKaEnvType = `${EPayKKaEnv}`;
56
+ export type PaymentSuccessData = {
57
+ returnUrl?: string;
58
+ };
59
+ export declare enum CardBrandCode {
60
+ VISA = "VISA",
61
+ MASTER_CARD = "MASTER_CARD",
62
+ JCB = "JCB",
63
+ AMEX = "AMEX",
64
+ DISCOVER = "DISCOVER",
65
+ DINERS_CLUB = "DINERS_CLUB"
66
+ }
67
+ export type CardBrand = `${CardBrandCode}`;
68
+ export interface ElementStylesConfig {
69
+ /** input 元素的样式 */
70
+ input?: InputStylesConfig;
71
+ /** label 文案的样式 */
72
+ label?: StylesConfig;
73
+ /** 错误提示文案的样式 */
74
+ errorMessage?: Partial<CSSStyleDeclaration>;
75
+ }
76
+ export interface FullElementStylesConfig extends ElementStylesConfig {
77
+ inputWrapper?: StylesConfig;
78
+ }
79
+ export interface StylesConfig {
80
+ /** 默认样式 */
81
+ base?: Partial<CSSStyleDeclaration>;
82
+ /** 校验通过时样式 */
83
+ valid?: Partial<CSSStyleDeclaration>;
84
+ /** 校验不通过时样式 */
85
+ invalid?: Partial<CSSStyleDeclaration>;
86
+ /** 聚焦元素时样式 */
87
+ focus?: Partial<CSSStyleDeclaration>;
88
+ }
89
+ export interface InputStylesConfig extends StylesConfig {
90
+ /** placeholder样式 */
91
+ placeholder?: {
92
+ /** 默认样式 */
93
+ base?: Partial<CSSStyleDeclaration>;
94
+ /** 聚焦元素时样式 */
95
+ focus?: Partial<CSSStyleDeclaration>;
96
+ };
97
+ /** 将鼠标悬停在元素上的样式 */
98
+ hover?: Partial<CSSStyleDeclaration>;
99
+ }
100
+ export declare const defaultInputStyleConfig: InputStylesConfig;
101
+ export declare const inputStyleAttrs: string[];
102
+ export type StyleStatusType = 'valid' | 'invalid' | 'focus' | 'blur' | 'base';