@alipay/ams-checkout 0.0.1698890614-dev.1 → 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/plugin/component/index.d.ts +2 -0
- package/esm/plugin/component/index.js +148 -77
- 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/package.json +1 -1
@@ -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, SecuritySceneEnum, targetEnum } from "../../types";
|
22
22
|
import { getType, isJsonString, isPC } from "../../util";
|
23
23
|
import { isLocalMock } from "../../util/mock";
|
@@ -44,6 +44,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
44
44
|
_defineProperty(this, "_appVersion", void 0);
|
45
45
|
_defineProperty(this, "_isRetention", void 0);
|
46
46
|
_defineProperty(this, "_actionQueryPromise", null);
|
47
|
+
_defineProperty(this, "_actionSubmitPromise", null);
|
47
48
|
_defineProperty(this, "_renderParams", null);
|
48
49
|
_defineProperty(this, "_componentSign", componentSignEnum.NONE);
|
49
50
|
_defineProperty(this, "_appLocationSearch", void 0);
|
@@ -118,7 +119,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
118
119
|
value: function initAPSecurity() {
|
119
120
|
var _this$_renderParams2,
|
120
121
|
_this = this;
|
121
|
-
if (componentSignEnum.CASHIER_PAYMENT_CARD
|
122
|
+
if (![componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.EASY_PAY_WALLET].includes(this._componentSign)) {
|
122
123
|
return;
|
123
124
|
}
|
124
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;
|
@@ -170,7 +171,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
170
171
|
}
|
171
172
|
}, {
|
172
173
|
key: "getDeviceIdAndLog",
|
173
|
-
value: function getDeviceIdAndLog() {
|
174
|
+
value: function getDeviceIdAndLog(scene) {
|
174
175
|
var _this2 = this;
|
175
176
|
return new Promise(function (resolve) {
|
176
177
|
// To avoid rendering being blocked, move the logic to the next event loop for processing
|
@@ -183,7 +184,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
183
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;
|
184
185
|
getDeviceIdStartTime = Date.now();
|
185
186
|
_context.next = 4;
|
186
|
-
return getApdidToken(getAppname(SecuritySceneEnum.CARD), securityConfig);
|
187
|
+
return getApdidToken(getAppname(scene || SecuritySceneEnum.CARD), securityConfig);
|
187
188
|
case 4:
|
188
189
|
deviceId = _context.sent;
|
189
190
|
_this2.logDeviceId(deviceId, getDeviceIdStartTime);
|
@@ -235,7 +236,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
235
236
|
this.renderPopupLoading(renderParams);
|
236
237
|
}
|
237
238
|
this.createApp(renderParams);
|
238
|
-
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 () {
|
239
240
|
_this3.AMSSDK.logger.logInfo({
|
240
241
|
title: 'sdk_event_successfully_created_app_process'
|
241
242
|
}).send();
|
@@ -301,8 +302,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
301
302
|
// eslint-disable-next-line no-async-promise-executor
|
302
303
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
303
304
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
304
|
-
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
|
305
|
-
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;
|
306
307
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
307
308
|
while (1) switch (_context2.prev = _context2.next) {
|
308
309
|
case 0:
|
@@ -314,73 +315,76 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
314
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,
|
315
316
|
notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
|
316
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:
|
317
330
|
/**
|
318
331
|
* @description card
|
319
332
|
*/
|
320
333
|
if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign) {
|
321
334
|
params.paymentMethodType = 'CARD';
|
322
335
|
}
|
323
|
-
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;
|
324
337
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign && securityConfig)) {
|
325
|
-
_context2.next =
|
338
|
+
_context2.next = 13;
|
326
339
|
break;
|
327
340
|
}
|
328
|
-
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) || '{}';
|
329
342
|
info = JSON.parse(extendInfo);
|
330
343
|
if (!((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false')) {
|
331
|
-
_context2.next =
|
344
|
+
_context2.next = 13;
|
332
345
|
break;
|
333
346
|
}
|
334
|
-
_context2.next =
|
347
|
+
_context2.next = 12;
|
335
348
|
return _this5.getDeviceIdAndLog();
|
336
|
-
case
|
349
|
+
case 12:
|
337
350
|
envInfo.deviceId = _context2.sent;
|
338
|
-
case
|
351
|
+
case 13:
|
339
352
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
340
|
-
_context2.next =
|
353
|
+
_context2.next = 18;
|
341
354
|
break;
|
342
355
|
}
|
343
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;
|
344
|
-
_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;
|
345
358
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
346
|
-
_context2.next =
|
359
|
+
_context2.next = 18;
|
347
360
|
break;
|
348
361
|
}
|
349
362
|
return _context2.abrupt("return", resolve({
|
350
363
|
message: 'sdk no need to make query request',
|
351
364
|
success: true
|
352
365
|
}));
|
353
|
-
case
|
366
|
+
case 18:
|
354
367
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
355
|
-
_context2.next =
|
368
|
+
_context2.next = 25;
|
356
369
|
break;
|
357
370
|
}
|
358
|
-
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) || {};
|
359
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;
|
360
373
|
if (!(signType === 'SMS')) {
|
361
|
-
_context2.next =
|
374
|
+
_context2.next = 23;
|
362
375
|
break;
|
363
376
|
}
|
364
377
|
return _context2.abrupt("return", resolve({
|
365
378
|
message: 'sdk no need to make query request',
|
366
379
|
success: true
|
367
380
|
}));
|
368
|
-
case 21:
|
369
|
-
if (!(!signType || signType !== 'REDIRECT')) {
|
370
|
-
_context2.next = 23;
|
371
|
-
break;
|
372
|
-
}
|
373
|
-
return _context2.abrupt("return", resolve({
|
374
|
-
success: false
|
375
|
-
}));
|
376
381
|
case 23:
|
377
|
-
if (!
|
382
|
+
if (!(!signType || signType !== 'REDIRECT')) {
|
378
383
|
_context2.next = 25;
|
379
384
|
break;
|
380
385
|
}
|
381
386
|
return _context2.abrupt("return", resolve({
|
382
|
-
|
383
|
-
success: true
|
387
|
+
success: false
|
384
388
|
}));
|
385
389
|
case 25:
|
386
390
|
queryPaymentInfo(params, {
|
@@ -419,6 +423,68 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
419
423
|
}());
|
420
424
|
return this._actionQueryPromise;
|
421
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
|
+
}
|
422
488
|
}, {
|
423
489
|
key: "cleanElement",
|
424
490
|
value: function cleanElement() {
|
@@ -535,9 +601,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
535
601
|
}, {
|
536
602
|
key: "createPopupWindow",
|
537
603
|
value: function createPopupWindow(data) {
|
538
|
-
var _this$
|
604
|
+
var _this$_renderParams5;
|
539
605
|
this._threedData = data;
|
540
|
-
var sessionData = encodeURIComponent((_this$
|
606
|
+
var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
|
541
607
|
var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
|
542
608
|
this.popupWindow = createModal({
|
543
609
|
device: this.platform,
|
@@ -547,19 +613,19 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
547
613
|
}, {
|
548
614
|
key: "getDeviceIdAndCallback",
|
549
615
|
value: function () {
|
550
|
-
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
616
|
+
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(eventContext) {
|
551
617
|
var deviceId;
|
552
|
-
return _regeneratorRuntime().wrap(function
|
553
|
-
while (1) switch (
|
618
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
619
|
+
while (1) switch (_context4.prev = _context4.next) {
|
554
620
|
case 0:
|
555
621
|
if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
|
556
|
-
|
622
|
+
_context4.next = 5;
|
557
623
|
break;
|
558
624
|
}
|
559
|
-
|
625
|
+
_context4.next = 3;
|
560
626
|
return this.getDeviceIdAndLog();
|
561
627
|
case 3:
|
562
|
-
deviceId =
|
628
|
+
deviceId = _context4.sent;
|
563
629
|
this.dispatchToApp({
|
564
630
|
context: {
|
565
631
|
event: 'appEventCallback',
|
@@ -571,11 +637,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
571
637
|
});
|
572
638
|
case 5:
|
573
639
|
case "end":
|
574
|
-
return
|
640
|
+
return _context4.stop();
|
575
641
|
}
|
576
|
-
},
|
642
|
+
}, _callee4, this);
|
577
643
|
}));
|
578
|
-
function getDeviceIdAndCallback(
|
644
|
+
function getDeviceIdAndCallback(_x4) {
|
579
645
|
return _getDeviceIdAndCallback.apply(this, arguments);
|
580
646
|
}
|
581
647
|
return getDeviceIdAndCallback;
|
@@ -740,7 +806,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
740
806
|
}, {
|
741
807
|
key: "handleRedirect",
|
742
808
|
value: function handleRedirect(data) {
|
743
|
-
var
|
809
|
+
var _this7 = this;
|
744
810
|
var _data = typeof data === 'string' ? {
|
745
811
|
normalUrl: data
|
746
812
|
} : {
|
@@ -755,11 +821,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
755
821
|
redirectInfo: JSON.stringify(_data)
|
756
822
|
}).send();
|
757
823
|
var successCallback = function successCallback(type, url) {
|
758
|
-
|
824
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
759
825
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
760
826
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
761
827
|
});
|
762
|
-
|
828
|
+
_this7.AMSSDK.logger.logInfo({
|
763
829
|
title: 'sdk_event_call_url_success'
|
764
830
|
}, {
|
765
831
|
redirectInfo: JSON.stringify(_data),
|
@@ -768,11 +834,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
768
834
|
}).send();
|
769
835
|
};
|
770
836
|
var failCallback = function failCallback(type, url) {
|
771
|
-
|
837
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
772
838
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
773
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)
|
774
840
|
});
|
775
|
-
|
841
|
+
_this7.AMSSDK.logger.logInfo({
|
776
842
|
title: 'sdk_error_call_url_failed'
|
777
843
|
}, {
|
778
844
|
redirectInfo: JSON.stringify(_data),
|
@@ -795,14 +861,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
795
861
|
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
796
862
|
}).catch(function () {
|
797
863
|
failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
798
|
-
return
|
864
|
+
return _this7.AMSSDK._redirect({
|
799
865
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
800
866
|
});
|
801
867
|
}).then(function () {
|
802
868
|
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
803
869
|
}).catch(function () {
|
804
870
|
failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
805
|
-
return
|
871
|
+
return _this7.AMSSDK._redirect({
|
806
872
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
807
873
|
});
|
808
874
|
}).then(function () {
|
@@ -813,9 +879,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
813
879
|
}
|
814
880
|
}, {
|
815
881
|
key: "handleDeclareInfo",
|
816
|
-
value: function handleDeclareInfo(
|
817
|
-
var
|
818
|
-
closeDialogData =
|
882
|
+
value: function handleDeclareInfo(_ref6) {
|
883
|
+
var _ref6$closeDialogData = _ref6.closeDialogData,
|
884
|
+
closeDialogData = _ref6$closeDialogData === void 0 ? {} : _ref6$closeDialogData;
|
819
885
|
_handleDeclareInfo({
|
820
886
|
closeDialogData: closeDialogData
|
821
887
|
});
|
@@ -889,22 +955,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
889
955
|
}, {
|
890
956
|
key: "sendRenderEvent",
|
891
957
|
value: function () {
|
892
|
-
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
893
|
-
var _this$
|
894
|
-
return _regeneratorRuntime().wrap(function
|
895
|
-
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) {
|
896
962
|
case 0:
|
897
|
-
|
898
|
-
if (this._actionQueryPromise) {
|
899
|
-
|
963
|
+
_context5.prev = 0;
|
964
|
+
if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
|
965
|
+
_context5.next = 3;
|
900
966
|
break;
|
901
967
|
}
|
902
|
-
return
|
968
|
+
return _context5.abrupt("return");
|
903
969
|
case 3:
|
904
|
-
|
970
|
+
_context5.next = 5;
|
905
971
|
return this._actionQueryPromise;
|
906
972
|
case 5:
|
907
|
-
res =
|
973
|
+
res = _context5.sent;
|
974
|
+
_context5.next = 8;
|
975
|
+
return this._actionSubmitPromise;
|
976
|
+
case 8:
|
977
|
+
submitRes = _context5.sent;
|
908
978
|
this._performanceData.push({
|
909
979
|
key: 'sdk_render_component',
|
910
980
|
value: Date.now()
|
@@ -914,12 +984,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
914
984
|
event: 'renderComponent',
|
915
985
|
data: {
|
916
986
|
queryResult: res,
|
917
|
-
|
918
|
-
|
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,
|
919
990
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
920
|
-
renderDisplayType: (_this$
|
921
|
-
appearance: (_this$
|
922
|
-
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,
|
923
994
|
envInfo: {
|
924
995
|
screenHeight: screen.height,
|
925
996
|
screenWidth: screen.width
|
@@ -936,16 +1007,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
936
1007
|
}
|
937
1008
|
});
|
938
1009
|
// eslint-disable-next-line no-empty
|
939
|
-
|
1010
|
+
_context5.next = 16;
|
940
1011
|
break;
|
941
|
-
case
|
942
|
-
|
943
|
-
|
944
|
-
case
|
1012
|
+
case 14:
|
1013
|
+
_context5.prev = 14;
|
1014
|
+
_context5.t0 = _context5["catch"](0);
|
1015
|
+
case 16:
|
945
1016
|
case "end":
|
946
|
-
return
|
1017
|
+
return _context5.stop();
|
947
1018
|
}
|
948
|
-
},
|
1019
|
+
}, _callee5, this, [[0, 14]]);
|
949
1020
|
}));
|
950
1021
|
function sendRenderEvent() {
|
951
1022
|
return _sendRenderEvent.apply(this, arguments);
|
@@ -959,7 +1030,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
959
1030
|
key: "cleanContainer",
|
960
1031
|
value: function cleanContainer() {
|
961
1032
|
var _document$getElementB4,
|
962
|
-
|
1033
|
+
_this8 = this;
|
963
1034
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
964
1035
|
this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
|
965
1036
|
this._performanceData = [];
|
@@ -971,7 +1042,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
971
1042
|
mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
|
972
1043
|
if (immediately) this.cleanElement();else {
|
973
1044
|
setTimeout(function () {
|
974
|
-
|
1045
|
+
_this8.cleanElement();
|
975
1046
|
}, 300);
|
976
1047
|
}
|
977
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>;
|
package/esm/service/index.js
CHANGED
@@ -14,7 +14,6 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
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
|
-
|
18
17
|
import { request } from "../request";
|
19
18
|
export function queryPaymentInfo(_x, _x2, _x3) {
|
20
19
|
return _queryPaymentInfo.apply(this, arguments);
|
@@ -38,4 +37,27 @@ function _queryPaymentInfo() {
|
|
38
37
|
}, _callee);
|
39
38
|
}));
|
40
39
|
return _queryPaymentInfo.apply(this, arguments);
|
40
|
+
}
|
41
|
+
export function submitPayInfo(_x4, _x5, _x6) {
|
42
|
+
return _submitPayInfo.apply(this, arguments);
|
43
|
+
}
|
44
|
+
function _submitPayInfo() {
|
45
|
+
_submitPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, options, logger) {
|
46
|
+
var hostSign;
|
47
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
48
|
+
while (1) switch (_context2.prev = _context2.next) {
|
49
|
+
case 0:
|
50
|
+
hostSign = ((params === null || params === void 0 ? void 0 : params.paymentSessionData) || '').split('&&')[1] || '';
|
51
|
+
return _context2.abrupt("return", request(params, _objectSpread(_objectSpread({}, options), {}, {
|
52
|
+
hostSign: hostSign,
|
53
|
+
needEnvInfo: true,
|
54
|
+
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
55
|
+
}), logger));
|
56
|
+
case 2:
|
57
|
+
case "end":
|
58
|
+
return _context2.stop();
|
59
|
+
}
|
60
|
+
}, _callee2);
|
61
|
+
}));
|
62
|
+
return _submitPayInfo.apply(this, arguments);
|
41
63
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -104,6 +104,7 @@ export interface IpaymentSessionMetaData {
|
|
104
104
|
paymentMethodInfoView?: any;
|
105
105
|
action?: {
|
106
106
|
autoDebitWithToken: boolean;
|
107
|
+
skipSdkQuery: boolean;
|
107
108
|
};
|
108
109
|
}
|
109
110
|
export declare enum localeEnum {
|
@@ -239,7 +240,7 @@ export declare enum errorEnum {
|
|
239
240
|
SIGNIN = "SIGNIN",
|
240
241
|
GETSIGNPARAMSERROR = "GETSIGNPARAMSERROR"
|
241
242
|
}
|
242
|
-
export interface
|
243
|
+
export interface RequestConfig {
|
243
244
|
env?: string;
|
244
245
|
baseURL?: string;
|
245
246
|
timeout?: number;
|
@@ -251,8 +252,11 @@ export interface IrequestConfig {
|
|
251
252
|
beforerRequest?: () => void;
|
252
253
|
afterRequest?: () => void;
|
253
254
|
needEnvInfo?: boolean;
|
254
|
-
locale?: string;
|
255
255
|
hostSign?: string;
|
256
|
+
appId?: string;
|
257
|
+
sandbox?: boolean;
|
258
|
+
deviceId?: string;
|
259
|
+
locale?: string;
|
256
260
|
envInfo?: Record<string, any>;
|
257
261
|
}
|
258
262
|
export interface CashierSdkActionQueryRequest {
|
@@ -262,6 +266,29 @@ export interface CashierSdkActionQueryRequest {
|
|
262
266
|
notRedirectAfterComplete?: boolean;
|
263
267
|
extParams?: any;
|
264
268
|
}
|
269
|
+
export interface CashierSubmitPayRequest {
|
270
|
+
/**
|
271
|
+
* @description payment method type
|
272
|
+
*/
|
273
|
+
paymentMethodType?: string;
|
274
|
+
/**
|
275
|
+
* @description payment factors
|
276
|
+
*/
|
277
|
+
paymentFactors?: Record<string, string>;
|
278
|
+
/**
|
279
|
+
* @description 需要验证的场景
|
280
|
+
*/
|
281
|
+
verifyFactors?: Record<string, string>;
|
282
|
+
paymentSessionData: string;
|
283
|
+
paymentSessionConfig?: any;
|
284
|
+
}
|
285
|
+
export interface CashierSubmitPayRequest {
|
286
|
+
paymentMethodType?: string;
|
287
|
+
paymentFactors?: Record<string, string>;
|
288
|
+
verifyFactors?: Record<string, string>;
|
289
|
+
paymentSessionData: string;
|
290
|
+
paymentSessionConfig?: any;
|
291
|
+
}
|
265
292
|
export interface CashierSdkActionQueryResult {
|
266
293
|
supportedLanguages?: any[];
|
267
294
|
amountConfirmRequired?: boolean;
|
@@ -279,6 +306,30 @@ export interface CashierSdkActionQueryResult {
|
|
279
306
|
schemeUrl?: string;
|
280
307
|
authUrl?: string;
|
281
308
|
}
|
309
|
+
export declare enum redirectTypeEnum {
|
310
|
+
UNSAFE_BROWSER = "UNSAFE_BROWSER",
|
311
|
+
SAFETY_BROWSER = "SAFETY_BROWSER",
|
312
|
+
INVOKE_SDK = "INVOKE_SDK"
|
313
|
+
}
|
314
|
+
export interface ActionForm {
|
315
|
+
parameters: any;
|
316
|
+
redirectUrl: any;
|
317
|
+
elementValue?: string;
|
318
|
+
redirectType?: redirectTypeEnum;
|
319
|
+
}
|
320
|
+
export interface CashierSubmitPayResult {
|
321
|
+
success: boolean;
|
322
|
+
resultCode?: string;
|
323
|
+
resultMessage?: string;
|
324
|
+
errorActions?: Record<string, string>;
|
325
|
+
errorCode?: string;
|
326
|
+
errorMessage?: string;
|
327
|
+
extendInfo?: Record<string, string>;
|
328
|
+
actionForm?: ActionForm;
|
329
|
+
normalUrl?: string;
|
330
|
+
errorStatus?: string;
|
331
|
+
message?: string;
|
332
|
+
}
|
282
333
|
export declare enum eventCodeEnum {
|
283
334
|
SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
|
284
335
|
SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
|
package/esm/types/index.js
CHANGED
@@ -124,6 +124,12 @@ export var errorEnum = /*#__PURE__*/function (errorEnum) {
|
|
124
124
|
errorEnum["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
|
125
125
|
return errorEnum;
|
126
126
|
}({});
|
127
|
+
export var redirectTypeEnum = /*#__PURE__*/function (redirectTypeEnum) {
|
128
|
+
redirectTypeEnum["UNSAFE_BROWSER"] = "UNSAFE_BROWSER";
|
129
|
+
redirectTypeEnum["SAFETY_BROWSER"] = "SAFETY_BROWSER";
|
130
|
+
redirectTypeEnum["INVOKE_SDK"] = "INVOKE_SDK";
|
131
|
+
return redirectTypeEnum;
|
132
|
+
}({}); // 拉SDK
|
127
133
|
export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
|
128
134
|
eventCodeEnum["SDK_START_OF_LOADING"] = "SDK_START_OF_LOADING";
|
129
135
|
eventCodeEnum["SDK_END_OF_LOADING"] = "SDK_END_OF_LOADING";
|