@alipay/ams-checkout 0.0.1752633195-dev.1 → 0.0.1753182181-dev.0

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.
@@ -80,7 +80,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
80
80
 
81
81
  // 首次支付
82
82
  isFirstTimeToPay = !autoDebitWithToken; // 处理ESP极速外跳支付场景
83
- if (!(requireFastSdk && isFirstTimeToPay)) {
83
+ if (!(isFirstTimeToPay && requireFastSdk)) {
84
84
  _context.next = 12;
85
85
  break;
86
86
  }
@@ -148,16 +148,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
148
148
  }, {
149
149
  key: "buildRedirectResult",
150
150
  value: function buildRedirectResult(authUrlInfo) {
151
- var _this = this;
152
151
  var data;
153
- var appendLocaleIntoNormalUrl = function appendLocaleIntoNormalUrl(normalUrl) {
154
- if ((authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.needLocale) === true && _this.initConfig.locale) {
155
- var url = new URL(normalUrl);
156
- url.searchParams.set('locale', _this.initConfig.locale);
157
- return url.toString();
158
- }
159
- return normalUrl;
160
- };
161
152
  if (!(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.normalUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.schemeUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.applinkUrl) && authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.authUrl) {
162
153
  data = {
163
154
  url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
@@ -166,7 +157,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
166
157
  };
167
158
  } else {
168
159
  data = {
169
- url: appendLocaleIntoNormalUrl(authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl),
160
+ url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
170
161
  schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
171
162
  applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
172
163
  };
@@ -185,15 +176,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
185
176
  }, {
186
177
  key: "sendRequestAndWaitWebLaunch",
187
178
  value: function sendRequestAndWaitWebLaunch() {
188
- var _this2 = this;
179
+ var _this = this;
189
180
  var webLaunchPromise = new Promise(function (resolve, reject) {
190
181
  var t = setTimeout(function () {
191
182
  reject(new Error('Load resource timeout'));
192
- }, _this2.LOAD_APP_RESOURCES_TIMEOUT);
193
- _this2.eventCenter.listen('onLaunch', function (res) {
183
+ }, _this.LOAD_APP_RESOURCES_TIMEOUT);
184
+ _this.eventCenter.listen('onLaunch', function (res) {
194
185
  clearTimeout(t);
195
186
  resolve(res);
196
- _this2.logger.logInfo({
187
+ _this.logger.logInfo({
197
188
  title: 'sdk_event_webAppOnLaunch'
198
189
  });
199
190
  });
@@ -201,25 +192,25 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
201
192
 
202
193
  // 等请求和 Web启动都Ready之后,发送renderComponent
203
194
  Promise.all([this.initSecuritySDK(), this.processQuery(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
204
- var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6, _this2$paymentContext7;
195
+ var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext3, _this$paymentContext$4;
205
196
  var _ref2 = _slicedToArray(_ref, 4),
206
197
  _initSecurityRes = _ref2[0],
207
198
  queryRes = _ref2[1],
208
199
  submitRes = _ref2[2],
209
200
  _webLaunchRes = _ref2[3];
210
- var logMetaData = _this2.logger.getLogConfig().mdata;
201
+ var logMetaData = _this.logger.getLogConfig().mdata;
211
202
  var data = {
212
- sessionResult: (_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj,
203
+ sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
213
204
  submitResult: submitRes,
214
- paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSessionId,
205
+ paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
215
206
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
216
- renderDisplayType: _this2.paymentContext.displayInfo.type,
217
- appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
218
- notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
219
- isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
220
- merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
221
- allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
222
- doubleFaUrl: getDoubleFaUrlFromSession((_this2$paymentContext6 = _this2.paymentContext) === null || _this2$paymentContext6 === void 0 ? void 0 : _this2$paymentContext6.paymentSessionObj, _this2.initConfig.environment),
207
+ renderDisplayType: _this.paymentContext.displayInfo.type,
208
+ appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
209
+ notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
210
+ isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
211
+ merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
212
+ allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
213
+ doubleFaUrl: getDoubleFaUrlFromSession((_this$paymentContext3 = _this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionObj, _this.initConfig.environment),
223
214
  envInfo: {
224
215
  screenHeight: screen.height,
225
216
  screenWidth: screen.width
@@ -228,7 +219,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
228
219
  trackId: logMetaData.requestSeq,
229
220
  platform: logMetaData.platform,
230
221
  firstLogTime: logMetaData.firstLogTime
231
- }, ((_this2$paymentContext7 = _this2.paymentContext.paymentSessionObj) === null || _this2$paymentContext7 === void 0 ? void 0 : _this2$paymentContext7.paymentSessionConfig) || {}), {}, {
222
+ }, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
232
223
  renderDisplayType: logMetaData.renderDisplayType,
233
224
  sdkVersion: logMetaData.sdkVersion,
234
225
  merchantId: logMetaData.merchantId,
@@ -239,16 +230,16 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
239
230
  if (queryRes) {
240
231
  data.queryResult = queryRes;
241
232
  }
242
- _this2.eventCenter.dispatchToApp({
233
+ _this.eventCenter.dispatchToApp({
243
234
  event: 'renderComponent',
244
235
  data: data
245
236
  });
246
- _this2.logger.logInfo({
237
+ _this.logger.logInfo({
247
238
  title: 'sdk_event_renderComponent'
248
239
  });
249
240
  }).catch(function (error) {
250
- _this2.eventCenter.emit(EVENT.destroy.name, {});
251
- _this2.eventCenter.emit(EVENT.eventCallback.name, {
241
+ _this.eventCenter.emit(EVENT.destroy.name, {});
242
+ _this.eventCenter.emit(EVENT.eventCallback.name, {
252
243
  code: eventCodeEnum.SDK_INTERNAL_ERROR,
253
244
  result: {
254
245
  message: error === null || error === void 0 ? void 0 : error.message
@@ -260,18 +251,18 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
260
251
  key: "processQuery",
261
252
  value: function () {
262
253
  var _processQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
263
- var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$paymentContext$, _this$paymentContext4, _this$paymentContext5;
264
- var queryParams, extendInfo, needAccountConfirmPage, isFirstTimeToPay, needQueryRender, extendInfoData, requestBizId, requester, _this$paymentContext$2, res;
254
+ var _this$paymentContext4, _this$paymentContext5, _this$paymentContext6, _this$paymentContext$5, _this$paymentContext7, _this$paymentContext8;
255
+ var queryParams, extendInfo, needAccountConfirmPage, isFirstTimeToPay, needQueryRender, extendInfoData, requestBizId, requester, _this$paymentContext$6, res;
265
256
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
266
257
  while (1) switch (_context2.prev = _context2.next) {
267
258
  case 0:
268
259
  queryParams = {
269
- paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionId) || '',
270
- paymentSessionConfig: (_this$paymentContext2 = this.paymentContext) === null || _this$paymentContext2 === void 0 || (_this$paymentContext2 = _this$paymentContext2.paymentSessionObj) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionConfig
260
+ paymentSessionData: ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionId) || '',
261
+ paymentSessionConfig: (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 || (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionConfig
271
262
  };
272
- extendInfo = (_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionObj.extendInfo;
273
- needAccountConfirmPage = (_this$paymentContext$ = (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionObj.needAccountConfirmPage) !== null && _this$paymentContext$ !== void 0 ? _this$paymentContext$ : true;
274
- isFirstTimeToPay = !((_this$paymentContext5 = this.paymentContext) !== null && _this$paymentContext5 !== void 0 && (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj.action) !== null && _this$paymentContext5 !== void 0 && _this$paymentContext5.autoDebitWithToken);
263
+ extendInfo = (_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionObj.extendInfo;
264
+ needAccountConfirmPage = (_this$paymentContext$5 = (_this$paymentContext7 = this.paymentContext) === null || _this$paymentContext7 === void 0 ? void 0 : _this$paymentContext7.paymentSessionObj.needAccountConfirmPage) !== null && _this$paymentContext$5 !== void 0 ? _this$paymentContext$5 : true;
265
+ isFirstTimeToPay = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.autoDebitWithToken);
275
266
  needQueryRender = true;
276
267
  try {
277
268
  extendInfoData = JSON.parse(extendInfo);
@@ -299,7 +290,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
299
290
  _context2.t1 = _objectSpread(_objectSpread({}, queryParams), {}, {
300
291
  actionType: 'init',
301
292
  integrationType: 'SDK',
302
- sdkVersion: (_this$paymentContext$2 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$2 !== void 0 ? _this$paymentContext$2 : '1.0.0'
293
+ sdkVersion: (_this$paymentContext$6 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$6 !== void 0 ? _this$paymentContext$6 : '1.0.0'
303
294
  });
304
295
  _context2.t2 = this.initConfig.environment;
305
296
  _context2.t3 = this.SDK_REQUEST_TIMEOUT;
@@ -358,21 +349,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
358
349
  key: "processSubmitPay",
359
350
  value: function () {
360
351
  var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
361
- var _this$paymentContext6, _this$paymentContext7, _this$paymentContext8, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$4, _this$paymentContext9;
362
- var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$3, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$5, res;
352
+ var _this$paymentContext9, _this$paymentContext10, _this$paymentContext11, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$8, _this$paymentContext12;
353
+ var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$7, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$9, res;
363
354
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
364
355
  while (1) switch (_context3.prev = _context3.next) {
365
356
  case 0:
366
357
  submitParams = {
367
- paymentSessionData: ((_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionId) || '',
368
- paymentSessionConfig: (_this$paymentContext7 = this.paymentContext) === null || _this$paymentContext7 === void 0 || (_this$paymentContext7 = _this$paymentContext7.paymentSessionObj) === null || _this$paymentContext7 === void 0 ? void 0 : _this$paymentContext7.paymentSessionConfig
358
+ paymentSessionData: ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionId) || '',
359
+ paymentSessionConfig: (_this$paymentContext10 = this.paymentContext) === null || _this$paymentContext10 === void 0 || (_this$paymentContext10 = _this$paymentContext10.paymentSessionObj) === null || _this$paymentContext10 === void 0 ? void 0 : _this$paymentContext10.paymentSessionConfig
369
360
  };
370
361
  _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
371
- _ref4 = ((_this$paymentContext8 = this.paymentContext) === null || _this$paymentContext8 === void 0 ? void 0 : _this$paymentContext8.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;
362
+ _ref4 = ((_this$paymentContext11 = this.paymentContext) === null || _this$paymentContext11 === void 0 ? void 0 : _this$paymentContext11.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;
372
363
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
373
364
  ///EasyPay 2.0 首次传signAgreement字段
374
365
  submitParams['signAgreement'] = enableSignAgreement;
375
- paymentMethodType = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentMethodInfoView) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.paymentMethodType;
366
+ paymentMethodType = (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentMethodInfoView) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.paymentMethodType;
376
367
  isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
377
368
  if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
378
369
  backScheme = getBackScheme(undefined, this.logger);
@@ -403,12 +394,12 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
403
394
  extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
404
395
  instanceId: this.instanceId,
405
396
  locale: this.initConfig.locale,
406
- paymentMethodType: (_this$paymentContext$4 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 || (_this$paymentContext$4 = _this$paymentContext$4.paymentMethodInfoView) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentMethodType,
397
+ paymentMethodType: (_this$paymentContext$8 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$8 === void 0 || (_this$paymentContext$8 = _this$paymentContext$8.paymentMethodInfoView) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.paymentMethodType,
407
398
  paymentSessionData: this.paymentContext.paymentSessionId,
408
399
  paymentSessionObj: this.paymentContext.paymentSessionObj,
409
400
  env: this.initConfig.environment,
410
401
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion,
411
- notRedirectAfterComplete: ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 || (_this$paymentContext9 = _this$paymentContext9.startBizFlowOptions) === null || _this$paymentContext9 === void 0 || (_this$paymentContext9 = _this$paymentContext9.submitPayRequestExtra) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.notRedirectAfterComplete) === true
402
+ notRedirectAfterComplete: ((_this$paymentContext12 = this.paymentContext) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.startBizFlowOptions) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.submitPayRequestExtra) === null || _this$paymentContext12 === void 0 ? void 0 : _this$paymentContext12.notRedirectAfterComplete) === true
412
403
  })) || {}; // 二次支付不再需要该参数
413
404
  if (!autoDebitWithToken) {
414
405
  extParams.complianceSDK = true;
@@ -419,7 +410,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
419
410
  _context3.t0 = requester;
420
411
  _context3.t1 = _objectSpread(_objectSpread({}, submitParams), {}, {
421
412
  integrationType: 'SDK',
422
- sdkVersion: (_this$paymentContext$5 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$5 !== void 0 ? _this$paymentContext$5 : '1.0.0'
413
+ sdkVersion: (_this$paymentContext$9 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$9 !== void 0 ? _this$paymentContext$9 : '1.0.0'
423
414
  });
424
415
  _context3.t2 = this.initConfig.environment;
425
416
  _context3.t3 = this.SDK_REQUEST_TIMEOUT;
@@ -478,13 +469,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
478
469
  key: "acquireApdidToken",
479
470
  value: function () {
480
471
  var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
481
- var _this$paymentContext$6;
472
+ var _this$paymentContext$10;
482
473
  var securityService, productScene, deviceId;
483
474
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
484
475
  while (1) switch (_context4.prev = _context4.next) {
485
476
  case 0:
486
477
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
487
- productScene = (_this$paymentContext$6 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$6 === void 0 || (_this$paymentContext$6 = _this$paymentContext$6.paymentSessionConfig) === null || _this$paymentContext$6 === void 0 ? void 0 : _this$paymentContext$6.productScene;
478
+ productScene = (_this$paymentContext$10 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$10 === void 0 || (_this$paymentContext$10 = _this$paymentContext$10.paymentSessionConfig) === null || _this$paymentContext$10 === void 0 ? void 0 : _this$paymentContext$10.productScene;
488
479
  deviceId = securityService.getDeviceId({
489
480
  productScene: productScene
490
481
  });
@@ -504,15 +495,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
504
495
  key: "initSecuritySDK",
505
496
  value: function () {
506
497
  var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
507
- var _this$paymentContext$7, _this$paymentContext$8, _this$paymentContext$9, _this$paymentContext$10, _this$paymentContext$11, _this$paymentContext$12, productSceneVersion, nonInitSecuritySDK, signButtonDisplay, userSignAgreement, isFirstTimeToPay, shouldInitSecuritySDK;
498
+ var _this$paymentContext$11, _this$paymentContext$12, _this$paymentContext$13, _this$paymentContext$14, _this$paymentContext$15, _this$paymentContext$16, productSceneVersion, nonInitSecuritySDK, signButtonDisplay, userSignAgreement, isFirstTimeToPay, shouldInitSecuritySDK;
508
499
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
509
500
  while (1) switch (_context5.prev = _context5.next) {
510
501
  case 0:
511
502
  _context5.prev = 0;
512
503
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
513
- nonInitSecuritySDK = (_this$paymentContext$7 = (_this$paymentContext$8 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.nonInitSecuritySDK) !== null && _this$paymentContext$7 !== void 0 ? _this$paymentContext$7 : false;
514
- signButtonDisplay = (_this$paymentContext$9 = (_this$paymentContext$10 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$10 === void 0 ? void 0 : _this$paymentContext$10.signButtonDisplay) !== null && _this$paymentContext$9 !== void 0 ? _this$paymentContext$9 : false;
515
- userSignAgreement = (_this$paymentContext$11 = (_this$paymentContext$12 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$12 === void 0 ? void 0 : _this$paymentContext$12.userSignAgreement) !== null && _this$paymentContext$11 !== void 0 ? _this$paymentContext$11 : false;
504
+ nonInitSecuritySDK = (_this$paymentContext$11 = (_this$paymentContext$12 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$12 === void 0 ? void 0 : _this$paymentContext$12.nonInitSecuritySDK) !== null && _this$paymentContext$11 !== void 0 ? _this$paymentContext$11 : false;
505
+ signButtonDisplay = (_this$paymentContext$13 = (_this$paymentContext$14 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$14 === void 0 ? void 0 : _this$paymentContext$14.signButtonDisplay) !== null && _this$paymentContext$13 !== void 0 ? _this$paymentContext$13 : false;
506
+ userSignAgreement = (_this$paymentContext$15 = (_this$paymentContext$16 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$16 === void 0 ? void 0 : _this$paymentContext$16.userSignAgreement) !== null && _this$paymentContext$15 !== void 0 ? _this$paymentContext$15 : false;
516
507
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
517
508
  shouldInitSecuritySDK = false;
518
509
  if (nonInitSecuritySDK) {
@@ -46,9 +46,10 @@ export var ContainerService = /*#__PURE__*/function () {
46
46
  }, {
47
47
  key: "init",
48
48
  value: function init(initOptions, instanceId, sdkMetaData) {
49
+ var _window;
49
50
  this.instanceId = instanceId;
50
51
  this.sdkMetaData = sdkMetaData;
51
- this.clientHeight = Math.max(window.innerHeight, window.visualViewport.height);
52
+ this.clientHeight = Math.max(window.innerHeight, ((_window = window) === null || _window === void 0 || (_window = _window.visualViewport) === null || _window === void 0 ? void 0 : _window.height) || 0);
52
53
  this.eventCenter = ServiceProvider.getInstance(instanceId).getService('EventCenter');
53
54
  this.logService = ServiceProvider.getInstance(instanceId).getService('Log');
54
55
  this.popupManager = new PopupManager();
@@ -164,10 +165,10 @@ export var ContainerService = /*#__PURE__*/function () {
164
165
  }, {
165
166
  key: "handleAccountFocus",
166
167
  value: function handleAccountFocus(focus) {
167
- var _window$visualViewpor, _window;
168
+ var _window$visualViewpor, _window2;
168
169
  // 失焦时v2会走默认的sizeChange还原高度,这里仅移除监听
169
170
  (_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 || _window$visualViewpor.removeEventListener('resize', this.boundFocusResizeChange);
170
- (_window = window) === null || _window === void 0 || _window.removeEventListener('resize', this.boundFocusResizeChange);
171
+ (_window2 = window) === null || _window2 === void 0 || _window2.removeEventListener('resize', this.boundFocusResizeChange);
171
172
  // 只有聚焦才监听,失焦后移除,避免影响别的场景
172
173
  if (focus) {
173
174
  var _window$visualViewpor2;
@@ -297,12 +298,12 @@ export var ContainerService = /*#__PURE__*/function () {
297
298
  }, {
298
299
  key: "focusResizeChange",
299
300
  value: function focusResizeChange() {
300
- var _window2;
301
+ var _window3;
301
302
  // 计算出当前iframe应有的高度,需要和顶部留有距离
302
303
  var webPageHeightRatio = 0.9;
303
304
  var browserPageHeightFocusRatio = 0.9;
304
305
  // sdk层才能拿到当前键盘弹起后页面的高度
305
- var height = ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.visualViewport) === null || _window2 === void 0 ? void 0 : _window2.height) || window.innerHeight;
306
+ var height = ((_window3 = window) === null || _window3 === void 0 || (_window3 = _window3.visualViewport) === null || _window3 === void 0 ? void 0 : _window3.height) || window.innerHeight;
306
307
  height = height * webPageHeightRatio;
307
308
  height = height * browserPageHeightFocusRatio;
308
309
  // 调用handleSizeChanged修改iframe高度
@@ -13,7 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
13
13
  import axios from 'axios';
14
14
  import { ServiceProvider } from '..';
15
15
  import { errorEnum } from "./deps";
16
- import { appId, device, fomatGetwayError, get, hostSignMap, isPC, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
16
+ import { appId, device, fomatGetwayError, get, hostSignMap, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
17
17
 
18
18
  /**
19
19
  * @author congle.zzq <congle.zzq@alipay.com>
@@ -149,7 +149,7 @@ export var RequesterService = /*#__PURE__*/function () {
149
149
  value: function getEnvInfo(options) {
150
150
  var _options$envInfo;
151
151
  var envInfo = _objectSpread(_objectSpread({
152
- terminalType: isPC() ? 'WEB' : 'WAP',
152
+ terminalType: device.isMobile ? 'WAP' : 'WEB',
153
153
  browserInfo: {
154
154
  browserJavaScriptEnabled: true,
155
155
  browserLanguage: navigator.language,
@@ -1,6 +1,6 @@
1
- import { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, IPaymentSessionMetaData } from '../../types';
1
+ import { ESP_PAGE_NAME } from '../../constant/easysafepay';
2
+ import { DisplayTypeEnum, IPaymentSessionMetaData, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from '../../types';
2
3
  import { SDKMetaData } from '../index';
3
- import { ESP_PAGE_NAME } from "../../constant/easysafepay";
4
4
  /**
5
5
  * Tell the SDK which version of the Web App to load.
6
6
  * Sent by server inside paymentSession.
@@ -110,7 +110,7 @@ export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum, enviro
110
110
  * V2应用EasySafePay 热更新兜底URL构建规则
111
111
  * 1. 兜底URL版本与sdk版本保持一致
112
112
  * 2. DEV环境下html新增版本前缀
113
- **/
113
+ **/
114
114
  export declare const getDefaultEasySafePayPageUrl: (pageName: ESP_PAGE_NAME, env: string) => string;
115
115
  /**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
116
116
  export declare const getDoubleFaUrlFromSession: (paymentSessionObj: IPaymentSessionMetaData, env?: string) => string;
@@ -4,12 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
+ import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config";
8
+ import { ESP_PAGE_NAME } from "../../constant/easysafepay";
7
9
  import { ComponentSignEnum, ProductSceneEnum } from "../../types";
8
- import { marmotMap, v2AppMarmotMap, sdkVersion } from "../../config";
9
10
  import { queryParse, serialize } from "../../util";
10
- import { compareVersion } from "../../util/versionCompare";
11
11
  import { isDebugLog } from "../../util/debug";
12
- import { ESP_PAGE_NAME } from "../../constant/easysafepay";
12
+ import { compareVersion } from "../../util/versionCompare";
13
+
13
14
  /**
14
15
  * Tell the SDK which version of the Web App to load.
15
16
  * Sent by server inside paymentSession.
@@ -117,6 +118,9 @@ var getAppPath = function getAppPath() {
117
118
  var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
118
119
  var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
119
120
  var webAppVersion = sdkMetaData.webAppVersion;
121
+ if (productSceneWithPaymentMethodCategoryType === ComponentSignEnum.AUTO_DEBIT_APM) {
122
+ return "".concat(v2AppMarmotMap[environment], "/auto-debit/").concat(webAppVersion, "/pages/trustly/index.html");
123
+ }
120
124
  switch (productScene) {
121
125
  case ProductSceneEnum.EASY_PAY:
122
126
  return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene, environment);
@@ -151,7 +155,7 @@ export var parseWebAppUrlMatchConfig = function parseWebAppUrlMatchConfig(extend
151
155
  };
152
156
  var getValidProductSceneVersion = function getValidProductSceneVersion(productScene, productSceneVer, paymentMethodCategoryType) {
153
157
  var _supportMapping;
154
- var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']));
158
+ var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']), ComponentSignEnum.AUTO_DEBIT_APM, ['1.0']));
155
159
  var targetVersions = supportMapping[productScene + '_' + paymentMethodCategoryType];
156
160
  if (!targetVersions) {
157
161
  return '';
@@ -251,8 +255,8 @@ export var matchEasySafePayV2Url = function matchEasySafePayV2Url(params) {
251
255
  if (!config) return defaultEspUrl;
252
256
 
253
257
  // 根据pageName匹配URL
254
- if (pageName == ESP_PAGE_NAME.SDK_PORTAL) return (config === null || config === void 0 ? void 0 : config.url) || defaultEspUrl;
255
- if (pageName == ESP_PAGE_NAME.DOUBLE_FA) return (config === null || config === void 0 ? void 0 : config.doubleFa) || defaultEspUrl;
258
+ if (pageName === ESP_PAGE_NAME.SDK_PORTAL) return (config === null || config === void 0 ? void 0 : config.url) || defaultEspUrl;
259
+ if (pageName === ESP_PAGE_NAME.DOUBLE_FA) return (config === null || config === void 0 ? void 0 : config.doubleFa) || defaultEspUrl;
256
260
  return defaultEspUrl;
257
261
  };
258
262
 
@@ -275,7 +279,7 @@ export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene, envi
275
279
  * @param productScene - The product scene for which the default checkout URL should be provided.
276
280
  */
277
281
  export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
278
- var environment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "prod";
282
+ var environment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'prod';
279
283
  switch (productScene) {
280
284
  case ProductSceneEnum.EASY_PAY:
281
285
  return getDefaultEasySafePayPageUrl(ESP_PAGE_NAME.SDK_PORTAL, environment);
@@ -288,7 +292,7 @@ export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
288
292
  * V2应用EasySafePay 热更新兜底URL构建规则
289
293
  * 1. 兜底URL版本与sdk版本保持一致
290
294
  * 2. DEV环境下html新增版本前缀
291
- **/
295
+ **/
292
296
  export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(pageName, env) {
293
297
  // 生成的URL EXAMPLE:
294
298
  // const DEFAULT_DOUBLE_FA_URL_MAPPING = {
@@ -298,14 +302,14 @@ export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(
298
302
  // pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
299
303
  // prod: 'https://checkout.antom.com/easysafepay/1.36.0/pages/double-fa/index.html',
300
304
  // };
301
- var environment = env || "prod";
302
- if (environment === "dev") return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index-").concat(sdkVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index.html");
305
+ var environment = env || 'prod';
306
+ if (environment === 'dev') return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index-").concat(sdkVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index.html");
303
307
  };
304
308
 
305
309
  /**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
306
310
  //TODO 后续需要构造一个类,专门用于构造&存储web应用url
307
311
  export var getDoubleFaUrlFromSession = function getDoubleFaUrlFromSession(paymentSessionObj) {
308
- var env = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "prod";
312
+ var env = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'prod';
309
313
  var mid = paymentSessionObj.clientId;
310
314
  var extendInfo = paymentSessionObj.extendInfo;
311
315
  var configs = parseWebAppUrlMatchConfig(extendInfo);
package/esm/index.d.ts CHANGED
@@ -7,10 +7,6 @@ export * from './types';
7
7
  export declare class AMSCheckout extends AMSComponent {
8
8
  constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
9
9
  }
10
- export declare class AMSAutoDebit extends AMSCheckout {
11
- constructor(options: IoptionsParams);
12
- static preload(options?: IPreloadOptions): void;
13
- }
14
10
  export declare class AMSAutoDebitPay extends AMSCheckout {
15
11
  constructor(options: IoptionsParams);
16
12
  static preload(options?: IPreloadOptions): void;
@@ -39,4 +35,11 @@ export declare class AMSEasyPay {
39
35
  createComponent(params: IcreateComponent): void;
40
36
  unmount(): void;
41
37
  }
38
+ export declare class AMSAutoDebit {
39
+ private core;
40
+ constructor(options: IoptionsParams);
41
+ createComponent(params: IcreateComponent): Promise<void>;
42
+ unmount(): void;
43
+ static preload(options?: IPreloadOptions): void;
44
+ }
42
45
  export default AMSCheckout;