@paykka/card-checkout-ui 0.7.0 → 0.9.2
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 +27 -20
- package/dist/card-checkout-ui.umd.cjs +27 -20
- package/dist/es/_commonjsHelpers.js +1 -0
- package/dist/es/api/http.js +19 -21
- package/dist/es/api/index.js +1 -0
- package/dist/es/api/modules/ali-pay/index.js +19 -11
- package/dist/es/api/modules/apple-pay/index.js +10 -26
- package/dist/es/api/modules/boost/index.js +56 -0
- package/dist/es/api/modules/card/index.js +17 -11
- package/dist/es/api/modules/checkout/index.js +6 -6
- package/dist/es/api/modules/checkout/map.js +29 -1
- package/dist/es/api/modules/gcash/index.js +56 -0
- package/dist/es/api/modules/get-browser-params.js +2 -2
- package/dist/es/api/modules/google-pay/index.js +10 -26
- package/dist/es/api/modules/grab-pay/index.js +56 -0
- package/dist/es/api/modules/index.js +1 -0
- package/dist/es/api/modules/line-pay/index.js +56 -0
- package/dist/es/api/modules/may-bank-qr-pay/index.js +56 -0
- package/dist/es/api/modules/nine-pay/index.js +56 -0
- package/dist/es/api/modules/paymaya/index.js +56 -0
- package/dist/es/api/modules/sepa/index.js +19 -11
- package/dist/es/api/modules/shopee-pay/index.js +56 -0
- package/dist/es/api/modules/tng-wallet/index.js +56 -0
- package/dist/es/api/modules/wechat-pay/index.js +18 -31
- package/dist/es/components/AccordionItem/AccordionItem.js +36 -0
- package/dist/es/components/AliPay/index.js +58 -60
- package/dist/es/components/ApplePay/index.js +29 -43
- package/dist/es/components/Boost/index.js +322 -0
- package/dist/es/components/Card/index.js +89 -75
- package/dist/es/components/CardBrands/index.js +2 -2
- package/dist/es/components/CardNumberField/index.js +113 -106
- package/dist/es/components/DropIn/index.js +365 -0
- package/dist/es/components/GooglePay/index.js +15 -7
- package/dist/es/components/GrabPay/index.js +322 -0
- package/dist/es/components/GuideCard/index.js +43 -0
- package/dist/es/components/LinePay/index.js +322 -0
- package/dist/es/components/MayBankQRPay/index.js +322 -0
- package/dist/es/components/NinePay/index.js +322 -0
- package/dist/es/components/SecuredIframe/index.js +3 -2
- package/dist/es/components/Sepa/index.js +8 -9
- package/dist/es/components/ShopeePay/index.js +322 -0
- package/dist/es/components/SubmitButton/index.js +6 -20
- package/dist/es/components/TNGWallet/index.js +322 -0
- package/dist/es/components/WechatPay/index.js +51 -61
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +41 -0
- package/dist/es/components/business/QRCodeModal/index.js +6 -0
- package/dist/es/components/business/QRCodeModal/qr-code-modal.js +1 -0
- package/dist/es/components/business/QRCodeModal/type.js +1 -0
- package/dist/es/components/business/index.js +6 -0
- package/dist/es/components/index.js +10 -0
- package/dist/es/components/internal/Accordion/Accordion.js +14 -0
- package/dist/es/components/internal/Accordion/accordion2.js +1 -0
- package/dist/es/components/internal/Accordion/accordionTransition.js +26 -0
- package/dist/es/components/internal/Accordion/index.js +7 -0
- package/dist/es/components/internal/Accordion/type.js +10 -0
- package/dist/es/components/internal/Modal/Modal.js +17 -3
- package/dist/es/components/internal/Modal/index.js +1 -0
- package/dist/es/components/internal/Modal/type.js +1 -0
- package/dist/es/components/internal/QRCode/QRCode.js +31 -0
- package/dist/es/components/internal/QRCode/index.js +4 -0
- package/dist/es/components/internal/QRCode/type.js +1 -0
- package/dist/es/components/internal/icons/IconBoost.js +63 -0
- package/dist/es/components/internal/icons/IconCard.js +3 -0
- package/dist/es/components/internal/icons/IconCard2.js +60 -0
- package/dist/es/components/internal/icons/IconGCash.js +196 -0
- package/dist/es/components/internal/icons/IconGcashComplete.js +184 -0
- package/dist/es/components/internal/icons/IconGrabPay.js +59 -0
- package/dist/es/components/internal/icons/IconLinePay.js +99 -0
- package/dist/es/components/internal/icons/IconMayBankQRPay.js +69 -0
- package/dist/es/components/internal/icons/IconNinePay.js +255 -0
- package/dist/es/components/internal/icons/IconPaymaya.js +114 -0
- package/dist/es/components/internal/icons/IconRedirect.js +58 -0
- package/dist/es/components/internal/icons/IconScan.js +102 -0
- package/dist/es/components/internal/icons/IconShopeePay.js +108 -0
- package/dist/es/components/internal/icons/IconTNGWallet.js +119 -0
- package/dist/es/components/internal/icons/IconUnionPay.js +65 -0
- package/dist/es/components/wallets/GCash/GCash.js +356 -0
- package/dist/es/components/wallets/GCash/g-cash.js +1 -0
- package/dist/es/components/wallets/GCash/index.js +1 -0
- package/dist/es/components/wallets/GCash/type.js +1 -0
- package/dist/es/components/wallets/Paymaya/Paymaya.js +323 -0
- package/dist/es/components/wallets/Paymaya/index.js +1 -0
- package/dist/es/components/wallets/Paymaya/paymaya2.js +1 -0
- package/dist/es/components/wallets/Paymaya/type.js +1 -0
- package/dist/es/config.js +12 -12
- package/dist/es/constant.js +94 -4
- package/dist/es/core/PayKKaCheckout.js +38 -3
- package/dist/es/core/Session.js +24 -23
- package/dist/es/core/error.js +7 -0
- package/dist/es/core/query.js +3 -2
- package/dist/es/core.js +2082 -70
- package/dist/es/hooks/usePayState.js +3 -4
- package/dist/es/i18n/I18n.js +8 -2
- package/dist/es/i18n/locales/de-DE.js +19 -1
- package/dist/es/i18n/locales/en-GB.js +19 -1
- package/dist/es/i18n/locales/es-ES.js +19 -1
- package/dist/es/i18n/locales/fr-FR.js +19 -1
- package/dist/es/i18n/locales/ja-JP.js +19 -1
- package/dist/es/i18n/locales/ko-KR.js +19 -1
- package/dist/es/i18n/locales/pt-PT.js +19 -1
- package/dist/es/i18n/locales/ru-RU.js +19 -1
- package/dist/es/i18n/locales/zh-CN.js +19 -1
- package/dist/es/i18n/locales/zh-HK.js +19 -1
- package/dist/es/i18n/locales/zh-TW.js +19 -1
- package/dist/es/i18n/util.js +20 -0
- package/dist/es/index.js +24 -0
- package/dist/es/style.css +1 -1096
- package/dist/es/types/index.js +1 -0
- package/dist/es/utils/array.js +9 -0
- package/dist/es/utils/card-brand/brands.js +11 -1
- package/dist/es/utils/card-brand/index.js +4 -3
- package/dist/es/utils/card-brand/luhn.js +25 -0
- package/dist/es/utils/date.js +25 -0
- package/dist/es/utils/detect.js +6 -0
- package/dist/es/utils/format.js +28 -12
- package/dist/es/utils/index.js +9 -1
- package/dist/es/utils/location.js +37 -0
- package/dist/es/utils/object.js +14 -0
- package/dist/es/utils/redirect.js +32 -0
- package/dist/es/utils/system-info/get-browser-info.js +4 -4
- package/dist/es/utils/system-info/get-system-info.js +11 -7
- package/dist/es/utils/system-info/index.js +4 -4
- package/dist/style.css +1 -1
- package/dist/types/api/http.d.ts +4 -10
- package/dist/types/api/modules/ali-pay/index.d.ts +2 -1
- package/dist/types/api/modules/apple-pay/index.d.ts +2 -1
- package/dist/types/api/modules/boost/index.d.ts +24 -0
- package/dist/types/api/modules/card/index.d.ts +1 -1
- package/dist/types/api/modules/checkout/index.d.ts +2 -2
- package/dist/types/api/modules/checkout/map.d.ts +2 -1
- package/dist/types/api/modules/checkout/type.d.ts +20 -2
- package/dist/types/api/modules/gcash/index.d.ts +24 -0
- package/dist/types/api/modules/get-browser-params.d.ts +2 -2
- package/dist/types/api/modules/google-pay/index.d.ts +2 -1
- package/dist/types/api/modules/grab-pay/index.d.ts +24 -0
- package/dist/types/api/modules/index.d.ts +9 -0
- package/dist/types/api/modules/line-pay/index.d.ts +24 -0
- package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +24 -0
- package/dist/types/api/modules/nine-pay/index.d.ts +24 -0
- package/dist/types/api/modules/paymaya/index.d.ts +24 -0
- package/dist/types/api/modules/sepa/index.d.ts +2 -1
- package/dist/types/api/modules/shopee-pay/index.d.ts +24 -0
- package/dist/types/api/modules/tng-wallet/index.d.ts +24 -0
- package/dist/types/api/modules/wechat-pay/index.d.ts +2 -1
- package/dist/types/components/AliPay/AliPay.d.ts +2 -1
- package/dist/types/components/AliPay/type.d.ts +1 -2
- package/dist/types/components/ApplePay/ApplePay.d.ts +2 -1
- package/dist/types/components/ApplePay/type.d.ts +9 -6
- package/dist/types/components/Boost/Boost.d.ts +7 -0
- package/dist/types/components/Boost/index.d.ts +2 -0
- package/dist/types/components/Boost/type.d.ts +61 -0
- package/dist/types/components/Card/Card.d.ts +2 -1
- package/dist/types/components/Card/type.d.ts +2 -2
- package/dist/types/components/DropIn/DropIn.d.ts +6 -0
- package/dist/types/components/DropIn/components/PaymentTabs/PaymentTabs.d.ts +3 -0
- package/dist/types/components/DropIn/components/PaymentTabs/index.d.ts +2 -0
- package/dist/types/components/DropIn/components/PaymentTabs/type.d.ts +11 -0
- package/dist/types/components/DropIn/config.d.ts +7 -0
- package/dist/types/components/DropIn/index.d.ts +2 -0
- package/dist/types/components/DropIn/type.d.ts +57 -0
- package/dist/types/components/GooglePay/GooglePay.d.ts +2 -1
- package/dist/types/components/GooglePay/type.d.ts +20 -9
- package/dist/types/components/GrabPay/GrabPay.d.ts +7 -0
- package/dist/types/components/GrabPay/index.d.ts +2 -0
- package/dist/types/components/GrabPay/type.d.ts +61 -0
- package/dist/types/components/GuideCard/GuideCard.d.ts +3 -0
- package/dist/types/components/GuideCard/index.d.ts +2 -0
- package/dist/types/components/GuideCard/type.d.ts +4 -0
- package/dist/types/components/LinePay/LinePay.d.ts +7 -0
- package/dist/types/components/LinePay/index.d.ts +2 -0
- package/dist/types/components/LinePay/type.d.ts +61 -0
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -0
- package/dist/types/components/MayBankQRPay/index.d.ts +2 -0
- package/dist/types/components/MayBankQRPay/type.d.ts +61 -0
- package/dist/types/components/NinePay/NinePay.d.ts +6 -0
- package/dist/types/components/NinePay/index.d.ts +2 -0
- package/dist/types/components/NinePay/type.d.ts +61 -0
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +1 -1
- package/dist/types/components/Sepa/Sepa.d.ts +2 -1
- package/dist/types/components/Sepa/type.d.ts +1 -2
- package/dist/types/components/ShopeePay/ShopeePay.d.ts +7 -0
- package/dist/types/components/ShopeePay/index.d.ts +2 -0
- package/dist/types/components/ShopeePay/type.d.ts +61 -0
- package/dist/types/components/SubmitButton/SubmitButton.d.ts +1 -1
- package/dist/types/components/TNGWallet/TNGWallet.d.ts +7 -0
- package/dist/types/components/TNGWallet/index.d.ts +2 -0
- package/dist/types/components/TNGWallet/type.d.ts +61 -0
- package/dist/types/components/WechatPay/WechatPay.d.ts +2 -1
- package/dist/types/components/WechatPay/type.d.ts +1 -2
- package/dist/types/components/business/QRCodeModal/QRCodeModal.d.ts +3 -0
- package/dist/types/components/business/QRCodeModal/index.d.ts +2 -0
- package/dist/types/components/business/QRCodeModal/type.d.ts +18 -0
- package/dist/types/components/business/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +10 -0
- package/dist/types/components/internal/Accordion/Accordion.d.ts +3 -0
- package/dist/types/components/internal/Accordion/accordionTransition.d.ts +8 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/AccordionItem.d.ts +3 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/index.d.ts +2 -0
- package/dist/types/components/internal/Accordion/components/AccordionItem/type.d.ts +18 -0
- package/dist/types/components/internal/Accordion/index.d.ts +3 -0
- package/dist/types/components/internal/Accordion/type.d.ts +18 -0
- package/dist/types/components/internal/Modal/index.d.ts +2 -0
- package/dist/types/components/internal/Modal/type.d.ts +3 -1
- package/dist/types/components/internal/QRCode/QRCode.d.ts +2 -0
- package/dist/types/components/internal/QRCode/index.d.ts +2 -0
- package/dist/types/components/internal/QRCode/type.d.ts +9 -0
- package/dist/types/components/internal/icons/IconBoost.d.ts +2 -0
- package/dist/types/components/internal/icons/IconCard.d.ts +2 -0
- package/dist/types/components/internal/icons/IconCard2.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGCash.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGcashComplete.d.ts +2 -0
- package/dist/types/components/internal/icons/IconGrabPay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconLinePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconMayBankQRPay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconNinePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconPaymaya.d.ts +2 -0
- package/dist/types/components/internal/icons/IconRedirect.d.ts +2 -0
- package/dist/types/components/internal/icons/IconScan.d.ts +2 -0
- package/dist/types/components/internal/icons/IconShopeePay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconTNGWallet.d.ts +2 -0
- package/dist/types/components/internal/icons/IconUnionPay.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +14 -0
- package/dist/types/components/wallets/GCash/GCash.d.ts +6 -0
- package/dist/types/components/wallets/GCash/index.d.ts +2 -0
- package/dist/types/components/wallets/GCash/type.d.ts +66 -0
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -0
- package/dist/types/components/wallets/Paymaya/index.d.ts +2 -0
- package/dist/types/components/wallets/Paymaya/type.d.ts +61 -0
- package/dist/types/config.d.ts +9 -9
- package/dist/types/constant.d.ts +38 -2
- package/dist/types/core/PayKKaCheckout.d.ts +11 -0
- package/dist/types/core/Session.d.ts +2 -0
- package/dist/types/core/error.d.ts +3 -1
- package/dist/types/core/query.d.ts +2 -2
- package/dist/types/hooks/usePayState.d.ts +0 -3
- package/dist/types/i18n/I18n.d.ts +1 -1
- package/dist/types/i18n/locales/de-DE.d.ts +15 -0
- package/dist/types/i18n/locales/en-GB.d.ts +15 -0
- package/dist/types/i18n/locales/es-ES.d.ts +15 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +15 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +15 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +15 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +15 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +15 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +15 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +15 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +15 -0
- package/dist/types/i18n/util.d.ts +10 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +34 -7
- package/dist/types/types/message.d.ts +1 -0
- package/dist/types/utils/array.d.ts +1 -0
- package/dist/types/utils/card-brand/brands.d.ts +4 -3
- package/dist/types/utils/card-brand/index.d.ts +9 -6
- package/dist/types/utils/card-brand/luhn.d.ts +9 -0
- package/dist/types/utils/date.d.ts +9 -0
- package/dist/types/utils/detect.d.ts +1 -0
- package/dist/types/utils/format.d.ts +7 -1
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/location.d.ts +7 -0
- package/dist/types/utils/object.d.ts +1 -0
- package/dist/types/utils/redirect.d.ts +5 -0
- package/dist/types/utils/system-info/get-browser-info.d.ts +1 -1
- package/dist/types/utils/system-info/get-system-info.d.ts +3 -2
- package/dist/types/utils/system-info/index.d.ts +3 -3
- package/package.json +65 -63
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { CustomLocales, Translation } from './locales';
|
|
2
|
+
/**
|
|
3
|
+
* 获取最终在收银台展示的语言
|
|
4
|
+
* 如果 locale 不符合,则取浏览器语言,若仍然不符合则用 en-GB
|
|
5
|
+
*/
|
|
6
|
+
export declare const getRealLocale: (locale: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* 如果 local 不在语言列表中,则要看看是否是 en 或 zh 开头
|
|
9
|
+
* 如果都不是,则返回 undefined,这里不做英文兜底,由上层判断
|
|
10
|
+
*/
|
|
11
|
+
export declare const getLocalKey: (locale: string) => string | undefined;
|
|
2
12
|
export declare function loadTranslation(locale: string, customLocales?: CustomLocales): Promise<{
|
|
3
13
|
locale: string;
|
|
4
14
|
translation: Translation;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export * from './components';
|
|
|
2
2
|
export { type ComponentInst, create, querySession, Session, PayKKaCheckout, PayKKaError } from './core';
|
|
3
3
|
export { I18n, LocaleKey } from './i18n';
|
|
4
4
|
export { setApiUrl, setCDNUrl, setFraudDetectionEnv, setCustomReqHeaders, setCustomLocale, setCheckoutConfig } from './config';
|
|
5
|
-
export { getFingerprint } from './utils';
|
|
5
|
+
export { getFingerprint, redirectToPayment } from './utils';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'preact/compat';
|
|
2
2
|
import type { LocaleKeyType } from '../i18n';
|
|
3
|
-
import type { PayKKaError, Session } from '../core';
|
|
3
|
+
import type { PayKKaCheckout, PayKKaError, Session } from '../core';
|
|
4
4
|
import type { FraudDetectionEnv } from './fraud-detection';
|
|
5
|
+
import type { FormValidateError } from '../components/internal/Form';
|
|
6
|
+
import type { PaymentMethod } from '../constant';
|
|
5
7
|
export * from './fraud-detection';
|
|
6
8
|
export * from './message';
|
|
7
9
|
export type CustomAttributes<T extends EventTarget, K extends keyof HTMLAttributes<T> = 'style' | 'className'> = Pick<HTMLAttributes<T>, K>;
|
|
@@ -23,16 +25,40 @@ export interface PayKKaInitConfiguration {
|
|
|
23
25
|
/** 收银台创建时报错触发 */
|
|
24
26
|
onInitError?: (error: PayKKaError) => void;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
28
|
+
* 全局回调,可以统一处理支付状态
|
|
29
|
+
* 创建组件时传同名回调可覆盖
|
|
30
|
+
*/
|
|
31
|
+
/** 提交表单时触发 */
|
|
32
|
+
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
33
|
+
/** 支付成功后触发 */
|
|
34
|
+
onSuccess?: (data: PaymentSuccessData) => void;
|
|
35
|
+
/** 支付失败时触发 */
|
|
36
|
+
onError?: (error: PayKKaError) => void;
|
|
37
|
+
/** 支付超时时触发 */
|
|
38
|
+
onTimeout?: () => void;
|
|
39
|
+
/** 收银台已过期时触发 */
|
|
40
|
+
onExpired?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* 环境配置,优先级大于 env 参数
|
|
27
44
|
*/
|
|
28
|
-
/** 环境配置,优先级大于 env 参数 */
|
|
29
45
|
_envConfig?: PayKKaEnvConfig;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
* 根据请求类型和请求方式额外传递的参数回调
|
|
49
|
+
*/
|
|
50
|
+
_getExtraParams?: (type: 'info' | 'query' | 'payment', paymentMethod: PaymentMethod) => Recordable;
|
|
30
51
|
}
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
/** 收银台创建组件时自动传入的内部属性 */
|
|
53
|
+
export type CoreProps = {
|
|
54
|
+
session: Session;
|
|
55
|
+
/** 收银台实例 */
|
|
56
|
+
core: PayKKaCheckout;
|
|
33
57
|
/** 定义 3DS 所需配置 */
|
|
34
58
|
threeDSFrame?: ThreeDSFrameConfig;
|
|
35
|
-
|
|
59
|
+
/** 组件是否通过 DropIn 创建 */
|
|
60
|
+
isDropIn?: boolean;
|
|
61
|
+
};
|
|
36
62
|
export interface ThreeDSFrameConfig {
|
|
37
63
|
/** 3DS 页面宽度 */
|
|
38
64
|
modalWidth?: number | string;
|
|
@@ -62,7 +88,8 @@ export declare enum CardBrandCode {
|
|
|
62
88
|
JCB = "JCB",
|
|
63
89
|
AMEX = "AMEX",
|
|
64
90
|
DISCOVER = "DISCOVER",
|
|
65
|
-
DINERS_CLUB = "DINERS_CLUB"
|
|
91
|
+
DINERS_CLUB = "DINERS_CLUB",
|
|
92
|
+
CHINA_UNION_PAY = "CHINA_UNION_PAY"
|
|
66
93
|
}
|
|
67
94
|
export type CardBrand = `${CardBrandCode}`;
|
|
68
95
|
export interface ElementStylesConfig {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const removeElementFromArray: (array: any[], element: any) => void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { IconAmex, IconDinnersClub, IconDiscover, IconJcb, IconMasterCard, IconVisa } from '../../components/internal/icons';
|
|
1
|
+
import { IconAmex, IconDinnersClub, IconDiscover, IconJcb, IconMasterCard, IconUnionPay, IconVisa } from '../../components/internal/icons';
|
|
2
2
|
import { CardBrandCode } from '../../types';
|
|
3
3
|
export declare const cardBrandCodes: CardBrandCode[];
|
|
4
4
|
export interface CardBrandConfig {
|
|
5
5
|
name: string;
|
|
6
6
|
code: CardBrandCode;
|
|
7
|
-
pattern
|
|
7
|
+
pattern?: RegExp;
|
|
8
|
+
validator?: (cardNumber: string) => boolean;
|
|
8
9
|
lengths: number[];
|
|
9
10
|
order: number;
|
|
10
11
|
}
|
|
11
12
|
export declare const cardBrands: CardBrandConfig[];
|
|
12
|
-
export declare const getCardBrandIconMap: (code: CardBrandCode) => typeof IconVisa | typeof IconMasterCard | typeof IconJcb | typeof IconAmex | typeof IconDiscover | typeof IconDinnersClub;
|
|
13
|
+
export declare const getCardBrandIconMap: (code: CardBrandCode) => typeof IconVisa | typeof IconMasterCard | typeof IconJcb | typeof IconAmex | typeof IconDiscover | typeof IconDinnersClub | typeof IconUnionPay;
|
|
13
14
|
export type CardBrands = (typeof cardBrands)[number]['code'];
|
|
14
15
|
export declare const cardBrandsLengthList: number[];
|
|
@@ -3,27 +3,30 @@ export { cardBrands, cardBrandsLengthList, cardBrandCodes };
|
|
|
3
3
|
export declare function getSupportedCardBrands(supportedCardBrands?: string[]): CardBrandConfig[];
|
|
4
4
|
export declare function findCardBrand(number: string, brands?: CardBrandConfig[]): CardBrandConfig | undefined;
|
|
5
5
|
export declare function findCardBrandInfo(number: string, brands?: CardBrandConfig[]): {
|
|
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;
|
|
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 | typeof import("../../components/internal/icons").IconUnionPay;
|
|
7
7
|
name: string;
|
|
8
8
|
code: import("../../types").CardBrandCode;
|
|
9
|
-
pattern
|
|
9
|
+
pattern?: RegExp | undefined;
|
|
10
|
+
validator?: ((cardNumber: string) => boolean) | undefined;
|
|
10
11
|
lengths: number[];
|
|
11
12
|
order: number;
|
|
12
13
|
} | undefined;
|
|
13
14
|
export declare function getCardBrandInfo(brand: CardBrandConfig): {
|
|
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
|
+
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 | typeof import("../../components/internal/icons").IconUnionPay;
|
|
15
16
|
name: string;
|
|
16
17
|
code: import("../../types").CardBrandCode;
|
|
17
|
-
pattern
|
|
18
|
+
pattern?: RegExp | undefined;
|
|
19
|
+
validator?: ((cardNumber: string) => boolean) | undefined;
|
|
18
20
|
lengths: number[];
|
|
19
21
|
order: number;
|
|
20
22
|
};
|
|
21
23
|
export type CardBrandInfo = ReturnType<typeof getCardBrandInfo>;
|
|
22
24
|
export declare function finCardBrandInfoByCode(code: string): {
|
|
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;
|
|
25
|
+
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 | typeof import("../../components/internal/icons").IconUnionPay;
|
|
24
26
|
name: string;
|
|
25
27
|
code: import("../../types").CardBrandCode;
|
|
26
|
-
pattern
|
|
28
|
+
pattern?: RegExp | undefined;
|
|
29
|
+
validator?: ((cardNumber: string) => boolean) | undefined;
|
|
27
30
|
lengths: number[];
|
|
28
31
|
order: number;
|
|
29
32
|
} | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 银行卡号码的校验采用Luhn算法,校验过程大致如下:
|
|
3
|
+
* 1. 从右到左给卡号字符串编号,最右边第一位是1,最右边第二位是2,最右边第三位是3….
|
|
4
|
+
* 2. 从右向左遍历,对每一位字符t执行第三个步骤,并将每一位的计算结果相加得到一个数s。
|
|
5
|
+
* 3. 对每一位的计算规则:如果这一位是奇数位,则返回t本身,如果是偶数位,则先将t乘以2得到一个数n,如果n是一位数(小于10),直接返回n,否则将n的个位数和十位数相加返回。
|
|
6
|
+
* 4. 如果s能够整除10,则此号码有效,否则号码无效。
|
|
7
|
+
* 因为最终的结果会对10取余来判断是否能够整除10,所以又叫做模10算法。
|
|
8
|
+
*/
|
|
9
|
+
export declare const luhnCheck: (cardNumber: string) => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const DATE_FORMAT = "MM/DD/YYYY";
|
|
2
|
+
export declare const DATE_TIME_FORMAT = "MM/DD/YYYY HH:mm:ss";
|
|
3
|
+
declare const timeTemplateMap: {
|
|
4
|
+
date: string;
|
|
5
|
+
datetime: string;
|
|
6
|
+
};
|
|
7
|
+
type TimeTemplate = keyof typeof timeTemplateMap;
|
|
8
|
+
export declare const formatTime: (value?: Numeric | Date, template?: StringUnion<TimeTemplate>) => string;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isEventSupported: (eventName: string, element?: HTMLDivElement) => boolean;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import type { Amount } from '../api/modules/type';
|
|
1
2
|
export declare const normalizedStyle: <T extends string | Nil | Recordable<any>>(...args: MaybeArray<T>[]) => string;
|
|
2
3
|
export declare const normalizedClass: <T extends string | Nil | Recordable<any>>(...args: MaybeArray<T>[]) => string;
|
|
3
4
|
export declare function limitedToNumber(val: string, whitelist?: string[]): string;
|
|
4
5
|
export declare function trimAll(str: string): string;
|
|
6
|
+
export declare const formatAmount: ({ amount, digits, currency, symbol }: Amount) => {
|
|
7
|
+
fixedAmount: () => string;
|
|
8
|
+
jointSymbol: () => string;
|
|
9
|
+
jointSymbolAndCurrency: () => string;
|
|
10
|
+
jointCurrency: () => string;
|
|
11
|
+
};
|
|
5
12
|
export declare function toFixed(num: number, digits?: number): string;
|
|
6
|
-
export declare const formatAmount: (value?: number | undefined, digits?: number) => string;
|
|
7
13
|
export declare function cssVarPrefix(value: string): string;
|
|
8
14
|
export declare function underscoreToUpperCamelCase(str: string): string;
|
|
9
15
|
export declare function extractAreaCodeAndPhoneNumber(phoneNumber?: string): {
|
|
@@ -9,6 +9,12 @@ export * from './is';
|
|
|
9
9
|
export * from './obj';
|
|
10
10
|
export * from './style';
|
|
11
11
|
export * from './iframe';
|
|
12
|
+
export * from './location';
|
|
13
|
+
export * from './redirect';
|
|
14
|
+
export * from './array';
|
|
15
|
+
export * from './detect';
|
|
16
|
+
export * from './date';
|
|
17
|
+
export * from './object';
|
|
12
18
|
export declare function getIf<T>(value: T, condition: boolean): T | undefined;
|
|
13
19
|
/**
|
|
14
20
|
* 将一个数值限制在指定的范围内
|
|
@@ -18,6 +24,7 @@ export declare function getIf<T>(value: T, condition: boolean): T | undefined;
|
|
|
18
24
|
*/
|
|
19
25
|
export declare function clamp(value: number, min?: number, max?: number): number;
|
|
20
26
|
export declare const safeParse: <T>(dataStr: string, defaultValue?: {}) => T;
|
|
27
|
+
export declare const safeStringify: (data: any, defaultValue?: string) => string;
|
|
21
28
|
/**
|
|
22
29
|
* @description: 日期是否过期
|
|
23
30
|
* @param {string} expireDate MM/YY
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getUrlParams: () => Record<string, string>;
|
|
2
|
+
export declare const getUrlParam: (paramName: string) => string | null;
|
|
3
|
+
export declare const createUrlWithParams: (baseUrl: string, params: Record<string, string | number | boolean>) => string;
|
|
4
|
+
export declare const parseUrl: (url: string) => {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
params: Record<string, string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const deepMerge: <T extends Recordable<any>, U extends Recordable<any>>(target: T, source: U) => T & U;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const getDeviceInfo: () => {
|
|
2
2
|
brand: undefined;
|
|
3
3
|
deviceBrand: undefined;
|
|
4
4
|
deviceModel: string | undefined;
|
|
@@ -10,7 +10,7 @@ export declare function getDeviceInfo(): {
|
|
|
10
10
|
platform: string;
|
|
11
11
|
system: string;
|
|
12
12
|
};
|
|
13
|
-
export declare
|
|
13
|
+
export declare const getSystemInfo: () => {
|
|
14
14
|
brand: undefined;
|
|
15
15
|
deviceBrand: undefined;
|
|
16
16
|
deviceModel: string | undefined;
|
|
@@ -30,3 +30,4 @@ export declare function getSystemInfo(): {
|
|
|
30
30
|
osTheme: undefined;
|
|
31
31
|
ua: string;
|
|
32
32
|
};
|
|
33
|
+
export declare const isMobile: () => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getFingerprint } from './finger-print';
|
|
2
2
|
import { getBrowserInfo } from './get-browser-info';
|
|
3
|
-
import { getSystemInfo } from './get-system-info';
|
|
4
|
-
export { getBrowserInfo, getSystemInfo, getFingerprint };
|
|
3
|
+
import { getSystemInfo, isMobile } from './get-system-info';
|
|
4
|
+
export { getBrowserInfo, getSystemInfo, getFingerprint, isMobile };
|
|
5
5
|
export * from './is-ua-webview';
|
|
6
6
|
export interface Browser {
|
|
7
7
|
userAgent: string;
|
|
@@ -16,4 +16,4 @@ export interface Browser {
|
|
|
16
16
|
osName: string;
|
|
17
17
|
deviceFingerprintId: string;
|
|
18
18
|
}
|
|
19
|
-
export declare
|
|
19
|
+
export declare const getBrowser: () => Promise<Browser>;
|
package/package.json
CHANGED
|
@@ -1,63 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@paykka/card-checkout-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "dist/paykka-card-checkout-ui.umd.js",
|
|
6
|
-
"module": "dist/es/index.js",
|
|
7
|
-
"typings": "dist/types/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/es/index.js",
|
|
11
|
-
"require": "./dist/paykka-card-checkout-ui.umd.js",
|
|
12
|
-
"types": "./dist/types/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"./*": "./dist/*"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@paykka/card-checkout-ui",
|
|
3
|
+
"version": "0.9.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/paykka-card-checkout-ui.umd.js",
|
|
6
|
+
"module": "dist/es/index.js",
|
|
7
|
+
"typings": "dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/es/index.js",
|
|
11
|
+
"require": "./dist/paykka-card-checkout-ui.umd.js",
|
|
12
|
+
"types": "./dist/types/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./*": "./dist/*"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite --host",
|
|
21
|
+
"build": "pnpm type-check && pnpm build:npm && pnpm build:inner && pnpm copy-dist-to-cdn && pnpm build:outer",
|
|
22
|
+
"build:npm": "tsx ./build/run.ts",
|
|
23
|
+
"build:inner": "tsx ./build/runInner.ts",
|
|
24
|
+
"build:outer": "tsx ./build/runOuter.ts",
|
|
25
|
+
"build:type": "tsc -p ./tsconfig.build.json",
|
|
26
|
+
"copy-dist-to-cdn": "tsx ./build/copyDist2CDN.ts",
|
|
27
|
+
"changeset": "changeset",
|
|
28
|
+
"changeset:pre": "changeset pre enter beta",
|
|
29
|
+
"changeset:pre-exit": "changeset pre exit",
|
|
30
|
+
"changeset:version": "changeset version",
|
|
31
|
+
"changeset:release": "changeset publish",
|
|
32
|
+
"changeset:prelease": "changeset publish --tag beta",
|
|
33
|
+
"release:prod": "pnpm build && pnpm changeset:release",
|
|
34
|
+
"release:noprod": "pnpm build && pnpm changeset:pre-exit && pnpm changeset:prelease",
|
|
35
|
+
"type-check": "tsc --noEmit -p tsconfig.json --composite false",
|
|
36
|
+
"release:npm": "npm publish --registry=https://registry.npmjs.org --access public"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"registry": "https://packages.aliyun.com/640edee5a84870ae9d591e48/npm/npm-registry/"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@ctrl/tinycolor": "^4.0.3",
|
|
43
|
+
"@fingerprintjs/fingerprintjs": "^4.2.2",
|
|
44
|
+
"@preact/signals": "^1.3.0",
|
|
45
|
+
"@types/applepayjs": "^14.0.9",
|
|
46
|
+
"@types/googlepay": "^0.7.6",
|
|
47
|
+
"preact": "^10.24.3",
|
|
48
|
+
"ts-toolbelt": "^9.6.0",
|
|
49
|
+
"unfetch": "^5.0.0",
|
|
50
|
+
"vue-tsc": "^2.1.10"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@changesets/cli": "^2.27.1",
|
|
54
|
+
"@preact/preset-vite": "^2.9.1",
|
|
55
|
+
"@types/node": "^20.12.7",
|
|
56
|
+
"autoprefixer": "^10.4.18",
|
|
57
|
+
"execa": "^8.0.1",
|
|
58
|
+
"fast-glob": "^3.3.2",
|
|
59
|
+
"sass": "^1.71.1",
|
|
60
|
+
"terser": "^5.42.0",
|
|
61
|
+
"tsx": "^4.7.3",
|
|
62
|
+
"typescript": "^5.4.5",
|
|
63
|
+
"vite": "^5.2.10"
|
|
64
|
+
}
|
|
65
|
+
}
|