@alipay/ams-checkout 1.24.0 → 1.25.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/component/channel.d.ts +19 -0
- package/esm/component/channel.js +87 -0
- package/esm/component/component.inline.style.d.ts +10 -0
- package/esm/component/component.inline.style.js +121 -0
- package/esm/component/component.popup.style.d.ts +23 -0
- package/esm/component/component.popup.style.js +190 -0
- package/esm/component/popupWindow.style.d.ts +11 -0
- package/esm/component/popupWindow.style.js +121 -0
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +3 -5
- package/esm/constant/index.js +4 -78
- package/esm/core/bus/interface.d.ts +0 -12
- package/esm/core/bus/interface.js +2 -16
- package/esm/core/component/address.d.ts +2 -2
- package/esm/core/component/appPreloadProcessing.js +0 -2
- package/esm/core/component/ckp/index.d.ts +3 -3
- package/esm/core/component/element/components/address.js +1 -1
- package/esm/core/component/element/components/auth.d.ts +1 -1
- package/esm/core/component/element/components/payment.js +1 -1
- package/esm/core/component/element/index.js +19 -19
- package/esm/core/component/element/type.d.ts +6 -0
- package/esm/core/component/index.d.ts +2 -2
- package/esm/core/component/index.js +2 -6
- package/esm/core/drop-in/index.d.ts +2 -2
- package/esm/core/instance/index.d.ts +5 -5
- package/esm/core/instance/index.js +1 -2
- package/esm/foundation/core/index.d.ts +5 -5
- package/esm/foundation/core/index.js +117 -52
- package/esm/foundation/index.d.ts +10 -7
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +8 -5
- package/esm/foundation/product-processor/easysafepay/deps.js +5 -2
- package/esm/foundation/product-processor/easysafepay/index.d.ts +6 -6
- package/esm/foundation/product-processor/easysafepay/index.js +192 -265
- package/esm/foundation/service/{event-bus → api-bus}/ability/callback.js +1 -1
- package/esm/foundation/service/{event-bus → api-bus}/ability/globalData.d.ts +1 -1
- package/esm/{core/bus → foundation/service/api-bus}/ability/globalData.js +2 -2
- package/esm/{core/bus → foundation/service/api-bus}/ability/request.d.ts +1 -1
- package/esm/{core/bus → foundation/service/api-bus}/ability/request.js +2 -2
- package/esm/foundation/service/{event-bus → api-bus}/ability/security.js +29 -19
- package/esm/foundation/service/{event-bus → api-bus}/ability/tracker.js +1 -1
- package/esm/foundation/service/{event-bus → api-bus}/busManager.js +1 -1
- package/esm/foundation/service/{event-bus → api-bus}/index.d.ts +2 -2
- package/esm/foundation/service/api-bus/interface.d.ts +48 -0
- package/esm/foundation/service/api-bus/interface.js +54 -0
- package/esm/foundation/service/container/index.d.ts +4 -2
- package/esm/foundation/service/container/index.js +47 -5
- package/esm/foundation/service/container/popup.js +1 -1
- package/esm/foundation/service/event-center.d.ts +6 -5
- package/esm/foundation/service/event-center.js +16 -17
- package/esm/foundation/service/global-data/index.d.ts +2 -2
- package/esm/foundation/service/global-data/index.js +4 -5
- package/esm/foundation/service/index.d.ts +2 -2
- package/esm/foundation/service/index.js +1 -1
- package/esm/foundation/service/log/index.d.ts +2 -2
- package/esm/foundation/service/log/index.js +1 -1
- package/esm/foundation/service/requester/deps.d.ts +1 -1
- package/esm/foundation/service/requester/requester.d.ts +2 -2
- package/esm/foundation/service/requester/requester.js +14 -11
- package/esm/foundation/service/security/index.d.ts +11 -9
- package/esm/foundation/service/security/index.js +114 -44
- package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_product_utils.js +38 -0
- package/esm/foundation/utils/redirect_utils.d.ts +5 -0
- package/esm/foundation/utils/redirect_utils.js +209 -45
- package/esm/foundation/utils/system_events.js +0 -5
- package/esm/foundation/utils/web_app_url_utils.d.ts +11 -2
- package/esm/foundation/utils/web_app_url_utils.js +18 -3
- package/esm/index.d.ts +12 -12
- package/esm/index.js +31 -31
- package/esm/plugin/component/cashierApp.d.ts +3 -3
- package/esm/plugin/component/cashierApp.js +9 -10
- package/esm/plugin/component/component.inline.style.d.ts +1 -1
- package/esm/plugin/component/component.inline.style.js +2 -3
- package/esm/plugin/component/component.popup.style.d.ts +1 -10
- package/esm/plugin/component/component.popup.style.js +10 -28
- package/esm/plugin/component/index.d.ts +1 -1
- package/esm/plugin/component/index.js +64 -62
- package/esm/plugin/payment-element/utils.d.ts +1 -1
- package/esm/plugin/payment-element/utils.js +1 -2
- package/esm/plugin/type.d.ts +1 -1
- package/esm/types/index.d.ts +17 -11
- package/esm/types/index.js +7 -1
- package/esm/util/getBackScheme.js +95 -3
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +4 -3
- package/esm/util/security.d.ts +33 -0
- package/esm/{foundation/service/event-bus/ability/request.js → util/security.js} +153 -122
- package/package.json +1 -1
- package/esm/core/bus/ability/globalData.d.ts +0 -10
- package/esm/foundation/service/event-bus/ability/globalData.js +0 -89
- package/esm/foundation/service/event-bus/ability/request.d.ts +0 -10
- package/esm/foundation/types/index.d.ts +0 -4
- package/esm/foundation/types/index.js +0 -4
- package/esm/util/ua/index.d.ts +0 -2
- package/esm/util/ua/index.js +0 -2
- package/esm/util/ua/isAndroid.d.ts +0 -4
- package/esm/util/ua/isAndroid.js +0 -7
- package/esm/util/ua/isIOS.d.ts +0 -4
- package/esm/util/ua/isIOS.js +0 -7
- /package/esm/foundation/service/{event-bus → api-bus}/ability/callback.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/ability/security.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/ability/tracker.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/busManager.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/index.js +0 -0
@@ -12,7 +12,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12
12
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
15
|
-
import { SDKCallbackActionEnum } from "
|
15
|
+
import { SDKCallbackActionEnum } from "../interface";
|
16
16
|
import { BusSubscriber } from "../busManager";
|
17
17
|
export var SDKCallbackBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
18
18
|
_inherits(SDKCallbackBusSubscriber, _BusSubscriber);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BusContext, BusMessage, BusSubscriber } from '../../../../foundation/service/
|
1
|
+
import { BusContext, BusMessage, BusSubscriber } from '../../../../foundation/service/api-bus/busManager';
|
2
2
|
export declare class DataBusSubscriber extends BusSubscriber {
|
3
3
|
private instanceId;
|
4
4
|
constructor(instanceId: string);
|
@@ -12,8 +12,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12
12
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
15
|
-
import { ServiceProvider } from "
|
16
|
-
import { BusSubscriber } from "
|
15
|
+
import { ServiceProvider } from "../../../../foundation/service";
|
16
|
+
import { BusSubscriber } from "../../../../foundation/service/api-bus/busManager";
|
17
17
|
import { DataActiontEnum } from "../interface";
|
18
18
|
export var DataBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
19
19
|
_inherits(DataBusSubscriber, _BusSubscriber);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BusContext, BusMessage, BusSubscriber } from "
|
1
|
+
import { BusContext, BusMessage, BusSubscriber } from "../../../../foundation/service/api-bus/busManager";
|
2
2
|
export declare class RequestBusSubscriber extends BusSubscriber {
|
3
3
|
private instanceId;
|
4
4
|
constructor(instanceId: string);
|
@@ -16,8 +16,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
17
17
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
18
|
import { RequestActiontEnum } from "../interface";
|
19
|
-
import { BusSubscriber } from "
|
20
|
-
import { ServiceProvider } from "
|
19
|
+
import { BusSubscriber } from "../../../../foundation/service/api-bus/busManager";
|
20
|
+
import { ServiceProvider } from "../../../../foundation/service";
|
21
21
|
export var RequestBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
22
22
|
_inherits(RequestBusSubscriber, _BusSubscriber);
|
23
23
|
var _super = _createSuper(RequestBusSubscriber);
|
@@ -16,7 +16,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
17
17
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
18
|
import { BusSubscriber } from "../busManager";
|
19
|
-
import { SecuritySDKActionEnum } from "
|
19
|
+
import { SecuritySDKActionEnum } from "../interface";
|
20
20
|
import { ServiceProvider } from "../../../../foundation/service";
|
21
21
|
export var SecurityBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
22
22
|
_inherits(SecurityBusSubscriber, _BusSubscriber);
|
@@ -43,18 +43,23 @@ export var SecurityBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
43
43
|
while (1) switch (_context.prev = _context.next) {
|
44
44
|
case 0:
|
45
45
|
console.log('preInitSecurity', message);
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
46
|
+
_context.prev = 1;
|
47
|
+
securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
48
|
+
_context.next = 5;
|
49
|
+
return securityService.preInitSecurity();
|
50
|
+
case 5:
|
51
|
+
context === null || context === void 0 || context.onCallBack(message.result(true));
|
52
|
+
_context.next = 11;
|
53
|
+
break;
|
54
|
+
case 8:
|
55
|
+
_context.prev = 8;
|
56
|
+
_context.t0 = _context["catch"](1);
|
57
|
+
context === null || context === void 0 || context.onCallBack(message.result(false));
|
58
|
+
case 11:
|
54
59
|
case "end":
|
55
60
|
return _context.stop();
|
56
61
|
}
|
57
|
-
}, _callee, this);
|
62
|
+
}, _callee, this, [[1, 8]]);
|
58
63
|
}));
|
59
64
|
function preInitSecurity(_x, _x2) {
|
60
65
|
return _preInitSecurity.apply(this, arguments);
|
@@ -70,18 +75,23 @@ export var SecurityBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
70
75
|
while (1) switch (_context2.prev = _context2.next) {
|
71
76
|
case 0:
|
72
77
|
console.log('initSecurity', message);
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
_context2.prev = 1;
|
79
|
+
securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
80
|
+
_context2.next = 5;
|
81
|
+
return securityService.initSecurity();
|
82
|
+
case 5:
|
83
|
+
context === null || context === void 0 || context.onCallBack(message.result(true));
|
84
|
+
_context2.next = 11;
|
85
|
+
break;
|
86
|
+
case 8:
|
87
|
+
_context2.prev = 8;
|
88
|
+
_context2.t0 = _context2["catch"](1);
|
89
|
+
context === null || context === void 0 || context.onCallBack(message.result(false));
|
90
|
+
case 11:
|
81
91
|
case "end":
|
82
92
|
return _context2.stop();
|
83
93
|
}
|
84
|
-
}, _callee2, this);
|
94
|
+
}, _callee2, this, [[1, 8]]);
|
85
95
|
}));
|
86
96
|
function initSecurity(_x3, _x4) {
|
87
97
|
return _initSecurity.apply(this, arguments);
|
@@ -16,7 +16,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
17
17
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
18
|
import { BusSubscriber } from "../busManager";
|
19
|
-
import { TrackerActionEnum } from "
|
19
|
+
import { TrackerActionEnum } from "../interface";
|
20
20
|
import { ServiceProvider } from "../../../../foundation/service";
|
21
21
|
export var TrackerBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
22
22
|
_inherits(TrackerBusSubscriber, _BusSubscriber);
|
@@ -10,7 +10,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
10
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
12
12
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
13
|
-
import { ServiceProvider } from
|
13
|
+
import { ServiceProvider } from '..';
|
14
14
|
/**
|
15
15
|
* Bus 埋点内容定义
|
16
16
|
*/
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Service } from '../../index';
|
2
|
-
import {
|
2
|
+
import { IoptionsParams } from '../../../types';
|
3
3
|
import { LogService } from '../log';
|
4
4
|
import { BusMessage, BusSubscriber, OnBusCallback } from './busManager';
|
5
5
|
/**
|
@@ -10,7 +10,7 @@ export declare class ApiBusManagerService implements Service {
|
|
10
10
|
protected logger: LogService;
|
11
11
|
protected instanceId: string;
|
12
12
|
private busManager;
|
13
|
-
init(initOptions:
|
13
|
+
init(initOptions: IoptionsParams, instanceId: string): void;
|
14
14
|
subscribe(subscriber: BusSubscriber): void;
|
15
15
|
unsubscribe(subscriber: BusSubscriber): void;
|
16
16
|
isSubscribed(actionName: string): boolean;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
export declare enum PaymentActionEnum {
|
2
|
+
optional_init = "plugin_optional_init"
|
3
|
+
}
|
4
|
+
export declare enum ApplePayActionEnum {
|
5
|
+
canMakePayments = "plugin_CARD_APPLE_PAY_available",
|
6
|
+
createComponent = "plugin_CARD_APPLE_PAY_createComponent",
|
7
|
+
destroyComponent = "plugin_CARD_APPLE_PAY_destroyComponent"
|
8
|
+
}
|
9
|
+
export declare enum PaypalActionEnum {
|
10
|
+
mountComponent = "plugin_Paypal_mountComponent",
|
11
|
+
destroyComponent = "plugin_Paypal_destroyComponent"
|
12
|
+
}
|
13
|
+
export declare enum SDKCallbackActionEnum {
|
14
|
+
onEventCallback = "onEventCallback"
|
15
|
+
}
|
16
|
+
export declare enum RequestActiontEnum {
|
17
|
+
request = "request",
|
18
|
+
getEnvInfo = "getEnvInfo",
|
19
|
+
getUserAgent = "getUserAgent"
|
20
|
+
}
|
21
|
+
export declare enum DataActiontEnum {
|
22
|
+
getGlobalData = "getGlobalData",
|
23
|
+
setGlobalData = "setGlobalData",
|
24
|
+
clearGlobalData = "clearGlobalData"
|
25
|
+
}
|
26
|
+
export declare enum SecuritySDKActionEnum {
|
27
|
+
preInitSecurity = "preInitSecurity",
|
28
|
+
initSecurity = "initSecurity",
|
29
|
+
getSecurityDeviceId = "getSecurityDeviceId"
|
30
|
+
}
|
31
|
+
export declare enum TrackerActionEnum {
|
32
|
+
/**
|
33
|
+
* level: string info/error
|
34
|
+
* basic: json object
|
35
|
+
* extra: json object
|
36
|
+
*/
|
37
|
+
reportAnalytics = "reportAnalytics"
|
38
|
+
}
|
39
|
+
export declare enum ComponentActiontEnum {
|
40
|
+
onDestory = "onDestory"
|
41
|
+
}
|
42
|
+
export declare enum RequestActiontEnum {
|
43
|
+
onDestory = "httpRequest"
|
44
|
+
}
|
45
|
+
export declare enum LoadingActiontEnum {
|
46
|
+
showLoading = "showLoading",
|
47
|
+
dismissLoading = "dismissLoading"
|
48
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
export var PaymentActionEnum = /*#__PURE__*/function (PaymentActionEnum) {
|
2
|
+
PaymentActionEnum["optional_init"] = "plugin_optional_init";
|
3
|
+
return PaymentActionEnum;
|
4
|
+
}({});
|
5
|
+
export var ApplePayActionEnum = /*#__PURE__*/function (ApplePayActionEnum) {
|
6
|
+
ApplePayActionEnum["canMakePayments"] = "plugin_CARD_APPLE_PAY_available";
|
7
|
+
ApplePayActionEnum["createComponent"] = "plugin_CARD_APPLE_PAY_createComponent";
|
8
|
+
ApplePayActionEnum["destroyComponent"] = "plugin_CARD_APPLE_PAY_destroyComponent";
|
9
|
+
return ApplePayActionEnum;
|
10
|
+
}({});
|
11
|
+
export var PaypalActionEnum = /*#__PURE__*/function (PaypalActionEnum) {
|
12
|
+
PaypalActionEnum["mountComponent"] = "plugin_Paypal_mountComponent";
|
13
|
+
PaypalActionEnum["destroyComponent"] = "plugin_Paypal_destroyComponent";
|
14
|
+
return PaypalActionEnum;
|
15
|
+
}({});
|
16
|
+
export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum) {
|
17
|
+
SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
|
18
|
+
return SDKCallbackActionEnum;
|
19
|
+
}({});
|
20
|
+
export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
21
|
+
RequestActiontEnum["request"] = "request";
|
22
|
+
RequestActiontEnum["getEnvInfo"] = "getEnvInfo";
|
23
|
+
RequestActiontEnum["getUserAgent"] = "getUserAgent";
|
24
|
+
return RequestActiontEnum;
|
25
|
+
}({});
|
26
|
+
export var DataActiontEnum = /*#__PURE__*/function (DataActiontEnum) {
|
27
|
+
DataActiontEnum["getGlobalData"] = "getGlobalData";
|
28
|
+
DataActiontEnum["setGlobalData"] = "setGlobalData";
|
29
|
+
DataActiontEnum["clearGlobalData"] = "clearGlobalData";
|
30
|
+
return DataActiontEnum;
|
31
|
+
}({});
|
32
|
+
export var SecuritySDKActionEnum = /*#__PURE__*/function (SecuritySDKActionEnum) {
|
33
|
+
SecuritySDKActionEnum["preInitSecurity"] = "preInitSecurity";
|
34
|
+
SecuritySDKActionEnum["initSecurity"] = "initSecurity";
|
35
|
+
SecuritySDKActionEnum["getSecurityDeviceId"] = "getSecurityDeviceId";
|
36
|
+
return SecuritySDKActionEnum;
|
37
|
+
}({});
|
38
|
+
export var TrackerActionEnum = /*#__PURE__*/function (TrackerActionEnum) {
|
39
|
+
TrackerActionEnum["reportAnalytics"] = "reportAnalytics";
|
40
|
+
return TrackerActionEnum;
|
41
|
+
}({});
|
42
|
+
export var ComponentActiontEnum = /*#__PURE__*/function (ComponentActiontEnum) {
|
43
|
+
ComponentActiontEnum["onDestory"] = "onDestory";
|
44
|
+
return ComponentActiontEnum;
|
45
|
+
}({});
|
46
|
+
RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
47
|
+
RequestActiontEnum["onDestory"] = "httpRequest";
|
48
|
+
return RequestActiontEnum;
|
49
|
+
}(RequestActiontEnum || {});
|
50
|
+
export var LoadingActiontEnum = /*#__PURE__*/function (LoadingActiontEnum) {
|
51
|
+
LoadingActiontEnum["showLoading"] = "showLoading";
|
52
|
+
LoadingActiontEnum["dismissLoading"] = "dismissLoading";
|
53
|
+
return LoadingActiontEnum;
|
54
|
+
}({});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DisplayInfo, SDKMetaData, Service } from '../../index';
|
2
|
-
import {
|
2
|
+
import { IoptionsParams } from '../../../types';
|
3
3
|
export declare class ContainerService implements Service {
|
4
4
|
private instanceId;
|
5
5
|
private sdkMetaData;
|
@@ -9,9 +9,10 @@ export declare class ContainerService implements Service {
|
|
9
9
|
private logService;
|
10
10
|
private displayInfo;
|
11
11
|
private webApp;
|
12
|
+
private _webAppHeartBeatTimeoutFn;
|
12
13
|
private customizedLoadingListener;
|
13
14
|
destroy(): void;
|
14
|
-
init(initOptions:
|
15
|
+
init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
15
16
|
update(): void;
|
16
17
|
load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
|
17
18
|
cleanContainer(displayInfo: DisplayInfo): void;
|
@@ -24,5 +25,6 @@ export declare class ContainerService implements Service {
|
|
24
25
|
private addCapabilityToEventCenter;
|
25
26
|
private addCapabilityToApiBusManager;
|
26
27
|
private handleSizeChanged;
|
28
|
+
private handleAppHeartBeat;
|
27
29
|
private changeCloseBtnVisibility;
|
28
30
|
}
|
@@ -9,11 +9,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
10
10
|
import { DisplayTypeEnum } from "../../../types";
|
11
11
|
import { createIframe, createPreloadIframe, startSizeChangeAnim } from "./utils";
|
12
|
-
import { addInlineLoading, createInlineBaseElement } from "../../../
|
13
|
-
import { addPopupLoading, createBaseElement } from "../../../
|
12
|
+
import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
|
13
|
+
import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
|
14
14
|
import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, LOADING_ID, MOCKUP_ID } from "../../../constant";
|
15
15
|
import { ServiceProvider } from "../index";
|
16
|
-
import { EVENT } from "../../../constant";
|
16
|
+
import { EVENT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../../constant";
|
17
17
|
import { PopupManager } from "./popup";
|
18
18
|
/**
|
19
19
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
@@ -31,6 +31,7 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
31
31
|
_defineProperty(this, "logService", void 0);
|
32
32
|
_defineProperty(this, "displayInfo", void 0);
|
33
33
|
_defineProperty(this, "webApp", void 0);
|
34
|
+
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
34
35
|
// if this variable is true, SDK will invoke listener instead of showing loading
|
35
36
|
_defineProperty(this, "customizedLoadingListener", void 0);
|
36
37
|
}
|
@@ -54,8 +55,9 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
54
55
|
}, {
|
55
56
|
key: "load",
|
56
57
|
value: function load(displayInfo, url, closeBtnFunc) {
|
57
|
-
|
58
|
-
|
58
|
+
var webApp = createIframe('antom-sdk-web-app' + (displayInfo.appendAliasContainerId ? "-".concat(displayInfo.selector) : ''));
|
59
|
+
this.webApp = webApp;
|
60
|
+
this.displayInfo = displayInfo;
|
59
61
|
webApp.src = url;
|
60
62
|
this.eventCenter.addIFrame(webApp);
|
61
63
|
if (webApp.src.includes('?')) {
|
@@ -202,6 +204,9 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
202
204
|
this.eventCenter.listen(EVENT.hideCloseButton.name, function () {
|
203
205
|
_this2.changeCloseBtnVisibility(false);
|
204
206
|
});
|
207
|
+
this.eventCenter.listen(EVENT.appHeartBeat.name, function () {
|
208
|
+
_this2.handleAppHeartBeat();
|
209
|
+
});
|
205
210
|
}
|
206
211
|
}, {
|
207
212
|
key: "addCapabilityToApiBusManager",
|
@@ -241,6 +246,43 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
241
246
|
this.webApp.style.height = "".concat(data.height, "px");
|
242
247
|
}
|
243
248
|
}
|
249
|
+
}, {
|
250
|
+
key: "handleAppHeartBeat",
|
251
|
+
value: function handleAppHeartBeat() {
|
252
|
+
var _this3 = this;
|
253
|
+
try {
|
254
|
+
if (!this._webAppHeartBeatTimeoutFn) {
|
255
|
+
this._webAppHeartBeatTimeoutFn = function () {
|
256
|
+
if (_this3.webApp && _this3.displayInfo) {
|
257
|
+
_this3.logService.logError({
|
258
|
+
title: 'sdk_error_appHeartBeatTimeout'
|
259
|
+
});
|
260
|
+
}
|
261
|
+
};
|
262
|
+
}
|
263
|
+
if (window._webAppHeartBeatTimeoutId) {
|
264
|
+
clearTimeout(window._webAppHeartBeatTimeoutId);
|
265
|
+
window._webAppHeartBeatTimeoutId = null;
|
266
|
+
}
|
267
|
+
if (this._webAppHeartBeatTimeoutFn) {
|
268
|
+
window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
269
|
+
}
|
270
|
+
setTimeout(function () {
|
271
|
+
if (_this3.webApp && _this3.displayInfo) {
|
272
|
+
_this3.eventCenter.dispatchToApp({
|
273
|
+
event: 'sdkHeartBeat',
|
274
|
+
data: {}
|
275
|
+
});
|
276
|
+
}
|
277
|
+
}, TIME_DELAY_SEND_HEART_BEAT);
|
278
|
+
} catch (error) {
|
279
|
+
this.logService.logError({
|
280
|
+
title: 'sdk_error_handleAppHeartBeat'
|
281
|
+
}, {
|
282
|
+
errorMessage: error.message
|
283
|
+
});
|
284
|
+
}
|
285
|
+
}
|
244
286
|
}, {
|
245
287
|
key: "changeCloseBtnVisibility",
|
246
288
|
value: function changeCloseBtnVisibility(isShow) {
|
@@ -8,7 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
8
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
9
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
10
10
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
11
|
-
import { createModal, destroyModal } from "../../../
|
11
|
+
import { createModal, destroyModal } from "../../../component/popupWindow.style";
|
12
12
|
import { LOADTIME_LIMIT, POPUP_LOADTIME_LOG_LIMIT } from "../../../constant";
|
13
13
|
/**
|
14
14
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { EventPayload, EventPayloadContext } from '../../types';
|
2
|
-
import { Service } from '../index';
|
1
|
+
import { EventPayload, EventPayloadContext, IoptionsParams } from '../../types';
|
2
|
+
import { SDKMetaData, Service } from '../index';
|
3
3
|
/**
|
4
4
|
* @author 江跃 <jiangbin.gjb@antgroup.com>
|
5
5
|
* @date 2024/9/17
|
@@ -7,11 +7,12 @@ import { Service } from '../index';
|
|
7
7
|
export declare class EventCenter implements Service {
|
8
8
|
private events;
|
9
9
|
private iframes;
|
10
|
+
private instanceId;
|
10
11
|
constructor();
|
11
12
|
/**
|
12
13
|
* Initializes the event center
|
13
14
|
*/
|
14
|
-
init(): void;
|
15
|
+
init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
15
16
|
/**
|
16
17
|
* Cleans up event listeners when the event center is destroyed.
|
17
18
|
*/
|
@@ -54,7 +55,7 @@ export declare class EventCenter implements Service {
|
|
54
55
|
* @param name - The name of the event to emit.
|
55
56
|
* @param data - The event data to pass to the event listeners.
|
56
57
|
*/
|
57
|
-
emit(name: string, data: any,
|
58
|
+
emit(name: string, data: any, EventPayload?: EventPayload): void;
|
58
59
|
/**
|
59
60
|
* Registers a callback for an event and immediately dispatches the event to the app.
|
60
61
|
* @param payloadContext - The context containing event information and callback ID.
|
@@ -70,6 +71,6 @@ export declare class EventCenter implements Service {
|
|
70
71
|
isExist(name: string): boolean;
|
71
72
|
}
|
72
73
|
interface IListener {
|
73
|
-
(data: any,
|
74
|
+
(data: any, EventPayload?: EventPayload): void;
|
74
75
|
}
|
75
76
|
export {};
|
@@ -9,7 +9,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
10
10
|
import { v4 as uuid } from 'uuid';
|
11
11
|
import { ERRORMESSAGE } from "../../constant";
|
12
|
-
import { MessageName } from "../../types";
|
12
|
+
import { EventPayload, MessageName } from "../../types";
|
13
13
|
import { isJsonString } from "../../util";
|
14
14
|
import { getIframeOrigin, registerSystemEvents, unRegisterSystemEvents } from "../utils/system_events";
|
15
15
|
|
@@ -22,6 +22,7 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
22
22
|
_classCallCheck(this, EventCenter);
|
23
23
|
_defineProperty(this, "events", void 0);
|
24
24
|
_defineProperty(this, "iframes", void 0);
|
25
|
+
_defineProperty(this, "instanceId", void 0);
|
25
26
|
this.events = new Map();
|
26
27
|
this.iframes = [];
|
27
28
|
}
|
@@ -31,7 +32,8 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
31
32
|
*/
|
32
33
|
_createClass(EventCenter, [{
|
33
34
|
key: "init",
|
34
|
-
value: function init() {
|
35
|
+
value: function init(initOptions, instanceId, sdkMetaData) {
|
36
|
+
this.instanceId = instanceId;
|
35
37
|
this.handleAppMessage = this.handleAppMessage.bind(this);
|
36
38
|
window.addEventListener('message', this.handleAppMessage);
|
37
39
|
registerSystemEvents(this);
|
@@ -89,7 +91,6 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
89
91
|
key: "handleAppMessage",
|
90
92
|
value: function handleAppMessage(e) {
|
91
93
|
var _e$data;
|
92
|
-
// console.log('sdk received message:', e);
|
93
94
|
if (!this.iframes.some(function (iframe) {
|
94
95
|
return iframe.origin === e.origin;
|
95
96
|
})) return;
|
@@ -98,15 +99,13 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
98
99
|
}
|
99
100
|
var isJson = isJsonString(e.data);
|
100
101
|
if (isJson) {
|
101
|
-
var
|
102
|
-
|
103
|
-
if (_eventPayload.name !== MessageName.APP_TO_SDK) {
|
102
|
+
var _EventPayload = JSON.parse(e.data);
|
103
|
+
if (_EventPayload.name !== MessageName.APP_TO_SDK) {
|
104
104
|
return;
|
105
105
|
}
|
106
|
-
this._handleAppMessage(
|
106
|
+
this._handleAppMessage(_EventPayload);
|
107
107
|
} else {
|
108
|
-
console.
|
109
|
-
// TODO: 异常上报
|
108
|
+
console.error(ERRORMESSAGE.NOT_JSON_FORMAT);
|
110
109
|
}
|
111
110
|
}
|
112
111
|
|
@@ -116,11 +115,11 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
116
115
|
*/
|
117
116
|
}, {
|
118
117
|
key: "_handleAppMessage",
|
119
|
-
value: function _handleAppMessage(
|
120
|
-
var context =
|
118
|
+
value: function _handleAppMessage(EventPayload) {
|
119
|
+
var context = EventPayload.context;
|
121
120
|
var event = context.event,
|
122
121
|
data = context.data;
|
123
|
-
this.emit(event, data,
|
122
|
+
this.emit(event, data, EventPayload);
|
124
123
|
}
|
125
124
|
|
126
125
|
/**
|
@@ -166,11 +165,11 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
166
165
|
*/
|
167
166
|
}, {
|
168
167
|
key: "emit",
|
169
|
-
value: function emit(name, data,
|
168
|
+
value: function emit(name, data, EventPayload) {
|
170
169
|
if (this.events.has(name)) {
|
171
170
|
var eventList = this.events.get(name);
|
172
171
|
eventList.forEach(function (item) {
|
173
|
-
item.func(data,
|
172
|
+
item.func(data, EventPayload);
|
174
173
|
});
|
175
174
|
}
|
176
175
|
}
|
@@ -218,13 +217,13 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
218
217
|
_this = this;
|
219
218
|
var data = {
|
220
219
|
name: MessageName.SDK_TO_APP,
|
221
|
-
context: payloadContext
|
220
|
+
context: payloadContext,
|
221
|
+
instanceId: this.instanceId
|
222
222
|
};
|
223
|
-
console.log('dispatchToApp');
|
224
223
|
(_this$iframes = this.iframes) === null || _this$iframes === void 0 || _this$iframes.forEach(function (iframe) {
|
225
224
|
var _iframe$origin;
|
226
225
|
if (!iframe.ref.contentWindow) {
|
227
|
-
console.
|
226
|
+
console.error('get app contentWindow error', iframe);
|
228
227
|
return;
|
229
228
|
}
|
230
229
|
var _ref = _this.queryParse(iframe.ref.src) || {},
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { IoptionsParams } from "../../../types";
|
2
2
|
import { Service } from "../../index";
|
3
3
|
export declare class GlobalDataService implements Service {
|
4
4
|
private globalData;
|
5
|
-
init(initOptions:
|
5
|
+
init(initOptions: IoptionsParams, instanceId: string): void;
|
6
6
|
destroy(): void;
|
7
7
|
update(): void;
|
8
8
|
getGlobalData(dataKey: string): any;
|
@@ -18,7 +18,7 @@ export var GlobalDataService = /*#__PURE__*/function () {
|
|
18
18
|
var _this = this;
|
19
19
|
// add capability to EventCenter
|
20
20
|
var eventCenter = ServiceProvider.getInstance(instanceId).getService('EventCenter');
|
21
|
-
eventCenter.listen(EVENT.getGlobalData.name, function (payload) {
|
21
|
+
eventCenter.listen(EVENT.getGlobalData.name, function (data, payload) {
|
22
22
|
var _payload$context, _payload$context2, _payload$context3, _payload$context4;
|
23
23
|
if (!((_payload$context = payload.context) !== null && _payload$context !== void 0 && _payload$context.eventCallbackId) || !((_payload$context2 = payload.context) !== null && _payload$context2 !== void 0 && (_payload$context2 = _payload$context2.data) !== null && _payload$context2 !== void 0 && _payload$context2.dataKey)) {
|
24
24
|
return;
|
@@ -30,12 +30,11 @@ export var GlobalDataService = /*#__PURE__*/function () {
|
|
30
30
|
data: targetData
|
31
31
|
});
|
32
32
|
});
|
33
|
-
eventCenter.listen(EVENT.setGlobalData.name, function (
|
34
|
-
|
35
|
-
if (!((_payload$context5 = payload.context) !== null && _payload$context5 !== void 0 && (_payload$context5 = _payload$context5.data) !== null && _payload$context5 !== void 0 && _payload$context5.dataKey) || !((_payload$context6 = payload.context) !== null && _payload$context6 !== void 0 && (_payload$context6 = _payload$context6.data) !== null && _payload$context6 !== void 0 && _payload$context6.data)) {
|
33
|
+
eventCenter.listen(EVENT.setGlobalData.name, function (data) {
|
34
|
+
if (!(data !== null && data !== void 0 && data.dataKey) || !(data !== null && data !== void 0 && data.data)) {
|
36
35
|
return;
|
37
36
|
}
|
38
|
-
_this.globalData.set(
|
37
|
+
_this.globalData.set(data.dataKey, data.data);
|
39
38
|
});
|
40
39
|
|
41
40
|
// register
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { IoptionsParams } from '../../types';
|
2
2
|
import { PaymentContext, SDKMetaData, Service } from '../index';
|
3
3
|
/**
|
4
4
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
@@ -12,7 +12,7 @@ export declare class ServiceProvider {
|
|
12
12
|
private services;
|
13
13
|
private extendServices;
|
14
14
|
private constructor();
|
15
|
-
init(initOptions:
|
15
|
+
init(initOptions: IoptionsParams, sdkMetaData: SDKMetaData): void;
|
16
16
|
update(paymentContext: PaymentContext): void;
|
17
17
|
getService<T>(serviceName: ServiceName): T;
|
18
18
|
registerService(serviceName: string, service: Service): void;
|
@@ -10,7 +10,7 @@ import { LogService } from "./log";
|
|
10
10
|
import { EventCenter } from "./event-center";
|
11
11
|
import { RequesterService } from "./requester/requester";
|
12
12
|
import { SecurityService } from "./security";
|
13
|
-
import { ApiBusManagerService } from "./
|
13
|
+
import { ApiBusManagerService } from "./api-bus";
|
14
14
|
import { GlobalDataService } from "./global-data";
|
15
15
|
|
16
16
|
/**
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { PaymentContext, SDKMetaData, Service } from '../../index';
|
2
|
-
import {
|
2
|
+
import { IoptionsParams } from '../../../types';
|
3
3
|
import { LogExtra, LogMetaData, LogPayload } from './types';
|
4
4
|
/**
|
5
5
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
@@ -25,7 +25,7 @@ export declare class LogService implements Service {
|
|
25
25
|
private isLoaded;
|
26
26
|
private trackId;
|
27
27
|
constructor();
|
28
|
-
init(initOptions:
|
28
|
+
init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
29
29
|
update(paymentContext: PaymentContext): void;
|
30
30
|
destroy(): void;
|
31
31
|
setMetaData(metaData: LogMetaData): void;
|
@@ -7,7 +7,7 @@ export type { LogPayload, LogExtra } from '../log/types';
|
|
7
7
|
export type { LogService } from '../log';
|
8
8
|
export type { Service, PaymentContext } from '../../index';
|
9
9
|
export { fomatGetwayError } from '../../../request/utils';
|
10
|
-
export type {
|
10
|
+
export type { IoptionsParams, IPaymentSessionMetaData } from '../../../types';
|
11
11
|
export { sdkVersion } from '../../../config/index';
|
12
12
|
export { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from '../../../config/request';
|
13
13
|
export type { RequestConfig } from '../../../types';
|