@alipay/ams-checkout 1.43.0 → 1.44.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/README.md +17 -1
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +1 -0
- package/esm/constant/index.js +1 -0
- package/esm/core/component/index.d.ts +1 -0
- package/esm/core/component/index.js +30 -9
- package/esm/plugin/component/channel.js +0 -1
- package/esm/plugin/component/index.js +6 -0
- package/package.json +12 -7
package/esm/config/index.d.ts
CHANGED
@@ -6,10 +6,10 @@ export declare const sdkVersion: string;
|
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
7
|
* TODO 这里考虑直接换成packagejson.version
|
8
8
|
*/
|
9
|
-
export declare const AMSCheckoutAppVersion = "1.
|
10
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
11
|
-
export declare const AMSEasyPayAppVersion = "1.
|
12
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
13
|
-
export declare const AMSVaultingAppVersion = "1.
|
14
|
-
export declare const AMSPaymentElementAppVersion = "1.
|
15
|
-
export declare const ADDRESSElementAppVersion = "1.
|
9
|
+
export declare const AMSCheckoutAppVersion = "1.44.0";
|
10
|
+
export declare const AMSAutoDebitAppVersion = "1.44.0";
|
11
|
+
export declare const AMSEasyPayAppVersion = "1.44.0";
|
12
|
+
export declare const AMSCashierPaymentAppVersion = "1.44.0";
|
13
|
+
export declare const AMSVaultingAppVersion = "1.44.0";
|
14
|
+
export declare const AMSPaymentElementAppVersion = "1.44.0";
|
15
|
+
export declare const ADDRESSElementAppVersion = "1.44.0";
|
package/esm/config/index.js
CHANGED
@@ -36,10 +36,10 @@ export var sdkVersion = json.version;
|
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
37
|
* TODO 这里考虑直接换成packagejson.version
|
38
38
|
*/
|
39
|
-
export var AMSCheckoutAppVersion = '1.
|
40
|
-
export var AMSAutoDebitAppVersion = '1.
|
41
|
-
export var AMSEasyPayAppVersion = '1.
|
42
|
-
export var AMSCashierPaymentAppVersion = '1.
|
43
|
-
export var AMSVaultingAppVersion = '1.
|
44
|
-
export var AMSPaymentElementAppVersion = '1.
|
45
|
-
export var ADDRESSElementAppVersion = '1.
|
39
|
+
export var AMSCheckoutAppVersion = '1.44.0'; // 兜底版本号
|
40
|
+
export var AMSAutoDebitAppVersion = '1.44.0'; // 代扣
|
41
|
+
export var AMSEasyPayAppVersion = '1.44.0'; // easypay
|
42
|
+
export var AMSCashierPaymentAppVersion = '1.44.0'; // 收银台(卡、apm)
|
43
|
+
export var AMSVaultingAppVersion = '1.44.0'; // 绑卡
|
44
|
+
export var AMSPaymentElementAppVersion = '1.44.0'; // payment element
|
45
|
+
export var ADDRESSElementAppVersion = '1.44.0'; // address element
|
package/esm/constant/index.d.ts
CHANGED
package/esm/constant/index.js
CHANGED
@@ -15,6 +15,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
15
15
|
channelType: ComponentSignEnum[];
|
16
16
|
productSceneVersion: string;
|
17
17
|
timer: any;
|
18
|
+
private _validateResolveMap;
|
18
19
|
constructor(options: IAMSComponentOptions);
|
19
20
|
private parameterInitAndCheck;
|
20
21
|
private pluginAppendIframe;
|
@@ -36,6 +36,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
36
36
|
*/
|
37
37
|
import { v4 as uuid } from 'uuid';
|
38
38
|
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT, SENDEVENT } from "../../constant";
|
39
|
+
import PreloadHelper from "../../foundation/utils/preload_helper";
|
39
40
|
import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
40
41
|
import ComponentApp from "../../plugin/component";
|
41
42
|
import { ExtendPlugin } from "../../plugin/const";
|
@@ -50,7 +51,6 @@ import { SecurityBusSubscriber } from "../bus/ability/security";
|
|
50
51
|
import { TrackerBusSubscriber } from "../bus/ability/tracker";
|
51
52
|
import CoreInstance from "../instance/index";
|
52
53
|
import { loadChannelPneumaticControl } from "./appPreloadProcessing";
|
53
|
-
import PreloadHelper from "../../foundation/utils/preload_helper";
|
54
54
|
export var getComponentSign = function getComponentSign(params) {
|
55
55
|
var _params$paymentSessio = params.paymentSessionConfig,
|
56
56
|
_params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
|
@@ -140,6 +140,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
140
140
|
_defineProperty(_assertThisInitialized(_this2), "channelType", void 0);
|
141
141
|
_defineProperty(_assertThisInitialized(_this2), "productSceneVersion", void 0);
|
142
142
|
_defineProperty(_assertThisInitialized(_this2), "timer", void 0);
|
143
|
+
_defineProperty(_assertThisInitialized(_this2), "_validateResolveMap", new Map());
|
143
144
|
var ComponentPlugin = new ComponentApp({
|
144
145
|
appVersion: options.appVersion
|
145
146
|
});
|
@@ -547,34 +548,54 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
547
548
|
}
|
548
549
|
var timeoutId;
|
549
550
|
var validationPromise = new Promise(function (validationResolve) {
|
551
|
+
var eventCallbackId = uuid();
|
552
|
+
_this9._validateResolveMap.set(eventCallbackId, validationResolve);
|
550
553
|
// 发送validateFields消息
|
551
554
|
_this9._sendMessageToAPP({
|
552
555
|
event: SENDEVENT.validateFields.name,
|
553
|
-
data: {}
|
556
|
+
data: {},
|
557
|
+
eventCallbackId: eventCallbackId
|
554
558
|
});
|
555
|
-
|
556
|
-
|
559
|
+
var isValidationResult = function isValidationResult(data) {
|
560
|
+
return _typeof(data) === 'object' && data !== null && typeof data.isValid === 'boolean';
|
561
|
+
};
|
562
|
+
var callback = /*#__PURE__*/function () {
|
557
563
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload) {
|
564
|
+
var currentEventCallbackId, currentResolve, result;
|
558
565
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
559
566
|
while (1) switch (_context2.prev = _context2.next) {
|
560
567
|
case 0:
|
568
|
+
currentEventCallbackId = (payload === null || payload === void 0 ? void 0 : payload.eventCallbackId) || ''; // 事件一一对应,处理异步商户调用多次可能导致乱序的问题
|
569
|
+
currentResolve = _this9._validateResolveMap.get(currentEventCallbackId);
|
570
|
+
result = {
|
571
|
+
isValid: false
|
572
|
+
};
|
573
|
+
if (isValidationResult(payload === null || payload === void 0 ? void 0 : payload.data)) {
|
574
|
+
result = payload === null || payload === void 0 ? void 0 : payload.data;
|
575
|
+
}
|
561
576
|
_this9.logger.logInfo({
|
562
577
|
title: 'sdk_event_validateFields'
|
563
578
|
}, {
|
564
|
-
processResult:
|
579
|
+
processResult: result.isValid ? 'true' : 'false'
|
565
580
|
});
|
566
581
|
// 收银台应用保证数据格式,三端SDK负责透传
|
567
|
-
|
568
|
-
|
582
|
+
if (!!currentResolve) {
|
583
|
+
currentResolve(result);
|
584
|
+
_this9._validateResolveMap.delete(currentEventCallbackId);
|
585
|
+
}
|
586
|
+
case 6:
|
569
587
|
case "end":
|
570
588
|
return _context2.stop();
|
571
589
|
}
|
572
590
|
}, _callee2);
|
573
591
|
}));
|
574
|
-
return function (_x2) {
|
592
|
+
return function callback(_x2) {
|
575
593
|
return _ref5.apply(this, arguments);
|
576
594
|
};
|
577
|
-
}()
|
595
|
+
}();
|
596
|
+
// 接收收银台应用的返回validateFieldsResult消息
|
597
|
+
// validateFieldsResultForward处理订阅eventCallbackId为空的问题
|
598
|
+
_this9._overrideSubscription(EVENT.validateFieldsResult.forwardName, callback, EVENT.validateFieldsResult.uniqueKey);
|
578
599
|
});
|
579
600
|
|
580
601
|
// 兜底场景,三端约定超时时间15秒,兼容cpf网络校验超时场景
|
@@ -1410,6 +1410,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1410
1410
|
});
|
1411
1411
|
return;
|
1412
1412
|
}
|
1413
|
+
if (data.context.event === EVENT.validateFieldsResult.name) {
|
1414
|
+
// 将validateFieldsResult事件转发到subsribe处理,解决subsribe拿不到eventCallbackId的问题
|
1415
|
+
this.AMSSDK._eventCenter.emit(EVENT.validateFieldsResult.forwardName, data.context);
|
1416
|
+
return;
|
1417
|
+
}
|
1418
|
+
|
1413
1419
|
// log event before sending the callback
|
1414
1420
|
this.logEventCallback(data, 'sdk_event_event_callback');
|
1415
1421
|
try {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@alipay/ams-checkout",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.44.0",
|
4
4
|
"description": "",
|
5
5
|
"author": "",
|
6
6
|
"main": "esm/index.js",
|
@@ -16,8 +16,8 @@
|
|
16
16
|
"scripts": {
|
17
17
|
"build": "father build",
|
18
18
|
"build:w": "father dev",
|
19
|
-
"ci": "
|
20
|
-
"cov": "jest --coverage",
|
19
|
+
"ci": "tnpm run cov",
|
20
|
+
"cov": "jest --coverage --silent",
|
21
21
|
"dev": "father dev",
|
22
22
|
"format": "prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"",
|
23
23
|
"lint": "eslint ./src",
|
@@ -47,6 +47,7 @@
|
|
47
47
|
"uuid": "^9.0.0"
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
|
+
"@ali/ci": "^4.72.0",
|
50
51
|
"@babel/core": "^7.20.7",
|
51
52
|
"@babel/preset-env": "^7.20.2",
|
52
53
|
"@commitlint/cli": "^17.3.0",
|
@@ -55,13 +56,13 @@
|
|
55
56
|
"@testing-library/react": "^9.5.0",
|
56
57
|
"@types/jest": "^29.2.4",
|
57
58
|
"@types/uuid": "^9.0.0",
|
58
|
-
"@typescript-eslint/eslint-plugin": "
|
59
|
-
"@typescript-eslint/parser": "^
|
59
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
60
|
+
"@typescript-eslint/parser": "^6.21.0",
|
60
61
|
"babel-jest": "^29.3.1",
|
61
62
|
"babel-loader": "^9.1.0",
|
62
63
|
"babel-plugin-import": "^1.13.0",
|
63
|
-
"eslint": "^8.
|
64
|
-
"eslint-plugin-prettier": "
|
64
|
+
"eslint": "^8.56.0",
|
65
|
+
"eslint-plugin-prettier": "^5.1.3",
|
65
66
|
"father": "^4.2.3",
|
66
67
|
"jest": "^29.5.0",
|
67
68
|
"jest-environment-jsdom": "^29.3.1",
|
@@ -77,5 +78,9 @@
|
|
77
78
|
},
|
78
79
|
"publishConfig": {
|
79
80
|
"access": "public"
|
81
|
+
},
|
82
|
+
"ci": {
|
83
|
+
"resourceClass": "L",
|
84
|
+
"type": "aci"
|
80
85
|
}
|
81
86
|
}
|