@alipay/ams-checkout 0.0.1715248982-dev.0 → 0.0.1716362599-dev.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/umd/ams-checkout.min.js +1 -1
- package/esm/config/request.js +3 -3
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +89 -0
- package/esm/core/component/ckp/index.d.ts +41 -0
- package/esm/core/component/ckp/index.js +139 -0
- package/esm/core/component/index.js +46 -18
- package/esm/index.d.ts +6 -1
- package/esm/index.js +26 -13
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +22 -22
- package/esm/plugin/component/channel.d.ts +20 -0
- package/esm/plugin/component/channel.js +52 -0
- package/esm/plugin/component/component.popup.style.d.ts +4 -1
- package/esm/plugin/component/component.popup.style.js +7 -1
- package/esm/plugin/component/index.d.ts +3 -1
- package/esm/plugin/component/index.js +214 -82
- package/esm/plugin/paypal/index.js +1 -1
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +20 -1
- package/esm/types/index.js +3 -0
- package/esm/util/debug.js +2 -2
- package/esm/util/index.d.ts +7 -1
- package/esm/util/index.js +67 -1
- package/esm/util/logger.js +18 -11
- package/esm/util/upgrade.d.ts +4 -4
- package/esm/util/upgrade.js +6 -6
- package/package.json +1 -1
package/esm/types/index.d.ts
CHANGED
@@ -42,10 +42,12 @@ export interface IcreatePaymentParams {
|
|
42
42
|
}
|
43
43
|
export declare enum componentSignEnum {
|
44
44
|
'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
|
45
|
+
'EASY_PAY_APM' = "EASY_PAY_APM",
|
45
46
|
'CASHIER_PAYMENT_CARD' = "CASHIER_PAYMENT_CARD",
|
46
47
|
'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
|
47
48
|
'CASHIER_PAYMENT_APM' = "CASHIER_PAYMENT_APM",
|
48
49
|
'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
|
50
|
+
'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
|
49
51
|
'NONE' = "NONE",
|
50
52
|
'VAULTING_CARD' = "VAULTING_CARD"
|
51
53
|
}
|
@@ -53,6 +55,7 @@ export declare enum productSceneEnum {
|
|
53
55
|
'EASY_PAY' = "EASY_PAY",
|
54
56
|
'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
|
55
57
|
'AUTO_DEBIT' = "AUTO_DEBIT",
|
58
|
+
'AUTO_DEBIT_PAY' = "AUTO_DEBIT_PAY",
|
56
59
|
'VAULTING' = "VAULTING",
|
57
60
|
'FLASH_BUY' = "FLASH_BUY",
|
58
61
|
'CARD_APPLE_PAY' = "CARD_APPLE_PAY"
|
@@ -84,7 +87,7 @@ export interface IappendIframeNodesParams extends IcreateComponent {
|
|
84
87
|
paypalConfiguration?: IPaypalConfiguration;
|
85
88
|
}
|
86
89
|
export interface IPaypalConfiguration {
|
87
|
-
style?:
|
90
|
+
style?: object;
|
88
91
|
blockPayPalCreditButton?: boolean;
|
89
92
|
blockPayPalPayLaterButton?: boolean;
|
90
93
|
displayPayPalPayLaterButtonOnly?: boolean;
|
@@ -135,6 +138,10 @@ export interface InitSecurityConfig {
|
|
135
138
|
product: productSceneEnum;
|
136
139
|
region?: string;
|
137
140
|
}
|
141
|
+
export interface frontModulesToBeLoadedInterface {
|
142
|
+
acquirerName: string;
|
143
|
+
scriptUrl: string;
|
144
|
+
}
|
138
145
|
export interface IpaymentSessionMetaData {
|
139
146
|
clientId?: string;
|
140
147
|
renderDisplayType?: string;
|
@@ -144,14 +151,24 @@ export interface IpaymentSessionMetaData {
|
|
144
151
|
extendInfo?: string;
|
145
152
|
paymentMethodInfoView?: any;
|
146
153
|
action?: {
|
154
|
+
amountConfirmRequired?: boolean;
|
147
155
|
autoDebitWithToken: boolean;
|
156
|
+
enableSignAgreement?: boolean;
|
148
157
|
skipSdkQuery: boolean;
|
158
|
+
requireFastSdk: boolean;
|
149
159
|
skipSdkQueryForm?: {
|
150
160
|
value: boolean;
|
151
161
|
version: string;
|
152
162
|
platform: string;
|
153
163
|
};
|
154
164
|
};
|
165
|
+
authUrlInfo?: {
|
166
|
+
appIdentifier?: string;
|
167
|
+
applinkUrl?: string;
|
168
|
+
normalUrl?: string;
|
169
|
+
schemeUrl?: string;
|
170
|
+
authUrl?: string;
|
171
|
+
};
|
155
172
|
paymentSessionFactor?: {
|
156
173
|
extendInfo?: {
|
157
174
|
merchantCapabilities?: string[];
|
@@ -212,6 +229,7 @@ export interface IpaymentSessionMetaData {
|
|
212
229
|
*/
|
213
230
|
agreementDescription?: string;
|
214
231
|
};
|
232
|
+
frontModulesToBeLoaded?: frontModulesToBeLoadedInterface[];
|
215
233
|
};
|
216
234
|
}
|
217
235
|
export interface IPaymentSessionFactor {
|
@@ -425,6 +443,7 @@ export interface CashierSubmitPayRequest {
|
|
425
443
|
verifyFactors?: Record<string, string>;
|
426
444
|
paymentSessionData: string;
|
427
445
|
paymentSessionConfig?: any;
|
446
|
+
extParams?: any;
|
428
447
|
}
|
429
448
|
export interface CashierSdkActionQueryResult {
|
430
449
|
supportedLanguages?: any[];
|
package/esm/types/index.js
CHANGED
@@ -17,10 +17,12 @@ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum)
|
|
17
17
|
}({});
|
18
18
|
export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
|
19
19
|
componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
|
20
|
+
componentSignEnum["EASY_PAY_APM"] = "EASY_PAY_APM";
|
20
21
|
componentSignEnum["CASHIER_PAYMENT_CARD"] = "CASHIER_PAYMENT_CARD";
|
21
22
|
componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
|
22
23
|
componentSignEnum["CASHIER_PAYMENT_APM"] = "CASHIER_PAYMENT_APM";
|
23
24
|
componentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
|
25
|
+
componentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
|
24
26
|
componentSignEnum["NONE"] = "NONE";
|
25
27
|
componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
|
26
28
|
return componentSignEnum;
|
@@ -29,6 +31,7 @@ export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
|
|
29
31
|
productSceneEnum["EASY_PAY"] = "EASY_PAY";
|
30
32
|
productSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
|
31
33
|
productSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
|
34
|
+
productSceneEnum["AUTO_DEBIT_PAY"] = "AUTO_DEBIT_PAY";
|
32
35
|
productSceneEnum["VAULTING"] = "VAULTING";
|
33
36
|
productSceneEnum["FLASH_BUY"] = "FLASH_BUY";
|
34
37
|
productSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY";
|
package/esm/util/debug.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { queryParse } from
|
1
|
+
import { queryParse } from '.';
|
2
2
|
export var isDebugLog = function isDebugLog() {
|
3
3
|
var _ref = queryParse() || {},
|
4
4
|
environment = _ref.environment;
|
5
5
|
if (!environment) {
|
6
6
|
return false;
|
7
7
|
}
|
8
|
-
return environment
|
8
|
+
return environment === 'dev';
|
9
9
|
};
|
package/esm/util/index.d.ts
CHANGED
@@ -39,4 +39,10 @@ declare const getOrSetStorageId: (key: string, value?: string) => string;
|
|
39
39
|
declare const checkTimeElapsed: () => boolean;
|
40
40
|
declare const isFunction: (func: any) => boolean;
|
41
41
|
declare function parseBase64ToString(base64: string): string;
|
42
|
-
|
42
|
+
declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
|
43
|
+
src: any;
|
44
|
+
attrOptions?: {};
|
45
|
+
timeOut?: number;
|
46
|
+
loadCallback?: any;
|
47
|
+
}, logger: any): Promise<unknown>;
|
48
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
|
package/esm/util/index.js
CHANGED
@@ -261,4 +261,70 @@ function parseBase64ToString(base64) {
|
|
261
261
|
return null;
|
262
262
|
}
|
263
263
|
}
|
264
|
-
|
264
|
+
function loadSDKScript(_ref, logger) {
|
265
|
+
var _this2 = this;
|
266
|
+
var src = _ref.src,
|
267
|
+
_ref$attrOptions = _ref.attrOptions,
|
268
|
+
attrOptions = _ref$attrOptions === void 0 ? {} : _ref$attrOptions,
|
269
|
+
_ref$timeOut = _ref.timeOut,
|
270
|
+
timeOut = _ref$timeOut === void 0 ? 3 : _ref$timeOut,
|
271
|
+
_ref$loadCallback = _ref.loadCallback,
|
272
|
+
loadCallback = _ref$loadCallback === void 0 ? null : _ref$loadCallback;
|
273
|
+
return new Promise(function (resolve, reject) {
|
274
|
+
// 创建 script 标签
|
275
|
+
logger.logInfo({
|
276
|
+
title: 'load_item_sdk_start'
|
277
|
+
}, {
|
278
|
+
src: src,
|
279
|
+
attrOptions: JSON.stringify(attrOptions)
|
280
|
+
});
|
281
|
+
console.time();
|
282
|
+
var script = document.createElement('script');
|
283
|
+
var timer = null;
|
284
|
+
script.type = 'text/javascript';
|
285
|
+
|
286
|
+
// 监听加载完成事件
|
287
|
+
script.onload = function () {
|
288
|
+
// 当脚本加载完毕时,执行回调函数
|
289
|
+
logger.logInfo({
|
290
|
+
title: 'load_item_sdk_end'
|
291
|
+
}, {
|
292
|
+
src: src,
|
293
|
+
attrOptions: JSON.stringify(attrOptions)
|
294
|
+
});
|
295
|
+
console.timeEnd();
|
296
|
+
clearTimeout(timer);
|
297
|
+
if (loadCallback) loadCallback();
|
298
|
+
resolve(true);
|
299
|
+
};
|
300
|
+
|
301
|
+
// 监听加载失败事件
|
302
|
+
script.onerror = function () {
|
303
|
+
logger.logError({
|
304
|
+
title: 'load_item_sdk_error'
|
305
|
+
}, {
|
306
|
+
src: src,
|
307
|
+
attrOptions: JSON.stringify(attrOptions)
|
308
|
+
});
|
309
|
+
clearTimeout(timer);
|
310
|
+
console.error('The script ' + src + ' is not accessible.');
|
311
|
+
reject(false);
|
312
|
+
};
|
313
|
+
timer = setTimeout(function () {
|
314
|
+
_this2.logger.logError({
|
315
|
+
title: 'load_item_sdk_timeout'
|
316
|
+
}, {
|
317
|
+
src: src,
|
318
|
+
attrOptions: JSON.stringify(attrOptions)
|
319
|
+
});
|
320
|
+
reject(false);
|
321
|
+
}, timeOut * 1000);
|
322
|
+
script.src = src;
|
323
|
+
attrOptions && Object.keys(attrOptions).forEach(function (key) {
|
324
|
+
script.setAttribute(key, attrOptions[key]);
|
325
|
+
});
|
326
|
+
// 将 script 标签添加到页面中
|
327
|
+
document.head.appendChild(script);
|
328
|
+
});
|
329
|
+
}
|
330
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
|
package/esm/util/logger.js
CHANGED
@@ -43,10 +43,15 @@ export var Logger = /*#__PURE__*/function () {
|
|
43
43
|
}, {
|
44
44
|
key: "logError",
|
45
45
|
value: function logError(error, extra) {
|
46
|
+
var now = Date.now();
|
47
|
+
var fsDuration = now - this.componentStartTime;
|
46
48
|
this.logs.push({
|
47
49
|
type: 'error',
|
48
50
|
logPayload: error,
|
49
|
-
extra: extra
|
51
|
+
extra: _objectSpread(_objectSpread({}, extra), {}, {
|
52
|
+
fsDuration: fsDuration,
|
53
|
+
timeStamp: now
|
54
|
+
})
|
50
55
|
});
|
51
56
|
if (this.debug) {
|
52
57
|
console.error(error);
|
@@ -57,10 +62,15 @@ export var Logger = /*#__PURE__*/function () {
|
|
57
62
|
}, {
|
58
63
|
key: "logInfo",
|
59
64
|
value: function logInfo(info, extra) {
|
65
|
+
var now = Date.now();
|
66
|
+
var fsDuration = now - this.componentStartTime;
|
60
67
|
this.logs.push({
|
61
68
|
type: 'info',
|
62
69
|
logPayload: info,
|
63
|
-
extra: extra
|
70
|
+
extra: _objectSpread(_objectSpread({}, extra), {}, {
|
71
|
+
fsDuration: fsDuration,
|
72
|
+
timeStamp: now
|
73
|
+
})
|
64
74
|
});
|
65
75
|
if (this.debug) {
|
66
76
|
console.log(info);
|
@@ -71,10 +81,15 @@ export var Logger = /*#__PURE__*/function () {
|
|
71
81
|
}, {
|
72
82
|
key: "reportRPC",
|
73
83
|
value: function reportRPC(rpcData, extra) {
|
84
|
+
var now = Date.now();
|
85
|
+
var fsDuration = now - this.componentStartTime;
|
74
86
|
this.logs.push({
|
75
87
|
type: 'rpc',
|
76
88
|
logPayload: rpcData,
|
77
|
-
extra: extra
|
89
|
+
extra: _objectSpread(_objectSpread({}, extra), {}, {
|
90
|
+
fsDuration: fsDuration,
|
91
|
+
timeStamp: now
|
92
|
+
})
|
78
93
|
});
|
79
94
|
if (this.debug) {
|
80
95
|
console.log(rpcData);
|
@@ -94,32 +109,24 @@ export var Logger = /*#__PURE__*/function () {
|
|
94
109
|
logInfo = _window$iTracker.logInfo,
|
95
110
|
reportRPC = _window$iTracker.reportRPC;
|
96
111
|
var logs = this.logs;
|
97
|
-
var now = Date.now();
|
98
|
-
var fsDuration = now - this.componentStartTime;
|
99
112
|
while (logs.length > 0) {
|
100
113
|
try {
|
101
114
|
var log = logs.pop();
|
102
115
|
if (log.type === 'error') {
|
103
116
|
var _log$logPayload;
|
104
117
|
logError(log.logPayload, _objectSpread({
|
105
|
-
fsDuration: fsDuration,
|
106
|
-
timeStamp: now,
|
107
118
|
trackId: this.trackId,
|
108
119
|
title: (_log$logPayload = log.logPayload) === null || _log$logPayload === void 0 ? void 0 : _log$logPayload.title
|
109
120
|
}, log === null || log === void 0 ? void 0 : log.extra));
|
110
121
|
} else if (log.type === 'info') {
|
111
122
|
var _log$logPayload2;
|
112
123
|
logInfo(log.logPayload, _objectSpread({
|
113
|
-
fsDuration: fsDuration,
|
114
|
-
timeStamp: now,
|
115
124
|
trackId: this.trackId,
|
116
125
|
title: (_log$logPayload2 = log.logPayload) === null || _log$logPayload2 === void 0 ? void 0 : _log$logPayload2.title
|
117
126
|
}, log === null || log === void 0 ? void 0 : log.extra));
|
118
127
|
} else if (log.type === 'rpc') {
|
119
128
|
var _log$logPayload3;
|
120
129
|
reportRPC(log.logPayload, _objectSpread({
|
121
|
-
fsDuration: fsDuration,
|
122
|
-
timeStamp: now,
|
123
130
|
trackId: this.trackId,
|
124
131
|
title: (_log$logPayload3 = log.logPayload) === null || _log$logPayload3 === void 0 ? void 0 : _log$logPayload3.title
|
125
132
|
}, log === null || log === void 0 ? void 0 : log.extra));
|
package/esm/util/upgrade.d.ts
CHANGED
@@ -27,13 +27,13 @@ export declare function isGreyscaleMatch(item: UpgradeItem, randomGreyscale: num
|
|
27
27
|
export declare const getMatchAppVersion: (_extendInfo: string, sdkInfo: UpgradeSdkInfo) => string;
|
28
28
|
/**
|
29
29
|
* 获取保存的加载版本
|
30
|
-
* @param
|
30
|
+
* @param versionKey
|
31
31
|
* @returns
|
32
32
|
*/
|
33
|
-
export declare const getLastAppVersion: (
|
33
|
+
export declare const getLastAppVersion: (versionKey: string) => string;
|
34
34
|
/**
|
35
35
|
* 保存指定场景的加载版本供下次使用
|
36
|
-
* @param
|
36
|
+
* @param versionKey
|
37
37
|
* @returns
|
38
38
|
*/
|
39
|
-
export declare const setLastAppVersion: (
|
39
|
+
export declare const setLastAppVersion: (versionKey: string, appVersion: string) => boolean;
|
package/esm/util/upgrade.js
CHANGED
@@ -89,12 +89,12 @@ export var getMatchAppVersion = function getMatchAppVersion(_extendInfo, sdkInfo
|
|
89
89
|
|
90
90
|
/**
|
91
91
|
* 获取保存的加载版本
|
92
|
-
* @param
|
92
|
+
* @param versionKey
|
93
93
|
* @returns
|
94
94
|
*/
|
95
|
-
export var getLastAppVersion = function getLastAppVersion(
|
95
|
+
export var getLastAppVersion = function getLastAppVersion(versionKey) {
|
96
96
|
try {
|
97
|
-
var key = "Antom_".concat(
|
97
|
+
var key = "Antom_".concat(versionKey, "_LastAppVersion");
|
98
98
|
return getStorageString(key, '');
|
99
99
|
} catch (error) {
|
100
100
|
return '';
|
@@ -102,12 +102,12 @@ export var getLastAppVersion = function getLastAppVersion(productScene) {
|
|
102
102
|
};
|
103
103
|
/**
|
104
104
|
* 保存指定场景的加载版本供下次使用
|
105
|
-
* @param
|
105
|
+
* @param versionKey
|
106
106
|
* @returns
|
107
107
|
*/
|
108
|
-
export var setLastAppVersion = function setLastAppVersion(
|
108
|
+
export var setLastAppVersion = function setLastAppVersion(versionKey, appVersion) {
|
109
109
|
try {
|
110
|
-
var key = "Antom_".concat(
|
110
|
+
var key = "Antom_".concat(versionKey, "_LastAppVersion");
|
111
111
|
return setStorageString(key, appVersion);
|
112
112
|
} catch (error) {
|
113
113
|
return false;
|