@alipay/ams-checkout 0.0.1709535659-dev.0 → 0.0.1709536306-dev.1
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/esm/config/request.js
CHANGED
@@ -12,8 +12,8 @@ var _queryParse = queryParse(),
|
|
12
12
|
groupId = _queryParse.groupId,
|
13
13
|
host = _queryParse.requestHost;
|
14
14
|
export var requestHost = {
|
15
|
-
local: 'http://imgs-
|
16
|
-
dev: host || 'http://imgs-
|
15
|
+
local: 'http://imgs-8452.sggz00b.dev.alipay.net/mgw.htm',
|
16
|
+
dev: host || 'http://imgs-8452.sggz00b.dev.alipay.net/mgw.htm',
|
17
17
|
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
18
18
|
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
19
19
|
prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -22,7 +22,7 @@ export var requestHost = {
|
|
22
22
|
export var clientId = '5J5Y8X4E2Y25GR00690';
|
23
23
|
export var tntInstId = 'ALIPW3SG';
|
24
24
|
export var appId = 'ANTOM_PAYMENT_WEB';
|
25
|
-
export var sofaId = groupId || '
|
25
|
+
export var sofaId = groupId || 'GROUP_20240304204929';
|
26
26
|
export var hostSignMap = function hostSignMap(hostSign, env) {
|
27
27
|
var map = {
|
28
28
|
SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -52,7 +52,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
52
52
|
this._storageId = _storageId;
|
53
53
|
|
54
54
|
// TODO Consumption data analysis control parameters
|
55
|
-
this.logger = new Logger(LogConfig, (options === null || options === void 0 ? void 0 : options.environment)
|
55
|
+
this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
56
56
|
this.logger.setMedta({
|
57
57
|
instanceId: this._instanceId
|
58
58
|
});
|
@@ -25,7 +25,6 @@ export default class ComponentApp {
|
|
25
25
|
private _renderDisplayType;
|
26
26
|
private _multipleCallbackEvents;
|
27
27
|
_merchantAppointParam: IMerchantAppointParam;
|
28
|
-
private _webAppHeartBeatTimeoutId;
|
29
28
|
private _webAppHeartBeatTimeoutFn;
|
30
29
|
constructor();
|
31
30
|
/**
|
@@ -98,7 +97,7 @@ export default class ComponentApp {
|
|
98
97
|
*/
|
99
98
|
dispatchToApp(payload: {
|
100
99
|
context: eventPayloadContext;
|
101
|
-
}, targetElement?: any): any;
|
100
|
+
}, targetElement?: any, sendLog?: boolean): any;
|
102
101
|
/**
|
103
102
|
* @description Subscribe to messages from SDK
|
104
103
|
*/
|
@@ -52,9 +52,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
52
52
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
53
53
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
54
54
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
55
|
-
_defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
|
56
55
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
57
|
-
this._appVersion = '1.
|
56
|
+
this._appVersion = '1.11.0.5';
|
58
57
|
this._isInitComponent = false;
|
59
58
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
60
59
|
this.createIframeNode = function () {
|
@@ -364,7 +363,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
364
363
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
365
364
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
366
365
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
|
367
|
-
var envInfo, params,
|
366
|
+
var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref4, _ref4$productSceneVer, productSceneVersion, _ref4$productScene, productScene, _ref5, _ref5$action, _ref5$action2, _ref5$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
|
368
367
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
369
368
|
while (1) switch (_context2.prev = _context2.next) {
|
370
369
|
case 0:
|
@@ -380,7 +379,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
380
379
|
/**
|
381
380
|
* @description Simulated or unnecessary scenarios
|
382
381
|
*/
|
383
|
-
|
382
|
+
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref3$extendInfo = _ref3.extendInfo, extendInfo = _ref3$extendInfo === void 0 ? '' : _ref3$extendInfo;
|
384
383
|
enableVaultingApiOptimize = false;
|
385
384
|
enableEasypayApiOptimize = false;
|
386
385
|
try {
|
@@ -427,8 +426,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
427
426
|
_context2.next = 26;
|
428
427
|
break;
|
429
428
|
}
|
430
|
-
|
431
|
-
|
429
|
+
_ref4 = params.paymentSessionConfig || {}, _ref4$productSceneVer = _ref4.productSceneVersion, productSceneVersion = _ref4$productSceneVer === void 0 ? '' : _ref4$productSceneVer, _ref4$productScene = _ref4.productScene, productScene = _ref4$productScene === void 0 ? '' : _ref4$productScene;
|
430
|
+
_ref5 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref5$action = _ref5.action, _ref5$action2 = _ref5$action === void 0 ? {} : _ref5$action, _ref5$action2$autoDeb = _ref5$action2.autoDebitWithToken, autoDebitWithToken = _ref5$action2$autoDeb === void 0 ? false : _ref5$action2$autoDeb;
|
432
431
|
if (!((_this5$_renderParams7 = _this5._renderParams) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.action) !== null && _this5$_renderParams7 !== void 0 && _this5$_renderParams7.skipSdkQuery && enableEasypayApiOptimize)) {
|
433
432
|
_context2.next = 21;
|
434
433
|
break;
|
@@ -542,7 +541,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
542
541
|
|
543
542
|
// eslint-disable-next-line no-async-promise-executor
|
544
543
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
545
|
-
var
|
544
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
546
545
|
var _this6$_renderParams;
|
547
546
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
548
547
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -605,7 +604,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
605
604
|
}, _callee3);
|
606
605
|
}));
|
607
606
|
return function (_x3) {
|
608
|
-
return
|
607
|
+
return _ref6.apply(this, arguments);
|
609
608
|
};
|
610
609
|
}());
|
611
610
|
}
|
@@ -1196,9 +1195,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1196
1195
|
}
|
1197
1196
|
}, {
|
1198
1197
|
key: "handleDeclareInfo",
|
1199
|
-
value: function handleDeclareInfo(
|
1200
|
-
var
|
1201
|
-
closeDialogData =
|
1198
|
+
value: function handleDeclareInfo(_ref7) {
|
1199
|
+
var _ref7$closeDialogData = _ref7.closeDialogData,
|
1200
|
+
closeDialogData = _ref7$closeDialogData === void 0 ? {} : _ref7$closeDialogData;
|
1202
1201
|
_handleDeclareInfo({
|
1203
1202
|
closeDialogData: closeDialogData
|
1204
1203
|
});
|
@@ -1235,12 +1234,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1235
1234
|
}
|
1236
1235
|
};
|
1237
1236
|
}
|
1238
|
-
if (
|
1239
|
-
clearTimeout(
|
1240
|
-
|
1237
|
+
if (window._webAppHeartBeatTimeoutId) {
|
1238
|
+
clearTimeout(window._webAppHeartBeatTimeoutId);
|
1239
|
+
window._webAppHeartBeatTimeoutId = null;
|
1241
1240
|
}
|
1242
1241
|
if (this._webAppHeartBeatTimeoutFn) {
|
1243
|
-
|
1242
|
+
window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1244
1243
|
}
|
1245
1244
|
setTimeout(function () {
|
1246
1245
|
if (_this8.isAppAttached()) {
|
@@ -1249,7 +1248,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1249
1248
|
event: 'sdkHeartBeat',
|
1250
1249
|
data: {}
|
1251
1250
|
}
|
1252
|
-
});
|
1251
|
+
}, null, false);
|
1253
1252
|
}
|
1254
1253
|
}, TIME_DELAY_SEND_HEART_BEAT);
|
1255
1254
|
} catch (error) {
|
@@ -1299,17 +1298,20 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1299
1298
|
key: "dispatchToApp",
|
1300
1299
|
value: function dispatchToApp(payload) {
|
1301
1300
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1301
|
+
var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
1302
1302
|
var data = Object.assign({}, payload, {
|
1303
1303
|
name: messageName.SDK_TO_APP,
|
1304
1304
|
mode: this.AMSSDK.options.mode,
|
1305
1305
|
appId: COMPONENTPLUGINID,
|
1306
1306
|
instanceId: this.AMSSDK._instanceId
|
1307
1307
|
});
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1308
|
+
if (sendLog) {
|
1309
|
+
this.AMSSDK.logger.logInfo({
|
1310
|
+
title: 'sdk_event_send_message_to_web'
|
1311
|
+
}, {
|
1312
|
+
event: data === null || data === void 0 ? void 0 : data.context.event
|
1313
|
+
}).send();
|
1314
|
+
}
|
1313
1315
|
if (targetElement && targetElement.contentWindow) {
|
1314
1316
|
return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
|
1315
1317
|
}
|
package/esm/request/index.js
CHANGED
@@ -50,8 +50,6 @@ function requestInstance(options) {
|
|
50
50
|
withCredentials: (_options$withCredenti = options.withCredentials) !== null && _options$withCredenti !== void 0 ? _options$withCredenti : true,
|
51
51
|
method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
|
52
52
|
});
|
53
|
-
console.log('baseURL', baseURL);
|
54
|
-
console.log('_headers', _headers);
|
55
53
|
return instance.request;
|
56
54
|
}
|
57
55
|
|
@@ -99,25 +97,21 @@ function _request() {
|
|
99
97
|
})];
|
100
98
|
startTime = Date.now();
|
101
99
|
_context.prev = 5;
|
102
|
-
console.log('requestInstance options', options);
|
103
|
-
console.log('requestInstance -data', _data);
|
104
100
|
myRequest = requestInstance(options);
|
105
|
-
_context.next =
|
101
|
+
_context.next = 9;
|
106
102
|
return myRequest({
|
107
103
|
data: _data
|
108
104
|
});
|
109
|
-
case
|
105
|
+
case 9:
|
110
106
|
_yield$myRequest = _context.sent;
|
111
107
|
data = _yield$myRequest.data;
|
112
108
|
headers = _yield$myRequest.headers;
|
113
|
-
console.log('requestInstance data', data);
|
114
|
-
console.log('requestInstance headers', headers);
|
115
109
|
resData = data || {};
|
116
110
|
traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
|
117
111
|
resData.traceId = traceId || '';
|
118
112
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
119
113
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
120
|
-
_context.next =
|
114
|
+
_context.next = 21;
|
121
115
|
break;
|
122
116
|
}
|
123
117
|
errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
|
@@ -136,7 +130,7 @@ function _request() {
|
|
136
130
|
errorCode: errorCode,
|
137
131
|
success: false
|
138
132
|
}));
|
139
|
-
case
|
133
|
+
case 21:
|
140
134
|
logger.reportRPC({
|
141
135
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
142
136
|
label: 'request',
|
@@ -147,8 +141,8 @@ function _request() {
|
|
147
141
|
traceId: traceId
|
148
142
|
}).send();
|
149
143
|
return _context.abrupt("return", resData);
|
150
|
-
case
|
151
|
-
_context.prev =
|
144
|
+
case 25:
|
145
|
+
_context.prev = 25;
|
152
146
|
_context.t0 = _context["catch"](5);
|
153
147
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
154
148
|
success: false,
|
@@ -170,11 +164,11 @@ function _request() {
|
|
170
164
|
errorCode: _errorCode,
|
171
165
|
errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
|
172
166
|
}));
|
173
|
-
case
|
167
|
+
case 32:
|
174
168
|
case "end":
|
175
169
|
return _context.stop();
|
176
170
|
}
|
177
|
-
}, _callee, null, [[5,
|
171
|
+
}, _callee, null, [[5, 25]]);
|
178
172
|
}));
|
179
173
|
return _request.apply(this, arguments);
|
180
174
|
}
|