@paykka/card-checkout-ui 0.5.15 → 0.6.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 +22 -0
- package/dist/card-checkout-ui.umd.cjs +19 -5
- package/dist/es/api/index.js +3 -0
- package/dist/es/api/modules/checkout/map.js +2 -1
- package/dist/es/api/modules/encrypted-card/index.js +54 -0
- package/dist/es/api/modules/get-browser-params.js +2 -2
- package/dist/es/api/modules/index.js +3 -0
- package/dist/es/components/AccountNameField/index.js +4 -0
- package/dist/es/components/AddressField/index.js +4 -0
- package/dist/es/components/AliPay/index.js +8 -8
- package/dist/es/components/ApplePay/index.js +71 -14
- package/dist/es/components/Card/index.js +56 -40
- package/dist/es/components/CardExpireDateField/index.js +8 -3
- package/dist/es/components/CardHolderNameField/index.js +4 -0
- package/dist/es/components/CardIBANField/index.js +4 -0
- package/dist/es/components/CardNumberField/index.js +34 -17
- package/dist/es/components/CardSecurityCodeField/index.js +8 -3
- package/dist/es/components/CardSelector/index.js +3 -0
- package/dist/es/components/CombinedEncryptedField/index.js +75 -0
- package/dist/es/components/EmailField/EmailField.js +4 -0
- package/dist/es/components/EncryptedCard/index.js +448 -0
- package/dist/es/components/GooglePay/index.js +57 -19
- package/dist/es/components/RecurringTip/index.js +1 -1
- package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +70 -25
- package/dist/es/components/SecuredIframe/index.js +190 -22
- package/dist/es/components/Sepa/index.js +16 -6
- package/dist/es/components/WechatPay/index.js +8 -8
- package/dist/es/components/index.js +4 -0
- package/dist/es/components/internal/CheckBox/CheckBox.js +1 -1
- package/dist/es/components/internal/Form/FormItem.js +28 -24
- package/dist/es/components/internal/Form/index.js +1 -0
- package/dist/es/components/internal/Form/type.js +15 -1
- package/dist/es/components/internal/Input/Input.js +9 -11
- package/dist/es/components/internal/Input/index.js +1 -0
- package/dist/es/components/internal/Input/type.js +13 -1
- package/dist/es/components/internal/Select/Select.js +2 -0
- package/dist/es/config.js +23 -6
- package/dist/es/constant.js +10 -0
- package/dist/es/core/PayKKaCheckout.js +62 -0
- package/dist/es/core/Session.js +3 -0
- package/dist/es/core/index.js +2 -0
- package/dist/es/core/query.js +4 -6
- package/dist/es/core.js +30 -30
- package/dist/es/hooks/useI18n.js +2 -2
- package/dist/es/hooks/usePayState.js +14 -25
- package/dist/es/i18n/I18n.js +11 -8
- package/dist/es/index.js +16 -3
- package/dist/es/out/fraud-detection.js +99 -0
- package/dist/es/style.css +8 -0
- package/dist/es/types/{radar.js → fraud-detection.js} +1 -1
- package/dist/es/types/index.js +49 -1
- package/dist/es/utils/card-brand/brands.js +16 -42
- package/dist/es/utils/index.js +11 -0
- package/dist/es/utils/load.js +14 -0
- package/dist/es/utils/style.js +37 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/checkout/map.d.ts +1 -0
- package/dist/types/api/modules/encrypted-card/index.d.ts +6 -0
- package/dist/types/api/modules/encrypted-card/type.d.ts +31 -0
- package/dist/types/api/modules/get-browser-params.d.ts +2 -2
- package/dist/types/components/AliPay/type.d.ts +0 -4
- package/dist/types/components/ApplePay/type.d.ts +16 -7
- package/dist/types/components/ApplePay/utils.d.ts +3 -0
- package/dist/types/components/Card/type.d.ts +15 -5
- package/dist/types/components/CardExpireDateField/type.d.ts +1 -0
- package/dist/types/components/CardNumberField/type.d.ts +3 -0
- package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -0
- package/dist/types/components/CombinedEncryptedField/CombinedEncryptedField.d.ts +4 -0
- package/dist/types/components/CombinedEncryptedField/index.d.ts +2 -0
- package/dist/types/components/CombinedEncryptedField/type.d.ts +15 -0
- package/dist/types/components/EncryptedCard/EncryptedCard.d.ts +4 -0
- package/dist/types/components/EncryptedCard/index.d.ts +4 -0
- package/dist/types/components/EncryptedCard/output.d.ts +9 -0
- package/dist/types/components/EncryptedCard/type.d.ts +85 -0
- package/dist/types/components/GooglePay/type.d.ts +17 -8
- package/dist/types/components/GooglePay/utils.d.ts +2 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +103 -22
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +6 -2
- package/dist/types/components/Sepa/type.d.ts +0 -4
- package/dist/types/components/WechatPay/type.d.ts +0 -4
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/internal/Form/FormItem.d.ts +1 -1
- package/dist/types/components/internal/Form/type.d.ts +7 -0
- package/dist/types/components/internal/Input/Input.d.ts +1 -1
- package/dist/types/components/internal/Input/type.d.ts +6 -0
- package/dist/types/config.d.ts +10 -3
- package/dist/types/constant.d.ts +1 -0
- package/dist/types/core/PayKKaCheckout.d.ts +12 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/query.d.ts +2 -2
- package/dist/types/hooks/useI18n.d.ts +2 -2
- package/dist/types/hooks/usePayState.d.ts +4 -22
- package/dist/types/i18n/I18n.d.ts +6 -5
- package/dist/types/i18n/locales/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/out/fraud-detection.d.ts +9 -0
- package/dist/types/types/{radar.d.ts → fraud-detection.d.ts} +3 -2
- package/dist/types/types/index.d.ts +69 -1
- package/dist/types/utils/card-brand/brands.d.ts +3 -10
- package/dist/types/utils/card-brand/index.d.ts +10 -9
- package/dist/types/utils/format.d.ts +2 -3
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/load.d.ts +7 -0
- package/dist/types/utils/style.d.ts +17 -0
- package/package.json +2 -2
- package/dist/card-checkout-ui.iife.js +0 -8
- package/dist/es/out/radar.js +0 -123
- package/dist/types/out/radar.d.ts +0 -14
|
@@ -1,3 +1,71 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'preact/compat';
|
|
2
|
-
|
|
2
|
+
import type { LocaleKeyType } from '../i18n';
|
|
3
|
+
import type { FraudDetectionEnv } from './fraud-detection';
|
|
4
|
+
export * from './fraud-detection';
|
|
3
5
|
export type CustomAttributes<T extends EventTarget, K extends keyof HTMLAttributes<T> = 'style' | 'className'> = Pick<HTMLAttributes<T>, K>;
|
|
6
|
+
/** 收银台初始化参数 */
|
|
7
|
+
export interface PayKKaInitConfiguration {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
/** 嵌入式收银台必传,需要商户进行配置 */
|
|
10
|
+
clientKey?: string;
|
|
11
|
+
/** 国际化语言 */
|
|
12
|
+
locale?: LocaleKeyType;
|
|
13
|
+
/** 是否隐藏支付按钮 */
|
|
14
|
+
hidePaymentButton?: boolean;
|
|
15
|
+
/** 欺诈检测环境配置 */
|
|
16
|
+
fraudDetectionEnv?: FraudDetectionEnv;
|
|
17
|
+
/** 收银台已经获取到可用支付方式时调用 */
|
|
18
|
+
onPaymentMethodsReady?: (methods: string[]) => void;
|
|
19
|
+
/** 收银台过期时触发,可被组件参数中的 onExpired 回调覆盖 */
|
|
20
|
+
/** 收银台创建时报错触发 */
|
|
21
|
+
onInitError?: (error: any) => void;
|
|
22
|
+
/**
|
|
23
|
+
* sandbox 模式下所需参数
|
|
24
|
+
*/
|
|
25
|
+
/** 是否采用 sandbox 环境,用于进行测试 */
|
|
26
|
+
sandbox?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type PaymentSuccessData = {
|
|
29
|
+
returnUrl?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare enum CardBrandCode {
|
|
32
|
+
VISA = "VISA",
|
|
33
|
+
MASTER_CARD = "MASTER_CARD",
|
|
34
|
+
JCB = "JCB",
|
|
35
|
+
AMEX = "AMEX",
|
|
36
|
+
DISCOVER = "DISCOVER",
|
|
37
|
+
DINERS_CLUB = "DINERS_CLUB"
|
|
38
|
+
}
|
|
39
|
+
export type CardBrand = keyof typeof CardBrandCode;
|
|
40
|
+
export interface ElementStylesConfig {
|
|
41
|
+
/** input 元素的样式 */
|
|
42
|
+
input?: InputStylesConfig;
|
|
43
|
+
/** label 文案的样式 */
|
|
44
|
+
label?: StylesConfig;
|
|
45
|
+
/** 错误提示文案的样式 */
|
|
46
|
+
errorMessage?: Partial<CSSStyleDeclaration>;
|
|
47
|
+
}
|
|
48
|
+
export interface StylesConfig {
|
|
49
|
+
/** 默认样式 */
|
|
50
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
51
|
+
/** 校验通过时样式 */
|
|
52
|
+
valid?: Partial<CSSStyleDeclaration>;
|
|
53
|
+
/** 校验不通过时样式 */
|
|
54
|
+
invalid?: Partial<CSSStyleDeclaration>;
|
|
55
|
+
/** 聚焦元素时样式 */
|
|
56
|
+
focus?: Partial<CSSStyleDeclaration>;
|
|
57
|
+
}
|
|
58
|
+
export interface InputStylesConfig extends StylesConfig {
|
|
59
|
+
/** placeholder样式 */
|
|
60
|
+
placeholder?: {
|
|
61
|
+
/** 默认样式 */
|
|
62
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
63
|
+
/** 聚焦元素时样式 */
|
|
64
|
+
focus?: Partial<CSSStyleDeclaration>;
|
|
65
|
+
};
|
|
66
|
+
/** 将鼠标悬停在元素上的样式 */
|
|
67
|
+
hover?: Partial<CSSStyleDeclaration>;
|
|
68
|
+
}
|
|
69
|
+
export declare const defaultInputStyleConfig: InputStylesConfig;
|
|
70
|
+
export declare const inputStyleAttrs: string[];
|
|
71
|
+
export type StyleStatusType = 'valid' | 'invalid' | 'focus' | 'blur' | 'base';
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { IconAmex, IconDinnersClub, IconDiscover, IconJcb, IconMasterCard, IconVisa } from '../../components/internal/icons';
|
|
2
|
-
|
|
3
|
-
VISA = "VISA",
|
|
4
|
-
MASTER_CARD = "MASTER_CARD",
|
|
5
|
-
JCB = "JCB",
|
|
6
|
-
AMEX = "AMEX",
|
|
7
|
-
DISCOVER = "DISCOVER",
|
|
8
|
-
DINERS_CLUB = "DINERS_CLUB"
|
|
9
|
-
}
|
|
2
|
+
import { CardBrandCode } from '../../types';
|
|
10
3
|
export declare const cardBrandCodes: CardBrandCode[];
|
|
11
|
-
export interface
|
|
4
|
+
export interface CardBrandConfig {
|
|
12
5
|
name: string;
|
|
13
6
|
code: CardBrandCode;
|
|
14
7
|
pattern: RegExp;
|
|
15
8
|
lengths: number[];
|
|
16
9
|
order: number;
|
|
17
10
|
}
|
|
18
|
-
export declare const cardBrands:
|
|
11
|
+
export declare const cardBrands: CardBrandConfig[];
|
|
19
12
|
export declare const cardBrandIconMap: {
|
|
20
13
|
VISA: typeof IconVisa;
|
|
21
14
|
MASTER_CARD: typeof IconMasterCard;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { cardBrands, cardBrandsLengthList, cardBrandCodes, cardBrandIconMap, type
|
|
2
|
-
export { cardBrands, cardBrandsLengthList, cardBrandCodes, cardBrandIconMap
|
|
3
|
-
export declare function getSupportedCardBrands(supportedCardBrands?: string[]):
|
|
4
|
-
export declare function findCardBrand(number: string, brands?:
|
|
5
|
-
export declare function findCardBrandInfo(number: string, brands?:
|
|
1
|
+
import { cardBrands, cardBrandsLengthList, cardBrandCodes, cardBrandIconMap, type CardBrandConfig } from './brands';
|
|
2
|
+
export { cardBrands, cardBrandsLengthList, cardBrandCodes, cardBrandIconMap };
|
|
3
|
+
export declare function getSupportedCardBrands(supportedCardBrands?: string[]): CardBrandConfig[];
|
|
4
|
+
export declare function findCardBrand(number: string, brands?: CardBrandConfig[]): CardBrandConfig | undefined;
|
|
5
|
+
export declare function findCardBrandInfo(number: string, brands?: CardBrandConfig[]): {
|
|
6
6
|
icon: typeof import("../../components/internal/icons").IconVisa | typeof import("../../components/internal/icons").IconMasterCard | typeof import("../../components/internal/icons").IconJcb | typeof import("../../components/internal/icons").IconAmex | typeof import("../../components/internal/icons").IconDiscover | typeof import("../../components/internal/icons").IconDinnersClub;
|
|
7
7
|
name: string;
|
|
8
|
-
code: import("
|
|
8
|
+
code: import("../../types").CardBrandCode;
|
|
9
9
|
pattern: RegExp;
|
|
10
10
|
lengths: number[];
|
|
11
11
|
order: number;
|
|
12
12
|
} | undefined;
|
|
13
|
-
export declare function getCardBrandInfo(brand:
|
|
13
|
+
export declare function getCardBrandInfo(brand: CardBrandConfig): {
|
|
14
14
|
icon: typeof import("../../components/internal/icons").IconVisa | typeof import("../../components/internal/icons").IconMasterCard | typeof import("../../components/internal/icons").IconJcb | typeof import("../../components/internal/icons").IconAmex | typeof import("../../components/internal/icons").IconDiscover | typeof import("../../components/internal/icons").IconDinnersClub;
|
|
15
15
|
name: string;
|
|
16
|
-
code: import("
|
|
16
|
+
code: import("../../types").CardBrandCode;
|
|
17
17
|
pattern: RegExp;
|
|
18
18
|
lengths: number[];
|
|
19
19
|
order: number;
|
|
20
20
|
};
|
|
21
|
+
export type CardBrandInfo = ReturnType<typeof getCardBrandInfo>;
|
|
21
22
|
export declare function finCardBrandInfoByCode(code: string): {
|
|
22
23
|
icon: typeof import("../../components/internal/icons").IconVisa | typeof import("../../components/internal/icons").IconMasterCard | typeof import("../../components/internal/icons").IconJcb | typeof import("../../components/internal/icons").IconAmex | typeof import("../../components/internal/icons").IconDiscover | typeof import("../../components/internal/icons").IconDinnersClub;
|
|
23
24
|
name: string;
|
|
24
|
-
code: import("
|
|
25
|
+
code: import("../../types").CardBrandCode;
|
|
25
26
|
pattern: RegExp;
|
|
26
27
|
lengths: number[];
|
|
27
28
|
order: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const normalizedStyle: <T extends string | Recordable<any
|
|
2
|
-
export declare const normalizedClass: <T extends string | Recordable<any
|
|
1
|
+
export declare const normalizedStyle: <T extends string | Nil | Recordable<any>>(...args: MaybeArray<T>[]) => string;
|
|
2
|
+
export declare const normalizedClass: <T extends string | Nil | Recordable<any>>(...args: MaybeArray<T>[]) => string;
|
|
3
3
|
export declare function limitedToNumber(val: string, whitelist?: string[]): string;
|
|
4
4
|
export declare function trimAll(str: string): string;
|
|
5
5
|
export declare function toFixed(num: number, digits?: number): string;
|
|
@@ -14,4 +14,3 @@ export declare function parseE164(phoneNumber?: string): {
|
|
|
14
14
|
areaCode: string;
|
|
15
15
|
phoneNumber: string;
|
|
16
16
|
} | null;
|
|
17
|
-
export declare const style2String: (style: Recordable) => string;
|
|
@@ -7,6 +7,7 @@ export * from './deep-freeze';
|
|
|
7
7
|
export * from './format';
|
|
8
8
|
export * from './is';
|
|
9
9
|
export * from './obj';
|
|
10
|
+
export * from './style';
|
|
10
11
|
export declare function getIf<T>(value: T, condition: boolean): T | undefined;
|
|
11
12
|
/**
|
|
12
13
|
* 将一个数值限制在指定的范围内
|
|
@@ -22,3 +23,5 @@ export declare const safeParse: <T>(dataStr: string, defaultValue?: {}) => T;
|
|
|
22
23
|
* @return {*}
|
|
23
24
|
*/
|
|
24
25
|
export declare function isExpired(expireDate: string): boolean;
|
|
26
|
+
/** 获取两个数组的交集 */
|
|
27
|
+
export declare const intersection: <T>(...arrays: T[][]) => T[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将对象转换为 CSS 样式字符串
|
|
3
|
+
* @param style 样式对象
|
|
4
|
+
* @returns CSS 样式字符串
|
|
5
|
+
*/
|
|
6
|
+
export declare const style2String: (style?: Recordable) => string;
|
|
7
|
+
/** 生成 className 映射 */
|
|
8
|
+
export declare const generateClassNameMap: (selector?: string) => {
|
|
9
|
+
focus: string;
|
|
10
|
+
hover: string;
|
|
11
|
+
valid: string;
|
|
12
|
+
invalid: string;
|
|
13
|
+
};
|
|
14
|
+
/** 动态加载样式 */
|
|
15
|
+
export declare const loadStyle: (styleStr: string, extraOptions?: Partial<HTMLScriptElement>) => void;
|
|
16
|
+
/** 创建 placeholder 样式 */
|
|
17
|
+
export declare const createPlaceholderStyle: (selector: string, style?: Recordable) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paykka/card-checkout-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/paykka-card-checkout-ui.umd.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@ctrl/tinycolor": "^4.0.3",
|
|
42
42
|
"@fingerprintjs/fingerprintjs": "^4.2.2",
|
|
43
43
|
"@preact/signals": "^1.3.0",
|
|
44
|
-
"@types/applepayjs": "^14.0.
|
|
44
|
+
"@types/applepayjs": "^14.0.9",
|
|
45
45
|
"@types/googlepay": "^0.7.6",
|
|
46
46
|
"preact": "^10.24.3",
|
|
47
47
|
"ts-toolbelt": "^9.6.0",
|