@alipay/ams-checkout 0.0.1730107332-dev.3 → 0.0.1730107332-dev.30

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.
Files changed (102) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +2 -3
  3. package/esm/component/channel.js +65 -30
  4. package/esm/component/component.inline.style.js +1 -1
  5. package/esm/component/component.popup.style.d.ts +1 -3
  6. package/esm/component/component.popup.style.js +1 -3
  7. package/esm/config/index.d.ts +7 -7
  8. package/esm/config/index.js +7 -7
  9. package/esm/constant/index.d.ts +3 -0
  10. package/esm/constant/index.js +3 -0
  11. package/esm/core/bus/ability/callback.d.ts +9 -0
  12. package/esm/core/bus/ability/callback.js +55 -0
  13. package/esm/core/bus/ability/security.d.ts +10 -0
  14. package/esm/core/bus/ability/security.js +104 -0
  15. package/esm/core/bus/ability/tracker.d.ts +9 -0
  16. package/esm/core/bus/ability/tracker.js +77 -0
  17. package/esm/core/bus/index.d.ts +125 -0
  18. package/esm/core/bus/index.js +366 -0
  19. package/esm/core/bus/interface.d.ts +36 -0
  20. package/esm/core/bus/interface.js +40 -0
  21. package/esm/core/component/address.d.ts +8 -0
  22. package/esm/core/component/address.js +72 -0
  23. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  24. package/esm/core/component/appPreloadProcessing.js +89 -0
  25. package/esm/core/component/ckp/index.d.ts +27 -0
  26. package/esm/core/component/ckp/index.js +166 -0
  27. package/esm/core/component/index.d.ts +51 -0
  28. package/esm/core/component/index.js +531 -0
  29. package/esm/core/drop-in/index.d.ts +22 -0
  30. package/esm/core/drop-in/index.js +104 -0
  31. package/esm/core/instance/index.d.ts +89 -0
  32. package/esm/core/instance/index.js +499 -0
  33. package/esm/foundation/core/index.d.ts +2 -2
  34. package/esm/foundation/core/index.js +8 -4
  35. package/esm/foundation/index.d.ts +8 -5
  36. package/esm/foundation/product-processor/easysafepay/deps.d.ts +5 -4
  37. package/esm/foundation/product-processor/easysafepay/deps.js +3 -2
  38. package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -3
  39. package/esm/foundation/product-processor/easysafepay/index.js +115 -231
  40. package/esm/foundation/service/api-bus/index.d.ts +2 -2
  41. package/esm/foundation/service/container/index.d.ts +2 -2
  42. package/esm/foundation/service/container/index.js +0 -1
  43. package/esm/foundation/service/event-center.d.ts +4 -4
  44. package/esm/foundation/service/event-center.js +10 -10
  45. package/esm/foundation/service/global-data/index.d.ts +2 -2
  46. package/esm/foundation/service/index.d.ts +2 -2
  47. package/esm/foundation/service/log/index.d.ts +2 -2
  48. package/esm/foundation/service/requester/deps.d.ts +1 -1
  49. package/esm/foundation/service/requester/requester.d.ts +2 -2
  50. package/esm/foundation/service/security/index.d.ts +2 -2
  51. package/esm/foundation/service/security/index.js +1 -0
  52. package/esm/foundation/utils/redirect_utils.d.ts +5 -0
  53. package/esm/foundation/utils/redirect_utils.js +178 -24
  54. package/esm/foundation/utils/web_app_url_utils.js +1 -1
  55. package/esm/index.d.ts +27 -2
  56. package/esm/index.js +133 -7
  57. package/esm/plugin/applepay/component.d.ts +50 -0
  58. package/esm/plugin/applepay/component.js +339 -0
  59. package/esm/plugin/applepay/index.d.ts +17 -0
  60. package/esm/plugin/applepay/index.js +117 -0
  61. package/esm/plugin/applepay/interface.d.ts +161 -0
  62. package/esm/plugin/applepay/interface.js +69 -0
  63. package/esm/plugin/applepay/service.d.ts +54 -0
  64. package/esm/plugin/applepay/service.js +289 -0
  65. package/esm/plugin/component/cashierApp.d.ts +34 -0
  66. package/esm/plugin/component/cashierApp.js +237 -0
  67. package/esm/plugin/component/channel.d.ts +21 -0
  68. package/esm/plugin/component/channel.js +89 -0
  69. package/esm/plugin/component/component.inline.style.d.ts +10 -0
  70. package/esm/plugin/component/component.inline.style.js +119 -0
  71. package/esm/plugin/component/component.popup.style.d.ts +16 -0
  72. package/esm/plugin/component/component.popup.style.js +174 -0
  73. package/esm/plugin/component/index.d.ts +126 -0
  74. package/esm/plugin/component/index.js +1839 -0
  75. package/esm/plugin/component/popupWindow.style.d.ts +11 -0
  76. package/esm/plugin/component/popupWindow.style.js +121 -0
  77. package/esm/plugin/const.d.ts +2 -0
  78. package/esm/plugin/const.js +33 -0
  79. package/esm/plugin/drop-in/index.d.ts +71 -0
  80. package/esm/plugin/drop-in/index.js +324 -0
  81. package/esm/plugin/payment-element/utils.d.ts +2 -0
  82. package/esm/plugin/payment-element/utils.js +6 -0
  83. package/esm/plugin/paypal/index.d.ts +20 -0
  84. package/esm/plugin/paypal/index.js +390 -0
  85. package/esm/plugin/type.d.ts +34 -0
  86. package/esm/plugin/type.js +1 -0
  87. package/esm/plugin/utils.d.ts +6 -0
  88. package/esm/plugin/utils.js +21 -0
  89. package/esm/types/index.d.ts +10 -11
  90. package/esm/types/index.js +2 -1
  91. package/esm/util/createIframeNode.d.ts +6 -0
  92. package/esm/util/createIframeNode.js +48 -0
  93. package/esm/util/getBackScheme.d.ts +5 -0
  94. package/esm/util/getBackScheme.js +134 -0
  95. package/esm/util/index.d.ts +1 -1
  96. package/esm/util/index.js +4 -3
  97. package/esm/util/intl-callapp/es/index.js +0 -1
  98. package/esm/util/security.d.ts +33 -0
  99. package/esm/util/security.js +182 -0
  100. package/package.json +2 -2
  101. package/esm/foundation/types/index.d.ts +0 -4
  102. package/esm/foundation/types/index.js +0 -4
@@ -1,11 +1,12 @@
1
+ export { v4 as uuid } from 'uuid';
1
2
  import * as _ChannelCustomize from "../../../component/channel";
2
3
  export { _ChannelCustomize as ChannelCustomize };
3
4
  export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from "../../../types";
4
- export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
5
- export { v4 as uuid } from 'uuid';
6
5
  export { isPC } from "../../../util";
6
+ export { getBackScheme } from "../../utils/redirect_utils";
7
7
  export { isLocalMock } from "../../../util/mock";
8
8
  export { ServiceProvider } from "../../service";
9
9
  export { LogService } from "../../service/log";
10
+ export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
10
11
  import * as _WebAppUrlUtil from "../../utils/web_app_url_utils";
11
12
  export { _WebAppUrlUtil as WebAppUrlUtil };
@@ -1,4 +1,4 @@
1
- import { BizFlowStartBehavior, IOptionsParams, PaymentContext, ProductProcessor, SDKMetaData } from './deps';
1
+ import { BizFlowStartBehavior, IoptionsParams, PaymentContext, ProductProcessor, SDKMetaData } from './deps';
2
2
  export declare class EasySafePayProcessor implements ProductProcessor {
3
3
  private paymentContext?;
4
4
  private initConfig;
@@ -9,7 +9,7 @@ export declare class EasySafePayProcessor implements ProductProcessor {
9
9
  private allowSubmitPayCallAhead;
10
10
  private channelBehavior?;
11
11
  private SECURITY_SDK_INIT_TIMEOUT;
12
- init(config: IOptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
12
+ init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
13
13
  startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
14
14
  private preloadWebApp;
15
15
  private buildWebAppPreloadUrl;
@@ -20,7 +20,6 @@ export declare class EasySafePayProcessor implements ProductProcessor {
20
20
  * start waiting web launch, then send renderComponent event
21
21
  * */
22
22
  private sendRequestAndWaitWebLaunch;
23
- private processPaymentQuery;
24
23
  private processSubmitPay;
25
24
  private acquireApdidToken;
26
25
  private initSecuritySDK;
@@ -16,7 +16,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
16
16
  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; }
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
18
  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); }
19
- import { uuid, ProductSceneEnum, ChannelCustomize, DisplayTypeEnum, isLocalMock, isPC, ServiceProvider, ProductInfoCacheUtil, WebAppUrlUtil } from "./deps";
19
+ import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, ProductInfoCacheUtil, ProductSceneEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
20
20
  export var EasySafePayProcessor = /*#__PURE__*/function () {
21
21
  function EasySafePayProcessor() {
22
22
  _classCallCheck(this, EasySafePayProcessor);
@@ -74,9 +74,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
74
74
  }
75
75
  return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
76
76
  case 12:
77
- _context.next = 14;
78
- return this.initSecuritySDK();
79
- case 14:
80
77
  // 下面的场景是需要渲染UI的渠道, 打开WebUrl
81
78
  webAppUrl = this.buildWebAppUrl(); // const webAppUrl = 'http://svc-9kvjxwjf68cptha8.cloudide.svc.et15-sqa.alipay.net:5173/src/component-app/index.html';
82
79
  resultPayload = {
@@ -88,14 +85,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
88
85
  hostSign: this.hostSign,
89
86
  productSceneVersion: productSceneVersion
90
87
  });
91
- // 返回结果之前,发送actionquery,并且等待Web应用启动的事件,内部是异步处理,不阻塞。
88
+ // 返回结果之前,发送 sessionData,并且等待Web应用启动的事件,内部是异步处理,不阻塞。
92
89
  this.sendRequestAndWaitWebLaunch();
93
90
  // 返回结果,RENDER,让外层去处理iframe加载等逻辑
94
91
  return _context.abrupt("return", {
95
92
  behaviorType: 'RENDER',
96
93
  payload: resultPayload
97
94
  });
98
- case 19:
95
+ case 17:
99
96
  case "end":
100
97
  return _context.stop();
101
98
  }
@@ -209,15 +206,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
209
206
  value: function sendRequestAndWaitWebLaunch() {
210
207
  var _this2 = this;
211
208
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
212
- var requestPromise = Promise.all([this.processPaymentQuery(), this.processSubmitPay()]).then(function (_ref) {
213
- var _ref2 = _slicedToArray(_ref, 2),
214
- queryRes = _ref2[0],
215
- submitRes = _ref2[1];
216
- return {
217
- queryRes: queryRes,
218
- submitRes: submitRes
219
- };
220
- });
221
209
  var webLaunchPromise = new Promise(function (resolve) {
222
210
  eventCenter.listen('onLaunch', function (res) {
223
211
  resolve(res);
@@ -225,23 +213,24 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
225
213
  });
226
214
 
227
215
  // 等请求和 Web启动都Ready之后,发送renderComponent
228
- Promise.all([requestPromise, webLaunchPromise]).then(function (_ref3) {
216
+ Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
229
217
  var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6;
230
- var _ref4 = _slicedToArray(_ref3, 2),
231
- requestResult = _ref4[0],
232
- launchRes = _ref4[1];
218
+ var _ref2 = _slicedToArray(_ref, 3),
219
+ _initSecurityRes = _ref2[0],
220
+ submitRes = _ref2[1],
221
+ _webLaunchRes = _ref2[2];
233
222
  var logMetaData = _this2.logger.getLogConfig().mdata;
234
223
  eventCenter.dispatchToApp({
235
224
  event: 'renderComponent',
236
225
  data: {
237
- queryResult: requestResult.queryRes,
238
- submitResult: requestResult.submitRes,
239
226
  sessionResult: (_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj,
227
+ submitResult: submitRes,
240
228
  paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSession,
241
229
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
242
230
  renderDisplayType: _this2.paymentContext.displayInfo.type,
243
231
  appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
244
232
  notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
233
+ isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
245
234
  merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
246
235
  allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
247
236
  envInfo: {
@@ -264,160 +253,40 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
264
253
  });
265
254
  }
266
255
  }, {
267
- key: "processPaymentQuery",
256
+ key: "processSubmitPay",
268
257
  value: function () {
269
- var _processPaymentQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
270
- var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$channelBehavior2;
271
- var envInfo, requestData, extendInfo, actionData, enableEasypayApiOptimize, extendInfoData, productSceneVersion, requestBizId, requester, res;
258
+ var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
259
+ var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$2;
260
+ var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
272
261
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
273
262
  while (1) switch (_context2.prev = _context2.next) {
274
- case 0:
275
- envInfo = {
276
- locale: this.initConfig.locale
277
- }; //
278
- requestData = {
279
- paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSession) || '',
280
- 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,
281
- notRedirectAfterComplete: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.startBizFlowOptions.submitPayRequestExtra.notRedirectAfterComplete) === true
282
- // merchantAppointParam: this._merchantAppointParam,
283
- };
284
- extendInfo = ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.extendInfo) || '';
285
- actionData = (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 || (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.action;
286
- enableEasypayApiOptimize = false;
287
- try {
288
- extendInfoData = JSON.parse(extendInfo);
289
- enableEasypayApiOptimize = extendInfoData.enableEasypayApiOptimize || false;
290
- } catch (error) {
291
- console.log(error);
292
- }
293
- if (!isLocalMock()) {
294
- _context2.next = 8;
295
- break;
296
- }
297
- return _context2.abrupt("return", {
298
- message: 'sdk no need to make query request',
299
- success: true
300
- });
301
- case 8:
302
- if (!((_this$channelBehavior2 = this.channelBehavior) !== null && _this$channelBehavior2 !== void 0 && _this$channelBehavior2.usePaymentSessionAsQueryResult)) {
303
- _context2.next = 10;
304
- break;
305
- }
306
- return _context2.abrupt("return", {
307
- autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
308
- amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
309
- success: true
310
- });
311
- case 10:
312
- if (!(actionData.skipSdkQuery && enableEasypayApiOptimize)) {
313
- _context2.next = 12;
314
- break;
315
- }
316
- return _context2.abrupt("return", {
317
- message: 'sdk no need to make query request',
318
- success: true
319
- });
320
- case 12:
321
- productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion; // ESP 2.0 无需Query
322
- if (!(productSceneVersion === '2.0')) {
323
- _context2.next = 15;
324
- break;
325
- }
326
- return _context2.abrupt("return", {
327
- message: 'sdk no need to make query request',
328
- success: true
329
- });
330
- case 15:
331
- _context2.next = 17;
332
- return this.acquireApdidToken();
333
- case 17:
334
- envInfo.deviceId = _context2.sent;
335
- requestBizId = uuid(); // 打日志
336
- this.logger.logInfo({
337
- title: 'sdk_event_sdkQuery'
338
- }, {
339
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
340
- requestBizId: requestBizId
341
- });
342
-
343
- // 真正发请求
344
- requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
345
- _context2.prev = 21;
346
- _context2.next = 24;
347
- return requester.request(requestData, {
348
- env: this.initConfig.environment,
349
- envInfo: envInfo,
350
- hostSign: this.hostSign,
351
- 'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
352
- });
353
- case 24:
354
- res = _context2.sent;
355
- this.logger.logInfo({
356
- title: 'sdk_event_sdkQueryEnd'
357
- }, {
358
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
359
- requestBizId: requestBizId,
360
- traceId: res.traceId
361
- });
362
- return _context2.abrupt("return", res);
363
- case 29:
364
- _context2.prev = 29;
365
- _context2.t0 = _context2["catch"](21);
366
- this.logger.logError({
367
- title: 'sdk_event_sdkQuery_failed'
368
- }, {
369
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
370
- errorReason: _context2.t0,
371
- requestBizId: requestBizId,
372
- traceId: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.traceId
373
- });
374
- throw _context2.t0;
375
- case 33:
376
- case "end":
377
- return _context2.stop();
378
- }
379
- }, _callee2, this, [[21, 29]]);
380
- }));
381
- function processPaymentQuery() {
382
- return _processPaymentQuery.apply(this, arguments);
383
- }
384
- return processPaymentQuery;
385
- }()
386
- }, {
387
- key: "processSubmitPay",
388
- value: function () {
389
- var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
390
- var _this$paymentContext6, _this$paymentContext7, _this$paymentContext9, _this$channelBehavior3, _this$channelBehavior4, _this$paymentContext$;
391
- var submitParams, shouldSkipSubmitPayInSDK, _this$paymentContext8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref6, _ref6$action, _ref6$action2, _ref6$action2$enableS, enableSignAgreement, _ref6$action2$autoDeb, autoDebitWithToken, requestBizId, extParams, requester, res;
392
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
393
- while (1) switch (_context3.prev = _context3.next) {
394
263
  case 0:
395
264
  submitParams = {
396
- paymentSessionData: ((_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSession) || '',
397
- 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
265
+ paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSession) || '',
266
+ 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
398
267
  };
399
- shouldSkipSubmitPayInSDK = false;
400
- if (this.channelBehavior) {
401
- // 新逻辑走 channelBehavior判断
402
- shouldSkipSubmitPayInSDK = !this.channelBehavior.submitPayInSdk;
403
- } else {
404
- // TODO: 拉会找栎昂、甘颜一起对下
405
- // 老逻辑,只要服务端标记不跳过sdkquery,就需要跳过submitpay
406
- shouldSkipSubmitPayInSDK = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.skipSdkQuery);
407
- }
408
- _ref5 = submitParams.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer;
409
- _ref6 = ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionObj) || {}, _ref6$action = _ref6.action, _ref6$action2 = _ref6$action === void 0 ? {} : _ref6$action, _ref6$action2$enableS = _ref6$action2.enableSignAgreement, enableSignAgreement = _ref6$action2$enableS === void 0 ? false : _ref6$action2$enableS, _ref6$action2$autoDeb = _ref6$action2.autoDebitWithToken, autoDebitWithToken = _ref6$action2$autoDeb === void 0 ? false : _ref6$action2$autoDeb;
268
+ _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
269
+ _ref4 = ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.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;
410
270
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
411
271
  ///EasyPay 2.0 首次传signAgreement字段
412
272
  submitParams['signAgreement'] = enableSignAgreement;
273
+ paymentMethodType = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType;
274
+ isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
275
+ if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
276
+ backScheme = getBackScheme(undefined, this.logger);
277
+ if (backScheme && backScheme !== 'https') {
278
+ submitParams['h5FromApp'] = encodeURIComponent(backScheme);
279
+ }
280
+ }
413
281
  }
414
- // 带上标记告知WebCheckOut SDK已发送submitpay请求
415
- this.allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
416
- if (!shouldSkipSubmitPayInSDK) {
417
- _context3.next = 9;
282
+ this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
283
+ console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
284
+ if (this.allowSubmitPayCallAhead) {
285
+ _context2.next = 9;
418
286
  break;
419
287
  }
420
- return _context3.abrupt("return", {
288
+ console.log('[web-sdk] DO NOT call submitPay');
289
+ return _context2.abrupt("return", {
421
290
  message: 'sdk no need to make submitPay request',
422
291
  success: true
423
292
  });
@@ -430,40 +299,42 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
430
299
  requestBizId: requestBizId
431
300
  });
432
301
  // 由渠道定制点来构建额外参数
433
- extParams = ((_this$channelBehavior3 = this.channelBehavior) === null || _this$channelBehavior3 === void 0 || (_this$channelBehavior4 = _this$channelBehavior3.buildSubmitPayExtParams) === null || _this$channelBehavior4 === void 0 ? void 0 : _this$channelBehavior4.call(_this$channelBehavior3, {
302
+ 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, {
434
303
  instanceId: this.instanceId,
435
304
  locale: this.initConfig.locale,
436
- paymentMethodType: (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType,
305
+ paymentMethodType: (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentMethodInfoView) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.paymentMethodType,
437
306
  paymentSessionData: this.paymentContext.paymentSession,
438
307
  env: this.initConfig.environment,
439
308
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
440
309
  })) || {};
310
+ extParams.complianceSDK = true;
441
311
  submitParams.extParams = extParams;
442
312
  requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
443
- _context3.prev = 14;
444
- _context3.t0 = requester;
445
- _context3.t1 = submitParams;
446
- _context3.t2 = this.initConfig.environment;
447
- _context3.next = 20;
313
+ _context2.prev = 15;
314
+ console.log('[web-sdk] DO call submitPay');
315
+ _context2.t0 = requester;
316
+ _context2.t1 = submitParams;
317
+ _context2.t2 = this.initConfig.environment;
318
+ _context2.next = 22;
448
319
  return this.acquireApdidToken();
449
- case 20:
450
- _context3.t3 = _context3.sent;
451
- _context3.t4 = {
452
- deviceId: _context3.t3
320
+ case 22:
321
+ _context2.t3 = _context2.sent;
322
+ _context2.t4 = {
323
+ deviceId: _context2.t3
453
324
  };
454
- _context3.t5 = this.hostSign;
455
- _context3.t6 = {
456
- env: _context3.t2,
325
+ _context2.t5 = this.hostSign;
326
+ _context2.t6 = {
327
+ env: _context2.t2,
457
328
  timeout: 15000,
458
- envInfo: _context3.t4,
459
- hostSign: _context3.t5,
329
+ envInfo: _context2.t4,
330
+ hostSign: _context2.t5,
460
331
  needEnvInfo: true,
461
332
  'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
462
333
  };
463
- _context3.next = 26;
464
- return _context3.t0.request.call(_context3.t0, _context3.t1, _context3.t6);
465
- case 26:
466
- res = _context3.sent;
334
+ _context2.next = 28;
335
+ return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
336
+ case 28:
337
+ res = _context2.sent;
467
338
  this.logger.logInfo({
468
339
  title: 'sdk_event_submitPayEnd'
469
340
  }, {
@@ -471,50 +342,50 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
471
342
  requestBizId: requestBizId,
472
343
  traceId: res.traceId
473
344
  });
474
- return _context3.abrupt("return", res);
475
- case 31:
476
- _context3.prev = 31;
477
- _context3.t7 = _context3["catch"](14);
345
+ return _context2.abrupt("return", res);
346
+ case 33:
347
+ _context2.prev = 33;
348
+ _context2.t7 = _context2["catch"](15);
478
349
  this.logger.logError({
479
350
  title: 'sdk_event_submitPay_failed'
480
351
  }, {
481
352
  paymentSessionConfig: JSON.stringify(submitParams.paymentSessionConfig),
482
- errorReason: _context3.t7,
353
+ errorReason: _context2.t7,
483
354
  requestBizId: requestBizId,
484
- traceId: _context3.t7 === null || _context3.t7 === void 0 ? void 0 : _context3.t7.traceId
355
+ traceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
485
356
  });
486
- throw _context3.t7;
487
- case 35:
357
+ throw _context2.t7;
358
+ case 37:
488
359
  case "end":
489
- return _context3.stop();
360
+ return _context2.stop();
490
361
  }
491
- }, _callee3, this, [[14, 31]]);
362
+ }, _callee2, this, [[15, 33]]);
492
363
  }));
493
364
  function processSubmitPay() {
494
365
  return _processSubmitPay.apply(this, arguments);
495
366
  }
496
367
  return processSubmitPay;
497
- }() // TOOD: 讨论下是否放到 requester里面
368
+ }()
498
369
  }, {
499
370
  key: "acquireApdidToken",
500
371
  value: function () {
501
- var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
502
- var _this$paymentContext$2;
372
+ var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
373
+ var _this$paymentContext$3;
503
374
  var securityService, productScene, deviceId;
504
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
505
- while (1) switch (_context4.prev = _context4.next) {
375
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
376
+ while (1) switch (_context3.prev = _context3.next) {
506
377
  case 0:
507
378
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
508
- productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
379
+ productScene = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentSessionConfig) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.productScene;
509
380
  deviceId = securityService.getDeviceId({
510
381
  productScene: productScene
511
382
  });
512
- return _context4.abrupt("return", deviceId);
383
+ return _context3.abrupt("return", deviceId);
513
384
  case 4:
514
385
  case "end":
515
- return _context4.stop();
386
+ return _context3.stop();
516
387
  }
517
- }, _callee4, this);
388
+ }, _callee3, this);
518
389
  }));
519
390
  function acquireApdidToken() {
520
391
  return _acquireApdidToken.apply(this, arguments);
@@ -524,58 +395,71 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
524
395
  }, {
525
396
  key: "initSecuritySDK",
526
397
  value: function () {
527
- var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
528
- var _this$paymentContext$3, productSceneVersion, nonCompliant, isFirstTimeToPay;
529
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
530
- while (1) switch (_context5.prev = _context5.next) {
398
+ var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
399
+ var _this$paymentContext$4, _this$paymentContext$5, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay;
400
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
401
+ while (1) switch (_context4.prev = _context4.next) {
531
402
  case 0:
532
- _context5.prev = 0;
403
+ _context4.prev = 0;
533
404
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
534
- nonCompliant = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.nonCompliant;
405
+ nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
406
+ nonInitSecuritySDK = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.nonInitSecuritySDK;
535
407
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
408
+ if (!nonInitSecuritySDK) {
409
+ _context4.next = 8;
410
+ break;
411
+ }
412
+ // 钱包不依赖风控
413
+ console.log('[web-sdk][security-sdk] DO NOT init security sdk when nonInitSecuritySDK is true');
414
+ return _context4.abrupt("return");
415
+ case 8:
536
416
  if (!(productSceneVersion === '1.0')) {
537
- _context5.next = 9;
417
+ _context4.next = 13;
538
418
  break;
539
419
  }
540
- console.log('[web-sdk][security-sdk] skip init security sdk for easypay 1.0');
541
420
  // 1.0 不初始化 SecuritySDK
542
- return _context5.abrupt("return");
543
- case 9:
421
+ console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 1.0');
422
+ return _context4.abrupt("return");
423
+ case 13:
544
424
  if (!(productSceneVersion === '2.0')) {
545
- _context5.next = 20;
425
+ _context4.next = 27;
546
426
  break;
547
427
  }
548
428
  if (!(nonCompliant === true)) {
549
- _context5.next = 16;
429
+ _context4.next = 20;
550
430
  break;
551
431
  }
552
432
  // 未切流「隐私合规」
553
- console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and nonCompliant is true');
554
- _context5.next = 14;
433
+ console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and nonCompliant is true');
434
+ _context4.next = 18;
555
435
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
556
- case 14:
557
- _context5.next = 20;
436
+ case 18:
437
+ _context4.next = 27;
558
438
  break;
559
- case 16:
560
- if (isFirstTimeToPay) {
561
- _context5.next = 20;
439
+ case 20:
440
+ if (!isFirstTimeToPay) {
441
+ _context4.next = 24;
562
442
  break;
563
443
  }
444
+ console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0 and when first time to pay');
445
+ _context4.next = 27;
446
+ break;
447
+ case 24:
564
448
  // 切流「隐私合规」且非首次支付
565
- console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and when not first time to pay');
566
- _context5.next = 20;
449
+ console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
450
+ _context4.next = 27;
567
451
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
568
- case 20:
569
- _context5.next = 24;
452
+ case 27:
453
+ _context4.next = 31;
570
454
  break;
571
- case 22:
572
- _context5.prev = 22;
573
- _context5.t0 = _context5["catch"](0);
574
- case 24:
455
+ case 29:
456
+ _context4.prev = 29;
457
+ _context4.t0 = _context4["catch"](0);
458
+ case 31:
575
459
  case "end":
576
- return _context5.stop();
460
+ return _context4.stop();
577
461
  }
578
- }, _callee5, this, [[0, 22]]);
462
+ }, _callee4, this, [[0, 29]]);
579
463
  }));
580
464
  function initSecuritySDK() {
581
465
  return _initSecuritySDK.apply(this, arguments);
@@ -1,5 +1,5 @@
1
1
  import { Service } from '../../index';
2
- import { IOptionsParams } from '../../../types';
2
+ import { IoptionsParams } from '../../../types';
3
3
  import { LogService } from '../log';
4
4
  import { BusMessage, BusSubscriber, OnBusCallback } from './busManager';
5
5
  /**
@@ -10,7 +10,7 @@ export declare class ApiBusManagerService implements Service {
10
10
  protected logger: LogService;
11
11
  protected instanceId: string;
12
12
  private busManager;
13
- init(initOptions: IOptionsParams, instanceId: string): void;
13
+ init(initOptions: IoptionsParams, instanceId: string): void;
14
14
  subscribe(subscriber: BusSubscriber): void;
15
15
  unsubscribe(subscriber: BusSubscriber): void;
16
16
  isSubscribed(actionName: string): boolean;
@@ -1,5 +1,5 @@
1
1
  import { DisplayInfo, SDKMetaData, Service } from '../../index';
2
- import { IOptionsParams } from '../../../types';
2
+ import { IoptionsParams } from '../../../types';
3
3
  export declare class ContainerService implements Service {
4
4
  private instanceId;
5
5
  private sdkMetaData;
@@ -11,7 +11,7 @@ export declare class ContainerService implements Service {
11
11
  private webApp;
12
12
  private customizedLoadingListener;
13
13
  destroy(): void;
14
- init(initOptions: IOptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
14
+ init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
15
15
  update(): void;
16
16
  load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
17
17
  cleanContainer(displayInfo: DisplayInfo): void;
@@ -54,7 +54,6 @@ export var ContainerService = /*#__PURE__*/function () {
54
54
  }, {
55
55
  key: "load",
56
56
  value: function load(displayInfo, url, closeBtnFunc) {
57
- console.log('load');
58
57
  var webApp = createIframe('antom-sdk-web-app' + (displayInfo.appendAliasContainerId ? "-".concat(displayInfo.selector) : ''));
59
58
  this.webApp = webApp;
60
59
  this.displayInfo = displayInfo;
@@ -1,4 +1,4 @@
1
- import { EventPayload, EventPayloadContext, IOptionsParams } from '../../types';
1
+ import { EventPayload, EventPayloadContext, IoptionsParams } from '../../types';
2
2
  import { SDKMetaData, Service } from '../index';
3
3
  /**
4
4
  * @author 江跃 <jiangbin.gjb@antgroup.com>
@@ -12,7 +12,7 @@ export declare class EventCenter implements Service {
12
12
  /**
13
13
  * Initializes the event center
14
14
  */
15
- init(initOptions: IOptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
15
+ init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
16
16
  /**
17
17
  * Cleans up event listeners when the event center is destroyed.
18
18
  */
@@ -54,7 +54,7 @@ export declare class EventCenter implements Service {
54
54
  * @param name - The name of the event to emit.
55
55
  * @param data - The event data to pass to the event listeners.
56
56
  */
57
- emit(name: string, data: any, eventPayload?: EventPayload): void;
57
+ emit(name: string, data: any, EventPayload?: EventPayload): void;
58
58
  /**
59
59
  * Registers a callback for an event and immediately dispatches the event to the app.
60
60
  * @param payloadContext - The context containing event information and callback ID.
@@ -69,6 +69,6 @@ export declare class EventCenter implements Service {
69
69
  isExist(name: string): boolean;
70
70
  }
71
71
  interface IListener {
72
- (data: any, eventPayload?: EventPayload): void;
72
+ (data: any, EventPayload?: EventPayload): void;
73
73
  }
74
74
  export {};