@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
package/dist/es/index.js
CHANGED
|
@@ -15,13 +15,16 @@ import { GooglePay } from "./components/GooglePay/index.js";
|
|
|
15
15
|
import { SecuredIframe } from "./components/SecuredIframe/index.js";
|
|
16
16
|
import { Sepa } from "./components/Sepa/index.js";
|
|
17
17
|
import { IBANField } from "./components/CardIBANField/index.js";
|
|
18
|
+
import { EEncryptedCardType, ENCRYPTED_CARD_ITEM_ATTR, ENCRYPTED_CARD_WRAPPER_ID, EncryptedCard, PayKKaEncryptedCard } from "./components/EncryptedCard/index.js";
|
|
19
|
+
import { CombinedEncryptedField } from "./components/CombinedEncryptedField/index.js";
|
|
18
20
|
import "./core/context.js";
|
|
19
21
|
import { create } from "./core/create.js";
|
|
20
22
|
import { Session } from "./core/Session.js";
|
|
21
23
|
import { querySession } from "./core/query.js";
|
|
24
|
+
import { PayKKaCheckout } from "./core/PayKKaCheckout.js";
|
|
22
25
|
import { I18n } from "./i18n/I18n.js";
|
|
23
|
-
import "./i18n/locales/index.js";
|
|
24
|
-
import { setApiUrl, setCDNUrl, setCustomReqHeaders,
|
|
26
|
+
import { LocaleKey } from "./i18n/locales/index.js";
|
|
27
|
+
import { setApiUrl, setCDNUrl, setCheckoutConfig, setCustomLocale, setCustomReqHeaders, setFraudDetectionEnv } from "./config.js";
|
|
25
28
|
import "./utils/card-brand/brands.js";
|
|
26
29
|
import { getFingerprint } from "./utils/system-info/finger-print.js";
|
|
27
30
|
import "./utils/system-info/get-browser-info.js";
|
|
@@ -36,9 +39,17 @@ export {
|
|
|
36
39
|
CardNumberField,
|
|
37
40
|
CardSecurityCodeField,
|
|
38
41
|
CardSelector,
|
|
42
|
+
CombinedEncryptedField,
|
|
43
|
+
EEncryptedCardType,
|
|
44
|
+
ENCRYPTED_CARD_ITEM_ATTR,
|
|
45
|
+
ENCRYPTED_CARD_WRAPPER_ID,
|
|
46
|
+
EncryptedCard,
|
|
39
47
|
GooglePay,
|
|
40
48
|
I18n,
|
|
41
49
|
IBANField,
|
|
50
|
+
LocaleKey,
|
|
51
|
+
PayKKaCheckout,
|
|
52
|
+
PayKKaEncryptedCard,
|
|
42
53
|
SecuredIframe,
|
|
43
54
|
Sepa,
|
|
44
55
|
Session,
|
|
@@ -49,6 +60,8 @@ export {
|
|
|
49
60
|
querySession,
|
|
50
61
|
setApiUrl,
|
|
51
62
|
setCDNUrl,
|
|
63
|
+
setCheckoutConfig,
|
|
64
|
+
setCustomLocale,
|
|
52
65
|
setCustomReqHeaders,
|
|
53
|
-
|
|
66
|
+
setFraudDetectionEnv
|
|
54
67
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { ECollMode } from "../types/fraud-detection.js";
|
|
8
|
+
var define_import_meta_env_default = { VITE_API_URL: "https://checkout.aq.paykka.com", VITE_CDN_ORIGIN: "https://checkout.aq.paykka.com", VITE_CDN_DIR: "/cp", BASE_URL: "/", MODE: "production", DEV: false, PROD: true, SSR: false };
|
|
9
|
+
const stripeKeyMap = {
|
|
10
|
+
eu: "pk_live_51QSXl2G2tOepMLcRVNu0S2T6MxyB1AIgCP5g7qMQvAviQS37v0wkPhJRKqfcbTql6ZkCkGktux4ixfXuZtFy6ZpP00awbGlLEq",
|
|
11
|
+
hk: "pk_live_51QSXh9Azq7GQL5iqwZNLz3KJ896MIUnai4H7H0z9DtlklJkgoH1VAlHKy382vWPqDm80nTy8MKUdJIKs0fFbTlKx006WcKWEDu",
|
|
12
|
+
us: define_import_meta_env_default.VITE_STRIPE_KEY
|
|
13
|
+
};
|
|
14
|
+
const DEFAULT_ENV = "eu";
|
|
15
|
+
let instance = null;
|
|
16
|
+
function getFraudDetectionInstance(env, mode) {
|
|
17
|
+
if (!instance) {
|
|
18
|
+
instance = new FraudDetection(env, mode);
|
|
19
|
+
}
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
22
|
+
class FraudDetection {
|
|
23
|
+
constructor(env = DEFAULT_ENV, mode = [ECollMode.SR]) {
|
|
24
|
+
__publicField(this, "collResultMap", {
|
|
25
|
+
[ECollMode.SR]: { s: "" }
|
|
26
|
+
});
|
|
27
|
+
__publicField(this, "collMap", {
|
|
28
|
+
[ECollMode.SR]: () => this.stripeRadarColl()
|
|
29
|
+
});
|
|
30
|
+
__publicField(this, "p");
|
|
31
|
+
__publicField(this, "realMode", []);
|
|
32
|
+
__publicField(this, "keyMap", {
|
|
33
|
+
[ECollMode.SR]: ""
|
|
34
|
+
});
|
|
35
|
+
this.realMode = mode;
|
|
36
|
+
if (mode.includes(ECollMode.SR)) {
|
|
37
|
+
if (typeof env === "string") {
|
|
38
|
+
this.keyMap[ECollMode.SR] = stripeKeyMap[env];
|
|
39
|
+
} else {
|
|
40
|
+
this.keyMap[ECollMode.SR] = env[ECollMode.SR];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
get fraudDetectionID() {
|
|
45
|
+
return this.transferRes();
|
|
46
|
+
}
|
|
47
|
+
/** 创建获取 radar session id 的 promise,缓存单例 */
|
|
48
|
+
async createFraudDetection() {
|
|
49
|
+
if (!this.p) {
|
|
50
|
+
this.p = Promise.all(
|
|
51
|
+
this.realMode.map(async (item) => {
|
|
52
|
+
if (this.collMap[item]) {
|
|
53
|
+
return await this.collMap[item]();
|
|
54
|
+
} else {
|
|
55
|
+
throw new Error(`Unsupported collection mode: ${item}`);
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
await this.p;
|
|
61
|
+
}
|
|
62
|
+
/** 获取 stripe 返回的 radar session id,组件直接调,有没有返回值都直接调,传给后端 */
|
|
63
|
+
transferRes() {
|
|
64
|
+
try {
|
|
65
|
+
const s = JSON.stringify(this.collResultMap[ECollMode.SR]);
|
|
66
|
+
return btoa(s);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.log("[PayKKa Fraud Detection SDK]:", error);
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
stripeRadarColl() {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
const script = document.createElement("script");
|
|
75
|
+
script.type = "text/javascript";
|
|
76
|
+
script.src = "https://js.stripe.com/v3/";
|
|
77
|
+
script.async = true;
|
|
78
|
+
script.onload = async () => {
|
|
79
|
+
const stripe = window.Stripe(this.keyMap[ECollMode.SR]);
|
|
80
|
+
const { radarSession, error } = await stripe.createRadarSession();
|
|
81
|
+
if (error) {
|
|
82
|
+
console.error(error);
|
|
83
|
+
reject(error);
|
|
84
|
+
} else {
|
|
85
|
+
this.collResultMap[ECollMode.SR].s = radarSession == null ? void 0 : radarSession.id;
|
|
86
|
+
resolve(radarSession);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
script.onerror = function() {
|
|
90
|
+
reject();
|
|
91
|
+
};
|
|
92
|
+
script.crossOrigin = "";
|
|
93
|
+
document.getElementsByTagName("head")[0].appendChild(script);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
getFraudDetectionInstance
|
|
99
|
+
};
|
package/dist/es/style.css
CHANGED
|
@@ -112,6 +112,14 @@
|
|
|
112
112
|
align-items: center;
|
|
113
113
|
flex-shrink: 0;
|
|
114
114
|
margin-left: 12px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.paykka-card-checkout-input__left-icon {
|
|
118
|
+
padding-left: 12px;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
margin-right: 12px;
|
|
115
123
|
}::-webkit-scrollbar {
|
|
116
124
|
height: 6px;
|
|
117
125
|
width: 6px;
|
package/dist/es/types/index.js
CHANGED
|
@@ -1 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
var CardBrandCode = /* @__PURE__ */ ((CardBrandCode2) => {
|
|
2
|
+
CardBrandCode2["VISA"] = "VISA";
|
|
3
|
+
CardBrandCode2["MASTER_CARD"] = "MASTER_CARD";
|
|
4
|
+
CardBrandCode2["JCB"] = "JCB";
|
|
5
|
+
CardBrandCode2["AMEX"] = "AMEX";
|
|
6
|
+
CardBrandCode2["DISCOVER"] = "DISCOVER";
|
|
7
|
+
CardBrandCode2["DINERS_CLUB"] = "DINERS_CLUB";
|
|
8
|
+
return CardBrandCode2;
|
|
9
|
+
})(CardBrandCode || {});
|
|
10
|
+
const defaultInputStyleConfig = {
|
|
11
|
+
base: {
|
|
12
|
+
padding: "0 0 0 12px"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const inputStyleAttrs = [
|
|
16
|
+
"padding",
|
|
17
|
+
"background",
|
|
18
|
+
"caretColor",
|
|
19
|
+
"color",
|
|
20
|
+
"font",
|
|
21
|
+
"fontFamily",
|
|
22
|
+
"fontSize",
|
|
23
|
+
"fontWeight",
|
|
24
|
+
"lineHeight",
|
|
25
|
+
"textAlign",
|
|
26
|
+
"textShadow",
|
|
27
|
+
"textTransform",
|
|
28
|
+
"letterSpacing",
|
|
29
|
+
"wordSpacing",
|
|
30
|
+
"textOverflow",
|
|
31
|
+
"whiteSpace",
|
|
32
|
+
"fontSizeAdjust",
|
|
33
|
+
"fontStretch",
|
|
34
|
+
"fontStyle",
|
|
35
|
+
"fontVariant",
|
|
36
|
+
"fontVariantAlternates",
|
|
37
|
+
"fontVariantCaps",
|
|
38
|
+
"fontVariantEastAsian",
|
|
39
|
+
"fontVariantLigatures",
|
|
40
|
+
"fontVariantNumeric",
|
|
41
|
+
"fontVariantPosition",
|
|
42
|
+
"lineHeight",
|
|
43
|
+
"outline"
|
|
44
|
+
];
|
|
45
|
+
export {
|
|
46
|
+
CardBrandCode,
|
|
47
|
+
defaultInputStyleConfig,
|
|
48
|
+
inputStyleAttrs
|
|
49
|
+
};
|
|
@@ -6,85 +6,59 @@ import { IconDiscover } from "../../components/internal/icons/IconDiscover.js";
|
|
|
6
6
|
import { IconJcb } from "../../components/internal/icons/IconJcb.js";
|
|
7
7
|
import { IconMasterCard } from "../../components/internal/icons/IconMasterCard.js";
|
|
8
8
|
import { IconVisa } from "../../components/internal/icons/IconVisa.js";
|
|
9
|
-
|
|
10
|
-
CardBrandCode2["VISA"] = "VISA";
|
|
11
|
-
CardBrandCode2["MASTER_CARD"] = "MASTER_CARD";
|
|
12
|
-
CardBrandCode2["JCB"] = "JCB";
|
|
13
|
-
CardBrandCode2["AMEX"] = "AMEX";
|
|
14
|
-
CardBrandCode2["DISCOVER"] = "DISCOVER";
|
|
15
|
-
CardBrandCode2["DINERS_CLUB"] = "DINERS_CLUB";
|
|
16
|
-
return CardBrandCode2;
|
|
17
|
-
})(CardBrandCode || {});
|
|
9
|
+
import { CardBrandCode } from "../../types/index.js";
|
|
18
10
|
const cardBrandCodes = Object.values(CardBrandCode);
|
|
19
11
|
const cardBrands = [
|
|
20
12
|
{
|
|
21
13
|
name: "Visa",
|
|
22
|
-
code:
|
|
14
|
+
code: CardBrandCode.VISA,
|
|
23
15
|
pattern: /^4[0-9]{0,18}$/,
|
|
24
16
|
lengths: [13, 16, 19],
|
|
25
17
|
order: 1
|
|
26
18
|
},
|
|
27
19
|
{
|
|
28
20
|
name: "MasterCard",
|
|
29
|
-
code:
|
|
21
|
+
code: CardBrandCode.MASTER_CARD,
|
|
30
22
|
lengths: [16],
|
|
31
23
|
pattern: /^(5[1-5][0-9]{0,14}|2[2-7][0-9]{0,14})$/,
|
|
32
24
|
order: 2
|
|
33
25
|
},
|
|
34
26
|
{
|
|
35
27
|
name: "JCB",
|
|
36
|
-
code:
|
|
28
|
+
code: CardBrandCode.JCB,
|
|
37
29
|
pattern: /^(352[8,9]{1}[0-9]{0,15}|35[4-8]{1}[0-9]{0,16})$/,
|
|
38
30
|
lengths: [16, 19],
|
|
39
31
|
order: 3
|
|
40
32
|
},
|
|
41
33
|
{
|
|
42
34
|
name: "American Express",
|
|
43
|
-
code:
|
|
35
|
+
code: CardBrandCode.AMEX,
|
|
44
36
|
pattern: /^3[47][0-9]{0,13}$/,
|
|
45
37
|
lengths: [15],
|
|
46
38
|
order: 6
|
|
47
39
|
},
|
|
48
40
|
{
|
|
49
41
|
name: "Discover",
|
|
50
|
-
code:
|
|
51
|
-
pattern: /^(6011
|
|
42
|
+
code: CardBrandCode.DISCOVER,
|
|
43
|
+
pattern: /^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,
|
|
52
44
|
lengths: [16],
|
|
53
45
|
order: 4
|
|
54
46
|
},
|
|
55
47
|
{
|
|
56
48
|
name: "Diners Club",
|
|
57
|
-
code:
|
|
58
|
-
pattern: /^(
|
|
59
|
-
lengths: [14],
|
|
49
|
+
code: CardBrandCode.DINERS_CLUB,
|
|
50
|
+
pattern: /^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,
|
|
51
|
+
lengths: [14, 16],
|
|
60
52
|
order: 5
|
|
61
53
|
}
|
|
62
54
|
];
|
|
63
55
|
const cardBrandIconMap = {
|
|
64
|
-
[
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
]:
|
|
68
|
-
[
|
|
69
|
-
|
|
70
|
-
/* MASTER_CARD */
|
|
71
|
-
]: IconMasterCard,
|
|
72
|
-
[
|
|
73
|
-
"JCB"
|
|
74
|
-
/* JCB */
|
|
75
|
-
]: IconJcb,
|
|
76
|
-
[
|
|
77
|
-
"AMEX"
|
|
78
|
-
/* AMEX */
|
|
79
|
-
]: IconAmex,
|
|
80
|
-
[
|
|
81
|
-
"DISCOVER"
|
|
82
|
-
/* DISCOVER */
|
|
83
|
-
]: IconDiscover,
|
|
84
|
-
[
|
|
85
|
-
"DINERS_CLUB"
|
|
86
|
-
/* DINERS_CLUB */
|
|
87
|
-
]: IconDinnersClub
|
|
56
|
+
[CardBrandCode.VISA]: IconVisa,
|
|
57
|
+
[CardBrandCode.MASTER_CARD]: IconMasterCard,
|
|
58
|
+
[CardBrandCode.JCB]: IconJcb,
|
|
59
|
+
[CardBrandCode.AMEX]: IconAmex,
|
|
60
|
+
[CardBrandCode.DISCOVER]: IconDiscover,
|
|
61
|
+
[CardBrandCode.DINERS_CLUB]: IconDinnersClub
|
|
88
62
|
};
|
|
89
63
|
[
|
|
90
64
|
...cardBrands.reduce((acc, cur) => {
|
package/dist/es/utils/index.js
CHANGED
|
@@ -27,9 +27,20 @@ function isExpired(expireDate) {
|
|
|
27
27
|
const currentDate = /* @__PURE__ */ new Date();
|
|
28
28
|
return expiryDate < currentDate;
|
|
29
29
|
}
|
|
30
|
+
const intersection = (...arrays) => {
|
|
31
|
+
if (arrays.length === 0)
|
|
32
|
+
return [];
|
|
33
|
+
let result = arrays[0];
|
|
34
|
+
for (let i = 1; i < arrays.length; i++) {
|
|
35
|
+
const set = new Set(result);
|
|
36
|
+
result = arrays[i].filter((item) => set.has(item));
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
30
40
|
export {
|
|
31
41
|
clamp,
|
|
32
42
|
getIf,
|
|
43
|
+
intersection,
|
|
33
44
|
isExpired,
|
|
34
45
|
safeParse
|
|
35
46
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const loadScript = (params) => {
|
|
2
|
+
var _a;
|
|
3
|
+
const { src, onload = null, onerror = null } = params;
|
|
4
|
+
const script = document.createElement("script");
|
|
5
|
+
script.type = "text/javascript";
|
|
6
|
+
script.src = src;
|
|
7
|
+
script.onload = onload;
|
|
8
|
+
script.onerror = onerror;
|
|
9
|
+
Object.assign(script, params.extraOptions);
|
|
10
|
+
(_a = document.getElementsByTagName("head")[0]) == null ? void 0 : _a.appendChild(script);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
loadScript
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const style2String = (style = {}) => {
|
|
2
|
+
return Object.entries(style).map(([key, value]) => {
|
|
3
|
+
const kebabKey = key.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4
|
+
return `${kebabKey}: ${value}`;
|
|
5
|
+
}).join("; ");
|
|
6
|
+
};
|
|
7
|
+
const generateClassNameMap = (selector) => {
|
|
8
|
+
return {
|
|
9
|
+
focus: `${selector}_focus`,
|
|
10
|
+
hover: `${selector}_hover`,
|
|
11
|
+
valid: `${selector}_valid`,
|
|
12
|
+
invalid: `${selector}_invalid`
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const loadStyle = (styleStr, extraOptions) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const style = document.createElement("style");
|
|
18
|
+
style.textContent = styleStr;
|
|
19
|
+
Object.assign(style, extraOptions);
|
|
20
|
+
(_a = document.getElementsByTagName("head")[0]) == null ? void 0 : _a.appendChild(style);
|
|
21
|
+
};
|
|
22
|
+
const createPlaceholderStyle = (selector, style = {}) => {
|
|
23
|
+
const styleStr = style2String(style);
|
|
24
|
+
const placeholderStyle = `
|
|
25
|
+
${selector}::placeholder { ${styleStr} }
|
|
26
|
+
${selector}::-webkit-input-placeholder { ${styleStr} }
|
|
27
|
+
${selector}:-moz-placeholder { ${styleStr} }
|
|
28
|
+
${selector}:-ms-input-placeholder { ${styleStr} }
|
|
29
|
+
`;
|
|
30
|
+
return placeholderStyle;
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
createPlaceholderStyle,
|
|
34
|
+
generateClassNameMap,
|
|
35
|
+
loadStyle,
|
|
36
|
+
style2String
|
|
37
|
+
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.paykka-card-checkout,.paykka-card-checkout *{box-sizing:border-box}@media (min-width: 480px){.paykka-card-checkout-ali-pay__email{padding-bottom:20px}}.paykka-card-checkout-ali-pay__error{margin-top:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-ali-pay__error{margin-top:20px}}.paykka-card-checkout-ali-pay__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-ali-pay__button{margin-top:20px}}.paykka-card-checkout-address-field__first-item .paykka-card-checkout-input__input-wrapper{padding:8px 0;border-bottom-right-radius:0;border-bottom-left-radius:0}.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper{padding:8px 0;border-radius:0;border-top:0}.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper:active,.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper--focus,.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper:focus{border-top:1px solid var(--paykka-card-checkout-input-color, #4F43DF);box-shadow:0 0 0 1px var(--paykka-card-checkout-input-color, #4F43DF)}.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper{padding:8px 0;border-top-right-radius:0;border-top-left-radius:0;border-top:0}.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper:active,.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper--focus,.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper:focus{border-top:1px solid var(--paykka-card-checkout-input-color, #4F43DF);box-shadow:0 0 0 1px var(--paykka-card-checkout-input-color, #4F43DF)}.paykka-card-checkout-form-item{font-size:16px}.paykka-card-checkout-form-item__label{margin-bottom:8px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1);-webkit-user-select:none;user-select:none}@media (min-width: 480px){.paykka-card-checkout-form-item__label{margin-bottom:10px}}.paykka-card-checkout-form-item__error-text{margin-top:4px;color:#f53f3f;font-size:14px}.paykka-card-checkout-input{position:relative;box-sizing:border-box;font-size:16px}.paykka-card-checkout-input__input-wrapper{display:flex;align-items:center;height:44px;width:100%;border-radius:8px;border:1px solid #E1E1E5;transition:border .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1);caret-color:var(--paykka-card-checkout-input-color, #4F43DF) .paykka-card-checkout-input__input-wrapper --success;caret-color-border-bottom:1px solid #00B42A}.paykka-card-checkout-input__input-wrapper--error{border:1px solid #F53F3F}.paykka-card-checkout-input__input-wrapper:active,.paykka-card-checkout-input__input-wrapper--focus,.paykka-card-checkout-input__input-wrapper:focus{border:1px solid var(--paykka-card-checkout-input-color, #4F43DF);box-shadow:0 0 0 2px var(--paykka-card-checkout-input-color, #4F43DF)}.paykka-card-checkout-input__input-wrapper-disabled{cursor:not-allowed;background:#f5f5f7}.paykka-card-checkout-input__input-wrapper-disabled:active,.paykka-card-checkout-input__input-wrapper-disabled--focus,.paykka-card-checkout-input__input-wrapper-disabled:focus{border:1px solid #F5F5F7;box-shadow:0 0 0 2px #f5f5f7}.paykka-card-checkout-input__input{outline:none;border:none;height:100%;width:100%;border-radius:12px;caret-color:var(--paykka-card-checkout-input-color, #4F43DF);font-size:16px;padding-left:12px}.paykka-card-checkout-input__input::placeholder{color:#c2c2c2}.paykka-card-checkout-input__right-icon{padding-right:12px;display:flex;align-items:center;flex-shrink:0;margin-left:12px}.paykka-card-checkout-select__wrapper{width:100%;position:relative;cursor:pointer}.paykka-card-checkout-select__render-label{position:absolute;top:0;line-height:44px;height:44px;padding:0 16px;display:flex}.paykka-card-checkout-select__render-label--placeholder{color:#c2c2c2}.paykka-card-checkout-select__render-label--hidden{visibility:hidden}.paykka-card-checkout-select__menu{margin-top:4px;width:100%;max-height:260px;background:#fff;box-shadow:0 4px 14px #0000001a;border-radius:4px;border:1px solid #EBEBEF;overflow-y:auto;z-index:999;position:absolute}.paykka-card-checkout-select__menu-item{padding:6px 12px;line-height:32px;color:#626266;cursor:pointer;display:flex;justify-content:space-between}.paykka-card-checkout-select__menu-item:hover,.paykka-card-checkout-select__menu-item:active,.paykka-card-checkout-select__menu-item--selected,.paykka-card-checkout-select__menu-item:focus{color:#1f1f1f;background:#f3f3f5}.paykka-card-checkout-select__menu-item-icon{margin-left:10px;display:flex;align-items:center}.paykka-card-checkout-select__menu-no-data{height:200px;display:flex;justify-content:center;align-items:center;color:#c2c2c2}.paykka-card-checkout-info{display:flex;align-items:center;padding:10px 14px;border-radius:4px}.paykka-card-checkout-info--error{background-color:#ffece8}.paykka-card-checkout-info__icon{margin-right:8px;height:1.3em;display:flex;align-items:center}.paykka-card-checkout-info__content{text-align:justify;word-break:break-all}.paykka-card-checkout-recurring-tip{display:flex;color:#a9a9a9}.paykka-card-checkout-recurring-tip__icon{width:20px;display:flex;padding-top:4px;padding-right:4px}.paykka-card-checkout-submit-button--success{opacity:1!important;background-color:#00b42a!important}.paykka-card-checkout-submit-button__text{line-height:1}.paykka-card-checkout-submit-button__text--not-verified{color:#fff9}.paykka-card-checkout-button{display:flex;align-items:center;justify-content:center;width:100%;height:44px;padding:0 14px;border-radius:8px;border:0;background-color:var(--paykka-card-checkout-button-bg-color, #4F43DF);color:var(--paykka-card-checkout-button-text-color, #fff);font-size:16px;cursor:pointer;text-decoration:none;transition:background-color .3s cubic-bezier(.4,0,.2,1)}.paykka-card-checkout-button:not(.paykka-card-checkout-button--loading).paykka-card-checkout-button:not(.paykka-card-checkout-button--disabled).paykka-card-checkout-button:not(.paykka-card-checkout-button--dashed):hover{background-color:var(--paykka-card-checkout-button-bg-color-hover, #3f33bb)}.paykka-card-checkout-button:not(.paykka-card-checkout-button--loading).paykka-card-checkout-button:not(.paykka-card-checkout-button--disabled).paykka-card-checkout-button:not(.paykka-card-checkout-button--dashed):active{background-color:var(--paykka-card-checkout-button-bg-color-active, #312498)}.paykka-card-checkout-button--loading{cursor:wait}.paykka-card-checkout-button--disabled{cursor:not-allowed;opacity:.5}.paykka-card-checkout-button--dashed{border:1px dashed #DFDFE5;color:#1f1f1f;background-color:transparent}.paykka-card-checkout-button__icon{display:flex;align-items:center;margin-right:12px}.paykka-card-checkout-loading-check{display:inline-flex;align-items:center;overflow:hidden;--circle-transition-time: .3s;--check-dashoffset: 50}.paykka-card-checkout-loading-check__circle{transition:stroke-dasharray var(--circle-transition-time) linear}.paykka-card-checkout-loading-check__circle--loading{animation:spin 1s infinite linear;transform-origin:center}.paykka-card-checkout-loading-check__check{stroke-dasharray:var(--check-dashoffset);stroke-dashoffset:var(--check-dashoffset);animation:tick .5s ease-out;animation-fill-mode:forwards;animation-delay:var(--circle-transition-time)}@keyframes tick{0%{stroke-dashoffset:var(--check-dashoffset)}to{stroke-dashoffset:0}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.paykka-card-checkout-card{min-width:280px}.paykka-card-checkout-card__field{margin-bottom:24px}.paykka-card-checkout-card__center{display:flex;justify-content:space-between}.paykka-card-checkout-card__center>div{width:calc((100% - 20px)/2);transition:width .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-card__center>div{width:calc((100% - 32px)/2)}}.paykka-card-checkout-card__holder-name{padding-bottom:16px}@media (min-width: 480px){.paykka-card-checkout-card__holder-name{padding-bottom:20px}}.paykka-card-checkout-card__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-card__button{margin-top:20px}}.paykka-card-checkout-card__card-brands{margin-top:8px}.paykka-card-checkout-card__card-number-wrapper{position:relative}.paykka-card-checkout-card__change-box{display:flex;align-items:center;color:#4f43df;font-size:14px;position:absolute;top:0;right:0;cursor:pointer}.paykka-card-checkout-card__card-selector-wrapper{display:flex;justify-content:space-between}.paykka-card-checkout-card-brands{display:flex;flex-wrap:wrap;gap:6px}.paykka-card-checkout-card-brands__more{line-height:32px;font-size:13px;color:#687282}.paykka-card-checkout-card-selector__action{padding:8px 12px}.paykka-card-checkout-card-selector__label{display:flex;align-items:center}.paykka-card-checkout-card-selector__card-no{margin-left:12px}.paykka-card-checkout-card-selector__change{display:flex;align-items:center;color:#4f43df;font-size:14px}.paykka-card-checkout-card-no__wrapper{display:flex;align-items:center}.paykka-card-checkout-card-no__dot{width:4px;height:4px;background:currentColor;margin-right:4px;border-radius:50%}.paykka-card-checkout-card-no__card-no{margin-left:4px}.paykka-card-checkout-check-box{display:inline-flex;align-items:center;font-size:14px;background-color:transparent;cursor:pointer}.paykka-card-checkout-check-box:hover .paykka-card-checkout-check-box__inner{border-color:#4f43df}.paykka-card-checkout-check-box--checked .paykka-card-checkout-check-box__inner{border-color:#4f43df;background-color:#4f43df}.paykka-card-checkout-check-box__inner{width:14px;height:14px;border:1px solid #E1E1E5;border-radius:2px;margin-right:8px;transition:border-color .2s cubic-bezier(.4,0,.2,1);display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}@media (min-width: 480px){.paykka-card-checkout-wechat-pay__email{padding-bottom:20px}}.paykka-card-checkout-wechat-pay__error{margin-top:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-wechat-pay__error{margin-top:20px}}.paykka-card-checkout-wechat-pay__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-wechat-pay__button{margin-top:20px}}.paykka-card-checkout-apple-pay__error{margin-bottom:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-apple-pay__error{margin-bottom:20px}}.paykka-card-checkout-apple-pay__button{width:100%;display:flex;align-items:center;justify-content:center;height:44px;--apple-pay-button-width: 100%;--apple-pay-button-height: 44px;--apple-pay-button-border-radius: 8px;--apple-pay-button-padding: 0px 0px;--apple-pay-button-box-sizing: border-box}.paykka-card-checkout-google-pay__error{margin-bottom:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-google-pay__error{margin-bottom:20px}}::-webkit-scrollbar{height:6px;width:6px}::-webkit-scrollbar-thumb{background-color:#00000040;border-radius:4px}::-webkit-scrollbar-button{display:none!important}::-moz-scrollbar-button{display:none!important}.paykka-card-checkout-sepa{min-width:280px}.paykka-card-checkout-sepa__field{margin-bottom:24px}.paykka-card-checkout-sepa__holder-name{padding-bottom:16px}@media (min-width: 480px){.paykka-card-checkout-sepa__holder-name{padding-bottom:20px}}.paykka-card-checkout-sepa__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-sepa__button{margin-top:20px}}
|
|
1
|
+
.paykka-card-checkout,.paykka-card-checkout *{box-sizing:border-box}@media (min-width: 480px){.paykka-card-checkout-ali-pay__email{padding-bottom:20px}}.paykka-card-checkout-ali-pay__error{margin-top:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-ali-pay__error{margin-top:20px}}.paykka-card-checkout-ali-pay__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-ali-pay__button{margin-top:20px}}.paykka-card-checkout-address-field__first-item .paykka-card-checkout-input__input-wrapper{padding:8px 0;border-bottom-right-radius:0;border-bottom-left-radius:0}.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper{padding:8px 0;border-radius:0;border-top:0}.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper:active,.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper--focus,.paykka-card-checkout-address-field__mid-item .paykka-card-checkout-input__input-wrapper:focus{border-top:1px solid var(--paykka-card-checkout-input-color, #4F43DF);box-shadow:0 0 0 1px var(--paykka-card-checkout-input-color, #4F43DF)}.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper{padding:8px 0;border-top-right-radius:0;border-top-left-radius:0;border-top:0}.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper:active,.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper--focus,.paykka-card-checkout-address-field__last-item .paykka-card-checkout-input__input-wrapper:focus{border-top:1px solid var(--paykka-card-checkout-input-color, #4F43DF);box-shadow:0 0 0 1px var(--paykka-card-checkout-input-color, #4F43DF)}.paykka-card-checkout-form-item{font-size:16px}.paykka-card-checkout-form-item__label{margin-bottom:8px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1);-webkit-user-select:none;user-select:none}@media (min-width: 480px){.paykka-card-checkout-form-item__label{margin-bottom:10px}}.paykka-card-checkout-form-item__error-text{margin-top:4px;color:#f53f3f;font-size:14px}.paykka-card-checkout-input{position:relative;box-sizing:border-box;font-size:16px}.paykka-card-checkout-input__input-wrapper{display:flex;align-items:center;height:44px;width:100%;border-radius:8px;border:1px solid #E1E1E5;transition:border .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1);caret-color:var(--paykka-card-checkout-input-color, #4F43DF) .paykka-card-checkout-input__input-wrapper --success;caret-color-border-bottom:1px solid #00B42A}.paykka-card-checkout-input__input-wrapper--error{border:1px solid #F53F3F}.paykka-card-checkout-input__input-wrapper:active,.paykka-card-checkout-input__input-wrapper--focus,.paykka-card-checkout-input__input-wrapper:focus{border:1px solid var(--paykka-card-checkout-input-color, #4F43DF);box-shadow:0 0 0 2px var(--paykka-card-checkout-input-color, #4F43DF)}.paykka-card-checkout-input__input-wrapper-disabled{cursor:not-allowed;background:#f5f5f7}.paykka-card-checkout-input__input-wrapper-disabled:active,.paykka-card-checkout-input__input-wrapper-disabled--focus,.paykka-card-checkout-input__input-wrapper-disabled:focus{border:1px solid #F5F5F7;box-shadow:0 0 0 2px #f5f5f7}.paykka-card-checkout-input__input{outline:none;border:none;height:100%;width:100%;border-radius:12px;caret-color:var(--paykka-card-checkout-input-color, #4F43DF);font-size:16px;padding-left:12px}.paykka-card-checkout-input__input::placeholder{color:#c2c2c2}.paykka-card-checkout-input__right-icon{padding-right:12px;display:flex;align-items:center;flex-shrink:0;margin-left:12px}.paykka-card-checkout-input__left-icon{padding-left:12px;display:flex;align-items:center;flex-shrink:0;margin-right:12px}.paykka-card-checkout-select__wrapper{width:100%;position:relative;cursor:pointer}.paykka-card-checkout-select__render-label{position:absolute;top:0;line-height:44px;height:44px;padding:0 16px;display:flex}.paykka-card-checkout-select__render-label--placeholder{color:#c2c2c2}.paykka-card-checkout-select__render-label--hidden{visibility:hidden}.paykka-card-checkout-select__menu{margin-top:4px;width:100%;max-height:260px;background:#fff;box-shadow:0 4px 14px #0000001a;border-radius:4px;border:1px solid #EBEBEF;overflow-y:auto;z-index:999;position:absolute}.paykka-card-checkout-select__menu-item{padding:6px 12px;line-height:32px;color:#626266;cursor:pointer;display:flex;justify-content:space-between}.paykka-card-checkout-select__menu-item:hover,.paykka-card-checkout-select__menu-item:active,.paykka-card-checkout-select__menu-item--selected,.paykka-card-checkout-select__menu-item:focus{color:#1f1f1f;background:#f3f3f5}.paykka-card-checkout-select__menu-item-icon{margin-left:10px;display:flex;align-items:center}.paykka-card-checkout-select__menu-no-data{height:200px;display:flex;justify-content:center;align-items:center;color:#c2c2c2}.paykka-card-checkout-info{display:flex;align-items:center;padding:10px 14px;border-radius:4px}.paykka-card-checkout-info--error{background-color:#ffece8}.paykka-card-checkout-info__icon{margin-right:8px;height:1.3em;display:flex;align-items:center}.paykka-card-checkout-info__content{text-align:justify;word-break:break-all}.paykka-card-checkout-recurring-tip{display:flex;color:#a9a9a9}.paykka-card-checkout-recurring-tip__icon{width:20px;display:flex;padding-top:4px;padding-right:4px}.paykka-card-checkout-submit-button--success{opacity:1!important;background-color:#00b42a!important}.paykka-card-checkout-submit-button__text{line-height:1}.paykka-card-checkout-submit-button__text--not-verified{color:#fff9}.paykka-card-checkout-button{display:flex;align-items:center;justify-content:center;width:100%;height:44px;padding:0 14px;border-radius:8px;border:0;background-color:var(--paykka-card-checkout-button-bg-color, #4F43DF);color:var(--paykka-card-checkout-button-text-color, #fff);font-size:16px;cursor:pointer;text-decoration:none;transition:background-color .3s cubic-bezier(.4,0,.2,1)}.paykka-card-checkout-button:not(.paykka-card-checkout-button--loading).paykka-card-checkout-button:not(.paykka-card-checkout-button--disabled).paykka-card-checkout-button:not(.paykka-card-checkout-button--dashed):hover{background-color:var(--paykka-card-checkout-button-bg-color-hover, #3f33bb)}.paykka-card-checkout-button:not(.paykka-card-checkout-button--loading).paykka-card-checkout-button:not(.paykka-card-checkout-button--disabled).paykka-card-checkout-button:not(.paykka-card-checkout-button--dashed):active{background-color:var(--paykka-card-checkout-button-bg-color-active, #312498)}.paykka-card-checkout-button--loading{cursor:wait}.paykka-card-checkout-button--disabled{cursor:not-allowed;opacity:.5}.paykka-card-checkout-button--dashed{border:1px dashed #DFDFE5;color:#1f1f1f;background-color:transparent}.paykka-card-checkout-button__icon{display:flex;align-items:center;margin-right:12px}.paykka-card-checkout-loading-check{display:inline-flex;align-items:center;overflow:hidden;--circle-transition-time: .3s;--check-dashoffset: 50}.paykka-card-checkout-loading-check__circle{transition:stroke-dasharray var(--circle-transition-time) linear}.paykka-card-checkout-loading-check__circle--loading{animation:spin 1s infinite linear;transform-origin:center}.paykka-card-checkout-loading-check__check{stroke-dasharray:var(--check-dashoffset);stroke-dashoffset:var(--check-dashoffset);animation:tick .5s ease-out;animation-fill-mode:forwards;animation-delay:var(--circle-transition-time)}@keyframes tick{0%{stroke-dashoffset:var(--check-dashoffset)}to{stroke-dashoffset:0}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.paykka-card-checkout-card{min-width:280px}.paykka-card-checkout-card__field{margin-bottom:24px}.paykka-card-checkout-card__center{display:flex;justify-content:space-between}.paykka-card-checkout-card__center>div{width:calc((100% - 20px)/2);transition:width .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-card__center>div{width:calc((100% - 32px)/2)}}.paykka-card-checkout-card__holder-name{padding-bottom:16px}@media (min-width: 480px){.paykka-card-checkout-card__holder-name{padding-bottom:20px}}.paykka-card-checkout-card__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-card__button{margin-top:20px}}.paykka-card-checkout-card__card-brands{margin-top:8px}.paykka-card-checkout-card__card-number-wrapper{position:relative}.paykka-card-checkout-card__change-box{display:flex;align-items:center;color:#4f43df;font-size:14px;position:absolute;top:0;right:0;cursor:pointer}.paykka-card-checkout-card__card-selector-wrapper{display:flex;justify-content:space-between}.paykka-card-checkout-card-brands{display:flex;flex-wrap:wrap;gap:6px}.paykka-card-checkout-card-brands__more{line-height:32px;font-size:13px;color:#687282}.paykka-card-checkout-card-selector__action{padding:8px 12px}.paykka-card-checkout-card-selector__label{display:flex;align-items:center}.paykka-card-checkout-card-selector__card-no{margin-left:12px}.paykka-card-checkout-card-selector__change{display:flex;align-items:center;color:#4f43df;font-size:14px}.paykka-card-checkout-card-no__wrapper{display:flex;align-items:center}.paykka-card-checkout-card-no__dot{width:4px;height:4px;background:currentColor;margin-right:4px;border-radius:50%}.paykka-card-checkout-card-no__card-no{margin-left:4px}.paykka-card-checkout-check-box{display:inline-flex;align-items:center;font-size:14px;background-color:transparent;cursor:pointer}.paykka-card-checkout-check-box:hover .paykka-card-checkout-check-box__inner{border-color:#4f43df}.paykka-card-checkout-check-box--checked .paykka-card-checkout-check-box__inner{border-color:#4f43df;background-color:#4f43df}.paykka-card-checkout-check-box__inner{width:14px;height:14px;border:1px solid #E1E1E5;border-radius:2px;margin-right:8px;transition:border-color .2s cubic-bezier(.4,0,.2,1);display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}@media (min-width: 480px){.paykka-card-checkout-wechat-pay__email{padding-bottom:20px}}.paykka-card-checkout-wechat-pay__error{margin-top:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-wechat-pay__error{margin-top:20px}}.paykka-card-checkout-wechat-pay__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-wechat-pay__button{margin-top:20px}}.paykka-card-checkout-apple-pay__error{margin-bottom:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-apple-pay__error{margin-bottom:20px}}.paykka-card-checkout-apple-pay__button{width:100%;display:flex;align-items:center;justify-content:center;height:44px;--apple-pay-button-width: 100%;--apple-pay-button-height: 44px;--apple-pay-button-border-radius: 8px;--apple-pay-button-padding: 0px 0px;--apple-pay-button-box-sizing: border-box}.paykka-card-checkout-google-pay__error{margin-bottom:16px;transition:margin-bottom .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-google-pay__error{margin-bottom:20px}}::-webkit-scrollbar{height:6px;width:6px}::-webkit-scrollbar-thumb{background-color:#00000040;border-radius:4px}::-webkit-scrollbar-button{display:none!important}::-moz-scrollbar-button{display:none!important}.paykka-card-checkout-sepa{min-width:280px}.paykka-card-checkout-sepa__field{margin-bottom:24px}.paykka-card-checkout-sepa__holder-name{padding-bottom:16px}@media (min-width: 480px){.paykka-card-checkout-sepa__holder-name{padding-bottom:20px}}.paykka-card-checkout-sepa__button{margin-top:16px;transition:margin-top .1s cubic-bezier(.4,0,.2,1)}@media (min-width: 480px){.paykka-card-checkout-sepa__button{margin-top:20px}}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RequestOptions } from '../../http';
|
|
2
|
+
import type { EncryptCardReq, EncryptCardRes, VerifyClientKeyRes } from './type';
|
|
3
|
+
/** 校验 client key 是否有效 */
|
|
4
|
+
declare const verifyClientKey: (clientKey: string, merchantId: string, options?: RequestOptions) => Promise<VerifyClientKeyRes | null>;
|
|
5
|
+
declare const encryptCard: (card: EncryptCardReq, options?: RequestOptions) => Promise<EncryptCardRes>;
|
|
6
|
+
export { verifyClientKey, encryptCard };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CardBrand } from '../../../types';
|
|
2
|
+
export interface VerifyClientKeyRes {
|
|
3
|
+
brands: CardBrand[];
|
|
4
|
+
}
|
|
5
|
+
export interface EncryptCardReq {
|
|
6
|
+
clientKey: string;
|
|
7
|
+
merchantId: string;
|
|
8
|
+
expYear: string;
|
|
9
|
+
expMonth: string;
|
|
10
|
+
cardNo: string;
|
|
11
|
+
cvv: string;
|
|
12
|
+
}
|
|
13
|
+
export interface EncryptCardRes {
|
|
14
|
+
/** 加密后的卡号 */
|
|
15
|
+
encryptedCardNumber: string;
|
|
16
|
+
/** 加密后的 CVV */
|
|
17
|
+
encryptedCVV: string;
|
|
18
|
+
/** 加密后的有效期年份 */
|
|
19
|
+
encryptedExpireYear: string;
|
|
20
|
+
/** 加密后的有效期月份 */
|
|
21
|
+
encryptedExpireMonth: string;
|
|
22
|
+
/** 卡信息 */
|
|
23
|
+
cardInfo: {
|
|
24
|
+
/** 卡 bin */
|
|
25
|
+
bin: string;
|
|
26
|
+
/** 卡品牌 */
|
|
27
|
+
brand: CardBrand;
|
|
28
|
+
/** 卡号后 4 位 */
|
|
29
|
+
last4: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function getBrowserParams(params?: {
|
|
2
|
-
|
|
2
|
+
fraudDetectionId?: string;
|
|
3
3
|
}): Promise<{
|
|
4
4
|
user_agent: string;
|
|
5
5
|
color_depth: number;
|
|
@@ -13,5 +13,5 @@ export declare function getBrowserParams(params?: {
|
|
|
13
13
|
device_os: string;
|
|
14
14
|
device_finger_print_id: string;
|
|
15
15
|
terminal_type: string;
|
|
16
|
-
|
|
16
|
+
fraud_detection_id: string | undefined;
|
|
17
17
|
}>;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { PayRes } from '../../api';
|
|
2
|
-
import type { LocaleKey } from '../../i18n';
|
|
3
2
|
import type { FormValidateError } from '../internal/Form';
|
|
4
3
|
export interface AliPayProps {
|
|
5
|
-
sessionId: string;
|
|
6
|
-
clientKey?: string;
|
|
7
|
-
i18n?: LocaleKey;
|
|
8
4
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
9
5
|
onSuccess?: (...args: any[]) => void;
|
|
10
6
|
onError?: (error: any) => void;
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { LocaleKey } from '../../i18n';
|
|
1
|
+
import type { PaymentSuccessData } from '../../types';
|
|
3
2
|
export interface ApplePayProps {
|
|
4
|
-
|
|
5
|
-
clientKey?: string;
|
|
6
|
-
i18n?: LocaleKey;
|
|
3
|
+
/** 支付授权成功后触发 */
|
|
7
4
|
onSubmit?: () => void;
|
|
8
|
-
|
|
5
|
+
/** 支付成功后触发 */
|
|
6
|
+
onSuccess?: (data: PaymentSuccessData) => void;
|
|
7
|
+
/** SDK 加载回调,status 为 true 表示加载成功,false 表示加载失败 */
|
|
8
|
+
onLoad?: (status: boolean) => void;
|
|
9
|
+
/** 支付失败时触发 */
|
|
9
10
|
onError?: (error: any) => void;
|
|
11
|
+
/** 支付超时时触发 */
|
|
10
12
|
onTimeout?: (source: 'retry' | 'channel') => void;
|
|
13
|
+
/** 收银台已过期时触发 */
|
|
11
14
|
onExpired?: () => void;
|
|
12
|
-
|
|
15
|
+
/** 交易被风控拦截时触发 */
|
|
13
16
|
onAuthorized?: () => void;
|
|
17
|
+
/** 支付取消时触发 */
|
|
14
18
|
onCancel?: () => void;
|
|
19
|
+
/** Apple Pay 按钮是否可用 */
|
|
20
|
+
onCanUse?: (canUse: boolean) => void;
|
|
21
|
+
/**
|
|
22
|
+
* 内部使用
|
|
23
|
+
*/
|
|
15
24
|
/** 点击 ApplePay 按钮 */
|
|
16
25
|
onBtnClick?: () => void;
|
|
17
26
|
}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PaymentSuccessData } from '../../types';
|
|
2
2
|
import type { FormValidateError } from '../internal/Form';
|
|
3
3
|
export interface CardProps {
|
|
4
|
-
|
|
5
|
-
clientKey?: string;
|
|
6
|
-
i18n?: LocaleKey;
|
|
4
|
+
/** 是否在卡号输入框下展示收银台支持的发卡行图标 */
|
|
7
5
|
showCardBrands?: boolean;
|
|
6
|
+
/** 提交表单时触发 */
|
|
8
7
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
9
|
-
|
|
8
|
+
/** 支付成功后触发 */
|
|
9
|
+
onSuccess?: (data: PaymentSuccessData) => void;
|
|
10
|
+
/** 支付失败时触发 */
|
|
10
11
|
onError?: (error: any) => void;
|
|
12
|
+
/** 支付超时时触发 */
|
|
11
13
|
onTimeout?: () => void;
|
|
14
|
+
/** 交易被风控拦截时触发 */
|
|
12
15
|
onAuthorized?: () => void;
|
|
16
|
+
/** 收银台已过期时触发 */
|
|
13
17
|
onExpired?: () => void;
|
|
18
|
+
/** 交易需要 3DS 验证时触发,url 为 3DS 验证链接,incomplete 为 false 表示目前要开始进行 3DS 验证,为 true 表示上一次 3DS 验证还未完成 */
|
|
14
19
|
onThreeDS?: (url: string, incomplete: boolean) => void;
|
|
15
20
|
}
|
|
16
21
|
export interface CardRef {
|
|
22
|
+
/** 3DS 验证流程结束后可调用该方法轮询收银台支付状态 */
|
|
17
23
|
checkThreeDS: () => void;
|
|
24
|
+
/** 不展示支付按钮时,可调用该方法进行支付 */
|
|
25
|
+
payment: () => void;
|
|
26
|
+
/** 进行表单切换时更新已填的地址信息 */
|
|
18
27
|
updateAddress: () => void;
|
|
28
|
+
/** 进行表单切换时更新已填的邮箱信息 */
|
|
19
29
|
updateEmail: () => void;
|
|
20
30
|
}
|
|
@@ -2,6 +2,7 @@ import type { FormItemProps, FormValidationStatus } from '../internal/Form';
|
|
|
2
2
|
import type { InputProps } from '../internal/Input';
|
|
3
3
|
export interface CardExpireDateFieldProps extends Pick<FormItemProps, 'onValidationStatusChange' | 'className' | 'style'>, Pick<InputProps, 'onInput'> {
|
|
4
4
|
security: boolean;
|
|
5
|
+
showLabel?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export interface CardExpireDateFieldRef {
|
|
7
8
|
focus: () => void;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import type { CardBrand } from '../../types';
|
|
1
2
|
import type { FormItemProps, FormValidationStatus } from '../internal/Form';
|
|
2
3
|
import type { InputProps } from '../internal/Input';
|
|
3
4
|
export interface CardNumberFieldProps extends Pick<FormItemProps, 'onValidationStatusChange' | 'className' | 'style'>, Pick<InputProps, 'onInput'> {
|
|
4
5
|
supportedCardBrands?: string[];
|
|
5
6
|
security: boolean;
|
|
7
|
+
showLabel?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export interface CardNumberFieldRef {
|
|
8
10
|
focus: () => void;
|
|
9
11
|
blur: () => void;
|
|
10
12
|
resetValidation: (status: FormValidationStatus, errorTip?: string) => void;
|
|
11
13
|
binValueChanged: (binValue: string) => void;
|
|
14
|
+
brandChanged: (brand?: CardBrand) => void;
|
|
12
15
|
getCardBrand: () => Recordable;
|
|
13
16
|
}
|
|
@@ -2,6 +2,7 @@ import type { FormItemProps, FormValidationStatus } from '../internal/Form';
|
|
|
2
2
|
import type { InputProps } from '../internal/Input';
|
|
3
3
|
export interface CardSecurityCodeFieldProps extends Pick<FormItemProps, 'onValidationStatusChange' | 'className' | 'style'>, Pick<InputProps, 'onInput'> {
|
|
4
4
|
security: boolean;
|
|
5
|
+
showLabel?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export interface CardSecurityCodeFieldRef {
|
|
7
8
|
focus: () => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CombinedEncryptedFieldProps, CombinedEncryptedFieldRef } from './type';
|
|
2
|
+
export declare const CombinedEncryptedField: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<CombinedEncryptedFieldProps> & {
|
|
3
|
+
ref?: import("preact").Ref<CombinedEncryptedFieldRef> | undefined;
|
|
4
|
+
}>;
|