@alipay/ams-checkout 0.0.1755258862-dev.3 → 0.0.1755258862-dev.5

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.
@@ -53,8 +53,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
53
53
  return _regeneratorRuntime().wrap(function _callee$(_context) {
54
54
  while (1) switch (_context.prev = _context.next) {
55
55
  case 0:
56
+ console.log('[DEBUG] - startBizFlow begin with paymentContext:', paymentContext);
56
57
  // 放在最前面的逻辑
57
58
  // 在PC场景下,几乎所有渠道都是没有拉端的逻辑的,所以需要改成1.0, 这个是历史原因
59
+ console.log('[DEBUG] - startBizFlow check isPC:', isPC());
58
60
  if (isPC()) {
59
61
  // 非TOSS渠道,在PC场景需要改成1.0
60
62
  if ('BANKTRANSFER_QUICKPAY' !== ((_paymentContext$payme = paymentContext.paymentSessionObj) === null || _paymentContext$payme === void 0 || (_paymentContext$payme = _paymentContext$payme.paymentMethodInfoView) === null || _paymentContext$payme === void 0 ? void 0 : _paymentContext$payme.paymentMethodType)) {
@@ -71,14 +73,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
71
73
  this.channelBehavior = ChannelCustomize.getChannelBehavior(paymentContext.paymentSessionObj);
72
74
  // 首次支付
73
75
  isFirstTimeToPay = !autoDebitWithToken; // 处理ESP1.0极速外跳支付场景
76
+ console.log('[DEBUG] - startBizFlow check fastSdk conditions:', {
77
+ productSceneVersion: productSceneVersion,
78
+ isFirstTimeToPay: isFirstTimeToPay,
79
+ requireFastSdk: requireFastSdk
80
+ });
74
81
  if (!(productSceneVersion === '1.0' && isFirstTimeToPay && requireFastSdk)) {
75
- _context.next = 12;
82
+ _context.next = 15;
76
83
  break;
77
84
  }
78
85
  return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
79
- case 12:
86
+ case 15:
80
87
  // 下面的场景是需要渲染UI的渠道, 打开WebUrl
81
- webAppUrl = this.buildWebAppUrl(); // const webAppUrl = 'http://svc-9kvjxwjf68cptha8.cloudide.svc.et15-sqa.alipay.net:5173/src/component-app/index.html';
88
+ webAppUrl = this.buildWebAppUrl();
89
+ console.log('[DEBUG] - startBizFlow webAppUrl:', webAppUrl);
90
+ // const webAppUrl = 'http://svc-9kvjxwjf68cptha8.cloudide.svc.et15-sqa.alipay.net:5173/src/component-app/index.html';
82
91
  resultPayload = {
83
92
  url: webAppUrl,
84
93
  allowClickPopupOutsideClose: (_this$channelBehavior = this.channelBehavior) === null || _this$channelBehavior === void 0 ? void 0 : _this$channelBehavior.allowClickOutsideClose
@@ -89,15 +98,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
89
98
  productSceneVersion: productSceneVersion
90
99
  });
91
100
  // 返回结果之前,发送 sessionData,并且等待Web应用启动的事件,内部是异步处理,不阻塞。
92
- console.log('[DEBUG] sendRequestAndWaitWebLaunch start');
93
101
  this.sendRequestAndWaitWebLaunch();
94
- console.log('[DEBUG] sendRequestAndWaitWebLaunch completed');
95
102
  // 返回结果,RENDER,让外层去处理iframe加载等逻辑
96
103
  return _context.abrupt("return", {
97
104
  behaviorType: 'RENDER',
98
105
  payload: resultPayload
99
106
  });
100
- case 19:
107
+ case 21:
101
108
  case "end":
102
109
  return _context.stop();
103
110
  }
@@ -164,6 +171,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
164
171
  key: "sendRequestAndWaitWebLaunch",
165
172
  value: function sendRequestAndWaitWebLaunch() {
166
173
  var _this = this;
174
+ console.log('[DEBUG] - sendRequestAndWaitWebLaunch start');
167
175
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
168
176
  var webLaunchPromise = new Promise(function (resolve) {
169
177
  eventCenter.listen('onLaunch', function (res) {
@@ -172,12 +180,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
172
180
  });
173
181
 
174
182
  // 等请求和 Web启动都Ready之后,发送renderComponent
183
+ console.log('[DEBUG] - sendRequestAndWaitWebLaunch waiting for promises');
175
184
  Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
176
185
  var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext$4;
177
186
  var _ref2 = _slicedToArray(_ref, 3),
178
187
  _initSecurityRes = _ref2[0],
179
188
  submitRes = _ref2[1],
180
189
  _webLaunchRes = _ref2[2];
190
+ console.log('[DEBUG] - sendRequestAndWaitWebLaunch all promises resolved');
181
191
  var logMetaData = _this.logger.getLogConfig().mdata;
182
192
  eventCenter.dispatchToApp({
183
193
  event: 'renderComponent',
@@ -209,8 +219,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
209
219
  })
210
220
  }
211
221
  });
212
- }, function (error) {
213
- console.log('[DEBUG] - sendRequestAndWaitWebLaunch - ERROR', error);
214
222
  });
215
223
  }
216
224
  }, {
@@ -222,13 +230,17 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
222
230
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
223
231
  while (1) switch (_context2.prev = _context2.next) {
224
232
  case 0:
225
- console.log('[DEBUG] processSubmitPay start');
233
+ console.log('[DEBUG] - processSubmitPay start');
226
234
  submitParams = {
227
235
  paymentSessionData: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionId) || '',
228
236
  paymentSessionConfig: (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionConfig
229
237
  };
230
238
  _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
231
239
  _ref4 = ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
240
+ console.log('[DEBUG] - processSubmitPay check productSceneVersion:', {
241
+ productSceneVersion: productSceneVersion,
242
+ autoDebitWithToken: autoDebitWithToken
243
+ });
232
244
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
233
245
  ///EasyPay 2.0 首次传signAgreement字段
234
246
  submitParams['signAgreement'] = enableSignAgreement;
@@ -243,15 +255,16 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
243
255
  }
244
256
  this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
245
257
  //console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
258
+ console.log('[DEBUG] - processSubmitPay check allowSubmitPayCallAhead:', this.allowSubmitPayCallAhead);
246
259
  if (this.allowSubmitPayCallAhead) {
247
- _context2.next = 8;
260
+ _context2.next = 10;
248
261
  break;
249
262
  }
250
263
  return _context2.abrupt("return", {
251
264
  message: 'sdk no need to make submitPay request',
252
265
  success: true
253
266
  });
254
- case 8:
267
+ case 10:
255
268
  requestBizId = uuid(); // 下面真实发请求
256
269
  this.logger.logInfo({
257
270
  title: 'sdk_event_submitPay'
@@ -271,13 +284,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
271
284
  extParams.complianceSDK = true;
272
285
  submitParams.extParams = extParams;
273
286
  requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
274
- _context2.prev = 14;
287
+ _context2.prev = 16;
288
+ console.log('[DEBUG] - processSubmitPay making request with params:', submitParams);
289
+ // console.log('[web-sdk] DO call submitPay');
290
+ console.log('[DEBUG] - processSubmitPay request config:', {
291
+ env: this.initConfig.environment,
292
+ timeout: 15000,
293
+ hostSign: this.hostSign,
294
+ 'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
295
+ });
275
296
  _context2.t0 = requester;
276
297
  _context2.t1 = submitParams;
277
298
  _context2.t2 = this.initConfig.environment;
278
- _context2.next = 20;
299
+ _context2.next = 24;
279
300
  return this.acquireApdidToken();
280
- case 20:
301
+ case 24:
281
302
  _context2.t3 = _context2.sent;
282
303
  _context2.t4 = {
283
304
  deviceId: _context2.t3
@@ -291,9 +312,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
291
312
  needEnvInfo: true,
292
313
  'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
293
314
  };
294
- _context2.next = 26;
315
+ _context2.next = 30;
295
316
  return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
296
- case 26:
317
+ case 30:
297
318
  res = _context2.sent;
298
319
  this.logger.logInfo({
299
320
  title: 'sdk_event_submitPayEnd'
@@ -302,11 +323,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
302
323
  requestId: requestBizId,
303
324
  rpcTraceId: res.traceId
304
325
  });
305
- console.log('[DEBUG] processSubmitPay completed', res);
326
+ console.log('[DEBUG] - processSubmitPay request success:', res);
306
327
  return _context2.abrupt("return", res);
307
- case 32:
308
- _context2.prev = 32;
309
- _context2.t7 = _context2["catch"](14);
328
+ case 36:
329
+ _context2.prev = 36;
330
+ _context2.t7 = _context2["catch"](16);
310
331
  this.logger.logError({
311
332
  title: 'sdk_event_submitPay_failed'
312
333
  }, {
@@ -315,13 +336,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
315
336
  requestId: requestBizId,
316
337
  rpcTraceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
317
338
  });
318
- console.log('[DEBUG] processSubmitPay ERROR', _context2.t7);
339
+ console.log('[DEBUG] - processSubmitPay request failed:', _context2.t7);
319
340
  throw _context2.t7;
320
- case 37:
341
+ case 41:
321
342
  case "end":
322
343
  return _context2.stop();
323
344
  }
324
- }, _callee2, this, [[14, 32]]);
345
+ }, _callee2, this, [[16, 36]]);
325
346
  }));
326
347
  function processSubmitPay() {
327
348
  return _processSubmitPay.apply(this, arguments);
@@ -362,7 +383,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
362
383
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
363
384
  while (1) switch (_context4.prev = _context4.next) {
364
385
  case 0:
365
- console.log('[DEBUG] initSecuritySDK start');
386
+ console.log('[DEBUG] - initSecuritySDK start');
366
387
  _context4.prev = 1;
367
388
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
368
389
  nonCompliant = (_this$paymentContext$8 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.nonCompliant;
@@ -395,31 +416,32 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
395
416
  }
396
417
  }
397
418
  }
419
+ console.log('[DEBUG] - initSecuritySDK shouldInitSecuritySDK:', shouldInitSecuritySDK);
398
420
  if (!shouldInitSecuritySDK) {
399
- _context4.next = 11;
421
+ _context4.next = 12;
400
422
  break;
401
423
  }
402
- _context4.next = 11;
424
+ _context4.next = 12;
403
425
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
404
- case 11:
405
- console.log('[DEBUG] initSecuritySDK completed');
426
+ case 12:
406
427
  this.logger.logInfo({
407
428
  title: 'a3753.b101271.c388193.d514078'
408
429
  }, {
409
430
  riskSdkInfo: shouldInitSecuritySDK ? RiskSdkInfoEnum.NEED : RiskSdkInfoEnum.NO_NEED
410
431
  });
411
- _context4.next = 18;
432
+ console.log('[DEBUG] - initSecuritySDK completed');
433
+ _context4.next = 19;
412
434
  break;
413
- case 15:
414
- _context4.prev = 15;
435
+ case 16:
436
+ _context4.prev = 16;
415
437
  _context4.t0 = _context4["catch"](1);
416
- console.log('[DEBUG] initSecuritySDK ERROR');
417
438
  // do nothing when init security failed
418
- case 18:
439
+ console.log('[DEBUG] - initSecuritySDK catch');
440
+ case 19:
419
441
  case "end":
420
442
  return _context4.stop();
421
443
  }
422
- }, _callee4, this, [[1, 15]]);
444
+ }, _callee4, this, [[1, 16]]);
423
445
  }));
424
446
  function initSecuritySDK() {
425
447
  return _initSecuritySDK.apply(this, arguments);
@@ -1,4 +1,6 @@
1
- import { IoptionsParams, PaymentContext, RequestConfig, SDKMetaData, Service } from './deps';
1
+ import { PaymentContext, Service } from '../../index';
2
+ import type { IoptionsParams, RequestConfig } from '../../../types';
3
+ import type { SDKMetaData } from '../../index';
2
4
  /**
3
5
  * @author congle.zzq <congle.zzq@alipay.com>
4
6
  * @date 2024/9/18
@@ -12,8 +12,37 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
13
  import axios from 'axios';
14
14
  import { ServiceProvider } from '..';
15
- import { errorEnum } from "./deps";
16
- import { appId, device, fomatGetwayError, get, hostSignMap, isPC, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
15
+ import { lightSandboxMap, appId, hostSignMap, requestHost, sofaId, tntInstId } from "../../../config/request";
16
+ import { device, isPC, queryParse, safeJson } from "../../../util";
17
+ import { fomatGetwayError } from "../../../request/utils";
18
+ import { get } from "../../../util/get";
19
+ import { sdkVersion } from "../../../config/index";
20
+ import { errorEnum } from "../../../types";
21
+
22
+ // import { errorEnum } from './deps';
23
+ // import {
24
+ // appId,
25
+ // device,
26
+ // fomatGetwayError,
27
+ // get,
28
+ // hostSignMap,
29
+ // IoptionsParams,
30
+ // isPC,
31
+ // lightSandboxMap,
32
+ // LogExtra,
33
+ // LogPayload,
34
+ // LogService,
35
+ // PaymentContext,
36
+ // queryParse,
37
+ // RequestConfig,
38
+ // requestHost,
39
+ // safeJson,
40
+ // SDKMetaData,
41
+ // sdkVersion,
42
+ // Service,
43
+ // sofaId,
44
+ // tntInstId,
45
+ // } from './deps'
17
46
 
18
47
  /**
19
48
  * @author congle.zzq <congle.zzq@alipay.com>
@@ -50,7 +79,10 @@ export var RequesterService = /*#__PURE__*/function () {
50
79
  return _regeneratorRuntime().wrap(function _callee$(_context) {
51
80
  while (1) switch (_context.prev = _context.next) {
52
81
  case 0:
53
- console.log('[DEBUG] request start', requestData, options);
82
+ console.log('[DEBUG] - request start', {
83
+ requestData: requestData,
84
+ options: options
85
+ });
54
86
  envInfo = this.getEnvInfo(options);
55
87
  _data = [_objectSpread(_objectSpread({}, requestData), {}, {
56
88
  envInfo: envInfo,
@@ -61,10 +93,10 @@ export var RequesterService = /*#__PURE__*/function () {
61
93
  startTime = Date.now();
62
94
  traceId = '';
63
95
  _context.prev = 5;
64
- console.log('[DEBUG] createRequestInstance start');
96
+ console.log('[DEBUG] - createRequestInstance start', options);
65
97
  myRequest = this.createRequestInstance(options);
66
- console.log('[DEBUG] createRequestInstance completed', myRequest);
67
- console.log('[DEBUG] myRequest start');
98
+ console.log('[DEBUG] - createRequestInstance completed', myRequest);
99
+ console.log('[DEBUG] - request payload:', _data);
68
100
  _context.next = 12;
69
101
  return myRequest({
70
102
  data: _data
@@ -73,18 +105,18 @@ export var RequesterService = /*#__PURE__*/function () {
73
105
  _yield$myRequest = _context.sent;
74
106
  data = _yield$myRequest.data;
75
107
  headers = _yield$myRequest.headers;
76
- console.log('[DEBUG] myRequest completed', data, headers);
77
108
  resData = data || {};
109
+ console.log('[DEBUG] - request response:', {
110
+ resData: resData,
111
+ headers: headers
112
+ });
78
113
  traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
79
114
  resData.traceId = traceId || '';
80
- console.log('[DEBUG] handleGetWayError start');
81
115
  handleGetWayError = fomatGetwayError(headers, traceId);
82
- console.log('[DEBUG] handleGetWayError completed', handleGetWayError);
83
116
  if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
84
- _context.next = 29;
117
+ _context.next = 25;
85
118
  break;
86
119
  }
87
- console.log('[DEBUG] handleGetWayError errorCode', handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode);
88
120
  errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
89
121
  errorCode = handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode;
90
122
  this.reportRequestTimeCost({
@@ -97,17 +129,12 @@ export var RequesterService = /*#__PURE__*/function () {
97
129
  msg: errorMessage,
98
130
  traceId: traceId
99
131
  });
100
- console.log('[DEBUG] handleGetWayError error', {
101
- errorMessage: errorMessage,
102
- errorCode: errorCode,
103
- success: false
104
- });
105
132
  throw new Error(JSON.stringify({
106
133
  errorMessage: errorMessage,
107
134
  errorCode: errorCode,
108
135
  success: false
109
136
  }));
110
- case 29:
137
+ case 25:
111
138
  this.reportRequestTimeCost({
112
139
  title: 'a3753.b101271.c388193.d521387',
113
140
  name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
@@ -118,18 +145,17 @@ export var RequesterService = /*#__PURE__*/function () {
118
145
  msg: '',
119
146
  traceId: traceId
120
147
  });
121
- console.log('[DEBUG] request completed', resData);
122
148
  return _context.abrupt("return", resData);
123
- case 34:
124
- _context.prev = 34;
149
+ case 29:
150
+ _context.prev = 29;
125
151
  _context.t0 = _context["catch"](5);
152
+ console.log('[DEBUG] - request error:', _context.t0);
126
153
  _error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
127
154
  success: false,
128
155
  errorCode: errorEnum.SYSTEM,
129
156
  traceId: traceId,
130
157
  errorMessage: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
131
158
  });
132
- console.log('[DEBUG] request error 1', _error, 'Original error:', _context.t0);
133
159
  timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
134
160
  _errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
135
161
  this.reportRequestTimeCost({
@@ -141,23 +167,17 @@ export var RequesterService = /*#__PURE__*/function () {
141
167
  code: _errorCode,
142
168
  msg: JSON.stringify((_error === null || _error === void 0 ? void 0 : _error.message) || _context.t0)
143
169
  });
144
- console.log('[DEBUG] request error 2', {
145
- success: false,
146
- errorCode: _errorCode,
147
- traceId: traceId,
148
- errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
149
- });
150
170
  return _context.abrupt("return", Promise.reject({
151
171
  success: false,
152
172
  errorCode: _errorCode,
153
173
  traceId: traceId,
154
174
  errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
155
175
  }));
156
- case 43:
176
+ case 37:
157
177
  case "end":
158
178
  return _context.stop();
159
179
  }
160
- }, _callee, this, [[5, 34]]);
180
+ }, _callee, this, [[5, 29]]);
161
181
  }));
162
182
  function request(_x, _x2) {
163
183
  return _request.apply(this, arguments);
@@ -206,52 +226,41 @@ export var RequesterService = /*#__PURE__*/function () {
206
226
  }, {
207
227
  key: "createRequestInstance",
208
228
  value: function createRequestInstance(options) {
209
- var _options$timeout, _options$withCredenti;
210
- console.log('[DEBUG] createRequestInstance start with options:', {
211
- env: options.env,
212
- 'Operation-Type': options['Operation-Type'],
213
- hostSign: options === null || options === void 0 ? void 0 : options.hostSign,
214
- timeout: options.timeout,
215
- method: options === null || options === void 0 ? void 0 : options.method,
216
- withCredentials: options.withCredentials,
217
- headers: Object.keys(options.headers || {})
218
- });
229
+ var _options$timeout, _options$withCredenti, _options$timeout2, _options$withCredenti2;
230
+ console.log('[DEBUG] - createRequestInstance options:', options);
219
231
  var date = new Date(); // 获取当前时间
220
232
  var timestamp = date.getTime(); // 获取时间戳
221
233
  var utcTimestamp = timestamp + date.getTimezoneOffset() * 60 * 1000; // 获取 UTC 时间戳
222
234
  var env = options.env || 'prod';
223
235
  var lightSandboxConfig = lightSandboxMap(options['Operation-Type'], env); // light_sandbox
224
- console.log('[DEBUG] lightSandboxConfig:', lightSandboxConfig);
236
+ console.log('[DEBUG] - createRequestInstance lightSandboxConfig:', lightSandboxConfig);
225
237
  var baseURL = options.baseURL || lightSandboxConfig.baseURL || hostSignMap(options === null || options === void 0 ? void 0 : options.hostSign, env) || requestHost[env];
226
- console.log('[DEBUG] baseURL:', baseURL);
227
238
  var _headers = _objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
228
239
  appId: lightSandboxConfig.appId || appId,
229
240
  workspaceId: options.env === 'pre' ? 'pre' : 'default'
230
241
  }, "x-cors-".concat(appId.toLowerCase(), "-default"), '1'), "version", '2.0'), 'sofa-group-name', lightSandboxConfig.sofaId || sofaId), 'Operation-Type', lightSandboxConfig['Operation-Type'] || options['Operation-Type'] || ''), 'Client-Time', utcTimestamp), "tntInstId", tntInstId), 'sdk-version', sdkVersion || ''), options.headers);
231
-
242
+ console.log('[DEBUG] - createRequestInstance headers:', _headers);
232
243
  // sandbox 影子链路
233
244
  if (this.sandboxFlag === 'true' || env === 'sandbox') {
234
245
  _headers['load-test'] = true;
235
246
  _headers.sofaPenAttrs = 'instMock=O&loadMode=2';
236
247
  }
237
248
  if (env !== 'dev') delete _headers['sofa-group-name'];
238
- console.log('[DEBUG] request headers keys:', Object.keys(_headers));
239
- console.log('[DEBUG] axios:', axios);
240
- var instance = axios.create({
249
+ console.log('[DEBUG] - createRequestInstance config:', {
241
250
  baseURL: baseURL,
242
251
  timeout: (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : 15000,
243
252
  headers: _headers,
244
253
  withCredentials: (_options$withCredenti = options.withCredentials) !== null && _options$withCredenti !== void 0 ? _options$withCredenti : true,
245
254
  method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
246
255
  });
247
- console.log('[DEBUG] axios instance created with config:', {
248
- baseURL: instance.defaults.baseURL,
249
- timeout: instance.defaults.timeout,
250
- method: instance.defaults.method,
251
- withCredentials: instance.defaults.withCredentials
256
+ var instance = axios.create({
257
+ baseURL: baseURL,
258
+ timeout: (_options$timeout2 = options.timeout) !== null && _options$timeout2 !== void 0 ? _options$timeout2 : 15000,
259
+ headers: _headers,
260
+ withCredentials: (_options$withCredenti2 = options.withCredentials) !== null && _options$withCredenti2 !== void 0 ? _options$withCredenti2 : true,
261
+ method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
252
262
  });
253
263
  return instance.request;
254
- // return instance.request.bind(instance);
255
264
  }
256
265
  }]);
257
266
  return RequesterService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1755258862-dev.3",
3
+ "version": "0.0.1755258862-dev.5",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",