@alipay/ams-checkout 0.0.1757298389-dev.1 → 0.0.1757298389-dev.10
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/component/component.popup.style.d.ts +1 -0
- package/esm/component/component.popup.style.js +1 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +10 -0
- package/esm/constant/index.js +12 -0
- package/esm/core/component/element/elementContainerService/containerService.js +3 -2
- package/esm/core/component/element/elementController/index.js +22 -15
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +16 -10
- package/esm/core/component/element/type.d.ts +8 -3
- package/esm/core/component/element/type.js +5 -0
- package/esm/core/component/element/util.d.ts +1 -1
- package/esm/core/component/index.d.ts +4 -1
- package/esm/core/component/index.js +105 -2
- package/esm/index.d.ts +10 -1
- package/esm/index.js +15 -1
- package/esm/plugin/component/index.d.ts +2 -0
- package/esm/plugin/component/index.js +23 -7
- package/esm/plugin/paypal/index.js +5 -2
- package/esm/types/index.d.ts +3 -0
- package/package.json +2 -2
|
@@ -23,7 +23,7 @@ import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK
|
|
|
23
23
|
import { ElementPaymentMethod } from "../../core/component/oldElement/type";
|
|
24
24
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
|
25
25
|
import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, TargetEnum } from "../../types";
|
|
26
|
-
import { getType, isJsonString, isPC } from "../../util";
|
|
26
|
+
import { getType, isJsonString, isPC, device } from "../../util";
|
|
27
27
|
import { getBackScheme } from "../../util/getBackScheme";
|
|
28
28
|
import { isLocalMock } from "../../util/mock";
|
|
29
29
|
import { matchVersion } from "../../util/versionCompare";
|
|
@@ -62,6 +62,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
62
62
|
_defineProperty(this, "_isAppWebview", void 0);
|
|
63
63
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
|
64
64
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
|
65
|
+
_defineProperty(this, "_hasRenderComponent", false);
|
|
65
66
|
this._appVersion = componentOption.appVersion;
|
|
66
67
|
this._isInitComponent = false;
|
|
67
68
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
|
@@ -71,7 +72,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
71
72
|
this.createPreloadIframeNode = function () {
|
|
72
73
|
return Promise.resolve();
|
|
73
74
|
};
|
|
74
|
-
this.platform =
|
|
75
|
+
this.platform = device.isMobile ? PlatformEnum.mobile : PlatformEnum.desktop;
|
|
75
76
|
this._isRetention = true;
|
|
76
77
|
this._appLocationSearch = '';
|
|
77
78
|
this._performanceData.push({
|
|
@@ -673,6 +674,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
673
674
|
message: res === null || res === void 0 ? void 0 : res.errorMessage
|
|
674
675
|
};
|
|
675
676
|
_this5.dispatchToSDK(EVENT.error.name, createComponentError);
|
|
677
|
+
_this5.dispatchToSDK(EVENT.eventCallback.name, createComponentError);
|
|
676
678
|
if ((res === null || res === void 0 || (_res$errorActions = res.errorActions) === null || _res$errorActions === void 0 ? void 0 : _res$errorActions.showType) === 'NONE') {
|
|
677
679
|
// 抛错销毁SDK,不展示错误页面
|
|
678
680
|
reject(createComponentError);
|
|
@@ -684,6 +686,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
684
686
|
if (ComponentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign) {
|
|
685
687
|
// 通用操作:抛CREATECOMPONENT_ERROR错误码给商户,商户升级到新版本需要处理CREATECOMPONENT_ERROR逻辑
|
|
686
688
|
_this5.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.NETWORK_REQUEST_ERROR);
|
|
689
|
+
_this5.dispatchToSDK(EVENT.eventCallback.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.NETWORK_REQUEST_ERROR);
|
|
687
690
|
}
|
|
688
691
|
if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.VAULTING_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
|
|
689
692
|
return resolve({
|
|
@@ -1407,6 +1410,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
1407
1410
|
});
|
|
1408
1411
|
return;
|
|
1409
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
|
+
|
|
1410
1419
|
// log event before sending the callback
|
|
1411
1420
|
this.logEventCallback(data, 'sdk_event_event_callback');
|
|
1412
1421
|
try {
|
|
@@ -1842,6 +1851,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
1842
1851
|
return this._actionSubmitPromise;
|
|
1843
1852
|
case 9:
|
|
1844
1853
|
submitRes = _context8.sent;
|
|
1854
|
+
this._hasRenderComponent = true;
|
|
1845
1855
|
this._performanceData.push({
|
|
1846
1856
|
key: 'sdk_render_component',
|
|
1847
1857
|
value: Date.now()
|
|
@@ -1897,16 +1907,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
1897
1907
|
}
|
|
1898
1908
|
});
|
|
1899
1909
|
// eslint-disable-next-line no-empty
|
|
1900
|
-
_context8.next =
|
|
1910
|
+
_context8.next = 19;
|
|
1901
1911
|
break;
|
|
1902
|
-
case
|
|
1903
|
-
_context8.prev =
|
|
1912
|
+
case 17:
|
|
1913
|
+
_context8.prev = 17;
|
|
1904
1914
|
_context8.t0 = _context8["catch"](0);
|
|
1905
|
-
case
|
|
1915
|
+
case 19:
|
|
1906
1916
|
case "end":
|
|
1907
1917
|
return _context8.stop();
|
|
1908
1918
|
}
|
|
1909
|
-
}, _callee8, this, [[0,
|
|
1919
|
+
}, _callee8, this, [[0, 17]]);
|
|
1910
1920
|
}));
|
|
1911
1921
|
function sendRenderEvent() {
|
|
1912
1922
|
return _sendRenderEvent.apply(this, arguments);
|
|
@@ -1933,6 +1943,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
1933
1943
|
this._performanceData = [];
|
|
1934
1944
|
this._isInitComponent = false;
|
|
1935
1945
|
this.app = null;
|
|
1946
|
+
this._hasRenderComponent = false;
|
|
1936
1947
|
if (immediately) this.cleanElement();else {
|
|
1937
1948
|
setTimeout(function () {
|
|
1938
1949
|
_this10.cleanElement();
|
|
@@ -2019,6 +2030,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
2019
2030
|
form.submit();
|
|
2020
2031
|
}, 0);
|
|
2021
2032
|
}
|
|
2033
|
+
}, {
|
|
2034
|
+
key: "shouldValidateFields",
|
|
2035
|
+
value: function shouldValidateFields() {
|
|
2036
|
+
return this._hasRenderComponent;
|
|
2037
|
+
}
|
|
2022
2038
|
}]);
|
|
2023
2039
|
return ComponentApp;
|
|
2024
2040
|
}();
|
|
@@ -82,7 +82,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
|
82
82
|
}
|
|
83
83
|
return Promise.resolve(paypalPluginProps);
|
|
84
84
|
});
|
|
85
|
-
// 加载paypal资源
|
|
85
|
+
// 加载paypal资源 TODO
|
|
86
86
|
_defineProperty(_assertThisInitialized(_this), "loadPaypalResource", function (paypalPluginProps) {
|
|
87
87
|
return new Promise(function (resolve, reject) {
|
|
88
88
|
var _paypalPluginProps$ap;
|
|
@@ -265,6 +265,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
|
265
265
|
return _ref6.apply(this, arguments);
|
|
266
266
|
};
|
|
267
267
|
}());
|
|
268
|
+
// TODO
|
|
268
269
|
_defineProperty(_assertThisInitialized(_this), "destroyComponent", /*#__PURE__*/function () {
|
|
269
270
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(context, message) {
|
|
270
271
|
var data;
|
|
@@ -373,7 +374,9 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
|
373
374
|
}
|
|
374
375
|
}, {
|
|
375
376
|
key: "onMessage",
|
|
376
|
-
value:
|
|
377
|
+
value:
|
|
378
|
+
// TODO
|
|
379
|
+
function onMessage(context, message) {
|
|
377
380
|
switch (message.getAction()) {
|
|
378
381
|
case PaypalActionEnum.mountComponent:
|
|
379
382
|
this.renderPaypalButton(context, message);
|
package/esm/types/index.d.ts
CHANGED
|
@@ -40,6 +40,9 @@ export interface IoptionsParams {
|
|
|
40
40
|
mode?: string;
|
|
41
41
|
securityRegion?: 'US' | 'SG' | 'DE';
|
|
42
42
|
}
|
|
43
|
+
export interface ValidationResult {
|
|
44
|
+
isValid: boolean;
|
|
45
|
+
}
|
|
43
46
|
export interface IPreloadOptions {
|
|
44
47
|
environment?: string;
|
|
45
48
|
securityRegion?: 'US' | 'SG' | 'DE';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/ams-checkout",
|
|
3
|
-
"version": "0.0.1757298389-dev.
|
|
3
|
+
"version": "0.0.1757298389-dev.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "esm/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
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",
|
|
24
|
-
"test": "jest --silent",
|
|
24
|
+
"test": "jest --coverage --silent",
|
|
25
25
|
"tsc": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"commitlint": {
|