@alipay/ams-checkout 0.0.1699863258-dev.0 → 0.0.1699863258-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/index.d.ts +9 -0
- package/esm/index.js +27 -0
- package/esm/plugin/component/cashierApp.js +2 -1
- package/esm/plugin/component/index.d.ts +2 -0
- package/esm/plugin/component/index.js +146 -84
- package/esm/request/index.d.ts +2 -2
- package/esm/request/index.js +1 -1
- package/esm/service/index.d.ts +4 -3
- package/esm/service/index.js +23 -0
- package/esm/types/index.d.ts +53 -2
- package/esm/types/index.js +6 -0
- package/esm/util/index.js +11 -6
- package/package.json +1 -1
package/esm/index.d.ts
CHANGED
@@ -13,4 +13,13 @@ export declare class AMSCheckout extends AMSComponent {
|
|
13
13
|
export declare class AMSAutoDebit extends AMSCheckout {
|
14
14
|
constructor(options: IoptionsParams);
|
15
15
|
}
|
16
|
+
export declare class AMSEasyPay extends AMSCheckout {
|
17
|
+
constructor(options: IoptionsParams);
|
18
|
+
}
|
19
|
+
export declare class AMSCashierPayment extends AMSCheckout {
|
20
|
+
constructor(options: IoptionsParams);
|
21
|
+
}
|
22
|
+
export declare class AMSVaulting extends AMSCheckout {
|
23
|
+
constructor(options: IoptionsParams);
|
24
|
+
}
|
16
25
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -38,4 +38,31 @@ export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
|
38
38
|
}
|
39
39
|
return _createClass(AMSAutoDebit);
|
40
40
|
}(AMSCheckout);
|
41
|
+
export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout2) {
|
42
|
+
_inherits(AMSEasyPay, _AMSCheckout2);
|
43
|
+
var _super3 = _createSuper(AMSEasyPay);
|
44
|
+
function AMSEasyPay(options) {
|
45
|
+
_classCallCheck(this, AMSEasyPay);
|
46
|
+
return _super3.call(this, options);
|
47
|
+
}
|
48
|
+
return _createClass(AMSEasyPay);
|
49
|
+
}(AMSCheckout);
|
50
|
+
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
51
|
+
_inherits(AMSCashierPayment, _AMSCheckout3);
|
52
|
+
var _super4 = _createSuper(AMSCashierPayment);
|
53
|
+
function AMSCashierPayment(options) {
|
54
|
+
_classCallCheck(this, AMSCashierPayment);
|
55
|
+
return _super4.call(this, options);
|
56
|
+
}
|
57
|
+
return _createClass(AMSCashierPayment);
|
58
|
+
}(AMSCheckout);
|
59
|
+
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
60
|
+
_inherits(AMSVaulting, _AMSCheckout4);
|
61
|
+
var _super5 = _createSuper(AMSVaulting);
|
62
|
+
function AMSVaulting(options) {
|
63
|
+
_classCallCheck(this, AMSVaulting);
|
64
|
+
return _super5.call(this, options);
|
65
|
+
}
|
66
|
+
return _createClass(AMSVaulting);
|
67
|
+
}(AMSCheckout);
|
41
68
|
export default AMSCheckout;
|
@@ -90,7 +90,8 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
90
90
|
instanceId: instanceId,
|
91
91
|
analyticsEnabled: (analytics === null || analytics === void 0 ? void 0 : analytics.enabled) === false ? 'false' : 'true',
|
92
92
|
sdkVersion: sdkVersion,
|
93
|
-
refUrl: window.location.href
|
93
|
+
refUrl: window.location.href,
|
94
|
+
_componentStartTime: "".concat(Date.now())
|
94
95
|
});
|
95
96
|
if (LOCAL_MOCK) urlParams.LOCAL_MOCK = LOCAL_MOCK;
|
96
97
|
if (requestHost) urlParams.requestHost = requestHost;
|
@@ -17,6 +17,7 @@ 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
23
|
private _appLocationSearch;
|
@@ -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
|
@@ -17,7 +17,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
18
18
|
import { marmotMap } from "../../config/index";
|
19
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";
|
20
|
-
import { queryPaymentInfo } from "../../service";
|
20
|
+
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
21
21
|
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
|
22
22
|
import { getType, isJsonString, isPC } from "../../util";
|
23
23
|
import { isLocalMock } from "../../util/mock";
|
@@ -43,6 +43,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
43
43
|
_defineProperty(this, "_appVersion", void 0);
|
44
44
|
_defineProperty(this, "_isRetention", void 0);
|
45
45
|
_defineProperty(this, "_actionQueryPromise", null);
|
46
|
+
_defineProperty(this, "_actionSubmitPromise", null);
|
46
47
|
_defineProperty(this, "_renderParams", null);
|
47
48
|
_defineProperty(this, "_componentSign", componentSignEnum.NONE);
|
48
49
|
_defineProperty(this, "_appLocationSearch", void 0);
|
@@ -257,7 +258,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
257
258
|
this.renderPopupLoading(renderParams);
|
258
259
|
}
|
259
260
|
this.createApp(renderParams);
|
260
|
-
return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
|
261
|
+
return Promise.all([this.createActionQueryPromise(), this.createSubmitPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
|
261
262
|
_this3.AMSSDK.logger.logInfo({
|
262
263
|
title: 'sdk_event_successfully_created_app_process'
|
263
264
|
}).send();
|
@@ -324,7 +325,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
324
325
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
325
326
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
326
327
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
|
327
|
-
var envInfo, params,
|
328
|
+
var envInfo, params, _this5$_renderParams5, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams6, _action$web, _action$wap, action, signType;
|
328
329
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
329
330
|
while (1) switch (_context2.prev = _context2.next) {
|
330
331
|
case 0:
|
@@ -337,79 +338,75 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
337
338
|
notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
|
338
339
|
};
|
339
340
|
/**
|
340
|
-
* @description
|
341
|
+
* @description Simulated or unnecessary scenarios
|
341
342
|
*/
|
342
|
-
if (
|
343
|
-
|
344
|
-
}
|
345
|
-
securityConfig = (_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 || (_this5$_renderParams4 = _this5$_renderParams4.paymentSessionMetaData) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.securityConfig;
|
346
|
-
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign && securityConfig)) {
|
347
|
-
_context2.next = 11;
|
343
|
+
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)) {
|
344
|
+
_context2.next = 4;
|
348
345
|
break;
|
349
346
|
}
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
347
|
+
return _context2.abrupt("return", resolve({
|
348
|
+
message: 'sdk no need to make query request',
|
349
|
+
success: true
|
350
|
+
}));
|
351
|
+
case 4:
|
352
|
+
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
353
|
+
_context2.next = 9;
|
354
354
|
break;
|
355
355
|
}
|
356
|
-
|
356
|
+
params.paymentMethodType = 'CARD';
|
357
|
+
_context2.next = 8;
|
357
358
|
return _this5.getDeviceIdAndLog();
|
358
|
-
case
|
359
|
+
case 8:
|
359
360
|
envInfo.deviceId = _context2.sent;
|
360
|
-
case
|
361
|
+
case 9:
|
361
362
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
362
|
-
_context2.next =
|
363
|
+
_context2.next = 17;
|
363
364
|
break;
|
364
365
|
}
|
365
366
|
_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;
|
366
|
-
_ref4 = ((_this5$
|
367
|
+
_ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.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;
|
367
368
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
368
|
-
_context2.next =
|
369
|
+
_context2.next = 14;
|
369
370
|
break;
|
370
371
|
}
|
371
372
|
return _context2.abrupt("return", resolve({
|
372
373
|
message: 'sdk no need to make query request',
|
373
374
|
success: true
|
374
375
|
}));
|
375
|
-
case
|
376
|
-
_context2.next =
|
376
|
+
case 14:
|
377
|
+
_context2.next = 16;
|
377
378
|
return _this5.getDeviceIdAndLog();
|
378
|
-
case
|
379
|
+
case 16:
|
379
380
|
envInfo.deviceId = _context2.sent;
|
380
|
-
case
|
381
|
+
case 17:
|
381
382
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
382
|
-
_context2.next =
|
383
|
+
_context2.next = 27;
|
383
384
|
break;
|
384
385
|
}
|
385
|
-
action = ((_this5$
|
386
|
+
action = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 || (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.action) || {};
|
386
387
|
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;
|
387
388
|
if (!(signType === 'SMS')) {
|
388
|
-
_context2.next =
|
389
|
+
_context2.next = 22;
|
389
390
|
break;
|
390
391
|
}
|
391
392
|
return _context2.abrupt("return", resolve({
|
392
393
|
message: 'sdk no need to make query request',
|
393
394
|
success: true
|
394
395
|
}));
|
395
|
-
case
|
396
|
+
case 22:
|
396
397
|
if (!(!signType || signType !== 'REDIRECT')) {
|
397
|
-
_context2.next =
|
398
|
+
_context2.next = 24;
|
398
399
|
break;
|
399
400
|
}
|
400
401
|
return _context2.abrupt("return", resolve({
|
401
402
|
success: false
|
402
403
|
}));
|
404
|
+
case 24:
|
405
|
+
_context2.next = 26;
|
406
|
+
return _this5.getDeviceIdAndLog();
|
403
407
|
case 26:
|
404
|
-
|
405
|
-
|
406
|
-
break;
|
407
|
-
}
|
408
|
-
return _context2.abrupt("return", resolve({
|
409
|
-
message: 'sdk no need to make query request',
|
410
|
-
success: true
|
411
|
-
}));
|
412
|
-
case 28:
|
408
|
+
envInfo.deviceId = _context2.sent;
|
409
|
+
case 27:
|
413
410
|
queryPaymentInfo(params, {
|
414
411
|
env: _this5.AMSSDK.options.env.environment,
|
415
412
|
envInfo: envInfo
|
@@ -434,7 +431,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
434
431
|
});
|
435
432
|
reject(err);
|
436
433
|
});
|
437
|
-
case
|
434
|
+
case 28:
|
438
435
|
case "end":
|
439
436
|
return _context2.stop();
|
440
437
|
}
|
@@ -446,6 +443,66 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
446
443
|
}());
|
447
444
|
return this._actionQueryPromise;
|
448
445
|
}
|
446
|
+
}, {
|
447
|
+
key: "createSubmitPromise",
|
448
|
+
value: function createSubmitPromise() {
|
449
|
+
var _this$_renderParams3,
|
450
|
+
_this$_renderParams4,
|
451
|
+
_this6 = this;
|
452
|
+
this._performanceData.push({
|
453
|
+
key: 'sdk_submit_start',
|
454
|
+
value: Date.now()
|
455
|
+
});
|
456
|
+
var params = {
|
457
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData) || '',
|
458
|
+
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
|
459
|
+
};
|
460
|
+
|
461
|
+
// eslint-disable-next-line no-async-promise-executor
|
462
|
+
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
463
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
464
|
+
var _this6$_renderParams;
|
465
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
466
|
+
while (1) switch (_context3.prev = _context3.next) {
|
467
|
+
case 0:
|
468
|
+
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)) {
|
469
|
+
_context3.next = 2;
|
470
|
+
break;
|
471
|
+
}
|
472
|
+
return _context3.abrupt("return", resolve({
|
473
|
+
message: 'sdk no need to make submitPay request',
|
474
|
+
success: true
|
475
|
+
}));
|
476
|
+
case 2:
|
477
|
+
submitPayInfo(params, {
|
478
|
+
env: _this6.AMSSDK.options.env.environment,
|
479
|
+
timeout: 15000
|
480
|
+
}, _this6.AMSSDK.logger).then(function (res) {
|
481
|
+
_this6._performanceData.push({
|
482
|
+
key: 'sdk_submit_end',
|
483
|
+
value: Date.now()
|
484
|
+
});
|
485
|
+
if (res !== null && res !== void 0 && res.success) {
|
486
|
+
resolve(res);
|
487
|
+
} else {
|
488
|
+
resolve(res);
|
489
|
+
}
|
490
|
+
}).catch(function () {
|
491
|
+
return resolve({
|
492
|
+
success: false
|
493
|
+
});
|
494
|
+
});
|
495
|
+
case 3:
|
496
|
+
case "end":
|
497
|
+
return _context3.stop();
|
498
|
+
}
|
499
|
+
}, _callee3);
|
500
|
+
}));
|
501
|
+
return function (_x3) {
|
502
|
+
return _ref5.apply(this, arguments);
|
503
|
+
};
|
504
|
+
}());
|
505
|
+
}
|
449
506
|
}, {
|
450
507
|
key: "cleanElement",
|
451
508
|
value: function cleanElement() {
|
@@ -562,9 +619,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
562
619
|
}, {
|
563
620
|
key: "createPopupWindow",
|
564
621
|
value: function createPopupWindow(data) {
|
565
|
-
var _this$
|
622
|
+
var _this$_renderParams5;
|
566
623
|
this._threedData = data;
|
567
|
-
var sessionData = encodeURIComponent((_this$
|
624
|
+
var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
|
568
625
|
var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
|
569
626
|
this.popupWindow = createModal({
|
570
627
|
device: this.platform,
|
@@ -574,19 +631,19 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
574
631
|
}, {
|
575
632
|
key: "getDeviceIdAndCallback",
|
576
633
|
value: function () {
|
577
|
-
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
634
|
+
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(eventContext) {
|
578
635
|
var deviceId;
|
579
|
-
return _regeneratorRuntime().wrap(function
|
580
|
-
while (1) switch (
|
636
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
637
|
+
while (1) switch (_context4.prev = _context4.next) {
|
581
638
|
case 0:
|
582
639
|
if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
|
583
|
-
|
640
|
+
_context4.next = 5;
|
584
641
|
break;
|
585
642
|
}
|
586
|
-
|
643
|
+
_context4.next = 3;
|
587
644
|
return this.getDeviceIdAndLog(eventContext === null || eventContext === void 0 ? void 0 : eventContext.data, true);
|
588
645
|
case 3:
|
589
|
-
deviceId =
|
646
|
+
deviceId = _context4.sent;
|
590
647
|
this.dispatchToApp({
|
591
648
|
context: {
|
592
649
|
event: 'appEventCallback',
|
@@ -598,11 +655,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
598
655
|
});
|
599
656
|
case 5:
|
600
657
|
case "end":
|
601
|
-
return
|
658
|
+
return _context4.stop();
|
602
659
|
}
|
603
|
-
},
|
660
|
+
}, _callee4, this);
|
604
661
|
}));
|
605
|
-
function getDeviceIdAndCallback(
|
662
|
+
function getDeviceIdAndCallback(_x4) {
|
606
663
|
return _getDeviceIdAndCallback.apply(this, arguments);
|
607
664
|
}
|
608
665
|
return getDeviceIdAndCallback;
|
@@ -767,7 +824,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
767
824
|
}, {
|
768
825
|
key: "handleRedirect",
|
769
826
|
value: function handleRedirect(data) {
|
770
|
-
var
|
827
|
+
var _this7 = this;
|
771
828
|
var _data = typeof data === 'string' ? {
|
772
829
|
normalUrl: data
|
773
830
|
} : {
|
@@ -782,11 +839,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
782
839
|
redirectInfo: JSON.stringify(_data)
|
783
840
|
}).send();
|
784
841
|
var successCallback = function successCallback(type, url) {
|
785
|
-
|
842
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
786
843
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
787
844
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
788
845
|
});
|
789
|
-
|
846
|
+
_this7.AMSSDK.logger.logInfo({
|
790
847
|
title: 'sdk_event_call_url_success'
|
791
848
|
}, {
|
792
849
|
redirectInfo: JSON.stringify(_data),
|
@@ -795,11 +852,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
795
852
|
}).send();
|
796
853
|
};
|
797
854
|
var failCallback = function failCallback(type, url) {
|
798
|
-
|
855
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
799
856
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
800
857
|
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)
|
801
858
|
});
|
802
|
-
|
859
|
+
_this7.AMSSDK.logger.logInfo({
|
803
860
|
title: 'sdk_error_call_url_failed'
|
804
861
|
}, {
|
805
862
|
redirectInfo: JSON.stringify(_data),
|
@@ -822,14 +879,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
822
879
|
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
823
880
|
}).catch(function () {
|
824
881
|
failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
825
|
-
return
|
882
|
+
return _this7.AMSSDK._redirect({
|
826
883
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
827
884
|
});
|
828
885
|
}).then(function () {
|
829
886
|
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
830
887
|
}).catch(function () {
|
831
888
|
failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
832
|
-
return
|
889
|
+
return _this7.AMSSDK._redirect({
|
833
890
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
834
891
|
});
|
835
892
|
}).then(function () {
|
@@ -840,9 +897,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
840
897
|
}
|
841
898
|
}, {
|
842
899
|
key: "handleDeclareInfo",
|
843
|
-
value: function handleDeclareInfo(
|
844
|
-
var
|
845
|
-
closeDialogData =
|
900
|
+
value: function handleDeclareInfo(_ref6) {
|
901
|
+
var _ref6$closeDialogData = _ref6.closeDialogData,
|
902
|
+
closeDialogData = _ref6$closeDialogData === void 0 ? {} : _ref6$closeDialogData;
|
846
903
|
_handleDeclareInfo({
|
847
904
|
closeDialogData: closeDialogData
|
848
905
|
});
|
@@ -916,22 +973,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
916
973
|
}, {
|
917
974
|
key: "sendRenderEvent",
|
918
975
|
value: function () {
|
919
|
-
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
920
|
-
var _this$
|
921
|
-
return _regeneratorRuntime().wrap(function
|
922
|
-
while (1) switch (
|
976
|
+
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
977
|
+
var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
|
978
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
979
|
+
while (1) switch (_context5.prev = _context5.next) {
|
923
980
|
case 0:
|
924
|
-
|
925
|
-
if (this._actionQueryPromise) {
|
926
|
-
|
981
|
+
_context5.prev = 0;
|
982
|
+
if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
|
983
|
+
_context5.next = 3;
|
927
984
|
break;
|
928
985
|
}
|
929
|
-
return
|
986
|
+
return _context5.abrupt("return");
|
930
987
|
case 3:
|
931
|
-
|
988
|
+
_context5.next = 5;
|
932
989
|
return this._actionQueryPromise;
|
933
990
|
case 5:
|
934
|
-
res =
|
991
|
+
res = _context5.sent;
|
992
|
+
_context5.next = 8;
|
993
|
+
return this._actionSubmitPromise;
|
994
|
+
case 8:
|
995
|
+
submitRes = _context5.sent;
|
935
996
|
this._performanceData.push({
|
936
997
|
key: 'sdk_render_component',
|
937
998
|
value: Date.now()
|
@@ -941,12 +1002,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
941
1002
|
event: 'renderComponent',
|
942
1003
|
data: {
|
943
1004
|
queryResult: res,
|
944
|
-
|
945
|
-
|
1005
|
+
submitResult: submitRes,
|
1006
|
+
sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
|
1007
|
+
paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
|
946
1008
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
947
|
-
renderDisplayType: (_this$
|
948
|
-
appearance: (_this$
|
949
|
-
notRedirectAfterComplete: ((_this$
|
1009
|
+
renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
|
1010
|
+
appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
|
1011
|
+
notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
|
950
1012
|
envInfo: {
|
951
1013
|
screenHeight: screen.height,
|
952
1014
|
screenWidth: screen.width
|
@@ -963,16 +1025,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
963
1025
|
}
|
964
1026
|
});
|
965
1027
|
// eslint-disable-next-line no-empty
|
966
|
-
|
1028
|
+
_context5.next = 16;
|
967
1029
|
break;
|
968
|
-
case
|
969
|
-
|
970
|
-
|
971
|
-
case
|
1030
|
+
case 14:
|
1031
|
+
_context5.prev = 14;
|
1032
|
+
_context5.t0 = _context5["catch"](0);
|
1033
|
+
case 16:
|
972
1034
|
case "end":
|
973
|
-
return
|
1035
|
+
return _context5.stop();
|
974
1036
|
}
|
975
|
-
},
|
1037
|
+
}, _callee5, this, [[0, 14]]);
|
976
1038
|
}));
|
977
1039
|
function sendRenderEvent() {
|
978
1040
|
return _sendRenderEvent.apply(this, arguments);
|
@@ -986,7 +1048,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
986
1048
|
key: "cleanContainer",
|
987
1049
|
value: function cleanContainer() {
|
988
1050
|
var _document$getElementB4,
|
989
|
-
|
1051
|
+
_this8 = this;
|
990
1052
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
991
1053
|
this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
|
992
1054
|
this._performanceData = [];
|
@@ -998,7 +1060,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
998
1060
|
mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
|
999
1061
|
if (immediately) this.cleanElement();else {
|
1000
1062
|
setTimeout(function () {
|
1001
|
-
|
1063
|
+
_this8.cleanElement();
|
1002
1064
|
}, 300);
|
1003
1065
|
}
|
1004
1066
|
}
|
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
@@ -19,8 +19,8 @@ import axios from 'axios';
|
|
19
19
|
import { sdkVersion } from "../config/index";
|
20
20
|
import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
|
21
21
|
import { errorEnum } from "../types";
|
22
|
-
import { device, isPC, queryParse, safeJson } from "../util";
|
23
22
|
import { get } from "../util/get";
|
23
|
+
import { device, isPC, queryParse, safeJson } from "../util";
|
24
24
|
import { fomatGetwayError } from "./utils";
|
25
25
|
var _queryParse = queryParse(),
|
26
26
|
_sandbox = _queryParse._sandbox;
|
package/esm/service/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult,
|
1
|
+
import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
|
2
2
|
import { Logger } from '../util/logger';
|
3
|
-
export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options:
|
4
|
-
export declare function antomConfig(options:
|
3
|
+
export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
|
4
|
+
export declare function antomConfig(options: RequestConfig, logger: Logger): Promise<any>;
|
5
|
+
export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
|
package/esm/service/index.js
CHANGED
@@ -74,4 +74,27 @@ function _antomConfig() {
|
|
74
74
|
}, _callee2, null, [[0, 11]]);
|
75
75
|
}));
|
76
76
|
return _antomConfig.apply(this, arguments);
|
77
|
+
}
|
78
|
+
export function submitPayInfo(_x6, _x7, _x8) {
|
79
|
+
return _submitPayInfo.apply(this, arguments);
|
80
|
+
}
|
81
|
+
function _submitPayInfo() {
|
82
|
+
_submitPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params, options, logger) {
|
83
|
+
var hostSign;
|
84
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
85
|
+
while (1) switch (_context3.prev = _context3.next) {
|
86
|
+
case 0:
|
87
|
+
hostSign = ((params === null || params === void 0 ? void 0 : params.paymentSessionData) || '').split('&&')[1] || '';
|
88
|
+
return _context3.abrupt("return", request(params, _objectSpread(_objectSpread({}, options), {}, {
|
89
|
+
hostSign: hostSign,
|
90
|
+
needEnvInfo: true,
|
91
|
+
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
92
|
+
}), logger));
|
93
|
+
case 2:
|
94
|
+
case "end":
|
95
|
+
return _context3.stop();
|
96
|
+
}
|
97
|
+
}, _callee3);
|
98
|
+
}));
|
99
|
+
return _submitPayInfo.apply(this, arguments);
|
77
100
|
}
|