@paykka/card-checkout-ui 0.6.0 → 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.
- package/dist/card-checkout-ui.js +12 -12
- package/dist/card-checkout-ui.umd.cjs +12 -12
- package/dist/es/api/index.js +0 -2
- package/dist/es/api/modules/checkout/index.js +1 -15
- package/dist/es/api/modules/checkout/map.js +20 -3
- package/dist/es/api/modules/index.js +0 -2
- package/dist/es/components/AccountNameField/index.js +0 -3
- package/dist/es/components/AddressField/index.js +2 -7
- package/dist/es/components/AliPay/index.js +8 -7
- package/dist/es/components/ApplePay/index.js +7 -8
- package/dist/es/components/Card/index.js +301 -125
- package/dist/es/components/CardBrands/index.js +0 -2
- package/dist/es/components/CardExpireDateField/index.js +1 -4
- package/dist/es/components/CardHolderNameField/index.js +3 -5
- package/dist/es/components/CardIBANField/index.js +0 -3
- package/dist/es/components/CardNo/index.js +0 -2
- package/dist/es/components/CardNumberField/index.js +1 -4
- package/dist/es/components/CardSecurityCodeField/index.js +1 -4
- package/dist/es/components/CardSelector/index.js +0 -3
- package/dist/es/components/CombinedCardInfo/index.js +99 -0
- package/dist/es/components/EmailField/EmailField.js +0 -3
- package/dist/es/components/EncryptedCard/index.js +35 -75
- package/dist/es/components/GooglePay/index.js +62 -28
- package/dist/es/components/RecurringTip/index.js +0 -2
- package/dist/es/components/SecuredFieldsProvider/index.js +230 -1
- package/dist/es/components/SecuredIframe/index.js +3 -1
- package/dist/es/components/Sepa/index.js +21 -27
- package/dist/es/components/SubmitButton/index.js +0 -2
- package/dist/es/components/ThreeDS/index.js +94 -0
- package/dist/es/components/WechatPay/index.js +26 -25
- package/dist/es/components/index.js +1 -3
- package/dist/es/components/internal/Button/Button.js +0 -2
- package/dist/es/components/internal/Button/index.js +0 -2
- package/dist/es/components/internal/CheckBox/CheckBox.js +0 -2
- package/dist/es/components/internal/CheckBox/index.js +0 -2
- package/dist/es/components/internal/Form/type.js +0 -2
- package/dist/es/components/internal/Info/Info.js +0 -2
- package/dist/es/components/internal/Info/index.js +0 -2
- package/dist/es/components/internal/Input/Input.js +2 -2
- package/dist/es/components/internal/Input/type.js +0 -2
- package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -2
- package/dist/es/components/internal/LoadingCheck/index.js +0 -2
- package/dist/es/components/internal/Modal/Modal.js +40 -0
- package/dist/es/components/internal/Modal/modal2.js +1 -0
- package/dist/es/components/internal/Select/Select.js +0 -2
- package/dist/es/components/internal/Select/SelectMenu.js +0 -2
- package/dist/es/components/internal/Select/SelectMenuItem.js +0 -2
- package/dist/es/components/internal/icons/Icon3DSFail.js +3 -0
- package/dist/es/components/internal/icons/Icon3DSInfo.js +62 -0
- package/dist/es/components/internal/icons/Icon3DSSuccess.js +3 -0
- package/dist/es/config.js +0 -2
- package/dist/es/constant.js +3 -2
- package/dist/es/core/PayKKaCheckout.js +96 -42
- package/dist/es/core/Session.js +7 -6
- package/dist/es/core/environment.js +26 -0
- package/dist/es/core/error.js +21 -0
- package/dist/es/core/index.js +0 -2
- package/dist/es/core/query.js +0 -2
- package/dist/es/core.js +34 -34
- package/dist/es/hooks/index.js +0 -2
- package/dist/es/hooks/useBreakpoints.js +57 -0
- package/dist/es/hooks/useI18n.js +1 -2
- package/dist/es/hooks/usePayState.js +18 -24
- package/dist/es/i18n/index.js +0 -2
- package/dist/es/i18n/locales/de-DE.js +11 -1
- package/dist/es/i18n/locales/en-GB.js +11 -1
- package/dist/es/i18n/locales/es-ES.js +11 -1
- package/dist/es/i18n/locales/fr-FR.js +11 -1
- package/dist/es/i18n/locales/index.js +8 -6
- package/dist/es/i18n/locales/ja-JP.js +11 -1
- package/dist/es/i18n/locales/ko-KR.js +11 -1
- package/dist/es/i18n/locales/pt-PT.js +11 -1
- package/dist/es/i18n/locales/ru-RU.js +11 -1
- package/dist/es/i18n/locales/zh-CN.js +11 -1
- package/dist/es/i18n/locales/zh-HK.js +11 -1
- package/dist/es/i18n/locales/zh-TW.js +11 -1
- package/dist/es/i18n/util.js +11 -8
- package/dist/es/index.js +4 -2
- package/dist/es/style.css +186 -4
- package/dist/es/types/message.js +28 -0
- package/dist/es/utils/card-brand/brands.js +12 -10
- package/dist/es/utils/card-brand/index.js +3 -2
- package/dist/es/utils/iframe.js +23 -0
- package/dist/es/utils/index.js +0 -1
- package/dist/es/utils/style.js +47 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/checkout/type.d.ts +14 -1
- package/dist/types/api/modules/get-browser-params.d.ts +1 -1
- package/dist/types/components/AddressField/type.d.ts +1 -0
- package/dist/types/components/AliPay/type.d.ts +4 -2
- package/dist/types/components/ApplePay/type.d.ts +4 -3
- package/dist/types/components/Card/type.d.ts +56 -10
- package/dist/types/components/CardHolderNameField/type.d.ts +1 -1
- package/dist/types/components/CombinedCardInfo/CombinedCardInfo.d.ts +5 -0
- package/dist/types/components/CombinedCardInfo/index.d.ts +2 -0
- package/dist/types/components/{CombinedEncryptedField → CombinedCardInfo}/type.d.ts +3 -2
- package/dist/types/components/GooglePay/type.d.ts +4 -3
- package/dist/types/components/SecuredFieldsProvider/index.d.ts +1 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +1 -153
- package/dist/types/components/SecuredFieldsProvider/utils/index.d.ts +1 -1
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +2 -1
- package/dist/types/components/Sepa/type.d.ts +4 -2
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/ThreeDSAuth.d.ts +3 -0
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/index.d.ts +2 -0
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +17 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +2 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/index.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +5 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +3 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/output.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +6 -0
- package/dist/types/components/ThreeDS/index.d.ts +1 -0
- package/dist/types/components/WechatPay/type.d.ts +4 -2
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/internal/Input/type.d.ts +1 -0
- package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
- package/dist/types/components/internal/Loading/index.d.ts +1 -0
- package/dist/types/components/internal/Modal/Modal.d.ts +5 -0
- package/dist/types/components/internal/Modal/index.d.ts +0 -0
- package/dist/types/components/internal/Modal/type.d.ts +20 -0
- package/dist/types/components/internal/icons/Icon3DSFail.d.ts +2 -0
- package/dist/types/components/internal/icons/Icon3DSInfo.d.ts +2 -0
- package/dist/types/components/internal/icons/Icon3DSSuccess.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +3 -0
- package/dist/types/constant.d.ts +6 -2
- package/dist/types/core/PayKKaCheckout.d.ts +22 -6
- package/dist/types/core/Session.d.ts +1 -1
- package/dist/types/core/context.d.ts +1 -0
- package/dist/types/core/environment.d.ts +4 -0
- package/dist/types/core/error.d.ts +16 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useBreakpoints.d.ts +15 -0
- package/dist/types/hooks/usePayState.d.ts +3 -6
- package/dist/types/i18n/locales/de-DE.d.ts +8 -0
- package/dist/types/i18n/locales/en-GB.d.ts +8 -0
- package/dist/types/i18n/locales/es-ES.d.ts +8 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +8 -0
- package/dist/types/i18n/locales/index.d.ts +2 -2
- package/dist/types/i18n/locales/ja-JP.d.ts +8 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +8 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +8 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +8 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +8 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +8 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +39 -8
- package/dist/types/types/message.d.ts +170 -0
- package/dist/types/utils/card-brand/brands.d.ts +1 -8
- package/dist/types/utils/card-brand/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/style.d.ts +12 -0
- package/package.json +63 -63
- package/dist/es/components/CombinedEncryptedField/index.js +0 -75
- package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +0 -268
- package/dist/types/components/CombinedEncryptedField/CombinedEncryptedField.d.ts +0 -4
- package/dist/types/components/CombinedEncryptedField/index.d.ts +0 -2
- /package/dist/types/{components/SecuredFieldsProvider/utils → utils}/iframe.d.ts +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { CardBrand } from '../../types';
|
|
2
2
|
import type { FormItemProps, FormValidationStatus } from '../internal/Form';
|
|
3
3
|
import type { InputProps } from '../internal/Input';
|
|
4
|
-
export interface
|
|
4
|
+
export interface CombinedCardInfoProps extends Pick<FormItemProps, 'onValidationStatusChange' | 'className' | 'style'>, Pick<InputProps, 'onInput'> {
|
|
5
5
|
supportedCardBrands?: string[];
|
|
6
6
|
security: boolean;
|
|
7
|
+
showLabel?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export interface
|
|
9
|
+
export interface CombinedCardInfoRef {
|
|
9
10
|
focus: () => void;
|
|
10
11
|
blur: () => void;
|
|
11
12
|
resetValidation: (status: FormValidationStatus, errorTip?: string) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { PayKKaError } from '../../core';
|
|
2
|
+
import type { CoreProps, PaymentSuccessData } from '../../types';
|
|
3
|
+
export interface GooglePayProps extends CoreProps {
|
|
3
4
|
/** 支付授权成功后触发 */
|
|
4
5
|
onSubmit?: () => void;
|
|
5
6
|
/** 支付成功后触发 */
|
|
@@ -7,7 +8,7 @@ export interface GooglePayProps {
|
|
|
7
8
|
/** SDK 加载回调,status 为 true 表示加载成功,false 表示加载失败 */
|
|
8
9
|
onLoad?: (status: boolean) => void;
|
|
9
10
|
/** 支付失败时触发 */
|
|
10
|
-
onError?: (error:
|
|
11
|
+
onError?: (error: PayKKaError) => void;
|
|
11
12
|
/** 支付超时时触发 */
|
|
12
13
|
onTimeout?: (source: 'retry' | 'channel') => void;
|
|
13
14
|
/** 收银台已过期时触发 */
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'preact/compat';
|
|
2
2
|
import type { SessionMode } from '../../constant';
|
|
3
3
|
import type { I18n } from '../../i18n';
|
|
4
|
-
import type {
|
|
5
|
-
import type { FormValidationStatus } from '../internal/Form';
|
|
6
|
-
import type { CardBrand, InputStylesConfig } from '../../types';
|
|
7
|
-
import type { EncryptCardRes } from '../../api/modules/encrypted-card/type';
|
|
4
|
+
import type { EncryptCardMessage, InputStylesConfig, Message, MessageAction } from '../../types';
|
|
8
5
|
export interface SecuredFieldsProviderProps extends SecuredFieldsCallback {
|
|
9
6
|
i18n: I18n;
|
|
10
7
|
supportedCardBrands: string[];
|
|
@@ -43,49 +40,6 @@ export declare enum EFieldType {
|
|
|
43
40
|
EXPIRE_DATE = "EXPIRE_DATE"
|
|
44
41
|
}
|
|
45
42
|
export type FieldType = keyof typeof EFieldType;
|
|
46
|
-
export declare enum MessageAction {
|
|
47
|
-
/** 通知 iframe 初始化 input */
|
|
48
|
-
INIT = "init",
|
|
49
|
-
/** 表单 iframe DOM 已加载 */
|
|
50
|
-
ACTIVATED = "Activated",
|
|
51
|
-
/** 隐藏的 iframe 已经加载 */
|
|
52
|
-
HIDDEN_IFRAME_READY = "hiddenIframeReady",
|
|
53
|
-
/** 是否聚焦 */
|
|
54
|
-
FOCUS = "focus",
|
|
55
|
-
/** 卡 bin 信息改变 */
|
|
56
|
-
BIN_VALUE = "binValue",
|
|
57
|
-
/** 检测到卡品牌 */
|
|
58
|
-
BRAND = "brand",
|
|
59
|
-
/** 传递验证通过信息(附带值) */
|
|
60
|
-
VALID_WITH_VALUE = "validWithValue",
|
|
61
|
-
/** 通知隐藏 iframe 进行支付 */
|
|
62
|
-
PAYMENT = "payment",
|
|
63
|
-
/** 通知表单组件支付响应信息 */
|
|
64
|
-
AFTER_PAYMENT = "afterPayment",
|
|
65
|
-
/** 通知表单组件支付错误信息 */
|
|
66
|
-
PAYMENT_ERROR = "paymentError",
|
|
67
|
-
/** 通知表单组件支付超时 */
|
|
68
|
-
PAYMENT_TIMEOUT = "paymentTimeout",
|
|
69
|
-
/** 通知表单项验证信息 */
|
|
70
|
-
VALID_STATUS_CHANGED = "validStatusChanged",
|
|
71
|
-
/** 通知表单项校验 */
|
|
72
|
-
VALIDATE = "validate",
|
|
73
|
-
/** 通知表单项校验结果 */
|
|
74
|
-
VALIDATED = "validated",
|
|
75
|
-
/** 通知表单项配置 */
|
|
76
|
-
SET_CONFIG = "setConfig",
|
|
77
|
-
/**
|
|
78
|
-
* frames
|
|
79
|
-
*/
|
|
80
|
-
/** 通知 clientKey 已校验 */
|
|
81
|
-
AUTHORIZED = "authorized",
|
|
82
|
-
/** 通知隐藏 iframe 加密卡信息 */
|
|
83
|
-
ENCRYPT_CARD = "encryptCard",
|
|
84
|
-
/** 通知加密后的卡信息 */
|
|
85
|
-
CARD_ENCRYPTED = "cardEncrypted",
|
|
86
|
-
/** 通知卡信息加密错误 */
|
|
87
|
-
CARD_ENCRYPTION_FAILED = "cardEncryptionFailed"
|
|
88
|
-
}
|
|
89
43
|
export interface SecuredFieldConfig extends FieldIframeConfig, SecuredFieldsCallback {
|
|
90
44
|
rootNode: HTMLElement;
|
|
91
45
|
fieldNode: HTMLElement;
|
|
@@ -100,112 +54,6 @@ export interface FieldIframeConfig {
|
|
|
100
54
|
supportedCardBrands: string[];
|
|
101
55
|
style?: InputStylesConfig;
|
|
102
56
|
}
|
|
103
|
-
/**
|
|
104
|
-
* message data
|
|
105
|
-
*/
|
|
106
|
-
export type Message<T extends MessageAction> = {
|
|
107
|
-
action: T;
|
|
108
|
-
} & MessageMapping[T];
|
|
109
|
-
type MessageMapping = {
|
|
110
|
-
[MessageAction.INIT]: InitMessage;
|
|
111
|
-
[MessageAction.FOCUS]: FocusMessage;
|
|
112
|
-
[MessageAction.BIN_VALUE]: BinValueMessage;
|
|
113
|
-
[MessageAction.VALID_WITH_VALUE]: ValidWithValueMessage;
|
|
114
|
-
[MessageAction.PAYMENT]: PaymentMessage;
|
|
115
|
-
[MessageAction.AFTER_PAYMENT]: AfterPaymentMessage;
|
|
116
|
-
[MessageAction.PAYMENT_ERROR]: PaymentErrorMessage;
|
|
117
|
-
[MessageAction.PAYMENT_TIMEOUT]: PaymentTimeoutMessage;
|
|
118
|
-
[MessageAction.VALID_STATUS_CHANGED]: ValidStatusChangedMessage;
|
|
119
|
-
[MessageAction.ENCRYPT_CARD]: EncryptCardMessage;
|
|
120
|
-
[MessageAction.CARD_ENCRYPTED]: CardEncryptedMessage;
|
|
121
|
-
[MessageAction.CARD_ENCRYPTION_FAILED]: CardEncryptionFailedMessage;
|
|
122
|
-
[MessageAction.AUTHORIZED]: AuthorizedMessage;
|
|
123
|
-
[MessageAction.BRAND]: BrandMessage;
|
|
124
|
-
[MessageAction.ACTIVATED]: ActivatedMessage;
|
|
125
|
-
[MessageAction.HIDDEN_IFRAME_READY]: {};
|
|
126
|
-
[MessageAction.VALIDATE]: {};
|
|
127
|
-
[MessageAction.VALIDATED]: ValidatedMessage;
|
|
128
|
-
[MessageAction.SET_CONFIG]: SetConfigMessage;
|
|
129
|
-
};
|
|
130
|
-
export interface InitMessage {
|
|
131
|
-
config?: FieldIframeConfig;
|
|
132
|
-
/** 是否隐藏,如不隐藏则为表单iframe */
|
|
133
|
-
hidden: boolean;
|
|
134
|
-
apiUrl?: string;
|
|
135
|
-
cdnUrl?: string;
|
|
136
|
-
}
|
|
137
|
-
export interface FocusMessage {
|
|
138
|
-
focus: boolean;
|
|
139
|
-
fieldType: EFieldType;
|
|
140
|
-
}
|
|
141
|
-
export interface InvalidMessage {
|
|
142
|
-
errorTip: string;
|
|
143
|
-
fieldType: EFieldType;
|
|
144
|
-
}
|
|
145
|
-
export interface ValidMessage {
|
|
146
|
-
fieldType: EFieldType;
|
|
147
|
-
}
|
|
148
|
-
export interface BinValueMessage {
|
|
149
|
-
binValue: string;
|
|
150
|
-
fieldType: EFieldType;
|
|
151
|
-
brand?: CardBrand;
|
|
152
|
-
}
|
|
153
|
-
export interface ValidWithValueMessage {
|
|
154
|
-
value: string;
|
|
155
|
-
fieldType: EFieldType;
|
|
156
|
-
}
|
|
157
|
-
export interface PaymentMessage {
|
|
158
|
-
formData: any;
|
|
159
|
-
locale: string;
|
|
160
|
-
}
|
|
161
|
-
export interface AfterPaymentMessage {
|
|
162
|
-
response: PayRes;
|
|
163
|
-
}
|
|
164
|
-
export interface PaymentErrorMessage {
|
|
165
|
-
error: {
|
|
166
|
-
message: string;
|
|
167
|
-
code: string;
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
export interface ValidStatusChangedMessage {
|
|
171
|
-
status: FormValidationStatus;
|
|
172
|
-
errorTip?: string;
|
|
173
|
-
fieldType: EFieldType;
|
|
174
|
-
}
|
|
175
|
-
export interface PaymentTimeoutMessage {
|
|
176
|
-
message?: string;
|
|
177
|
-
}
|
|
178
|
-
export interface CardEncryptedMessage {
|
|
179
|
-
encryptedInfo: EncryptCardRes;
|
|
180
|
-
}
|
|
181
|
-
export interface CardEncryptionFailedMessage {
|
|
182
|
-
error: {
|
|
183
|
-
message: string;
|
|
184
|
-
code: string;
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
export interface AuthorizedMessage {
|
|
188
|
-
success: boolean;
|
|
189
|
-
}
|
|
190
|
-
export interface BrandMessage {
|
|
191
|
-
brand?: CardBrand;
|
|
192
|
-
fieldType: EFieldType;
|
|
193
|
-
}
|
|
194
|
-
export interface EncryptCardMessage {
|
|
195
|
-
merchantId: string;
|
|
196
|
-
clientKey: string;
|
|
197
|
-
}
|
|
198
|
-
export interface ActivatedMessage {
|
|
199
|
-
fieldType: EFieldType;
|
|
200
|
-
}
|
|
201
|
-
export interface ValidatedMessage {
|
|
202
|
-
status: FormValidationStatus;
|
|
203
|
-
fieldType: EFieldType;
|
|
204
|
-
}
|
|
205
|
-
export interface SetConfigMessage {
|
|
206
|
-
style?: InputStylesConfig;
|
|
207
|
-
}
|
|
208
57
|
export declare const SECURED_FILED_ATTR = "data-sf";
|
|
209
58
|
export declare const SECURED_IFRAME_CLASS_NAME = "secured-iframe";
|
|
210
59
|
export declare const HIDDEN_IFRAME_NAME = "hidden-pay-iframe";
|
|
211
|
-
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './fields';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './securedFields';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EFieldType
|
|
1
|
+
import { EFieldType } from '../SecuredFieldsProvider/type';
|
|
2
|
+
import type { Message, MessageAction } from '../../types';
|
|
2
3
|
export declare const useSecuredInput: () => {
|
|
3
4
|
value: import("preact/hooks").MutableRef<string>;
|
|
4
5
|
cardBin: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { PayKKaError } from '../../core';
|
|
2
|
+
import type { CoreProps } from '../../types';
|
|
1
3
|
import type { FormValidateError } from '../internal/Form';
|
|
2
|
-
export interface SepaProps {
|
|
4
|
+
export interface SepaProps extends CoreProps {
|
|
3
5
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
4
6
|
onSuccess?: (returnUrl?: string) => void;
|
|
5
|
-
onError?: (error:
|
|
7
|
+
onError?: (error: PayKKaError) => void;
|
|
6
8
|
onTimeout?: () => void;
|
|
7
9
|
onAuthorized?: () => void;
|
|
8
10
|
onExpired?: () => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CheckoutTheme } from '../../../../api';
|
|
2
|
+
export interface ThreeDSAuthProps {
|
|
3
|
+
/** 是否展示弹框 */
|
|
4
|
+
show: boolean;
|
|
5
|
+
/** 是否已完成 3DS 认证 */
|
|
6
|
+
incomplete?: boolean;
|
|
7
|
+
/** 3DS 认证页面地址 */
|
|
8
|
+
url?: string;
|
|
9
|
+
/** 弹窗宽度,不传就自适应 */
|
|
10
|
+
width?: number | string;
|
|
11
|
+
/** 弹窗高度,不传就自适应 */
|
|
12
|
+
height?: number | string;
|
|
13
|
+
/** 主题 */
|
|
14
|
+
theme?: CheckoutTheme;
|
|
15
|
+
/** 关闭弹框 */
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ThreeDSIframe';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/ThreeDSAuth';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PayRes } from '../../api';
|
|
2
|
+
import type { PayKKaError } from '../../core';
|
|
3
|
+
import type { CoreProps } from '../../types';
|
|
2
4
|
import type { FormValidateError } from '../internal/Form';
|
|
3
|
-
export interface WechatPayProps {
|
|
5
|
+
export interface WechatPayProps extends CoreProps {
|
|
4
6
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
5
7
|
onSuccess?: (...args: any[]) => void;
|
|
6
|
-
onError?: (error:
|
|
8
|
+
onError?: (error: PayKKaError) => void;
|
|
7
9
|
onTimeout?: (source: 'retry' | 'channel') => void;
|
|
8
10
|
onExpired?: () => void;
|
|
9
11
|
onSubmitResponse?: (payRes: PayRes) => void;
|
|
@@ -7,6 +7,7 @@ export interface InputProps extends HTMLAttributes<HTMLInputElement>, CustomAttr
|
|
|
7
7
|
rightIcon?: ReactNode;
|
|
8
8
|
leftIcon?: ReactNode;
|
|
9
9
|
inputClassName?: string;
|
|
10
|
+
showStatus?: boolean;
|
|
10
11
|
onCompositionStart?: (e: CompositionEvent) => void;
|
|
11
12
|
}
|
|
12
13
|
export interface InputRef {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Loading: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Loading';
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from "preact/compat";
|
|
2
|
+
import type { CustomAttributes } from "../../../types";
|
|
3
|
+
export interface ModalProps extends CustomAttributes<HTMLDivElement> {
|
|
4
|
+
/** 是否展示弹框 */
|
|
5
|
+
show: boolean;
|
|
6
|
+
/** 弹窗宽度,不传就自适应 */
|
|
7
|
+
width?: number | string;
|
|
8
|
+
/** 弹窗高度,不传就自适应 */
|
|
9
|
+
height?: number | string;
|
|
10
|
+
/** 点击蒙层是否关闭弹窗,不传默认可关闭 */
|
|
11
|
+
maskClosable?: boolean;
|
|
12
|
+
/** 弹窗头部内容 */
|
|
13
|
+
header?: ReactNode;
|
|
14
|
+
/** 弹窗内容 */
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
/** 弹窗状态改变时调用 */
|
|
17
|
+
onChange?: (status: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ModalRef {
|
|
20
|
+
}
|
package/dist/types/constant.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export declare enum EAddressType {
|
|
|
32
32
|
ADDRESS_2 = "ADDRESS_2"
|
|
33
33
|
}
|
|
34
34
|
export declare enum SessionMode {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
/** 单页面收银台 */
|
|
36
|
+
HOSTED = "HOSTED",
|
|
37
|
+
/** 嵌入式收银台 */
|
|
38
|
+
DROP_IN = "DROP_IN",
|
|
39
|
+
/** 组件式收银台 */
|
|
40
|
+
COMPONENT = "COMPONENT"
|
|
37
41
|
}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { ComponentType, JSX } from 'preact';
|
|
2
|
-
import type { PayKKaInitConfiguration } from '../types';
|
|
2
|
+
import type { CoreProps, PayKKaEnvConfig, PayKKaInitConfiguration } from '../types';
|
|
3
|
+
import { type ComponentInst } from './create';
|
|
3
4
|
import { Session } from './Session';
|
|
5
|
+
import getFraudDetectionInstance from '../out/fraud-detection';
|
|
6
|
+
export type FraudDetectionType = ReturnType<typeof getFraudDetectionInstance>;
|
|
7
|
+
/**
|
|
8
|
+
* 收银台实例
|
|
9
|
+
* 不能用单例,如果使用单页面应用,在路由切换时不会重新初始化,会导致收银台配置和状态相互影响
|
|
10
|
+
*/
|
|
4
11
|
export declare class PayKKaCheckout {
|
|
5
|
-
private
|
|
6
|
-
private static session?;
|
|
7
|
-
private static instance;
|
|
12
|
+
#private;
|
|
8
13
|
constructor(config: PayKKaInitConfiguration);
|
|
9
14
|
private init;
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
12
28
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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,19 +1,16 @@
|
|
|
1
1
|
import type { SubmitButtonStatus } from '../components';
|
|
2
|
-
import { Session } from '../core';
|
|
3
|
-
export declare function usePayState(): {
|
|
2
|
+
import type { Session } from '../core';
|
|
3
|
+
export declare function usePayState(session: Session): {
|
|
4
4
|
validated: boolean;
|
|
5
5
|
setValidated: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<boolean>>;
|
|
6
6
|
submitButtonStatus: SubmitButtonStatus;
|
|
7
7
|
setSubmitButtonStatus: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<SubmitButtonStatus>>;
|
|
8
8
|
errorMsg: string;
|
|
9
9
|
setErrorMsg: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<string>>;
|
|
10
|
-
session: Session | null;
|
|
11
|
-
setSession: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<Session | null>>;
|
|
12
|
-
sessionReady: boolean;
|
|
13
|
-
setSessionReady: import("preact/hooks").Dispatch<import("preact/hooks").StateUpdater<boolean>>;
|
|
14
10
|
i18n: import("../i18n").I18n;
|
|
15
11
|
fraudDetection: {
|
|
16
12
|
fraudDetectionID: string;
|
|
17
13
|
createFraudDetection: () => Promise<void>;
|
|
18
14
|
} | null;
|
|
15
|
+
sessionReady: boolean;
|
|
19
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;
|