@alipay/ams-checkout 0.0.1730107332-dev.4 → 0.0.1730706734-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/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +6 -1
- package/esm/constant/index.js +80 -3
- package/esm/core/bus/ability/callback.d.ts +9 -0
- package/esm/{foundation/service/api-bus → core/bus}/ability/callback.js +1 -1
- package/esm/core/bus/ability/globalData.d.ts +10 -0
- package/esm/{foundation/service/api-bus → core/bus}/ability/globalData.js +2 -2
- package/esm/{foundation/service/api-bus → core/bus}/ability/request.d.ts +1 -1
- package/esm/{foundation/service/api-bus → core/bus}/ability/request.js +2 -2
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/security.js +104 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/ability/tracker.js +77 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/index.js +366 -0
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +91 -0
- package/esm/core/component/ckp/index.d.ts +27 -0
- package/esm/core/component/ckp/index.js +166 -0
- 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 +59 -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/element-mock.d.ts +2 -0
- package/esm/core/component/element/element-mock.js +263 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +776 -0
- package/esm/core/component/element/mock.d.ts +3 -0
- package/esm/core/component/element/mock.js +1156 -0
- package/esm/core/component/element/type.d.ts +176 -0
- package/esm/core/component/element/type.js +34 -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 +51 -0
- package/esm/core/component/index.js +535 -0
- package/esm/core/drop-in/index.d.ts +22 -0
- package/esm/core/drop-in/index.js +104 -0
- package/esm/core/instance/index.d.ts +89 -0
- package/esm/core/instance/index.js +500 -0
- package/esm/foundation/core/index.d.ts +3 -3
- package/esm/foundation/core/index.js +51 -114
- package/esm/foundation/index.d.ts +3 -5
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +4 -7
- package/esm/foundation/product-processor/easysafepay/deps.js +2 -5
- package/esm/foundation/product-processor/easysafepay/index.d.ts +4 -5
- package/esm/foundation/product-processor/easysafepay/index.js +114 -174
- package/esm/foundation/service/container/index.js +5 -5
- package/esm/foundation/service/container/popup.js +1 -1
- package/esm/foundation/service/event-bus/ability/callback.js +55 -0
- package/esm/foundation/service/{api-bus → event-bus}/ability/globalData.d.ts +1 -1
- package/esm/foundation/service/event-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/event-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/request.js +151 -0
- package/esm/foundation/service/{api-bus → event-bus}/ability/security.js +19 -29
- package/esm/foundation/service/{api-bus → event-bus}/ability/tracker.js +1 -1
- package/esm/foundation/service/{api-bus → event-bus}/busManager.js +1 -1
- package/esm/foundation/service/event-center.d.ts +5 -4
- package/esm/foundation/service/event-center.js +39 -8
- package/esm/foundation/service/global-data/index.js +5 -4
- package/esm/foundation/service/index.js +1 -1
- package/esm/foundation/service/requester/requester.js +11 -14
- package/esm/foundation/service/security/index.d.ts +7 -9
- package/esm/foundation/service/security/index.js +44 -113
- package/esm/foundation/utils/redirect_utils.js +8 -24
- package/esm/foundation/utils/web_app_url_utils.d.ts +2 -11
- package/esm/foundation/utils/web_app_url_utils.js +2 -17
- package/esm/index.d.ts +30 -1
- package/esm/index.js +147 -7
- package/esm/plugin/applepay/component.d.ts +50 -0
- package/esm/plugin/applepay/component.js +339 -0
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/plugin/applepay/interface.d.ts +161 -0
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/plugin/applepay/service.d.ts +54 -0
- package/esm/plugin/applepay/service.js +289 -0
- package/esm/plugin/component/cashierApp.d.ts +36 -0
- package/esm/plugin/component/cashierApp.js +245 -0
- package/esm/{component → plugin/component}/channel.d.ts +2 -1
- package/esm/{component → plugin/component}/channel.js +37 -1
- package/esm/{component → plugin/component}/component.inline.style.d.ts +2 -2
- package/esm/{component → plugin/component}/component.inline.style.js +7 -6
- package/esm/{component → plugin/component}/component.popup.style.d.ts +1 -1
- package/esm/{component → plugin/component}/component.popup.style.js +4 -4
- package/esm/plugin/component/index.d.ts +126 -0
- package/esm/plugin/component/index.js +1862 -0
- package/esm/{component → plugin/component}/popupWindow.style.js +2 -2
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +33 -0
- package/esm/plugin/drop-in/index.d.ts +71 -0
- package/esm/plugin/drop-in/index.js +324 -0
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +7 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +390 -0
- package/esm/plugin/type.d.ts +34 -0
- package/esm/plugin/type.js +1 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- 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 +2 -0
- package/esm/types/index.d.ts +218 -22
- package/esm/types/index.js +47 -4
- package/esm/util/createIframeNode.d.ts +6 -0
- package/esm/util/createIframeNode.js +48 -0
- package/esm/util/getBackScheme.d.ts +2 -2
- package/esm/util/getBackScheme.js +2 -94
- package/esm/util/index.d.ts +11 -1
- package/esm/util/index.js +84 -4
- package/esm/util/intl-callapp/es/index.js +0 -1
- package/esm/util/ua/index.d.ts +2 -0
- package/esm/util/ua/index.js +2 -0
- package/esm/util/ua/isAndroid.d.ts +4 -0
- package/esm/util/ua/isAndroid.js +7 -0
- package/esm/util/ua/isIOS.d.ts +4 -0
- package/esm/util/ua/isIOS.js +7 -0
- package/package.json +2 -1
- package/esm/foundation/utils/payment_product_utils.d.ts +0 -13
- package/esm/foundation/utils/payment_product_utils.js +0 -38
- /package/esm/{foundation/service/api-bus → core/bus}/interface.d.ts +0 -0
- /package/esm/{foundation/service/api-bus → core/bus}/interface.js +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/ability/callback.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/ability/security.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/ability/tracker.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/busManager.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/index.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/index.js +0 -0
- /package/esm/{component → plugin/component}/popupWindow.style.d.ts +0 -0
@@ -46,7 +46,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
46
46
|
key: "request",
|
47
47
|
value: (function () {
|
48
48
|
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestData, options) {
|
49
|
-
var envInfo, _data, startTime,
|
49
|
+
var envInfo, _data, startTime, myRequest, _yield$myRequest, data, headers, resData, traceId, handleGetWayError, errorMessage, errorCode, _error$message, _error, timeoutCode, _errorCode;
|
50
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
51
51
|
while (1) switch (_context.prev = _context.next) {
|
52
52
|
case 0:
|
@@ -58,14 +58,13 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
58
58
|
})
|
59
59
|
})];
|
60
60
|
startTime = Date.now();
|
61
|
-
|
62
|
-
_context.prev = 4;
|
61
|
+
_context.prev = 3;
|
63
62
|
myRequest = this.createRequestInstance(options);
|
64
|
-
_context.next =
|
63
|
+
_context.next = 7;
|
65
64
|
return myRequest({
|
66
65
|
data: _data
|
67
66
|
});
|
68
|
-
case
|
67
|
+
case 7:
|
69
68
|
_yield$myRequest = _context.sent;
|
70
69
|
data = _yield$myRequest.data;
|
71
70
|
headers = _yield$myRequest.headers;
|
@@ -74,7 +73,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
74
73
|
resData.traceId = traceId || '';
|
75
74
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
76
75
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
77
|
-
_context.next =
|
76
|
+
_context.next = 19;
|
78
77
|
break;
|
79
78
|
}
|
80
79
|
errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
|
@@ -93,7 +92,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
93
92
|
errorCode: errorCode,
|
94
93
|
success: false
|
95
94
|
}));
|
96
|
-
case
|
95
|
+
case 19:
|
97
96
|
this.reportRequestTimeCost({
|
98
97
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
99
98
|
label: 'request',
|
@@ -104,13 +103,12 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
104
103
|
traceId: traceId
|
105
104
|
});
|
106
105
|
return _context.abrupt("return", resData);
|
107
|
-
case
|
108
|
-
_context.prev =
|
109
|
-
_context.t0 = _context["catch"](
|
106
|
+
case 23:
|
107
|
+
_context.prev = 23;
|
108
|
+
_context.t0 = _context["catch"](3);
|
110
109
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
111
110
|
success: false,
|
112
111
|
errorCode: errorEnum.SYSTEM,
|
113
|
-
traceId: traceId,
|
114
112
|
errorMessage: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
|
115
113
|
});
|
116
114
|
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
|
@@ -126,14 +124,13 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
126
124
|
return _context.abrupt("return", Promise.reject({
|
127
125
|
success: false,
|
128
126
|
errorCode: _errorCode,
|
129
|
-
traceId: traceId,
|
130
127
|
errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
|
131
128
|
}));
|
132
|
-
case
|
129
|
+
case 30:
|
133
130
|
case "end":
|
134
131
|
return _context.stop();
|
135
132
|
}
|
136
|
-
}, _callee, this, [[
|
133
|
+
}, _callee, this, [[3, 23]]);
|
137
134
|
}));
|
138
135
|
function request(_x, _x2) {
|
139
136
|
return _request.apply(this, arguments);
|
@@ -9,20 +9,18 @@ export declare class SecurityService implements Service {
|
|
9
9
|
update(paymentContext: PaymentContext): void;
|
10
10
|
destroy(): void;
|
11
11
|
getDeviceId(deviceIdParameter?: DeviceIdParameter, isPolling?: boolean): Promise<string>;
|
12
|
-
|
13
|
-
initSecurity(timeout?: number): Promise<void>;
|
14
|
-
private _initSecurity;
|
12
|
+
initSecurity(isPre?: boolean): Security;
|
15
13
|
private logDeviceId;
|
16
14
|
/**
|
17
|
-
|
18
|
-
|
15
|
+
* @description Obtain security SDK through scenario identification
|
16
|
+
*/
|
19
17
|
private _getSecuritySDKByProductScene;
|
20
18
|
/**
|
21
|
-
|
22
|
-
|
19
|
+
* @description New security SDK through scenario identification
|
20
|
+
*/
|
23
21
|
private _newSecuritySDKByScene;
|
24
22
|
/**
|
25
|
-
|
26
|
-
|
23
|
+
* @description Obtain risk control configuration in local storage
|
24
|
+
*/
|
27
25
|
private _getSecurityConfigStorage;
|
28
26
|
}
|
@@ -23,10 +23,13 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
23
23
|
value: function init(initOptions, instanceId, sdkMetaData) {
|
24
24
|
this.logger = ServiceProvider.getInstance(instanceId).getService('Log');
|
25
25
|
this.productScene = sdkMetaData.productScene;
|
26
|
+
this.initSecurity(true);
|
26
27
|
}
|
27
28
|
}, {
|
28
29
|
key: "update",
|
29
|
-
value: function update(paymentContext) {
|
30
|
+
value: function update(paymentContext) {
|
31
|
+
this.initSecurity(false);
|
32
|
+
}
|
30
33
|
}, {
|
31
34
|
key: "destroy",
|
32
35
|
value: function destroy() {}
|
@@ -97,115 +100,42 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
97
100
|
}
|
98
101
|
return getDeviceId;
|
99
102
|
}()
|
100
|
-
}, {
|
101
|
-
key: "preInitSecurity",
|
102
|
-
value: function () {
|
103
|
-
var _preInitSecurity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timeout) {
|
104
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
105
|
-
while (1) switch (_context3.prev = _context3.next) {
|
106
|
-
case 0:
|
107
|
-
_context3.next = 2;
|
108
|
-
return this._initSecurity(true, timeout);
|
109
|
-
case 2:
|
110
|
-
case "end":
|
111
|
-
return _context3.stop();
|
112
|
-
}
|
113
|
-
}, _callee3, this);
|
114
|
-
}));
|
115
|
-
function preInitSecurity(_x) {
|
116
|
-
return _preInitSecurity.apply(this, arguments);
|
117
|
-
}
|
118
|
-
return preInitSecurity;
|
119
|
-
}()
|
120
103
|
}, {
|
121
104
|
key: "initSecurity",
|
122
|
-
value: function () {
|
123
|
-
var
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
return _context4.stop();
|
132
|
-
}
|
133
|
-
}, _callee4, this);
|
134
|
-
}));
|
135
|
-
function initSecurity(_x2) {
|
136
|
-
return _initSecurity2.apply(this, arguments);
|
105
|
+
value: function initSecurity() {
|
106
|
+
var _this2 = this;
|
107
|
+
var isPre = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
108
|
+
var sdkAction = isPre ? 'PreInit' : 'Init';
|
109
|
+
var sdk = this._getSecuritySDKByProductScene({
|
110
|
+
product: this.productScene
|
111
|
+
});
|
112
|
+
if (sdk) {
|
113
|
+
return sdk;
|
137
114
|
}
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
case 5:
|
163
|
-
this.logger.logInfo({
|
164
|
-
title: "sdk_event_securitySdk".concat(sdkAction)
|
165
|
-
});
|
166
|
-
return _context5.abrupt("return", new Promise(function (resolve, reject) {
|
167
|
-
if (timeout) {
|
168
|
-
setTimeout(function () {
|
169
|
-
_this2.logger.logError({
|
170
|
-
title: 'sdk_error_securitySdkInitTimeout'
|
171
|
-
}, {
|
172
|
-
product: _this2.productScene,
|
173
|
-
sign: isPre ? 'Active initialization' : 'SDK internal initialization'
|
174
|
-
}).send();
|
175
|
-
}, timeout);
|
176
|
-
}
|
177
|
-
_this2._newSecuritySDKByScene({
|
178
|
-
product: _this2.productScene,
|
179
|
-
region: isPre ? SecurityRegionEnum.SG : undefined
|
180
|
-
}, function () {
|
181
|
-
_this2.logger.logInfo({
|
182
|
-
title: "sdk_event_securitySdk".concat(sdkAction, "Success")
|
183
|
-
}, isPre ? {
|
184
|
-
product: _this2.productScene
|
185
|
-
} : undefined).send();
|
186
|
-
resolve();
|
187
|
-
}, function (msg) {
|
188
|
-
_this2.logger.logError({
|
189
|
-
title: 'sdk_error_securitySdkInitFailed',
|
190
|
-
msg: msg || undefined
|
191
|
-
}, {
|
192
|
-
product: _this2.productScene,
|
193
|
-
sign: isPre ? 'Active initialization' : 'SDK internal initialization'
|
194
|
-
}).send();
|
195
|
-
reject();
|
196
|
-
});
|
197
|
-
}));
|
198
|
-
case 7:
|
199
|
-
case "end":
|
200
|
-
return _context5.stop();
|
201
|
-
}
|
202
|
-
}, _callee5, this);
|
203
|
-
}));
|
204
|
-
function _initSecurity() {
|
205
|
-
return _initSecurity3.apply(this, arguments);
|
206
|
-
}
|
207
|
-
return _initSecurity;
|
208
|
-
}()
|
115
|
+
this.logger.logInfo({
|
116
|
+
title: "sdk_event_securitySdk".concat(sdkAction)
|
117
|
+
});
|
118
|
+
sdk = this._newSecuritySDKByScene({
|
119
|
+
product: this.productScene,
|
120
|
+
region: isPre ? SecurityRegionEnum.SG : undefined
|
121
|
+
}, function () {
|
122
|
+
_this2.logger.logInfo({
|
123
|
+
title: "sdk_event_securitySdk".concat(sdkAction, "Success")
|
124
|
+
}, isPre ? {
|
125
|
+
product: _this2.productScene
|
126
|
+
} : undefined).send();
|
127
|
+
}, function (msg) {
|
128
|
+
_this2.logger.logError({
|
129
|
+
title: 'sdk_error_securitySdkInitFailed',
|
130
|
+
msg: msg || undefined
|
131
|
+
}, {
|
132
|
+
product: _this2.productScene,
|
133
|
+
sign: isPre ? 'Active initialization' : 'SDK internal initialization'
|
134
|
+
}).send();
|
135
|
+
throw new Error("sdk_error_securitySdkInitFailed: ".concat(msg || 'Unknown error'));
|
136
|
+
});
|
137
|
+
return sdk;
|
138
|
+
}
|
209
139
|
}, {
|
210
140
|
key: "logDeviceId",
|
211
141
|
value: function logDeviceId(deviceId, getDeviceIdStartTime) {
|
@@ -228,8 +158,8 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
228
158
|
}
|
229
159
|
|
230
160
|
/**
|
231
|
-
|
232
|
-
|
161
|
+
* @description Obtain security SDK through scenario identification
|
162
|
+
*/
|
233
163
|
}, {
|
234
164
|
key: "_getSecuritySDKByProductScene",
|
235
165
|
value: function _getSecuritySDKByProductScene(securityConfig) {
|
@@ -240,8 +170,8 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
240
170
|
}
|
241
171
|
|
242
172
|
/**
|
243
|
-
|
244
|
-
|
173
|
+
* @description New security SDK through scenario identification
|
174
|
+
*/
|
245
175
|
}, {
|
246
176
|
key: "_newSecuritySDKByScene",
|
247
177
|
value: function _newSecuritySDKByScene(securityConfig, successCallback, failCallback) {
|
@@ -255,14 +185,15 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
255
185
|
});
|
256
186
|
SecurityService.securitySdkMap.set(scene, securitySdk);
|
257
187
|
securitySdk.initSecurity(successCallback, failCallback);
|
188
|
+
return securitySdk;
|
258
189
|
} catch (error) {
|
259
190
|
failCallback && failCallback(error === null || error === void 0 ? void 0 : error.toString());
|
260
191
|
}
|
261
192
|
}
|
262
193
|
|
263
194
|
/**
|
264
|
-
|
265
|
-
|
195
|
+
* @description Obtain risk control configuration in local storage
|
196
|
+
*/
|
266
197
|
}, {
|
267
198
|
key: "_getSecurityConfigStorage",
|
268
199
|
value: function _getSecurityConfigStorage(product) {
|
@@ -7,7 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
7
7
|
import { eventCodeEnum, RedirectType, TargetEnum } from "../../types";
|
8
8
|
import { ServiceProvider } from "../service";
|
9
9
|
import { isPC } from "../../util";
|
10
|
-
import CallApp from "../../util/intl-callapp/es
|
10
|
+
import CallApp from "../../util/intl-callapp/es";
|
11
11
|
import { EVENT } from "../../constant";
|
12
12
|
|
13
13
|
/**
|
@@ -20,31 +20,15 @@ export var redirect = function redirect(payload, instanceId) {
|
|
20
20
|
logService.logInfo({
|
21
21
|
title: 'sdk_event_call_url_start'
|
22
22
|
}, _objectSpread({}, payload)).send();
|
23
|
-
if (payload.isCallApp && payload.schemeUrl) {
|
24
|
-
var detectSuccessDelay = payload.callAppDetectSuccessDelay;
|
25
|
-
var _callAppLib = new CallApp({
|
26
|
-
successCb: function successCb() {
|
27
|
-
successCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
28
|
-
},
|
29
|
-
resultJudgmentTime: detectSuccessDelay
|
30
|
-
});
|
31
|
-
_callAppLib.open({
|
32
|
-
scheme: payload.schemeUrl,
|
33
|
-
fallback: function fallback() {
|
34
|
-
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
35
|
-
}
|
36
|
-
});
|
37
|
-
return;
|
38
|
-
}
|
39
23
|
// 支持 target: _blank,新开tab页打开
|
40
24
|
if (payload.browserLinkTarget === TargetEnum.BLANK) {
|
41
|
-
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
25
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', payload, serviceProvider);
|
42
26
|
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
43
27
|
window.open(payload.url);
|
44
28
|
return;
|
45
29
|
}
|
46
30
|
if (payload.browserLinkTarget === TargetEnum.REPLACE && !(payload !== null && payload !== void 0 && payload.applinkUrl) && !(payload !== null && payload !== void 0 && payload.schemeUrl)) {
|
47
|
-
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
31
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', payload, serviceProvider);
|
48
32
|
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
49
33
|
window.location.replace(payload.url);
|
50
34
|
return;
|
@@ -71,14 +55,14 @@ export var redirect = function redirect(payload, instanceId) {
|
|
71
55
|
fallback: function fallback() {
|
72
56
|
// Applink evoke failed, try to use scheme url
|
73
57
|
if (payload.applinkUrl) {
|
74
|
-
failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl, serviceProvider);
|
58
|
+
failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl, payload, serviceProvider);
|
75
59
|
}
|
76
60
|
callAppLib.open({
|
77
61
|
scheme: payload.schemeUrl,
|
78
62
|
fallback: function fallback() {
|
79
|
-
//
|
63
|
+
// ScehmeUrl evoke failed
|
80
64
|
if (payload.schemeUrl) {
|
81
|
-
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
65
|
+
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, payload, serviceProvider);
|
82
66
|
}
|
83
67
|
window.location.href = payload.url;
|
84
68
|
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
@@ -100,10 +84,10 @@ var successCallback = function successCallback(payload, type, url, serviceProvid
|
|
100
84
|
url: url
|
101
85
|
}).send();
|
102
86
|
};
|
103
|
-
var failCallback = function failCallback(payload, type, url, serviceProvider) {
|
87
|
+
var failCallback = function failCallback(payload, type, url, behaviorData, serviceProvider) {
|
104
88
|
serviceProvider.getService('EventCenter').emit(EVENT.eventCallback.name, {
|
105
89
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
106
|
-
message: "Failed to open app,applinkUrl: ".concat(
|
90
|
+
message: "Failed to open app,applinkUrl: ".concat(behaviorData === null || behaviorData === void 0 ? void 0 : behaviorData.applinkUrl, " schemeUrl: ").concat(behaviorData === null || behaviorData === void 0 ? void 0 : behaviorData.schemeUrl, " normalUrl: ").concat(behaviorData === null || behaviorData === void 0 ? void 0 : behaviorData.url)
|
107
91
|
});
|
108
92
|
serviceProvider.getService('Log').logInfo({
|
109
93
|
title: 'sdk_error_call_url_failed'
|
@@ -21,26 +21,17 @@ export interface QueryParams {
|
|
21
21
|
locale: string;
|
22
22
|
instanceId: string;
|
23
23
|
analyticsEnabled: boolean;
|
24
|
-
isPreload
|
24
|
+
isPreload: string;
|
25
25
|
hostSign?: string;
|
26
26
|
}
|
27
|
-
export declare const
|
27
|
+
export declare const getWebAppUrl: (params: {
|
28
28
|
environment: string;
|
29
29
|
sdkMetaData: SDKMetaData;
|
30
30
|
productSceneVersion: string;
|
31
31
|
paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
|
32
|
-
isPreload?: boolean;
|
33
32
|
query: QueryParams;
|
34
33
|
}) => {
|
35
34
|
path: string;
|
36
35
|
locationSearch: string;
|
37
36
|
};
|
38
|
-
export declare const getWebAppUrl: (params: {
|
39
|
-
environment: string;
|
40
|
-
sdkMetaData: SDKMetaData;
|
41
|
-
productSceneVersion: string;
|
42
|
-
paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
|
43
|
-
isPreload?: boolean;
|
44
|
-
query: QueryParams;
|
45
|
-
}) => string;
|
46
37
|
export declare const parseWebAppMatchConfig: (extendInfo: string) => WebAppMatchConfig[];
|
@@ -12,13 +12,12 @@ import { isDebugLog } from "../../util/debug";
|
|
12
12
|
* Sent by server inside paymentSession.
|
13
13
|
*/
|
14
14
|
|
15
|
-
export var
|
15
|
+
export var getWebAppUrl = function getWebAppUrl(params) {
|
16
16
|
var environment = params.environment,
|
17
17
|
sdkMetaData = params.sdkMetaData,
|
18
18
|
productSceneVersion = params.productSceneVersion,
|
19
19
|
paymentMethodCategoryType = params.paymentMethodCategoryType,
|
20
|
-
query = params.query
|
21
|
-
isPreload = params.isPreload;
|
20
|
+
query = params.query;
|
22
21
|
var path = getAppPath(environment, sdkMetaData, productSceneVersion, paymentMethodCategoryType);
|
23
22
|
var _queryParse = queryParse(),
|
24
23
|
_sandbox = _queryParse._sandbox,
|
@@ -33,10 +32,6 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
|
33
32
|
for (var key in query) {
|
34
33
|
urlParams[key] = '' + query[key];
|
35
34
|
}
|
36
|
-
// 如果是preload模式,添加一个preload的query参数
|
37
|
-
if (isPreload) {
|
38
|
-
urlParams['isPreload'] = 'true';
|
39
|
-
}
|
40
35
|
urlParams.appMatched = sdkMetaData.webAppVersion ? 'true' : 'false';
|
41
36
|
urlParams.sdkVersion = sdkMetaData.sdkVersion;
|
42
37
|
urlParams.refUrl = window.location.href;
|
@@ -57,16 +52,6 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
|
57
52
|
locationSearch: locationSearch
|
58
53
|
};
|
59
54
|
};
|
60
|
-
export var getWebAppUrl = function getWebAppUrl(params) {
|
61
|
-
var info = getWebAppUrlInfo(params);
|
62
|
-
var webAppUrl;
|
63
|
-
if (info.path.indexOf('?') !== -1) {
|
64
|
-
webAppUrl = "".concat(info.path, "&").concat(info.locationSearch);
|
65
|
-
} else {
|
66
|
-
webAppUrl = "".concat(info.path, "?").concat(info.locationSearch);
|
67
|
-
}
|
68
|
-
return webAppUrl;
|
69
|
-
};
|
70
55
|
var getAppPath = function getAppPath() {
|
71
56
|
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'prod';
|
72
57
|
var sdkMetaData = arguments.length > 1 ? arguments[1] : undefined;
|
package/esm/index.d.ts
CHANGED
@@ -1,7 +1,36 @@
|
|
1
|
-
import {
|
1
|
+
import { AddressComponent } from './core/component/address';
|
2
|
+
import { ElementComponent } from './core/component/element';
|
3
|
+
import { AMSComponent } from './core/component/index';
|
4
|
+
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IOptionsParams } from './types';
|
5
|
+
export { AMSCheckoutPage } from './core/component/ckp';
|
2
6
|
export * from './types';
|
7
|
+
export declare class AMSCheckout extends AMSComponent {
|
8
|
+
constructor(_options: IOptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
9
|
+
}
|
10
|
+
export declare class AMSAutoDebit extends AMSCheckout {
|
11
|
+
constructor(options: IOptionsParams);
|
12
|
+
}
|
13
|
+
export declare class AMSAutoDebitPay extends AMSCheckout {
|
14
|
+
constructor(options: IOptionsParams);
|
15
|
+
}
|
3
16
|
export declare class AMSEasyPay {
|
4
17
|
private core;
|
5
18
|
constructor(options: IOptionsParams);
|
6
19
|
createComponent(params: IcreateComponent): void;
|
7
20
|
}
|
21
|
+
export declare class AMSCashierPayment extends AMSCheckout {
|
22
|
+
constructor(options: IOptionsParams);
|
23
|
+
}
|
24
|
+
export declare class AMSVaulting extends AMSCheckout {
|
25
|
+
constructor(options: IOptionsParams);
|
26
|
+
}
|
27
|
+
export declare class AntomElement extends AMSCheckout {
|
28
|
+
constructor(options: IOptionsParams);
|
29
|
+
}
|
30
|
+
export declare class AddressElement extends AddressComponent {
|
31
|
+
constructor(options: IoptionsAddressParams);
|
32
|
+
}
|
33
|
+
export declare class Element extends ElementComponent {
|
34
|
+
constructor(options: IElementOptions);
|
35
|
+
}
|
36
|
+
export default AMSCheckout;
|