@alipay/ams-checkout 0.0.1698890614-dev.0 → 0.0.1699585541-dev.2
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/core/instance/index.js +9 -7
- package/esm/plugin/component/cashierApp.d.ts +4 -1
- package/esm/plugin/component/cashierApp.js +4 -1
- package/esm/plugin/component/index.d.ts +3 -1
- package/esm/plugin/component/index.js +167 -93
- package/esm/request/index.d.ts +2 -2
- package/esm/request/index.js +1 -1
- package/esm/service/index.d.ts +3 -9
- package/esm/service/index.js +23 -1
- package/esm/types/index.d.ts +53 -2
- package/esm/types/index.js +6 -0
- package/esm/util/jshield-apdid/apdid-core.umd.min.js +1 -0
- package/esm/util/logger.js +12 -10
- package/esm/util/security.js +1 -1
- package/package.json +1 -1
@@ -94,14 +94,16 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
94
94
|
key: "getStorageId",
|
95
95
|
value: function getStorageId(instanceId) {
|
96
96
|
var storageKey = 'AMSSDK_STORAGE_ID';
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
try {
|
98
|
+
if (window.localStorage) {
|
99
|
+
var storageId = window.localStorage.getItem(storageKey);
|
100
|
+
if (storageId) {
|
101
|
+
return storageId;
|
102
|
+
} else {
|
103
|
+
window.localStorage.setItem(storageKey, instanceId);
|
104
|
+
}
|
103
105
|
}
|
104
|
-
}
|
106
|
+
} catch (error) {/* empty */}
|
105
107
|
return instanceId;
|
106
108
|
}
|
107
109
|
|
@@ -18,7 +18,10 @@ export declare const getIframeUrl: (iframeParams: {
|
|
18
18
|
locale: string;
|
19
19
|
instanceId: string;
|
20
20
|
renderDisplayType: renderDisplayTypeEnum;
|
21
|
-
}) =>
|
21
|
+
}) => {
|
22
|
+
path: string;
|
23
|
+
locationSearch: string;
|
24
|
+
};
|
22
25
|
/**
|
23
26
|
* @description Create iframe
|
24
27
|
*/
|
@@ -99,7 +99,10 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
99
99
|
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
100
100
|
if (_displayType) urlParams.displayType = _displayType;
|
101
101
|
var locationSearch = serialize(urlParams);
|
102
|
-
return
|
102
|
+
return {
|
103
|
+
path: path,
|
104
|
+
locationSearch: locationSearch
|
105
|
+
};
|
103
106
|
};
|
104
107
|
|
105
108
|
/**
|
@@ -17,9 +17,10 @@ export default class ComponentApp {
|
|
17
17
|
private _appVersion;
|
18
18
|
private _isRetention;
|
19
19
|
private _actionQueryPromise;
|
20
|
+
private _actionSubmitPromise;
|
20
21
|
private _renderParams;
|
21
22
|
private _componentSign;
|
22
|
-
private
|
23
|
+
private _appLocationSearch;
|
23
24
|
private _renderDisplayType;
|
24
25
|
constructor();
|
25
26
|
/**
|
@@ -49,6 +50,7 @@ export default class ComponentApp {
|
|
49
50
|
* @description Interface request
|
50
51
|
*/
|
51
52
|
private createActionQueryPromise;
|
53
|
+
private createSubmitPromise;
|
52
54
|
private cleanElement;
|
53
55
|
/**
|
54
56
|
* @description Create app
|
@@ -14,12 +14,11 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
14
14
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
15
15
|
* 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.
|
16
16
|
*/
|
17
|
-
/* eslint-disable no-console */
|
18
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
19
18
|
import { marmotMap } from "../../config/index";
|
20
19
|
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID } from "../../constant";
|
21
|
-
import { queryPaymentInfo } from "../../service";
|
22
|
-
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, SecuritySceneEnum, targetEnum
|
20
|
+
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
21
|
+
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, SecuritySceneEnum, targetEnum } from "../../types";
|
23
22
|
import { getType, isJsonString, isPC } from "../../util";
|
24
23
|
import { isLocalMock } from "../../util/mock";
|
25
24
|
import { getApdidToken, getAppname, getSecurityHost, initSecuritySDK } from "../../util/security";
|
@@ -45,9 +44,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
45
44
|
_defineProperty(this, "_appVersion", void 0);
|
46
45
|
_defineProperty(this, "_isRetention", void 0);
|
47
46
|
_defineProperty(this, "_actionQueryPromise", null);
|
47
|
+
_defineProperty(this, "_actionSubmitPromise", null);
|
48
48
|
_defineProperty(this, "_renderParams", null);
|
49
49
|
_defineProperty(this, "_componentSign", componentSignEnum.NONE);
|
50
|
-
_defineProperty(this, "
|
50
|
+
_defineProperty(this, "_appLocationSearch", void 0);
|
51
51
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
52
52
|
this._appVersion = '1.6.0';
|
53
53
|
this._isInitComponent = false;
|
@@ -56,8 +56,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
56
56
|
return Promise.resolve();
|
57
57
|
};
|
58
58
|
this.platform = isPC() ? platformEnum.desktop : platformEnum.mobile;
|
59
|
-
this._clickEventName = this.platform === platformEnum.mobile ? 'touchend' : 'click';
|
60
59
|
this._isRetention = true;
|
60
|
+
this._appLocationSearch = '';
|
61
61
|
this._performanceData.push({
|
62
62
|
key: 'sdk_init',
|
63
63
|
value: Date.now()
|
@@ -119,7 +119,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
119
119
|
value: function initAPSecurity() {
|
120
120
|
var _this$_renderParams2,
|
121
121
|
_this = this;
|
122
|
-
if (componentSignEnum.CASHIER_PAYMENT_CARD
|
122
|
+
if (![componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.EASY_PAY_WALLET].includes(this._componentSign)) {
|
123
123
|
return;
|
124
124
|
}
|
125
125
|
var securityConfig = (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 || (_this$_renderParams2 = _this$_renderParams2.paymentSessionMetaData) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.securityConfig;
|
@@ -171,7 +171,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
171
171
|
}
|
172
172
|
}, {
|
173
173
|
key: "getDeviceIdAndLog",
|
174
|
-
value: function getDeviceIdAndLog() {
|
174
|
+
value: function getDeviceIdAndLog(scene) {
|
175
175
|
var _this2 = this;
|
176
176
|
return new Promise(function (resolve) {
|
177
177
|
// To avoid rendering being blocked, move the logic to the next event loop for processing
|
@@ -184,7 +184,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
184
184
|
securityConfig = (_this2$_renderParams = _this2._renderParams) === null || _this2$_renderParams === void 0 || (_this2$_renderParams = _this2$_renderParams.paymentSessionMetaData) === null || _this2$_renderParams === void 0 ? void 0 : _this2$_renderParams.securityConfig;
|
185
185
|
getDeviceIdStartTime = Date.now();
|
186
186
|
_context.next = 4;
|
187
|
-
return getApdidToken(getAppname(SecuritySceneEnum.CARD), securityConfig);
|
187
|
+
return getApdidToken(getAppname(scene || SecuritySceneEnum.CARD), securityConfig);
|
188
188
|
case 4:
|
189
189
|
deviceId = _context.sent;
|
190
190
|
_this2.logDeviceId(deviceId, getDeviceIdStartTime);
|
@@ -236,7 +236,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
236
236
|
this.renderPopupLoading(renderParams);
|
237
237
|
}
|
238
238
|
this.createApp(renderParams);
|
239
|
-
return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
|
239
|
+
return Promise.all([this.createActionQueryPromise(), this.createSubmitPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
|
240
240
|
_this3.AMSSDK.logger.logInfo({
|
241
241
|
title: 'sdk_event_successfully_created_app_process'
|
242
242
|
}).send();
|
@@ -302,8 +302,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
302
302
|
// eslint-disable-next-line no-async-promise-executor
|
303
303
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
304
304
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
305
|
-
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
|
306
|
-
var envInfo, params, securityConfig, _this5$
|
305
|
+
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
|
306
|
+
var envInfo, params, securityConfig, _this5$_renderParams6, extendInfo, info, _this5$_renderParams7, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
|
307
307
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
308
308
|
while (1) switch (_context2.prev = _context2.next) {
|
309
309
|
case 0:
|
@@ -315,73 +315,76 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
315
315
|
paymentSessionConfig: (_this5$_renderParams2 = _this5._renderParams) === null || _this5$_renderParams2 === void 0 || (_this5$_renderParams2 = _this5$_renderParams2.paymentSessionMetaData) === null || _this5$_renderParams2 === void 0 ? void 0 : _this5$_renderParams2.paymentSessionConfig,
|
316
316
|
notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
|
317
317
|
};
|
318
|
+
/**
|
319
|
+
* @description Simulated or unnecessary scenarios
|
320
|
+
*/
|
321
|
+
if (!(isLocalMock() || (_this5$_renderParams4 = _this5._renderParams) !== null && _this5$_renderParams4 !== void 0 && (_this5$_renderParams4 = _this5$_renderParams4.paymentSessionMetaData) !== null && _this5$_renderParams4 !== void 0 && _this5$_renderParams4.action.skipSdkQuery)) {
|
322
|
+
_context2.next = 4;
|
323
|
+
break;
|
324
|
+
}
|
325
|
+
return _context2.abrupt("return", resolve({
|
326
|
+
message: 'sdk no need to make query request',
|
327
|
+
success: true
|
328
|
+
}));
|
329
|
+
case 4:
|
318
330
|
/**
|
319
331
|
* @description card
|
320
332
|
*/
|
321
333
|
if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign) {
|
322
334
|
params.paymentMethodType = 'CARD';
|
323
335
|
}
|
324
|
-
securityConfig = (_this5$
|
336
|
+
securityConfig = (_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.securityConfig;
|
325
337
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign && securityConfig)) {
|
326
|
-
_context2.next =
|
338
|
+
_context2.next = 13;
|
327
339
|
break;
|
328
340
|
}
|
329
|
-
extendInfo = ((_this5$
|
341
|
+
extendInfo = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 || (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.extendInfo) || '{}';
|
330
342
|
info = JSON.parse(extendInfo);
|
331
343
|
if (!((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false')) {
|
332
|
-
_context2.next =
|
344
|
+
_context2.next = 13;
|
333
345
|
break;
|
334
346
|
}
|
335
|
-
_context2.next =
|
347
|
+
_context2.next = 12;
|
336
348
|
return _this5.getDeviceIdAndLog();
|
337
|
-
case
|
349
|
+
case 12:
|
338
350
|
envInfo.deviceId = _context2.sent;
|
339
|
-
case
|
351
|
+
case 13:
|
340
352
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
341
|
-
_context2.next =
|
353
|
+
_context2.next = 18;
|
342
354
|
break;
|
343
355
|
}
|
344
356
|
_ref3 = params.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer, _ref3$productScene = _ref3.productScene, productScene = _ref3$productScene === void 0 ? '' : _ref3$productScene;
|
345
|
-
_ref4 = ((_this5$
|
357
|
+
_ref4 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
|
346
358
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
347
|
-
_context2.next =
|
359
|
+
_context2.next = 18;
|
348
360
|
break;
|
349
361
|
}
|
350
362
|
return _context2.abrupt("return", resolve({
|
351
363
|
message: 'sdk no need to make query request',
|
352
364
|
success: true
|
353
365
|
}));
|
354
|
-
case
|
366
|
+
case 18:
|
355
367
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
356
|
-
_context2.next =
|
368
|
+
_context2.next = 25;
|
357
369
|
break;
|
358
370
|
}
|
359
|
-
action = ((_this5$
|
371
|
+
action = ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 || (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.action) || {};
|
360
372
|
signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
361
373
|
if (!(signType === 'SMS')) {
|
362
|
-
_context2.next =
|
374
|
+
_context2.next = 23;
|
363
375
|
break;
|
364
376
|
}
|
365
377
|
return _context2.abrupt("return", resolve({
|
366
378
|
message: 'sdk no need to make query request',
|
367
379
|
success: true
|
368
380
|
}));
|
369
|
-
case 21:
|
370
|
-
if (!(!signType || signType !== 'REDIRECT')) {
|
371
|
-
_context2.next = 23;
|
372
|
-
break;
|
373
|
-
}
|
374
|
-
return _context2.abrupt("return", resolve({
|
375
|
-
success: false
|
376
|
-
}));
|
377
381
|
case 23:
|
378
|
-
if (!
|
382
|
+
if (!(!signType || signType !== 'REDIRECT')) {
|
379
383
|
_context2.next = 25;
|
380
384
|
break;
|
381
385
|
}
|
382
386
|
return _context2.abrupt("return", resolve({
|
383
|
-
|
384
|
-
success: true
|
387
|
+
success: false
|
385
388
|
}));
|
386
389
|
case 25:
|
387
390
|
queryPaymentInfo(params, {
|
@@ -420,6 +423,68 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
420
423
|
}());
|
421
424
|
return this._actionQueryPromise;
|
422
425
|
}
|
426
|
+
}, {
|
427
|
+
key: "createSubmitPromise",
|
428
|
+
value: function createSubmitPromise() {
|
429
|
+
var _this$_renderParams3,
|
430
|
+
_this$_renderParams4,
|
431
|
+
_this6 = this;
|
432
|
+
this._performanceData.push({
|
433
|
+
key: 'sdk_submit_start',
|
434
|
+
value: Date.now()
|
435
|
+
});
|
436
|
+
var envInfo = {
|
437
|
+
locale: this.AMSSDK.options.locale
|
438
|
+
};
|
439
|
+
var params = {
|
440
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData) || '',
|
441
|
+
paymentSessionConfig: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionMetaData) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.paymentSessionConfig
|
442
|
+
};
|
443
|
+
|
444
|
+
// eslint-disable-next-line no-async-promise-executor
|
445
|
+
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
446
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
447
|
+
var _this6$_renderParams;
|
448
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
449
|
+
while (1) switch (_context3.prev = _context3.next) {
|
450
|
+
case 0:
|
451
|
+
if (!(!((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.action.skipSdkQuery) && componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign)) {
|
452
|
+
_context3.next = 2;
|
453
|
+
break;
|
454
|
+
}
|
455
|
+
return _context3.abrupt("return", resolve({
|
456
|
+
message: 'sdk no need to make submitPay request',
|
457
|
+
success: true
|
458
|
+
}));
|
459
|
+
case 2:
|
460
|
+
submitPayInfo(params, {
|
461
|
+
timeout: 15000
|
462
|
+
}, _this6.AMSSDK.logger).then(function (res) {
|
463
|
+
_this6._performanceData.push({
|
464
|
+
key: 'sdk_submit_end',
|
465
|
+
value: Date.now()
|
466
|
+
});
|
467
|
+
if (res !== null && res !== void 0 && res.success) {
|
468
|
+
resolve(res);
|
469
|
+
} else {
|
470
|
+
resolve(res);
|
471
|
+
}
|
472
|
+
}).catch(function () {
|
473
|
+
return resolve({
|
474
|
+
success: false
|
475
|
+
});
|
476
|
+
});
|
477
|
+
case 3:
|
478
|
+
case "end":
|
479
|
+
return _context3.stop();
|
480
|
+
}
|
481
|
+
}, _callee3);
|
482
|
+
}));
|
483
|
+
return function (_x3) {
|
484
|
+
return _ref5.apply(this, arguments);
|
485
|
+
};
|
486
|
+
}());
|
487
|
+
}
|
423
488
|
}, {
|
424
489
|
key: "cleanElement",
|
425
490
|
value: function cleanElement() {
|
@@ -479,17 +544,21 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
479
544
|
extendInfo: extendInfo
|
480
545
|
});
|
481
546
|
this.app = createIframe(this.AMSSDK.options.mode, this.platform);
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
547
|
+
var _getIframeUrl = getIframeUrl({
|
548
|
+
renderDisplayType: renderParams.renderDisplayType,
|
549
|
+
componentSign: this._componentSign,
|
550
|
+
analytics: this.AMSSDK.options.analytics,
|
551
|
+
productSceneVersion: productSceneVersion,
|
552
|
+
environment: environment,
|
553
|
+
appVersion: this._appVersion,
|
554
|
+
extendInfo: extendInfo,
|
555
|
+
locale: this.AMSSDK.options.locale,
|
556
|
+
instanceId: this.AMSSDK._instanceId
|
557
|
+
}),
|
558
|
+
path = _getIframeUrl.path,
|
559
|
+
locationSearch = _getIframeUrl.locationSearch;
|
560
|
+
this._appLocationSearch = locationSearch;
|
561
|
+
this.app.src = "".concat(path, "?").concat(locationSearch);
|
493
562
|
|
494
563
|
// Subscribe to messages from iframe
|
495
564
|
this.addEventListener();
|
@@ -532,10 +601,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
532
601
|
}, {
|
533
602
|
key: "createPopupWindow",
|
534
603
|
value: function createPopupWindow(data) {
|
535
|
-
var _this$
|
604
|
+
var _this$_renderParams5;
|
536
605
|
this._threedData = data;
|
537
|
-
var sessionData = encodeURIComponent((_this$
|
538
|
-
var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&
|
606
|
+
var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
|
607
|
+
var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
|
539
608
|
this.popupWindow = createModal({
|
540
609
|
device: this.platform,
|
541
610
|
url: threedPageUrl
|
@@ -544,19 +613,19 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
544
613
|
}, {
|
545
614
|
key: "getDeviceIdAndCallback",
|
546
615
|
value: function () {
|
547
|
-
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
616
|
+
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(eventContext) {
|
548
617
|
var deviceId;
|
549
|
-
return _regeneratorRuntime().wrap(function
|
550
|
-
while (1) switch (
|
618
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
619
|
+
while (1) switch (_context4.prev = _context4.next) {
|
551
620
|
case 0:
|
552
621
|
if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
|
553
|
-
|
622
|
+
_context4.next = 5;
|
554
623
|
break;
|
555
624
|
}
|
556
|
-
|
625
|
+
_context4.next = 3;
|
557
626
|
return this.getDeviceIdAndLog();
|
558
627
|
case 3:
|
559
|
-
deviceId =
|
628
|
+
deviceId = _context4.sent;
|
560
629
|
this.dispatchToApp({
|
561
630
|
context: {
|
562
631
|
event: 'appEventCallback',
|
@@ -568,11 +637,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
568
637
|
});
|
569
638
|
case 5:
|
570
639
|
case "end":
|
571
|
-
return
|
640
|
+
return _context4.stop();
|
572
641
|
}
|
573
|
-
},
|
642
|
+
}, _callee4, this);
|
574
643
|
}));
|
575
|
-
function getDeviceIdAndCallback(
|
644
|
+
function getDeviceIdAndCallback(_x4) {
|
576
645
|
return _getDeviceIdAndCallback.apply(this, arguments);
|
577
646
|
}
|
578
647
|
return getDeviceIdAndCallback;
|
@@ -737,7 +806,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
737
806
|
}, {
|
738
807
|
key: "handleRedirect",
|
739
808
|
value: function handleRedirect(data) {
|
740
|
-
var
|
809
|
+
var _this7 = this;
|
741
810
|
var _data = typeof data === 'string' ? {
|
742
811
|
normalUrl: data
|
743
812
|
} : {
|
@@ -752,11 +821,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
752
821
|
redirectInfo: JSON.stringify(_data)
|
753
822
|
}).send();
|
754
823
|
var successCallback = function successCallback(type, url) {
|
755
|
-
|
824
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
756
825
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
757
826
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
758
827
|
});
|
759
|
-
|
828
|
+
_this7.AMSSDK.logger.logInfo({
|
760
829
|
title: 'sdk_event_call_url_success'
|
761
830
|
}, {
|
762
831
|
redirectInfo: JSON.stringify(_data),
|
@@ -765,11 +834,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
765
834
|
}).send();
|
766
835
|
};
|
767
836
|
var failCallback = function failCallback(type, url) {
|
768
|
-
|
837
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
769
838
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
770
839
|
message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
|
771
840
|
});
|
772
|
-
|
841
|
+
_this7.AMSSDK.logger.logInfo({
|
773
842
|
title: 'sdk_error_call_url_failed'
|
774
843
|
}, {
|
775
844
|
redirectInfo: JSON.stringify(_data),
|
@@ -792,14 +861,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
792
861
|
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
793
862
|
}).catch(function () {
|
794
863
|
failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
795
|
-
return
|
864
|
+
return _this7.AMSSDK._redirect({
|
796
865
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
797
866
|
});
|
798
867
|
}).then(function () {
|
799
868
|
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
800
869
|
}).catch(function () {
|
801
870
|
failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
802
|
-
return
|
871
|
+
return _this7.AMSSDK._redirect({
|
803
872
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
804
873
|
});
|
805
874
|
}).then(function () {
|
@@ -810,9 +879,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
810
879
|
}
|
811
880
|
}, {
|
812
881
|
key: "handleDeclareInfo",
|
813
|
-
value: function handleDeclareInfo(
|
814
|
-
var
|
815
|
-
closeDialogData =
|
882
|
+
value: function handleDeclareInfo(_ref6) {
|
883
|
+
var _ref6$closeDialogData = _ref6.closeDialogData,
|
884
|
+
closeDialogData = _ref6$closeDialogData === void 0 ? {} : _ref6$closeDialogData;
|
816
885
|
_handleDeclareInfo({
|
817
886
|
closeDialogData: closeDialogData
|
818
887
|
});
|
@@ -886,22 +955,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
886
955
|
}, {
|
887
956
|
key: "sendRenderEvent",
|
888
957
|
value: function () {
|
889
|
-
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
890
|
-
var _this$
|
891
|
-
return _regeneratorRuntime().wrap(function
|
892
|
-
while (1) switch (
|
958
|
+
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
959
|
+
var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
|
960
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
961
|
+
while (1) switch (_context5.prev = _context5.next) {
|
893
962
|
case 0:
|
894
|
-
|
895
|
-
if (this._actionQueryPromise) {
|
896
|
-
|
963
|
+
_context5.prev = 0;
|
964
|
+
if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
|
965
|
+
_context5.next = 3;
|
897
966
|
break;
|
898
967
|
}
|
899
|
-
return
|
968
|
+
return _context5.abrupt("return");
|
900
969
|
case 3:
|
901
|
-
|
970
|
+
_context5.next = 5;
|
902
971
|
return this._actionQueryPromise;
|
903
972
|
case 5:
|
904
|
-
res =
|
973
|
+
res = _context5.sent;
|
974
|
+
_context5.next = 8;
|
975
|
+
return this._actionSubmitPromise;
|
976
|
+
case 8:
|
977
|
+
submitRes = _context5.sent;
|
905
978
|
this._performanceData.push({
|
906
979
|
key: 'sdk_render_component',
|
907
980
|
value: Date.now()
|
@@ -911,12 +984,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
911
984
|
event: 'renderComponent',
|
912
985
|
data: {
|
913
986
|
queryResult: res,
|
914
|
-
|
915
|
-
|
987
|
+
submitResult: submitRes,
|
988
|
+
sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
|
989
|
+
paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
|
916
990
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
917
|
-
renderDisplayType: (_this$
|
918
|
-
appearance: (_this$
|
919
|
-
notRedirectAfterComplete: ((_this$
|
991
|
+
renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
|
992
|
+
appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
|
993
|
+
notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
|
920
994
|
envInfo: {
|
921
995
|
screenHeight: screen.height,
|
922
996
|
screenWidth: screen.width
|
@@ -933,16 +1007,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
933
1007
|
}
|
934
1008
|
});
|
935
1009
|
// eslint-disable-next-line no-empty
|
936
|
-
|
1010
|
+
_context5.next = 16;
|
937
1011
|
break;
|
938
|
-
case
|
939
|
-
|
940
|
-
|
941
|
-
case
|
1012
|
+
case 14:
|
1013
|
+
_context5.prev = 14;
|
1014
|
+
_context5.t0 = _context5["catch"](0);
|
1015
|
+
case 16:
|
942
1016
|
case "end":
|
943
|
-
return
|
1017
|
+
return _context5.stop();
|
944
1018
|
}
|
945
|
-
},
|
1019
|
+
}, _callee5, this, [[0, 14]]);
|
946
1020
|
}));
|
947
1021
|
function sendRenderEvent() {
|
948
1022
|
return _sendRenderEvent.apply(this, arguments);
|
@@ -956,7 +1030,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
956
1030
|
key: "cleanContainer",
|
957
1031
|
value: function cleanContainer() {
|
958
1032
|
var _document$getElementB4,
|
959
|
-
|
1033
|
+
_this8 = this;
|
960
1034
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
961
1035
|
this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
|
962
1036
|
this._performanceData = [];
|
@@ -968,7 +1042,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
968
1042
|
mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
|
969
1043
|
if (immediately) this.cleanElement();else {
|
970
1044
|
setTimeout(function () {
|
971
|
-
|
1045
|
+
_this8.cleanElement();
|
972
1046
|
}, 300);
|
973
1047
|
}
|
974
1048
|
}
|
package/esm/request/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { RequestConfig } from '../types';
|
2
2
|
import { Logger } from '../util/logger';
|
3
3
|
/**
|
4
4
|
*
|
@@ -6,4 +6,4 @@ import { Logger } from '../util/logger';
|
|
6
6
|
* @param options 请求配置
|
7
7
|
* @example request({ name: 'test' }, { operation-type: 'xxx.xxx.xxx' })
|
8
8
|
*/
|
9
|
-
export declare function request<T>(requestData: Record<string, any> | undefined, options:
|
9
|
+
export declare function request<T>(requestData: Record<string, any> | undefined, options: RequestConfig, logger: Logger): Promise<T>;
|
package/esm/request/index.js
CHANGED
@@ -15,11 +15,11 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
15
15
|
* 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.
|
16
16
|
*/
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
18
|
+
import axios from 'axios';
|
18
19
|
import { sdkVersion } from "../config/index";
|
19
20
|
import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
|
20
21
|
import { errorEnum } from "../types";
|
21
22
|
import { get } from "../util/get";
|
22
|
-
import axios from 'axios';
|
23
23
|
import { device, fomatGetwayError, isPC, queryParse, safeJson } from "../util";
|
24
24
|
var _queryParse = queryParse(),
|
25
25
|
_sandbox = _queryParse._sandbox;
|
package/esm/service/index.d.ts
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
-
*
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
-
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
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
|
-
*/
|
1
|
+
import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
|
8
2
|
import { Logger } from '../util/logger';
|
9
|
-
|
10
|
-
export declare function
|
3
|
+
export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
|
4
|
+
export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
|