@alipay/ams-checkout 0.0.1752633195-dev.0 → 0.0.1753090885-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/component/popupWindow.style.d.ts +4 -1
- package/esm/component/popupWindow.style.js +33 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +7 -0
- package/esm/constant/index.js +7 -0
- package/esm/core/component/element/elementController/index.js +22 -14
- package/esm/core/component/element/type.d.ts +29 -15
- package/esm/core/component/element/type.js +20 -12
- package/esm/foundation/product-processor/easysafepay/index.js +45 -54
- package/esm/foundation/service/container/index.d.ts +2 -0
- package/esm/foundation/service/container/index.js +42 -19
- package/esm/foundation/service/container/popup.d.ts +9 -6
- package/esm/foundation/service/container/popup.js +3 -1
- package/esm/foundation/service/requester/requester.js +2 -2
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +7 -9
- package/esm/util/index.d.ts +1 -0
- package/esm/util/index.js +21 -2
- package/package.json +1 -1
@@ -80,7 +80,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
80
80
|
|
81
81
|
// 首次支付
|
82
82
|
isFirstTimeToPay = !autoDebitWithToken; // 处理ESP极速外跳支付场景
|
83
|
-
if (!(
|
83
|
+
if (!(isFirstTimeToPay && requireFastSdk)) {
|
84
84
|
_context.next = 12;
|
85
85
|
break;
|
86
86
|
}
|
@@ -148,16 +148,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
148
148
|
}, {
|
149
149
|
key: "buildRedirectResult",
|
150
150
|
value: function buildRedirectResult(authUrlInfo) {
|
151
|
-
var _this = this;
|
152
151
|
var data;
|
153
|
-
var appendLocaleIntoNormalUrl = function appendLocaleIntoNormalUrl(normalUrl) {
|
154
|
-
if ((authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.needLocale) === true && _this.initConfig.locale) {
|
155
|
-
var url = new URL(normalUrl);
|
156
|
-
url.searchParams.set('locale', _this.initConfig.locale);
|
157
|
-
return url.toString();
|
158
|
-
}
|
159
|
-
return normalUrl;
|
160
|
-
};
|
161
152
|
if (!(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.normalUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.schemeUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.applinkUrl) && authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.authUrl) {
|
162
153
|
data = {
|
163
154
|
url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
@@ -166,7 +157,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
166
157
|
};
|
167
158
|
} else {
|
168
159
|
data = {
|
169
|
-
url:
|
160
|
+
url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
|
170
161
|
schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
|
171
162
|
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
|
172
163
|
};
|
@@ -185,15 +176,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
185
176
|
}, {
|
186
177
|
key: "sendRequestAndWaitWebLaunch",
|
187
178
|
value: function sendRequestAndWaitWebLaunch() {
|
188
|
-
var
|
179
|
+
var _this = this;
|
189
180
|
var webLaunchPromise = new Promise(function (resolve, reject) {
|
190
181
|
var t = setTimeout(function () {
|
191
182
|
reject(new Error('Load resource timeout'));
|
192
|
-
},
|
193
|
-
|
183
|
+
}, _this.LOAD_APP_RESOURCES_TIMEOUT);
|
184
|
+
_this.eventCenter.listen('onLaunch', function (res) {
|
194
185
|
clearTimeout(t);
|
195
186
|
resolve(res);
|
196
|
-
|
187
|
+
_this.logger.logInfo({
|
197
188
|
title: 'sdk_event_webAppOnLaunch'
|
198
189
|
});
|
199
190
|
});
|
@@ -201,25 +192,25 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
201
192
|
|
202
193
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
203
194
|
Promise.all([this.initSecuritySDK(), this.processQuery(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
204
|
-
var
|
195
|
+
var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext3, _this$paymentContext$4;
|
205
196
|
var _ref2 = _slicedToArray(_ref, 4),
|
206
197
|
_initSecurityRes = _ref2[0],
|
207
198
|
queryRes = _ref2[1],
|
208
199
|
submitRes = _ref2[2],
|
209
200
|
_webLaunchRes = _ref2[3];
|
210
|
-
var logMetaData =
|
201
|
+
var logMetaData = _this.logger.getLogConfig().mdata;
|
211
202
|
var data = {
|
212
|
-
sessionResult: (
|
203
|
+
sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
|
213
204
|
submitResult: submitRes,
|
214
|
-
paymentSessionData: (
|
205
|
+
paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
|
215
206
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
216
|
-
renderDisplayType:
|
217
|
-
appearance: (
|
218
|
-
notRedirectAfterComplete: ((
|
219
|
-
isAppWebview:
|
220
|
-
merchantAppointParam: (
|
221
|
-
allowSubmitPayCallAhead:
|
222
|
-
doubleFaUrl: getDoubleFaUrlFromSession((
|
207
|
+
renderDisplayType: _this.paymentContext.displayInfo.type,
|
208
|
+
appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
|
209
|
+
notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
|
210
|
+
isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
|
211
|
+
merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
|
212
|
+
allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
|
213
|
+
doubleFaUrl: getDoubleFaUrlFromSession((_this$paymentContext3 = _this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionObj, _this.initConfig.environment),
|
223
214
|
envInfo: {
|
224
215
|
screenHeight: screen.height,
|
225
216
|
screenWidth: screen.width
|
@@ -228,7 +219,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
228
219
|
trackId: logMetaData.requestSeq,
|
229
220
|
platform: logMetaData.platform,
|
230
221
|
firstLogTime: logMetaData.firstLogTime
|
231
|
-
}, ((
|
222
|
+
}, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
|
232
223
|
renderDisplayType: logMetaData.renderDisplayType,
|
233
224
|
sdkVersion: logMetaData.sdkVersion,
|
234
225
|
merchantId: logMetaData.merchantId,
|
@@ -239,16 +230,16 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
239
230
|
if (queryRes) {
|
240
231
|
data.queryResult = queryRes;
|
241
232
|
}
|
242
|
-
|
233
|
+
_this.eventCenter.dispatchToApp({
|
243
234
|
event: 'renderComponent',
|
244
235
|
data: data
|
245
236
|
});
|
246
|
-
|
237
|
+
_this.logger.logInfo({
|
247
238
|
title: 'sdk_event_renderComponent'
|
248
239
|
});
|
249
240
|
}).catch(function (error) {
|
250
|
-
|
251
|
-
|
241
|
+
_this.eventCenter.emit(EVENT.destroy.name, {});
|
242
|
+
_this.eventCenter.emit(EVENT.eventCallback.name, {
|
252
243
|
code: eventCodeEnum.SDK_INTERNAL_ERROR,
|
253
244
|
result: {
|
254
245
|
message: error === null || error === void 0 ? void 0 : error.message
|
@@ -260,18 +251,18 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
260
251
|
key: "processQuery",
|
261
252
|
value: function () {
|
262
253
|
var _processQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
263
|
-
var _this$
|
264
|
-
var queryParams, extendInfo, needAccountConfirmPage, isFirstTimeToPay, needQueryRender, extendInfoData, requestBizId, requester, _this$paymentContext$
|
254
|
+
var _this$paymentContext4, _this$paymentContext5, _this$paymentContext6, _this$paymentContext$5, _this$paymentContext7, _this$paymentContext8;
|
255
|
+
var queryParams, extendInfo, needAccountConfirmPage, isFirstTimeToPay, needQueryRender, extendInfoData, requestBizId, requester, _this$paymentContext$6, res;
|
265
256
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
266
257
|
while (1) switch (_context2.prev = _context2.next) {
|
267
258
|
case 0:
|
268
259
|
queryParams = {
|
269
|
-
paymentSessionData: ((_this$
|
270
|
-
paymentSessionConfig: (_this$
|
260
|
+
paymentSessionData: ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionId) || '',
|
261
|
+
paymentSessionConfig: (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 || (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionConfig
|
271
262
|
};
|
272
|
-
extendInfo = (_this$
|
273
|
-
needAccountConfirmPage = (_this$paymentContext$ = (_this$
|
274
|
-
isFirstTimeToPay = !((_this$
|
263
|
+
extendInfo = (_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionObj.extendInfo;
|
264
|
+
needAccountConfirmPage = (_this$paymentContext$5 = (_this$paymentContext7 = this.paymentContext) === null || _this$paymentContext7 === void 0 ? void 0 : _this$paymentContext7.paymentSessionObj.needAccountConfirmPage) !== null && _this$paymentContext$5 !== void 0 ? _this$paymentContext$5 : true;
|
265
|
+
isFirstTimeToPay = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.autoDebitWithToken);
|
275
266
|
needQueryRender = true;
|
276
267
|
try {
|
277
268
|
extendInfoData = JSON.parse(extendInfo);
|
@@ -299,7 +290,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
299
290
|
_context2.t1 = _objectSpread(_objectSpread({}, queryParams), {}, {
|
300
291
|
actionType: 'init',
|
301
292
|
integrationType: 'SDK',
|
302
|
-
sdkVersion: (_this$paymentContext$
|
293
|
+
sdkVersion: (_this$paymentContext$6 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$6 !== void 0 ? _this$paymentContext$6 : '1.0.0'
|
303
294
|
});
|
304
295
|
_context2.t2 = this.initConfig.environment;
|
305
296
|
_context2.t3 = this.SDK_REQUEST_TIMEOUT;
|
@@ -358,21 +349,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
358
349
|
key: "processSubmitPay",
|
359
350
|
value: function () {
|
360
351
|
var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
361
|
-
var _this$
|
362
|
-
var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$
|
352
|
+
var _this$paymentContext9, _this$paymentContext10, _this$paymentContext11, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$8, _this$paymentContext12;
|
353
|
+
var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$7, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$9, res;
|
363
354
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
364
355
|
while (1) switch (_context3.prev = _context3.next) {
|
365
356
|
case 0:
|
366
357
|
submitParams = {
|
367
|
-
paymentSessionData: ((_this$
|
368
|
-
paymentSessionConfig: (_this$
|
358
|
+
paymentSessionData: ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionId) || '',
|
359
|
+
paymentSessionConfig: (_this$paymentContext10 = this.paymentContext) === null || _this$paymentContext10 === void 0 || (_this$paymentContext10 = _this$paymentContext10.paymentSessionObj) === null || _this$paymentContext10 === void 0 ? void 0 : _this$paymentContext10.paymentSessionConfig
|
369
360
|
};
|
370
361
|
_ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
|
371
|
-
_ref4 = ((_this$
|
362
|
+
_ref4 = ((_this$paymentContext11 = this.paymentContext) === null || _this$paymentContext11 === void 0 ? void 0 : _this$paymentContext11.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
|
372
363
|
if (productSceneVersion === '2.0' && !autoDebitWithToken) {
|
373
364
|
///EasyPay 2.0 首次传signAgreement字段
|
374
365
|
submitParams['signAgreement'] = enableSignAgreement;
|
375
|
-
paymentMethodType = (_this$paymentContext$
|
366
|
+
paymentMethodType = (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentMethodInfoView) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.paymentMethodType;
|
376
367
|
isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
|
377
368
|
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
378
369
|
backScheme = getBackScheme(undefined, this.logger);
|
@@ -403,12 +394,12 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
403
394
|
extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
|
404
395
|
instanceId: this.instanceId,
|
405
396
|
locale: this.initConfig.locale,
|
406
|
-
paymentMethodType: (_this$paymentContext$
|
397
|
+
paymentMethodType: (_this$paymentContext$8 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$8 === void 0 || (_this$paymentContext$8 = _this$paymentContext$8.paymentMethodInfoView) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.paymentMethodType,
|
407
398
|
paymentSessionData: this.paymentContext.paymentSessionId,
|
408
399
|
paymentSessionObj: this.paymentContext.paymentSessionObj,
|
409
400
|
env: this.initConfig.environment,
|
410
401
|
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion,
|
411
|
-
notRedirectAfterComplete: ((_this$
|
402
|
+
notRedirectAfterComplete: ((_this$paymentContext12 = this.paymentContext) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.startBizFlowOptions) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.submitPayRequestExtra) === null || _this$paymentContext12 === void 0 ? void 0 : _this$paymentContext12.notRedirectAfterComplete) === true
|
412
403
|
})) || {}; // 二次支付不再需要该参数
|
413
404
|
if (!autoDebitWithToken) {
|
414
405
|
extParams.complianceSDK = true;
|
@@ -419,7 +410,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
419
410
|
_context3.t0 = requester;
|
420
411
|
_context3.t1 = _objectSpread(_objectSpread({}, submitParams), {}, {
|
421
412
|
integrationType: 'SDK',
|
422
|
-
sdkVersion: (_this$paymentContext$
|
413
|
+
sdkVersion: (_this$paymentContext$9 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$9 !== void 0 ? _this$paymentContext$9 : '1.0.0'
|
423
414
|
});
|
424
415
|
_context3.t2 = this.initConfig.environment;
|
425
416
|
_context3.t3 = this.SDK_REQUEST_TIMEOUT;
|
@@ -478,13 +469,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
478
469
|
key: "acquireApdidToken",
|
479
470
|
value: function () {
|
480
471
|
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
481
|
-
var _this$paymentContext$
|
472
|
+
var _this$paymentContext$10;
|
482
473
|
var securityService, productScene, deviceId;
|
483
474
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
484
475
|
while (1) switch (_context4.prev = _context4.next) {
|
485
476
|
case 0:
|
486
477
|
securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
487
|
-
productScene = (_this$paymentContext$
|
478
|
+
productScene = (_this$paymentContext$10 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$10 === void 0 || (_this$paymentContext$10 = _this$paymentContext$10.paymentSessionConfig) === null || _this$paymentContext$10 === void 0 ? void 0 : _this$paymentContext$10.productScene;
|
488
479
|
deviceId = securityService.getDeviceId({
|
489
480
|
productScene: productScene
|
490
481
|
});
|
@@ -504,15 +495,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
504
495
|
key: "initSecuritySDK",
|
505
496
|
value: function () {
|
506
497
|
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
507
|
-
var _this$paymentContext$
|
498
|
+
var _this$paymentContext$11, _this$paymentContext$12, _this$paymentContext$13, _this$paymentContext$14, _this$paymentContext$15, _this$paymentContext$16, productSceneVersion, nonInitSecuritySDK, signButtonDisplay, userSignAgreement, isFirstTimeToPay, shouldInitSecuritySDK;
|
508
499
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
509
500
|
while (1) switch (_context5.prev = _context5.next) {
|
510
501
|
case 0:
|
511
502
|
_context5.prev = 0;
|
512
503
|
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
|
513
|
-
nonInitSecuritySDK = (_this$paymentContext$
|
514
|
-
signButtonDisplay = (_this$paymentContext$
|
515
|
-
userSignAgreement = (_this$paymentContext$
|
504
|
+
nonInitSecuritySDK = (_this$paymentContext$11 = (_this$paymentContext$12 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$12 === void 0 ? void 0 : _this$paymentContext$12.nonInitSecuritySDK) !== null && _this$paymentContext$11 !== void 0 ? _this$paymentContext$11 : false;
|
505
|
+
signButtonDisplay = (_this$paymentContext$13 = (_this$paymentContext$14 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$14 === void 0 ? void 0 : _this$paymentContext$14.signButtonDisplay) !== null && _this$paymentContext$13 !== void 0 ? _this$paymentContext$13 : false;
|
506
|
+
userSignAgreement = (_this$paymentContext$15 = (_this$paymentContext$16 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$16 === void 0 ? void 0 : _this$paymentContext$16.userSignAgreement) !== null && _this$paymentContext$15 !== void 0 ? _this$paymentContext$15 : false;
|
516
507
|
isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
517
508
|
shouldInitSecuritySDK = false;
|
518
509
|
if (nonInitSecuritySDK) {
|
@@ -35,5 +35,7 @@ export declare class ContainerService implements Service {
|
|
35
35
|
private changeCloseBtnVisibility;
|
36
36
|
private handleMaskCloseBtnShow;
|
37
37
|
private handleCloseButtonTheme;
|
38
|
+
private handlePopupWindow;
|
39
|
+
private handlePopWindow;
|
38
40
|
getWebApp(): HTMLIFrameElement;
|
39
41
|
}
|
@@ -195,19 +195,7 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
195
195
|
});
|
196
196
|
});
|
197
197
|
this.eventCenter.listen(EVENT.popupWindow.name, function (data) {
|
198
|
-
|
199
|
-
if (data.paymentElementOldModel) return;
|
200
|
-
insertStyleSheet();
|
201
|
-
_this.popupManager.popup(_objectSpread({
|
202
|
-
platform: (_this$displayInfo2 = _this.displayInfo) === null || _this$displayInfo2 === void 0 ? void 0 : _this$displayInfo2.platform
|
203
|
-
}, data)).then(function () {
|
204
|
-
_this.eventCenter.addIFrame(_this.popupManager.popupApp);
|
205
|
-
}).catch(function (error) {
|
206
|
-
_this.logService.logError({
|
207
|
-
title: (error === null || error === void 0 ? void 0 : error.title) || 'sdk_error_create_pop_up'
|
208
|
-
}, error);
|
209
|
-
_this.eventCenter.emit(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
|
210
|
-
});
|
198
|
+
_this.handlePopupWindow(data);
|
211
199
|
});
|
212
200
|
this.eventCenter.listen(EVENT.popWindow.name, function () {
|
213
201
|
_this.popupManager.pop();
|
@@ -266,9 +254,9 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
266
254
|
}, {
|
267
255
|
key: "handleSizeChanged",
|
268
256
|
value: function handleSizeChanged(data) {
|
269
|
-
var _this$
|
270
|
-
appendAliasContainerId = _this$
|
271
|
-
selector = _this$
|
257
|
+
var _this$displayInfo2 = this.displayInfo,
|
258
|
+
appendAliasContainerId = _this$displayInfo2.appendAliasContainerId,
|
259
|
+
selector = _this$displayInfo2.selector;
|
272
260
|
var cashierId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat((selector === null || selector === void 0 ? void 0 : selector.indexOf('#')) === -1 ? selector : selector.slice(1)) : COMPONENT_CONTAINER_ID;
|
273
261
|
if (!this.webApp || !this.displayInfo) {
|
274
262
|
return;
|
@@ -329,9 +317,9 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
329
317
|
key: "focusScrollFixed",
|
330
318
|
value: function focusScrollFixed(focus) {
|
331
319
|
// 获取iframe dom元素
|
332
|
-
var _this$
|
333
|
-
appendAliasContainerId = _this$
|
334
|
-
selector = _this$
|
320
|
+
var _this$displayInfo3 = this.displayInfo,
|
321
|
+
appendAliasContainerId = _this$displayInfo3.appendAliasContainerId,
|
322
|
+
selector = _this$displayInfo3.selector;
|
335
323
|
var cashierId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat((selector === null || selector === void 0 ? void 0 : selector.indexOf('#')) === -1 ? selector : selector.slice(1)) : COMPONENT_CONTAINER_ID;
|
336
324
|
if (!this.webApp || !this.displayInfo) {
|
337
325
|
return;
|
@@ -422,6 +410,41 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
422
410
|
maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
|
423
411
|
}
|
424
412
|
}
|
413
|
+
|
414
|
+
// SDK主动打开弹框
|
415
|
+
}, {
|
416
|
+
key: "handlePopupWindow",
|
417
|
+
value: function handlePopupWindow(data) {
|
418
|
+
var _this$displayInfo4,
|
419
|
+
_this3 = this;
|
420
|
+
if (data.paymentElementOldModel) return;
|
421
|
+
insertStyleSheet();
|
422
|
+
this.popupManager.popup(_objectSpread({
|
423
|
+
platform: (_this$displayInfo4 = this.displayInfo) === null || _this$displayInfo4 === void 0 ? void 0 : _this$displayInfo4.platform,
|
424
|
+
showCloseOnLoading: data.showCloseOnLoading,
|
425
|
+
onCloseOnLoading: function onCloseOnLoading() {
|
426
|
+
return _this3.handlePopWindow(data);
|
427
|
+
}
|
428
|
+
}, data)).then(function () {
|
429
|
+
_this3.eventCenter.addIFrame(_this3.popupManager.popupApp);
|
430
|
+
}).catch(function (error) {
|
431
|
+
_this3.logService.logError({
|
432
|
+
title: (error === null || error === void 0 ? void 0 : error.title) || 'sdk_error_create_pop_up'
|
433
|
+
}, error);
|
434
|
+
_this3.eventCenter.emit(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
|
435
|
+
});
|
436
|
+
}
|
437
|
+
|
438
|
+
// SDK主动关闭弹框
|
439
|
+
}, {
|
440
|
+
key: "handlePopWindow",
|
441
|
+
value: function handlePopWindow(data) {
|
442
|
+
this.popupManager.pop();
|
443
|
+
this.eventCenter.dispatchToApp({
|
444
|
+
event: EVENT.popWindow.name,
|
445
|
+
data: data
|
446
|
+
});
|
447
|
+
}
|
425
448
|
}, {
|
426
449
|
key: "getWebApp",
|
427
450
|
value: function getWebApp() {
|
@@ -1,4 +1,12 @@
|
|
1
1
|
import { PlatformEnum } from '../../../types';
|
2
|
+
export type IPopUpParams = {
|
3
|
+
url: string;
|
4
|
+
widthPadding: number;
|
5
|
+
heightPadding: number;
|
6
|
+
platform: PlatformEnum;
|
7
|
+
showCloseOnLoading: boolean;
|
8
|
+
onCloseOnLoading: () => void;
|
9
|
+
};
|
2
10
|
/**
|
3
11
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
4
12
|
* @date 2024/9/22
|
@@ -7,11 +15,6 @@ export declare class PopupManager {
|
|
7
15
|
private popupUrlQuery;
|
8
16
|
popupApp: HTMLIFrameElement;
|
9
17
|
setPopupUrlQuery(queryParams: string): void;
|
10
|
-
popup(data:
|
11
|
-
url: string;
|
12
|
-
widthPadding: number;
|
13
|
-
heightPadding: number;
|
14
|
-
platform: PlatformEnum;
|
15
|
-
}): Promise<void>;
|
18
|
+
popup(data: IPopUpParams): Promise<void>;
|
16
19
|
pop(): void;
|
17
20
|
}
|
@@ -53,7 +53,9 @@ export var PopupManager = /*#__PURE__*/function () {
|
|
53
53
|
widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
|
54
54
|
device: data === null || data === void 0 ? void 0 : data.platform,
|
55
55
|
url: pageUrl,
|
56
|
-
loadingConfig: undefined
|
56
|
+
loadingConfig: undefined,
|
57
|
+
showCloseOnLoading: data.showCloseOnLoading,
|
58
|
+
onCloseOnLoading: data.onCloseOnLoading
|
57
59
|
});
|
58
60
|
case 11:
|
59
61
|
this.popupApp = _context.sent;
|
@@ -13,7 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
13
13
|
import axios from 'axios';
|
14
14
|
import { ServiceProvider } from '..';
|
15
15
|
import { errorEnum } from "./deps";
|
16
|
-
import { appId, device, fomatGetwayError, get, hostSignMap,
|
16
|
+
import { appId, device, fomatGetwayError, get, hostSignMap, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
|
17
17
|
|
18
18
|
/**
|
19
19
|
* @author congle.zzq <congle.zzq@alipay.com>
|
@@ -149,7 +149,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
149
149
|
value: function getEnvInfo(options) {
|
150
150
|
var _options$envInfo;
|
151
151
|
var envInfo = _objectSpread(_objectSpread({
|
152
|
-
terminalType:
|
152
|
+
terminalType: device.isMobile ? 'WAP' : 'WEB',
|
153
153
|
browserInfo: {
|
154
154
|
browserJavaScriptEnabled: true,
|
155
155
|
browserLanguage: navigator.language,
|
package/esm/request/index.js
CHANGED
@@ -20,7 +20,7 @@ import { sdkVersion } from "../config/index";
|
|
20
20
|
import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
|
21
21
|
import { errorEnum } from "../types";
|
22
22
|
import { get } from "../util/get";
|
23
|
-
import { device,
|
23
|
+
import { device, queryParse, safeJson } from "../util";
|
24
24
|
import { fomatGetwayError } from "./utils";
|
25
25
|
var _queryParse = queryParse(),
|
26
26
|
_sandbox = _queryParse._sandbox;
|
@@ -70,7 +70,7 @@ function _request() {
|
|
70
70
|
while (1) switch (_context.prev = _context.next) {
|
71
71
|
case 0:
|
72
72
|
envInfo = _objectSpread(_objectSpread({
|
73
|
-
terminalType:
|
73
|
+
terminalType: device.isMobile ? 'WAP' : 'WEB',
|
74
74
|
browserInfo: {
|
75
75
|
browserJavaScriptEnabled: true,
|
76
76
|
browserLanguage: navigator.language,
|
package/esm/types/index.d.ts
CHANGED
@@ -261,7 +261,13 @@ export interface IPaymentSessionMetaData {
|
|
261
261
|
paymentMethodInfoView?: any;
|
262
262
|
paymentView?: any;
|
263
263
|
action?: PaymentSessionActionData;
|
264
|
-
authUrlInfo?:
|
264
|
+
authUrlInfo?: {
|
265
|
+
appIdentifier?: string;
|
266
|
+
applinkUrl?: string;
|
267
|
+
normalUrl?: string;
|
268
|
+
schemeUrl?: string;
|
269
|
+
authUrl?: string;
|
270
|
+
};
|
265
271
|
paymentSessionFactor?: {
|
266
272
|
externalRiskTimeout?: number;
|
267
273
|
extendInfo?: {
|
@@ -333,14 +339,6 @@ export interface IPaymentSessionMetaData {
|
|
333
339
|
skipRenderPaymentMethod?: boolean;
|
334
340
|
needAccountConfirmPage?: boolean;
|
335
341
|
}
|
336
|
-
export interface IAuthUrlInfo {
|
337
|
-
appIdentifier?: string;
|
338
|
-
applinkUrl?: string;
|
339
|
-
normalUrl?: string;
|
340
|
-
schemeUrl?: string;
|
341
|
-
authUrl?: string;
|
342
|
-
needLocale?: boolean;
|
343
|
-
}
|
344
342
|
export interface IPaymentSessionFactor {
|
345
343
|
merchantInfo?: IMerchantInfo;
|
346
344
|
paymentMethodInfo: IPaymentMethodInfo;
|
package/esm/util/index.d.ts
CHANGED
package/esm/util/index.js
CHANGED
@@ -148,14 +148,33 @@ var isAndroid = /Android/i.test(UA);
|
|
148
148
|
var isMacOS = /\bMacintosh\b/.test(UA);
|
149
149
|
var isWindowsNT = /Windows NT/.test(UA);
|
150
150
|
var isMobile = function isMobile() {
|
151
|
-
return /Android|iPhone|iPad|iPod|Mobile/.test(UA);
|
151
|
+
return /Android|iPhone|iPad|iPod|Mobile/.test(UA) || isOpenHarmonyMobile();
|
152
|
+
};
|
153
|
+
var isOpenHarmony = function isOpenHarmony() {
|
154
|
+
// 检查是否为鸿蒙操作系统
|
155
|
+
return /OpenHarmony/i.test(navigator.userAgent);
|
156
|
+
};
|
157
|
+
var isOpenHarmonyMobile = function isOpenHarmonyMobile() {
|
158
|
+
// 检查是否为鸿蒙操作系统
|
159
|
+
var isHarmonyOS = /OpenHarmony/i.test(navigator.userAgent);
|
160
|
+
// 检查是否为手机设备
|
161
|
+
var isPhone = /Phone/i.test(navigator.userAgent);
|
162
|
+
// 检查是否为平板设备
|
163
|
+
var isTablet = /Tablet/i.test(navigator.userAgent);
|
164
|
+
// 返回是否为鸿蒙手机或平板
|
165
|
+
return isHarmonyOS && (isPhone || isTablet);
|
166
|
+
};
|
167
|
+
var isOpenHarmonyPC = function isOpenHarmonyPC() {
|
168
|
+
// 检查是否为鸿蒙操作系统
|
169
|
+
return /OpenHarmony/i.test(navigator.userAgent) && /PC/i.test(navigator.userAgent);
|
152
170
|
};
|
153
171
|
var device = {
|
154
172
|
iOS: isIOS,
|
155
173
|
Android: isAndroid,
|
156
174
|
macOS: isMacOS,
|
157
175
|
WindowsNT: isWindowsNT,
|
158
|
-
isMobile: !!isMobile()
|
176
|
+
isMobile: !!isMobile(),
|
177
|
+
isOpenHarmonyMobile: !!isOpenHarmonyMobile()
|
159
178
|
};
|
160
179
|
var safeJson = function safeJson(data, obj) {
|
161
180
|
try {
|