@alipay/ams-checkout 0.0.1726734012-dev.1 → 0.0.1726734012-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/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 +25 -0
- package/esm/component/component.popup.style.js +203 -0
- package/esm/component/popupWindow.style.d.ts +11 -0
- package/esm/component/popupWindow.style.js +121 -0
- package/esm/config/index.d.ts +11 -0
- package/esm/config/index.js +20 -1
- package/esm/constant/index.d.ts +25 -0
- package/esm/constant/index.js +28 -0
- package/esm/core/bus/index.d.ts +3 -3
- package/esm/core/bus/index.js +14 -14
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.js +2 -2
- package/esm/core/component/ckp/index.js +12 -8
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +60 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +817 -0
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +491 -0
- package/esm/core/component/element/type.d.ts +191 -0
- package/esm/core/component/element/type.js +36 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/core/component/index.d.ts +14 -7
- package/esm/core/component/index.js +137 -78
- package/esm/core/drop-in/index.js +2 -2
- package/esm/core/instance/index.d.ts +2 -1
- package/esm/core/instance/index.js +27 -12
- package/esm/foundation/core/index.d.ts +28 -0
- package/esm/foundation/core/index.js +396 -0
- package/esm/foundation/index.d.ts +75 -0
- package/esm/foundation/index.js +42 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +18 -0
- package/esm/foundation/product-processor/easysafepay/deps.js +12 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +26 -0
- package/esm/foundation/product-processor/easysafepay/index.js +464 -0
- package/esm/foundation/service/api-bus/ability/callback.d.ts +9 -0
- package/esm/foundation/service/api-bus/ability/callback.js +55 -0
- package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/request.js +151 -0
- package/esm/foundation/service/api-bus/ability/security.d.ts +12 -0
- package/esm/foundation/service/api-bus/ability/security.js +161 -0
- package/esm/foundation/service/api-bus/ability/tracker.d.ts +9 -0
- package/esm/foundation/service/api-bus/ability/tracker.js +80 -0
- package/esm/foundation/service/api-bus/busManager.d.ts +127 -0
- package/esm/foundation/service/api-bus/busManager.js +398 -0
- package/esm/foundation/service/api-bus/index.d.ts +20 -0
- package/esm/foundation/service/api-bus/index.js +88 -0
- 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 +32 -0
- package/esm/foundation/service/container/index.js +332 -0
- package/esm/foundation/service/container/popup.d.ts +17 -0
- package/esm/foundation/service/container/popup.js +103 -0
- package/esm/foundation/service/container/utils.d.ts +7 -0
- package/esm/foundation/service/container/utils.js +48 -0
- package/esm/foundation/service/event-center.d.ts +82 -0
- package/esm/foundation/service/event-center.js +274 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/global-data/index.js +68 -0
- package/esm/foundation/service/index.d.ts +19 -0
- package/esm/foundation/service/index.js +82 -0
- package/esm/foundation/service/log/index.d.ts +43 -0
- package/esm/foundation/service/log/index.js +250 -0
- package/esm/foundation/service/log/keys.d.ts +13 -0
- package/esm/foundation/service/log/keys.js +103 -0
- package/esm/foundation/service/log/processor.d.ts +9 -0
- package/esm/foundation/service/log/processor.js +148 -0
- package/esm/foundation/service/log/types.d.ts +32 -0
- package/esm/foundation/service/log/types.js +1 -0
- package/esm/foundation/service/requester/deps.d.ts +17 -0
- package/esm/foundation/service/requester/deps.js +11 -0
- package/esm/foundation/service/requester/requester.d.ts +22 -0
- package/esm/foundation/service/requester/requester.js +217 -0
- package/esm/foundation/service/security/index.d.ts +28 -0
- package/esm/foundation/service/security/index.js +284 -0
- package/esm/foundation/service/security/security.d.ts +33 -0
- package/esm/foundation/service/security/security.js +182 -0
- package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
- package/esm/foundation/utils/gray_scale_utils.js +40 -0
- package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_context_utils.js +57 -0
- 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 +11 -0
- package/esm/foundation/utils/redirect_utils.js +262 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/system_events.js +66 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +46 -0
- package/esm/foundation/utils/web_app_url_utils.js +112 -0
- package/esm/index.d.ts +21 -12
- package/esm/index.js +116 -56
- package/esm/plugin/applepay/component.js +13 -11
- package/esm/plugin/applepay/index.js +10 -6
- package/esm/plugin/applepay/service.d.ts +2 -2
- package/esm/plugin/applepay/service.js +26 -18
- package/esm/plugin/component/cashierApp.d.ts +10 -8
- package/esm/plugin/component/cashierApp.js +48 -11
- package/esm/plugin/component/channel.d.ts +4 -3
- package/esm/plugin/component/channel.js +39 -2
- package/esm/plugin/component/component.inline.style.d.ts +9 -10
- package/esm/plugin/component/component.inline.style.js +93 -10
- package/esm/plugin/component/component.popup.style.d.ts +15 -6
- package/esm/plugin/component/component.popup.style.js +30 -7
- package/esm/plugin/component/index.d.ts +14 -8
- package/esm/plugin/component/index.js +384 -187
- package/esm/plugin/component/popupWindow.style.d.ts +5 -2
- package/esm/plugin/component/popupWindow.style.js +70 -14
- package/esm/plugin/const.js +5 -5
- package/esm/plugin/drop-in/index.d.ts +5 -5
- package/esm/plugin/drop-in/index.js +7 -7
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.js +2 -1
- package/esm/plugin/type.d.ts +4 -3
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +6 -2
- package/esm/types/index.d.ts +339 -40
- package/esm/types/index.js +119 -55
- package/esm/util/createIframeNode.d.ts +2 -2
- package/esm/util/createIframeNode.js +3 -3
- package/esm/util/getBackScheme.d.ts +5 -0
- package/esm/util/getBackScheme.js +133 -0
- package/esm/util/index.js +4 -8
- package/esm/util/logger.d.ts +3 -3
- package/esm/util/logger.js +49 -13
- package/esm/util/security.d.ts +3 -2
- package/esm/util/security.js +2 -2
- package/esm/util/spm-map.d.ts +172 -0
- package/esm/util/spm-map.js +172 -0
- package/package.json +3 -1
package/esm/types/index.js
CHANGED
@@ -6,46 +6,61 @@
|
|
6
6
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
7
7
|
*/
|
8
8
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
9
|
+
export * from "../core/component/element/type";
|
10
|
+
|
9
11
|
/**
|
10
12
|
* SDK options
|
11
13
|
*/
|
12
14
|
|
13
|
-
export var
|
14
|
-
|
15
|
-
|
16
|
-
return
|
17
|
-
}({});
|
18
|
-
export var
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
15
|
+
export var DisplayTypeEnum = /*#__PURE__*/function (DisplayTypeEnum) {
|
16
|
+
DisplayTypeEnum["popup"] = "popup";
|
17
|
+
DisplayTypeEnum["inline"] = "inline";
|
18
|
+
return DisplayTypeEnum;
|
19
|
+
}({});
|
20
|
+
export var ComponentSignEnumV2 = /*#__PURE__*/function (ComponentSignEnumV2) {
|
21
|
+
ComponentSignEnumV2["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
|
22
|
+
ComponentSignEnumV2["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
|
23
|
+
return ComponentSignEnumV2;
|
24
|
+
}({});
|
25
|
+
export var ComponentSignEnum = /*#__PURE__*/function (ComponentSignEnum) {
|
26
|
+
ComponentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
|
27
|
+
ComponentSignEnum["EASY_PAY_APM"] = "EASY_PAY_APM";
|
28
|
+
ComponentSignEnum["CASHIER_PAYMENT_CARD"] = "CASHIER_PAYMENT_CARD";
|
29
|
+
ComponentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
|
30
|
+
ComponentSignEnum["CASHIER_PAYMENT_APM"] = "CASHIER_PAYMENT_APM";
|
31
|
+
ComponentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
|
32
|
+
ComponentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
|
33
|
+
ComponentSignEnum["NONE"] = "NONE";
|
34
|
+
ComponentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
|
35
|
+
ComponentSignEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
|
36
|
+
ComponentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
|
37
|
+
ComponentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
|
38
|
+
return ComponentSignEnum;
|
39
|
+
}({});
|
40
|
+
export var ProductSceneEnum = /*#__PURE__*/function (ProductSceneEnum) {
|
41
|
+
ProductSceneEnum["EASY_PAY"] = "EASY_PAY";
|
42
|
+
ProductSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
|
43
|
+
ProductSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
|
44
|
+
ProductSceneEnum["AUTO_DEBIT_PAY"] = "AUTO_DEBIT_PAY";
|
45
|
+
ProductSceneEnum["VAULTING"] = "VAULTING";
|
46
|
+
ProductSceneEnum["FLASH_BUY"] = "FLASH_BUY";
|
47
|
+
ProductSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY";
|
48
|
+
ProductSceneEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT";
|
49
|
+
ProductSceneEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS";
|
50
|
+
ProductSceneEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
|
51
|
+
return ProductSceneEnum;
|
52
|
+
}({});
|
53
|
+
export var PaymentMethodCategoryTypeEnum = /*#__PURE__*/function (PaymentMethodCategoryTypeEnum) {
|
54
|
+
PaymentMethodCategoryTypeEnum["CARD"] = "CARD";
|
55
|
+
PaymentMethodCategoryTypeEnum["WALLET"] = "WALLET";
|
56
|
+
PaymentMethodCategoryTypeEnum["BANK"] = "BANK";
|
57
|
+
PaymentMethodCategoryTypeEnum["APM"] = "APM";
|
58
|
+
PaymentMethodCategoryTypeEnum["ALL"] = "ALL";
|
59
|
+
return PaymentMethodCategoryTypeEnum;
|
48
60
|
}({});
|
61
|
+
|
62
|
+
/** 表单地址数据 */
|
63
|
+
|
49
64
|
export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
|
50
65
|
payPalConfigurationIntentEnum["intent"] = "intent";
|
51
66
|
payPalConfigurationIntentEnum["capture"] = "capture";
|
@@ -74,11 +89,11 @@ export var networkModeEnum = /*#__PURE__*/function (networkModeEnum) {
|
|
74
89
|
networkModeEnum["session"] = "session";
|
75
90
|
return networkModeEnum;
|
76
91
|
}({});
|
77
|
-
export var
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
return
|
92
|
+
export var EnvironmentEnum = /*#__PURE__*/function (EnvironmentEnum) {
|
93
|
+
EnvironmentEnum["sandbox"] = "sandbox";
|
94
|
+
EnvironmentEnum["prod"] = "prod";
|
95
|
+
EnvironmentEnum["light_sandbox"] = "light_sandbox";
|
96
|
+
return EnvironmentEnum;
|
82
97
|
}({});
|
83
98
|
export var osTypeEnum = /*#__PURE__*/function (osTypeEnum) {
|
84
99
|
osTypeEnum["IOS"] = "IOS";
|
@@ -93,10 +108,10 @@ export var terminalTypeEnum = /*#__PURE__*/function (terminalTypeEnum) {
|
|
93
108
|
terminalTypeEnum["MINI_APP"] = "MINI_APP";
|
94
109
|
return terminalTypeEnum;
|
95
110
|
}({});
|
96
|
-
export var
|
97
|
-
|
98
|
-
|
99
|
-
return
|
111
|
+
export var PlatformEnum = /*#__PURE__*/function (PlatformEnum) {
|
112
|
+
PlatformEnum["desktop"] = "desktop";
|
113
|
+
PlatformEnum["mobile"] = "mobile";
|
114
|
+
return PlatformEnum;
|
100
115
|
}({});
|
101
116
|
|
102
117
|
/**
|
@@ -115,17 +130,17 @@ export var platformEnum = /*#__PURE__*/function (platformEnum) {
|
|
115
130
|
* @description Create an event handler, In pop-up layer mode, the user clicks the semi floating layer close button and is called.
|
116
131
|
*/
|
117
132
|
|
118
|
-
export var
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
return
|
123
|
-
}({});
|
124
|
-
export var
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
return
|
133
|
+
export var MessageName = /*#__PURE__*/function (MessageName) {
|
134
|
+
MessageName["SDK_TO_APP"] = "SDK_TO_APP";
|
135
|
+
MessageName["APP_TO_SDK"] = "APP_TO_SDK";
|
136
|
+
MessageName["APP_TO_APP"] = "APP_TO_APP";
|
137
|
+
return MessageName;
|
138
|
+
}({});
|
139
|
+
export var TargetEnum = /*#__PURE__*/function (TargetEnum) {
|
140
|
+
TargetEnum["BLANK"] = "_blank";
|
141
|
+
TargetEnum["SELF"] = "_self";
|
142
|
+
TargetEnum["REPLACE"] = "_replace";
|
143
|
+
return TargetEnum;
|
129
144
|
}({});
|
130
145
|
export var errorEnum = /*#__PURE__*/function (errorEnum) {
|
131
146
|
errorEnum["PARAMS"] = "PARAMS";
|
@@ -194,4 +209,53 @@ export var ProductSceneVersion = /*#__PURE__*/function (ProductSceneVersion) {
|
|
194
209
|
ProductSceneVersion["V1"] = "1.0";
|
195
210
|
ProductSceneVersion["V2"] = "2.0";
|
196
211
|
return ProductSceneVersion;
|
212
|
+
}({});
|
213
|
+
export var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
|
214
|
+
AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
|
215
|
+
AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
|
216
|
+
return AccountStatusEnum;
|
217
|
+
}({});
|
218
|
+
|
219
|
+
// element 接口start
|
220
|
+
|
221
|
+
export var InterActionTypeEnum = /*#__PURE__*/function (InterActionTypeEnum) {
|
222
|
+
InterActionTypeEnum["COLLECT_REDIRECT"] = "COLLECT_REDIRECT";
|
223
|
+
InterActionTypeEnum["SHOW_CODE"] = "SHOW_CODE";
|
224
|
+
InterActionTypeEnum["COLLECT_SHOW_CODE"] = "COLLECT_SHOW_CODE";
|
225
|
+
InterActionTypeEnum["REDIRECT"] = "REDIRECT";
|
226
|
+
return InterActionTypeEnum;
|
227
|
+
}({});
|
228
|
+
// element 接口end
|
229
|
+
|
230
|
+
export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
|
231
|
+
ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
|
232
|
+
ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
|
233
|
+
ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
|
234
|
+
ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
|
235
|
+
return ElementPaymentMethod;
|
236
|
+
}({});
|
237
|
+
export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
|
238
|
+
ElementPaymentEvent["INITIAL_DATA_READY"] = "initialDataReady";
|
239
|
+
ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
|
240
|
+
ElementPaymentEvent["SIGN_OUT"] = "onSignout";
|
241
|
+
ElementPaymentEvent["BLUR"] = "onBlur";
|
242
|
+
ElementPaymentEvent["VALIDATE"] = "validate";
|
243
|
+
ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
|
244
|
+
ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
|
245
|
+
ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
|
246
|
+
ElementPaymentEvent["LAUNCH"] = "onLaunch";
|
247
|
+
ElementPaymentEvent["CALLBACK"] = "callback";
|
248
|
+
ElementPaymentEvent["LOG"] = "log";
|
249
|
+
return ElementPaymentEvent;
|
250
|
+
}({});
|
251
|
+
export var ConnectErrorCode = /*#__PURE__*/function (ConnectErrorCode) {
|
252
|
+
ConnectErrorCode["RISK_REJECT"] = "RISK_REJECT";
|
253
|
+
ConnectErrorCode["USER_AUTH_VERIFICATION_FAILED"] = "USER_AUTH_VERIFICATION_FAILED";
|
254
|
+
ConnectErrorCode["USER_NOT_EXISTS"] = "USER_NOT_EXISTS";
|
255
|
+
return ConnectErrorCode;
|
256
|
+
}({});
|
257
|
+
export var RiskSdkInfoEnum = /*#__PURE__*/function (RiskSdkInfoEnum) {
|
258
|
+
RiskSdkInfoEnum["NEED"] = "need";
|
259
|
+
RiskSdkInfoEnum["NO_NEED"] = "noneed";
|
260
|
+
return RiskSdkInfoEnum;
|
197
261
|
}({});
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { Iselector,
|
1
|
+
import { Iselector, DisplayTypeEnum } from '../types';
|
2
2
|
/**
|
3
3
|
* @description context中需要包含app节点,用于插入selector中
|
4
4
|
*/
|
5
|
-
export declare const createIframeNode: (context: any, selector: Iselector, renderDisplayType:
|
5
|
+
export declare const createIframeNode: (context: any, selector: Iselector, renderDisplayType: DisplayTypeEnum) => Promise<void>;
|
6
6
|
export declare const createPreloadIframeNode: (virtualPreloadIframe: any) => void;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
8
8
|
import { getType } from '.';
|
9
9
|
import { ERRORMESSAGE, EVENT } from "../constant";
|
10
|
-
import {
|
10
|
+
import { MessageName, DisplayTypeEnum } from "../types";
|
11
11
|
/**
|
12
12
|
* @description context中需要包含app节点,用于插入selector中
|
13
13
|
*/
|
@@ -24,7 +24,7 @@ export var createIframeNode = function createIframeNode(context, selector, rende
|
|
24
24
|
};
|
25
25
|
reject(error);
|
26
26
|
context._dispatchToSDK({
|
27
|
-
name:
|
27
|
+
name: MessageName.APP_TO_SDK,
|
28
28
|
instanceId: context.AMSSDK._instanceId,
|
29
29
|
context: {
|
30
30
|
event: EVENT.error.name,
|
@@ -33,7 +33,7 @@ export var createIframeNode = function createIframeNode(context, selector, rende
|
|
33
33
|
});
|
34
34
|
return;
|
35
35
|
}
|
36
|
-
if (renderDisplayType ===
|
36
|
+
if (renderDisplayType === DisplayTypeEnum.popup) dorpinDom.innerHTML = '';
|
37
37
|
if (context.app) {
|
38
38
|
dorpinDom.appendChild(context.app);
|
39
39
|
}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
var UA_MATCH_RULES = [{
|
2
|
+
matchRule: 'AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z]+) Safari\\/([0-9\\._]+)$',
|
3
|
+
iosScheme: 'https',
|
4
|
+
andScheme: ''
|
5
|
+
}, {
|
6
|
+
matchRule: 'HeyTapBrowser',
|
7
|
+
iosScheme: '',
|
8
|
+
andScheme: ''
|
9
|
+
}, {
|
10
|
+
matchRule: 'HuaweiBrowser',
|
11
|
+
iosScheme: '',
|
12
|
+
andScheme: ''
|
13
|
+
}, {
|
14
|
+
matchRule: 'Kwai',
|
15
|
+
iosScheme: 'kwai',
|
16
|
+
andScheme: ''
|
17
|
+
}, {
|
18
|
+
matchRule: 'MQQBrowser',
|
19
|
+
iosScheme: 'mttbrowser',
|
20
|
+
andScheme: ''
|
21
|
+
}, {
|
22
|
+
matchRule: 'MicroMessenger',
|
23
|
+
iosScheme: '',
|
24
|
+
andScheme: ''
|
25
|
+
}, {
|
26
|
+
matchRule: 'MiuiBrowser',
|
27
|
+
iosScheme: '',
|
28
|
+
andScheme: ''
|
29
|
+
}, {
|
30
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* CriOS\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z\\._a-z]+) Safari\\/([0-9\\._]+)$',
|
31
|
+
iosScheme: 'googlechrome',
|
32
|
+
andScheme: ''
|
33
|
+
}, {
|
34
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile Safari\\/([0-9\\._]+)$',
|
35
|
+
iosScheme: 'googlechrome',
|
36
|
+
andScheme: ''
|
37
|
+
}, {
|
38
|
+
matchRule: 'NewsArticle',
|
39
|
+
iosScheme: 'snssdk141',
|
40
|
+
andScheme: ''
|
41
|
+
}, {
|
42
|
+
matchRule: 'UCBrowser',
|
43
|
+
iosScheme: 'ucbrowser',
|
44
|
+
andScheme: ''
|
45
|
+
}, {
|
46
|
+
matchRule: 'VideoArticle',
|
47
|
+
iosScheme: 'snssdk32',
|
48
|
+
andScheme: ''
|
49
|
+
}, {
|
50
|
+
matchRule: 'VivoBrowser',
|
51
|
+
iosScheme: '',
|
52
|
+
andScheme: ''
|
53
|
+
}, {
|
54
|
+
matchRule: 'ZhongAnWebView',
|
55
|
+
iosScheme: 'zaapp',
|
56
|
+
andScheme: ''
|
57
|
+
}, {
|
58
|
+
matchRule: 'aweme',
|
59
|
+
iosScheme: 'snssdk1128',
|
60
|
+
andScheme: ''
|
61
|
+
}, {
|
62
|
+
matchRule: 'aweme_lite',
|
63
|
+
iosScheme: 'snssdk2329',
|
64
|
+
andScheme: ''
|
65
|
+
}, {
|
66
|
+
matchRule: 'com.xs.fm',
|
67
|
+
iosScheme: 'novelfm3040',
|
68
|
+
andScheme: ''
|
69
|
+
}, {
|
70
|
+
matchRule: 'netdisk',
|
71
|
+
iosScheme: '',
|
72
|
+
andScheme: ''
|
73
|
+
}, {
|
74
|
+
matchRule: 'qqnews',
|
75
|
+
iosScheme: 'qqnews',
|
76
|
+
andScheme: ''
|
77
|
+
}];
|
78
|
+
|
79
|
+
/**
|
80
|
+
* 通过配置规则检测 UA 和获得回跳 scheme
|
81
|
+
*/
|
82
|
+
export function getBackScheme(mockUa, logger) {
|
83
|
+
var ua = mockUa || window.navigator.userAgent || '';
|
84
|
+
// 获取规则
|
85
|
+
var uaMatchedRule = UA_MATCH_RULES;
|
86
|
+
var matchedRule;
|
87
|
+
var matched = null;
|
88
|
+
for (var i = 0; i < uaMatchedRule.length; i++) {
|
89
|
+
var rule = uaMatchedRule[i];
|
90
|
+
matched = ua.match(rule.matchRule);
|
91
|
+
if (matched) {
|
92
|
+
matchedRule = rule;
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
if (!matchedRule) {
|
97
|
+
logBackScheme(logger, ua, '');
|
98
|
+
return;
|
99
|
+
}
|
100
|
+
if (isAndroid(ua)) {
|
101
|
+
logBackScheme(logger, ua, matchedRule.andScheme);
|
102
|
+
return matchedRule.andScheme;
|
103
|
+
}
|
104
|
+
if (isIOS(ua)) {
|
105
|
+
logBackScheme(logger, ua, matchedRule.iosScheme);
|
106
|
+
return matchedRule.iosScheme;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
function logBackScheme(logger, userAgent, scheme) {
|
110
|
+
if (logger) {
|
111
|
+
logger.logInfo({
|
112
|
+
title: 'a3753.b101271.c377460'
|
113
|
+
}, {
|
114
|
+
eventMessage: scheme
|
115
|
+
});
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* 当前运行环境是否 Android
|
121
|
+
*/
|
122
|
+
function isAndroid(mockUA) {
|
123
|
+
var ua = (mockUA || navigator.userAgent).toLowerCase();
|
124
|
+
return /android|adr|linux/.test(ua);
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* 当前运行环境是否 IOS
|
129
|
+
*/
|
130
|
+
function isIOS(mockUA) {
|
131
|
+
var ua = (mockUA || navigator.userAgent).toLowerCase();
|
132
|
+
return /iphone|ipad|ipod|ios|macintosh/.test(ua);
|
133
|
+
}
|
package/esm/util/index.js
CHANGED
@@ -280,8 +280,7 @@ function loadSDKScript(_ref, logger) {
|
|
280
280
|
logger.logInfo({
|
281
281
|
title: 'load_item_sdk_start'
|
282
282
|
}, {
|
283
|
-
|
284
|
-
attrOptions: JSON.stringify(attrOptions)
|
283
|
+
eventMessage: src
|
285
284
|
});
|
286
285
|
console.time();
|
287
286
|
var script = document.createElement('script');
|
@@ -294,8 +293,7 @@ function loadSDKScript(_ref, logger) {
|
|
294
293
|
logger.logInfo({
|
295
294
|
title: 'load_item_sdk_end'
|
296
295
|
}, {
|
297
|
-
|
298
|
-
attrOptions: JSON.stringify(attrOptions)
|
296
|
+
eventMessage: src
|
299
297
|
});
|
300
298
|
console.timeEnd();
|
301
299
|
clearTimeout(timer);
|
@@ -308,8 +306,7 @@ function loadSDKScript(_ref, logger) {
|
|
308
306
|
logger.logError({
|
309
307
|
title: 'load_item_sdk_error'
|
310
308
|
}, {
|
311
|
-
|
312
|
-
attrOptions: JSON.stringify(attrOptions)
|
309
|
+
eventMessage: src
|
313
310
|
});
|
314
311
|
clearTimeout(timer);
|
315
312
|
console.error('The script ' + src + ' is not accessible.');
|
@@ -319,8 +316,7 @@ function loadSDKScript(_ref, logger) {
|
|
319
316
|
_this2.logger.logError({
|
320
317
|
title: 'load_item_sdk_timeout'
|
321
318
|
}, {
|
322
|
-
|
323
|
-
attrOptions: JSON.stringify(attrOptions)
|
319
|
+
eventMessage: src
|
324
320
|
});
|
325
321
|
reject(false);
|
326
322
|
}, timeOut * 1000);
|
package/esm/util/logger.d.ts
CHANGED
@@ -13,10 +13,10 @@ export interface LogMetaData {
|
|
13
13
|
platform?: string;
|
14
14
|
sdkVersion?: string;
|
15
15
|
webAppVersion?: string;
|
16
|
-
|
16
|
+
firstLogTime?: number;
|
17
17
|
fsDuration?: number;
|
18
18
|
instanceId?: string;
|
19
|
-
|
19
|
+
deviceId?: string;
|
20
20
|
renderDisplayType?: string;
|
21
21
|
merchantId?: string;
|
22
22
|
productScene?: string;
|
@@ -49,7 +49,7 @@ export declare class Logger {
|
|
49
49
|
static setInstance(instance: Logger): Logger;
|
50
50
|
static getInstance(): Logger;
|
51
51
|
setMedta(mdata: LogMetaData): void;
|
52
|
-
logError(error: LogPayload, extra?: Extra): Logger;
|
52
|
+
logError(error: LogPayload, extra?: Extra, enableExtractCompliance?: boolean): Logger;
|
53
53
|
logInfo(info: LogPayload, extra?: Extra): Logger;
|
54
54
|
reportRPC(rpcData: LogPayload, extra?: Extra): Logger;
|
55
55
|
reportLogs(): void;
|
package/esm/util/logger.js
CHANGED
@@ -7,6 +7,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
7
7
|
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; }
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
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
|
+
import { LogComplianceProcessor } from "../foundation/service/log/processor";
|
11
|
+
import { SPM_MAP } from "./spm-map";
|
10
12
|
export var Logger = /*#__PURE__*/function () {
|
11
13
|
function Logger(config, debug) {
|
12
14
|
_classCallCheck(this, Logger);
|
@@ -43,18 +45,30 @@ export var Logger = /*#__PURE__*/function () {
|
|
43
45
|
}, {
|
44
46
|
key: "logError",
|
45
47
|
value: function logError(error, extra) {
|
48
|
+
var _this2 = this;
|
49
|
+
var enableExtractCompliance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
50
|
+
var newExtra = enableExtractCompliance ? LogComplianceProcessor.extractComplianceParams(error.title, extra !== null && extra !== void 0 ? extra : {}, function (error, ext) {
|
51
|
+
_this2.logError(error, ext, false);
|
52
|
+
}) : extra !== null && extra !== void 0 ? extra : {};
|
46
53
|
var now = Date.now();
|
47
54
|
var fsDuration = now - this.componentStartTime;
|
55
|
+
var newError = _objectSpread({}, error);
|
56
|
+
var oldTitle = error === null || error === void 0 ? void 0 : error.title;
|
57
|
+
if (SPM_MAP[oldTitle]) {
|
58
|
+
newError.title = SPM_MAP[oldTitle];
|
59
|
+
}
|
60
|
+
newExtra.eventSource = 'sdk';
|
61
|
+
newExtra.eventAlias = extra !== null && extra !== void 0 && extra.eventAlias ? extra === null || extra === void 0 ? void 0 : extra.eventAlias : oldTitle;
|
48
62
|
this.logs.push({
|
49
63
|
type: 'error',
|
50
|
-
logPayload:
|
51
|
-
extra: _objectSpread(_objectSpread({},
|
64
|
+
logPayload: newError,
|
65
|
+
extra: _objectSpread(_objectSpread({}, newExtra), {}, {
|
52
66
|
fsDuration: fsDuration,
|
53
67
|
timeStamp: now
|
54
68
|
})
|
55
69
|
});
|
56
70
|
if (this.debug) {
|
57
|
-
console.
|
71
|
+
console.log('[web-sdk] Log error', newError, newExtra);
|
58
72
|
}
|
59
73
|
this.send();
|
60
74
|
return this;
|
@@ -62,18 +76,29 @@ export var Logger = /*#__PURE__*/function () {
|
|
62
76
|
}, {
|
63
77
|
key: "logInfo",
|
64
78
|
value: function logInfo(info, extra) {
|
79
|
+
var _this3 = this;
|
80
|
+
var newExtra = LogComplianceProcessor.extractComplianceParams(info.title, extra !== null && extra !== void 0 ? extra : {}, function (error, ext) {
|
81
|
+
_this3.logError(error, ext, false);
|
82
|
+
});
|
65
83
|
var now = Date.now();
|
66
84
|
var fsDuration = now - this.componentStartTime;
|
85
|
+
var newInfo = _objectSpread({}, info);
|
86
|
+
var oldTitle = info === null || info === void 0 ? void 0 : info.title;
|
87
|
+
if (SPM_MAP[oldTitle]) {
|
88
|
+
newInfo.title = SPM_MAP[oldTitle];
|
89
|
+
}
|
90
|
+
newExtra.eventSource = 'sdk';
|
91
|
+
newExtra.eventAlias = extra !== null && extra !== void 0 && extra.eventAlias ? extra === null || extra === void 0 ? void 0 : extra.eventAlias : oldTitle;
|
67
92
|
this.logs.push({
|
68
93
|
type: 'info',
|
69
|
-
logPayload:
|
70
|
-
extra: _objectSpread(_objectSpread({},
|
94
|
+
logPayload: newInfo,
|
95
|
+
extra: _objectSpread(_objectSpread({}, newExtra), {}, {
|
71
96
|
fsDuration: fsDuration,
|
72
97
|
timeStamp: now
|
73
98
|
})
|
74
99
|
});
|
75
100
|
if (this.debug) {
|
76
|
-
console.log(
|
101
|
+
console.log('[web-sdk] Log error', newInfo, newExtra);
|
77
102
|
}
|
78
103
|
this.send();
|
79
104
|
return this;
|
@@ -81,18 +106,29 @@ export var Logger = /*#__PURE__*/function () {
|
|
81
106
|
}, {
|
82
107
|
key: "reportRPC",
|
83
108
|
value: function reportRPC(rpcData, extra) {
|
109
|
+
var _this4 = this;
|
110
|
+
var newExtra = LogComplianceProcessor.extractComplianceParams(rpcData.title, extra !== null && extra !== void 0 ? extra : {}, function (error, ext) {
|
111
|
+
_this4.logError(error, ext, false);
|
112
|
+
});
|
84
113
|
var now = Date.now();
|
85
114
|
var fsDuration = now - this.componentStartTime;
|
115
|
+
var newRpcData = _objectSpread({}, rpcData);
|
116
|
+
var oldTitle = rpcData === null || rpcData === void 0 ? void 0 : rpcData.title;
|
117
|
+
if (SPM_MAP[oldTitle]) {
|
118
|
+
newRpcData.title = SPM_MAP[oldTitle];
|
119
|
+
}
|
120
|
+
newExtra.eventSource = 'sdk';
|
121
|
+
newExtra.eventAlias = extra !== null && extra !== void 0 && extra.eventAlias ? extra === null || extra === void 0 ? void 0 : extra.eventAlias : oldTitle;
|
86
122
|
this.logs.push({
|
87
123
|
type: 'rpc',
|
88
|
-
logPayload:
|
89
|
-
extra: _objectSpread(_objectSpread({},
|
124
|
+
logPayload: newRpcData,
|
125
|
+
extra: _objectSpread(_objectSpread({}, newExtra), {}, {
|
90
126
|
fsDuration: fsDuration,
|
91
127
|
timeStamp: now
|
92
128
|
})
|
93
129
|
});
|
94
130
|
if (this.debug) {
|
95
|
-
console.log(
|
131
|
+
console.log('[web-sdk] Log rpc', newRpcData, newExtra);
|
96
132
|
}
|
97
133
|
this.send();
|
98
134
|
return this;
|
@@ -151,16 +187,16 @@ export var Logger = /*#__PURE__*/function () {
|
|
151
187
|
}, {
|
152
188
|
key: "initTracker",
|
153
189
|
value: function initTracker() {
|
154
|
-
var
|
190
|
+
var _this5 = this;
|
155
191
|
if (this.isLoaded) return;
|
156
192
|
this.isLoaded = true;
|
157
193
|
try {
|
158
194
|
if (typeof localStorage !== 'undefined') {
|
159
195
|
this.loadScript(this.config.scriptUrl, function () {
|
160
196
|
var _window4;
|
161
|
-
(_window4 = window) === null || _window4 === void 0 || _window4.iTracker.initiTracker(
|
197
|
+
(_window4 = window) === null || _window4 === void 0 || _window4.iTracker.initiTracker(_this5.config);
|
162
198
|
setTimeout(function () {
|
163
|
-
|
199
|
+
_this5.reportLogs();
|
164
200
|
}, 80);
|
165
201
|
});
|
166
202
|
}
|
@@ -217,6 +253,6 @@ export var LogConfig = {
|
|
217
253
|
productId: 'ANTOM_SDK',
|
218
254
|
version: 'iteration/20231021',
|
219
255
|
mdata: {
|
220
|
-
|
256
|
+
firstLogTime: Date.now()
|
221
257
|
}
|
222
258
|
};
|
package/esm/util/security.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { IsecurityConfig,
|
2
|
-
export declare const getSecurityConfigStorageKey: (scene:
|
1
|
+
import { IsecurityConfig, ProductSceneEnum, DeviceIdParameter } from '../types';
|
2
|
+
export declare const getSecurityConfigStorageKey: (scene: ProductSceneEnum) => string;
|
3
3
|
export declare enum SecurityRegionEnum {
|
4
4
|
SG = "SG",
|
5
5
|
US = "US",
|
@@ -18,6 +18,7 @@ export declare const sceneMap: {
|
|
18
18
|
EASYPAY: string;
|
19
19
|
EASY_PAY: string;
|
20
20
|
FLASH_BUY: string;
|
21
|
+
ELEMENT_PAYMENT: string;
|
21
22
|
};
|
22
23
|
export declare const getSecurityHost: (region: string) => string;
|
23
24
|
export declare const getSecurityScene: (product: string) => string;
|
package/esm/util/security.js
CHANGED
@@ -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 {
|
11
|
+
import { ProductSceneEnum } from "../types";
|
12
12
|
import APDID from "./jshield-apdid/apdid-core.umd.min";
|
13
13
|
export var getSecurityConfigStorageKey = function getSecurityConfigStorageKey(scene) {
|
14
14
|
return "AMSSDK_SECURITY_CONFIG_".concat(scene);
|
@@ -24,7 +24,7 @@ export var securityHost = {
|
|
24
24
|
US: 'https://open-na-global.alipay.com/api/open/risk_client',
|
25
25
|
DE: 'https://open-de-global.alipay.com/api/open/risk_client'
|
26
26
|
};
|
27
|
-
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},
|
27
|
+
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ProductSceneEnum.CASHIER_PAYMENT, 'Acquirer'), ProductSceneEnum.AUTO_DEBIT, 'Acquirer'), ProductSceneEnum.VAULTING, 'Acquirer'), ProductSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), ProductSceneEnum.EASY_PAY, 'EasyPay'), ProductSceneEnum.FLASH_BUY, 'OneAccount'), ProductSceneEnum.ELEMENT_PAYMENT, 'Acquirer');
|
28
28
|
export var getSecurityHost = function getSecurityHost(region) {
|
29
29
|
return securityHost[region] || securityHost[SecurityRegionEnum.SG];
|
30
30
|
};
|