@alipay/ams-checkout 0.0.1730107332-dev.4 → 0.0.1730107332-dev.40

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 (122) 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 +63 -29
  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 +10 -10
  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 +167 -0
  27. package/esm/core/component/element/components/address.d.ts +19 -0
  28. package/esm/core/component/element/components/address.js +68 -0
  29. package/esm/core/component/element/components/auth.d.ts +17 -0
  30. package/esm/core/component/element/components/auth.js +60 -0
  31. package/esm/core/component/element/components/payment.d.ts +19 -0
  32. package/esm/core/component/element/components/payment.js +74 -0
  33. package/esm/core/component/element/index.d.ts +47 -0
  34. package/esm/core/component/element/index.js +816 -0
  35. package/esm/core/component/element/mock.d.ts +4 -0
  36. package/esm/core/component/element/mock.js +491 -0
  37. package/esm/core/component/element/type.d.ts +190 -0
  38. package/esm/core/component/element/type.js +35 -0
  39. package/esm/core/component/element/utils.d.ts +13 -0
  40. package/esm/core/component/element/utils.js +6 -0
  41. package/esm/core/component/index.d.ts +51 -0
  42. package/esm/core/component/index.js +531 -0
  43. package/esm/core/drop-in/index.d.ts +22 -0
  44. package/esm/core/drop-in/index.js +104 -0
  45. package/esm/core/instance/index.d.ts +89 -0
  46. package/esm/core/instance/index.js +499 -0
  47. package/esm/foundation/core/index.d.ts +3 -3
  48. package/esm/foundation/core/index.js +10 -8
  49. package/esm/foundation/index.d.ts +6 -5
  50. package/esm/foundation/product-processor/easysafepay/deps.d.ts +6 -6
  51. package/esm/foundation/product-processor/easysafepay/deps.js +4 -4
  52. package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -3
  53. package/esm/foundation/product-processor/easysafepay/index.js +110 -243
  54. package/esm/foundation/service/api-bus/index.d.ts +2 -2
  55. package/esm/foundation/service/container/index.d.ts +4 -2
  56. package/esm/foundation/service/container/index.js +43 -1
  57. package/esm/foundation/service/event-center.d.ts +6 -4
  58. package/esm/foundation/service/event-center.js +47 -17
  59. package/esm/foundation/service/global-data/index.d.ts +2 -2
  60. package/esm/foundation/service/index.d.ts +2 -2
  61. package/esm/foundation/service/log/index.d.ts +2 -2
  62. package/esm/foundation/service/log/index.js +1 -1
  63. package/esm/foundation/service/requester/deps.d.ts +1 -1
  64. package/esm/foundation/service/requester/requester.d.ts +2 -2
  65. package/esm/foundation/service/security/index.d.ts +2 -2
  66. package/esm/foundation/service/security/index.js +1 -0
  67. package/esm/foundation/utils/redirect_utils.d.ts +5 -0
  68. package/esm/foundation/utils/redirect_utils.js +205 -58
  69. package/esm/foundation/utils/system_events.js +0 -5
  70. package/esm/foundation/utils/web_app_url_utils.js +1 -1
  71. package/esm/index.d.ts +31 -2
  72. package/esm/index.js +146 -6
  73. package/esm/plugin/applepay/component.d.ts +50 -0
  74. package/esm/plugin/applepay/component.js +339 -0
  75. package/esm/plugin/applepay/index.d.ts +17 -0
  76. package/esm/plugin/applepay/index.js +117 -0
  77. package/esm/plugin/applepay/interface.d.ts +161 -0
  78. package/esm/plugin/applepay/interface.js +69 -0
  79. package/esm/plugin/applepay/service.d.ts +54 -0
  80. package/esm/plugin/applepay/service.js +289 -0
  81. package/esm/plugin/component/cashierApp.d.ts +36 -0
  82. package/esm/plugin/component/cashierApp.js +244 -0
  83. package/esm/plugin/component/channel.d.ts +21 -0
  84. package/esm/plugin/component/channel.js +89 -0
  85. package/esm/plugin/component/component.inline.style.d.ts +10 -0
  86. package/esm/plugin/component/component.inline.style.js +121 -0
  87. package/esm/plugin/component/component.popup.style.d.ts +16 -0
  88. package/esm/plugin/component/component.popup.style.js +174 -0
  89. package/esm/plugin/component/index.d.ts +127 -0
  90. package/esm/plugin/component/index.js +1896 -0
  91. package/esm/plugin/component/popupWindow.style.d.ts +11 -0
  92. package/esm/plugin/component/popupWindow.style.js +121 -0
  93. package/esm/plugin/const.d.ts +2 -0
  94. package/esm/plugin/const.js +33 -0
  95. package/esm/plugin/drop-in/index.d.ts +71 -0
  96. package/esm/plugin/drop-in/index.js +324 -0
  97. package/esm/plugin/payment-element/utils.d.ts +2 -0
  98. package/esm/plugin/payment-element/utils.js +6 -0
  99. package/esm/plugin/paypal/index.d.ts +20 -0
  100. package/esm/plugin/paypal/index.js +390 -0
  101. package/esm/plugin/type.d.ts +34 -0
  102. package/esm/plugin/type.js +1 -0
  103. package/esm/plugin/utils.d.ts +6 -0
  104. package/esm/plugin/utils.js +21 -0
  105. package/esm/service/element.d.ts +4 -0
  106. package/esm/service/element.js +51 -0
  107. package/esm/service/index.d.ts +1 -0
  108. package/esm/service/index.js +2 -0
  109. package/esm/types/index.d.ts +228 -26
  110. package/esm/types/index.js +54 -5
  111. package/esm/util/createIframeNode.d.ts +6 -0
  112. package/esm/util/createIframeNode.js +48 -0
  113. package/esm/util/getBackScheme.d.ts +2 -2
  114. package/esm/util/getBackScheme.js +2 -2
  115. package/esm/util/index.d.ts +11 -1
  116. package/esm/util/index.js +84 -3
  117. package/esm/util/intl-callapp/es/index.js +0 -1
  118. package/esm/util/security.d.ts +33 -0
  119. package/esm/util/security.js +182 -0
  120. package/package.json +2 -1
  121. package/esm/foundation/types/index.d.ts +0 -4
  122. package/esm/foundation/types/index.js +0 -4
@@ -1,18 +1,18 @@
1
1
  export type { SDKMetaData } from "../..";
2
+ export { v4 as uuid } from 'uuid';
3
+ export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload, } from '../..';
2
4
  export * as ChannelCustomize from '../../../component/channel';
3
5
  export type { IChannelBehavior } from '../../../component/channel';
4
- export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from '../../../types';
5
- export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
6
- export { v4 as uuid } from 'uuid';
7
- export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IOptionsParams, } from '../../../types';
6
+ export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, RiskSdkInfoEnum } from '../../../types';
7
+ export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IoptionsParams, } from '../../../types';
8
8
  export { isPC } from '../../../util';
9
- export { getBackScheme } from '../../../util/getBackScheme';
9
+ export { getBackScheme } from '../../utils/redirect_utils';
10
10
  export { isLocalMock } from '../../../util/mock';
11
- export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload } from '../..';
12
11
  export { ServiceProvider } from '../../service';
13
12
  export type { ContainerService } from '../../service/container';
14
13
  export type { EventCenter } from '../../service/event-center';
15
14
  export { LogService } from '../../service/log';
16
15
  export type { RequesterService } from '../../service/requester/requester';
17
16
  export type { SecurityService } from '../../service/security';
17
+ export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
18
18
  export * as WebAppUrlUtil from '../../utils/web_app_url_utils';
@@ -1,12 +1,12 @@
1
+ export { v4 as uuid } from 'uuid';
1
2
  import * as _ChannelCustomize from "../../../component/channel";
2
3
  export { _ChannelCustomize as ChannelCustomize };
3
- export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from "../../../types";
4
- export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
5
- export { v4 as uuid } from 'uuid';
4
+ export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, RiskSdkInfoEnum } from "../../../types";
6
5
  export { isPC } from "../../../util";
7
- export { getBackScheme } from "../../../util/getBackScheme";
6
+ export { getBackScheme } from "../../utils/redirect_utils";
8
7
  export { isLocalMock } from "../../../util/mock";
9
8
  export { ServiceProvider } from "../../service";
10
9
  export { LogService } from "../../service/log";
10
+ export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
11
11
  import * as _WebAppUrlUtil from "../../utils/web_app_url_utils";
12
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 { ChannelCustomize, DisplayTypeEnum, getBackScheme, isLocalMock, isPC, ProductInfoCacheUtil, ProductSceneEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
19
+ import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, 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,19 +213,19 @@ 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,
240
- paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSession,
227
+ submitResult: submitRes,
228
+ paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSessionId,
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,
@@ -265,149 +253,20 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
265
253
  });
266
254
  }
267
255
  }, {
268
- key: "processPaymentQuery",
256
+ key: "processSubmitPay",
269
257
  value: function () {
270
- var _processPaymentQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
271
- var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$channelBehavior2;
272
- 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;
273
261
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
274
262
  while (1) switch (_context2.prev = _context2.next) {
275
- case 0:
276
- envInfo = {
277
- locale: this.initConfig.locale
278
- }; //
279
- requestData = {
280
- paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSession) || '',
281
- 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,
282
- notRedirectAfterComplete: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.startBizFlowOptions.submitPayRequestExtra.notRedirectAfterComplete) === true
283
- // merchantAppointParam: this._merchantAppointParam,
284
- };
285
- 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) || '';
286
- 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;
287
- enableEasypayApiOptimize = false;
288
- try {
289
- extendInfoData = JSON.parse(extendInfo);
290
- enableEasypayApiOptimize = extendInfoData.enableEasypayApiOptimize || false;
291
- } catch (error) {
292
- console.log(error);
293
- }
294
- if (!isLocalMock()) {
295
- _context2.next = 8;
296
- break;
297
- }
298
- return _context2.abrupt("return", {
299
- message: 'sdk no need to make query request',
300
- success: true
301
- });
302
- case 8:
303
- if (!((_this$channelBehavior2 = this.channelBehavior) !== null && _this$channelBehavior2 !== void 0 && _this$channelBehavior2.usePaymentSessionAsQueryResult)) {
304
- _context2.next = 10;
305
- break;
306
- }
307
- return _context2.abrupt("return", {
308
- autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
309
- amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
310
- success: true
311
- });
312
- case 10:
313
- if (!(actionData.skipSdkQuery && enableEasypayApiOptimize)) {
314
- _context2.next = 12;
315
- break;
316
- }
317
- return _context2.abrupt("return", {
318
- message: 'sdk no need to make query request',
319
- success: true
320
- });
321
- case 12:
322
- productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion; // ESP 2.0 无需Query
323
- if (!(productSceneVersion === '2.0')) {
324
- _context2.next = 15;
325
- break;
326
- }
327
- return _context2.abrupt("return", {
328
- message: 'sdk no need to make query request',
329
- success: true
330
- });
331
- case 15:
332
- _context2.next = 17;
333
- return this.acquireApdidToken();
334
- case 17:
335
- envInfo.deviceId = _context2.sent;
336
- requestBizId = uuid(); // 打日志
337
- this.logger.logInfo({
338
- title: 'sdk_event_sdkQuery'
339
- }, {
340
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
341
- requestBizId: requestBizId
342
- });
343
-
344
- // 真正发请求
345
- requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
346
- _context2.prev = 21;
347
- _context2.next = 24;
348
- return requester.request(requestData, {
349
- env: this.initConfig.environment,
350
- envInfo: envInfo,
351
- hostSign: this.hostSign,
352
- 'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
353
- });
354
- case 24:
355
- res = _context2.sent;
356
- this.logger.logInfo({
357
- title: 'sdk_event_sdkQueryEnd'
358
- }, {
359
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
360
- requestBizId: requestBizId,
361
- traceId: res.traceId
362
- });
363
- return _context2.abrupt("return", res);
364
- case 29:
365
- _context2.prev = 29;
366
- _context2.t0 = _context2["catch"](21);
367
- this.logger.logError({
368
- title: 'sdk_event_sdkQuery_failed'
369
- }, {
370
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
371
- errorReason: _context2.t0,
372
- requestBizId: requestBizId,
373
- traceId: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.traceId
374
- });
375
- throw _context2.t0;
376
- case 33:
377
- case "end":
378
- return _context2.stop();
379
- }
380
- }, _callee2, this, [[21, 29]]);
381
- }));
382
- function processPaymentQuery() {
383
- return _processPaymentQuery.apply(this, arguments);
384
- }
385
- return processPaymentQuery;
386
- }()
387
- }, {
388
- key: "processSubmitPay",
389
- value: function () {
390
- var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
391
- var _this$paymentContext6, _this$paymentContext7, _this$paymentContext9, _this$channelBehavior3, _this$channelBehavior4, _this$paymentContext$2;
392
- var submitParams, shouldSkipSubmitPayInSDK, _this$paymentContext8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref6, _ref6$action, _ref6$action2, _ref6$action2$enableS, enableSignAgreement, _ref6$action2$autoDeb, autoDebitWithToken, _this$paymentContext$, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
393
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
394
- while (1) switch (_context3.prev = _context3.next) {
395
263
  case 0:
396
264
  submitParams = {
397
- paymentSessionData: ((_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSession) || '',
398
- 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.paymentSessionId) || '',
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
399
267
  };
400
- shouldSkipSubmitPayInSDK = false;
401
- if (this.channelBehavior) {
402
- // 新逻辑走 channelBehavior判断
403
- shouldSkipSubmitPayInSDK = !this.channelBehavior.submitPayInSdk;
404
- } else {
405
- // TODO: 拉会找栎昂、甘颜一起对下
406
- // 老逻辑,只要服务端标记不跳过sdkquery,就需要跳过submitpay
407
- 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);
408
- }
409
- _ref5 = submitParams.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer;
410
- _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;
411
270
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
412
271
  ///EasyPay 2.0 首次传signAgreement字段
413
272
  submitParams['signAgreement'] = enableSignAgreement;
@@ -420,17 +279,17 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
420
279
  }
421
280
  }
422
281
  }
423
- // 带上标记告知WebCheckOut SDK已发送submitpay请求
424
- this.allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
425
- if (!shouldSkipSubmitPayInSDK) {
426
- _context3.next = 9;
282
+ this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
283
+ //console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
284
+ if (this.allowSubmitPayCallAhead) {
285
+ _context2.next = 7;
427
286
  break;
428
287
  }
429
- return _context3.abrupt("return", {
288
+ return _context2.abrupt("return", {
430
289
  message: 'sdk no need to make submitPay request',
431
290
  success: true
432
291
  });
433
- case 9:
292
+ case 7:
434
293
  requestBizId = uuid(); // 下面真实发请求
435
294
  this.logger.logInfo({
436
295
  title: 'sdk_event_submitPay'
@@ -439,40 +298,41 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
439
298
  requestBizId: requestBizId
440
299
  });
441
300
  // 由渠道定制点来构建额外参数
442
- 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, {
301
+ 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, {
443
302
  instanceId: this.instanceId,
444
303
  locale: this.initConfig.locale,
445
304
  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,
446
- paymentSessionData: this.paymentContext.paymentSession,
305
+ paymentSessionData: this.paymentContext.paymentSessionId,
447
306
  env: this.initConfig.environment,
448
307
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
449
308
  })) || {};
309
+ extParams.complianceSDK = true;
450
310
  submitParams.extParams = extParams;
451
311
  requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
452
- _context3.prev = 14;
453
- _context3.t0 = requester;
454
- _context3.t1 = submitParams;
455
- _context3.t2 = this.initConfig.environment;
456
- _context3.next = 20;
312
+ _context2.prev = 13;
313
+ _context2.t0 = requester;
314
+ _context2.t1 = submitParams;
315
+ _context2.t2 = this.initConfig.environment;
316
+ _context2.next = 19;
457
317
  return this.acquireApdidToken();
458
- case 20:
459
- _context3.t3 = _context3.sent;
460
- _context3.t4 = {
461
- deviceId: _context3.t3
318
+ case 19:
319
+ _context2.t3 = _context2.sent;
320
+ _context2.t4 = {
321
+ deviceId: _context2.t3
462
322
  };
463
- _context3.t5 = this.hostSign;
464
- _context3.t6 = {
465
- env: _context3.t2,
323
+ _context2.t5 = this.hostSign;
324
+ _context2.t6 = {
325
+ env: _context2.t2,
466
326
  timeout: 15000,
467
- envInfo: _context3.t4,
468
- hostSign: _context3.t5,
327
+ envInfo: _context2.t4,
328
+ hostSign: _context2.t5,
469
329
  needEnvInfo: true,
470
330
  'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
471
331
  };
472
- _context3.next = 26;
473
- return _context3.t0.request.call(_context3.t0, _context3.t1, _context3.t6);
474
- case 26:
475
- res = _context3.sent;
332
+ _context2.next = 25;
333
+ return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
334
+ case 25:
335
+ res = _context2.sent;
476
336
  this.logger.logInfo({
477
337
  title: 'sdk_event_submitPayEnd'
478
338
  }, {
@@ -480,50 +340,50 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
480
340
  requestBizId: requestBizId,
481
341
  traceId: res.traceId
482
342
  });
483
- return _context3.abrupt("return", res);
484
- case 31:
485
- _context3.prev = 31;
486
- _context3.t7 = _context3["catch"](14);
343
+ return _context2.abrupt("return", res);
344
+ case 30:
345
+ _context2.prev = 30;
346
+ _context2.t7 = _context2["catch"](13);
487
347
  this.logger.logError({
488
348
  title: 'sdk_event_submitPay_failed'
489
349
  }, {
490
350
  paymentSessionConfig: JSON.stringify(submitParams.paymentSessionConfig),
491
- errorReason: _context3.t7,
351
+ errorReason: _context2.t7,
492
352
  requestBizId: requestBizId,
493
- traceId: _context3.t7 === null || _context3.t7 === void 0 ? void 0 : _context3.t7.traceId
353
+ traceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
494
354
  });
495
- throw _context3.t7;
496
- case 35:
355
+ throw _context2.t7;
356
+ case 34:
497
357
  case "end":
498
- return _context3.stop();
358
+ return _context2.stop();
499
359
  }
500
- }, _callee3, this, [[14, 31]]);
360
+ }, _callee2, this, [[13, 30]]);
501
361
  }));
502
362
  function processSubmitPay() {
503
363
  return _processSubmitPay.apply(this, arguments);
504
364
  }
505
365
  return processSubmitPay;
506
- }() // TOOD: 讨论下是否放到 requester里面
366
+ }()
507
367
  }, {
508
368
  key: "acquireApdidToken",
509
369
  value: function () {
510
- var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
370
+ var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
511
371
  var _this$paymentContext$3;
512
372
  var securityService, productScene, deviceId;
513
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
514
- while (1) switch (_context4.prev = _context4.next) {
373
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
374
+ while (1) switch (_context3.prev = _context3.next) {
515
375
  case 0:
516
376
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
517
377
  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;
518
378
  deviceId = securityService.getDeviceId({
519
379
  productScene: productScene
520
380
  });
521
- return _context4.abrupt("return", deviceId);
381
+ return _context3.abrupt("return", deviceId);
522
382
  case 4:
523
383
  case "end":
524
- return _context4.stop();
384
+ return _context3.stop();
525
385
  }
526
- }, _callee4, this);
386
+ }, _callee3, this);
527
387
  }));
528
388
  function acquireApdidToken() {
529
389
  return _acquireApdidToken.apply(this, arguments);
@@ -533,58 +393,65 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
533
393
  }, {
534
394
  key: "initSecuritySDK",
535
395
  value: function () {
536
- var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
537
- var _this$paymentContext$4, productSceneVersion, nonCompliant, isFirstTimeToPay;
538
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
539
- while (1) switch (_context5.prev = _context5.next) {
396
+ var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
397
+ var _this$paymentContext$4, _this$paymentContext$5, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay, shouldInitSecuritySDK;
398
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
399
+ while (1) switch (_context4.prev = _context4.next) {
540
400
  case 0:
541
- _context5.prev = 0;
401
+ _context4.prev = 0;
542
402
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
543
403
  nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
404
+ nonInitSecuritySDK = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.nonInitSecuritySDK;
544
405
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
545
- if (!(productSceneVersion === '1.0')) {
546
- _context5.next = 9;
547
- break;
548
- }
549
- console.log('[web-sdk][security-sdk] skip init security sdk for easypay 1.0');
550
- // 1.0 不初始化 SecuritySDK
551
- return _context5.abrupt("return");
552
- case 9:
553
- if (!(productSceneVersion === '2.0')) {
554
- _context5.next = 20;
555
- break;
556
- }
557
- if (!(nonCompliant === true)) {
558
- _context5.next = 16;
559
- break;
406
+ shouldInitSecuritySDK = false;
407
+ if (nonInitSecuritySDK) {
408
+ // 钱包不依赖风控
409
+ // console.log('[web-sdk][security-sdk] DO NOT init security sdk when nonInitSecuritySDK is true');
410
+ shouldInitSecuritySDK = false;
411
+ } else {
412
+ if (productSceneVersion === '1.0') {
413
+ // 1.0 不初始化 SecuritySDK
414
+ // console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 1.0');
415
+ shouldInitSecuritySDK = false;
416
+ } else if (productSceneVersion === '2.0') {
417
+ if (nonCompliant === true) {
418
+ // 未切流「隐私合规」
419
+ // console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and nonCompliant is true');
420
+ shouldInitSecuritySDK = true;
421
+ } else {
422
+ if (isFirstTimeToPay) {
423
+ // console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0 and when first time to pay');
424
+ shouldInitSecuritySDK = false;
425
+ } else {
426
+ // 切流「隐私合规」且非首次支付
427
+ // console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
428
+ shouldInitSecuritySDK = true;
429
+ }
430
+ }
431
+ }
560
432
  }
561
- // 未切流「隐私合规」
562
- console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and nonCompliant is true');
563
- _context5.next = 14;
564
- return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
565
- case 14:
566
- _context5.next = 20;
567
- break;
568
- case 16:
569
- if (isFirstTimeToPay) {
570
- _context5.next = 20;
433
+ if (!shouldInitSecuritySDK) {
434
+ _context4.next = 10;
571
435
  break;
572
436
  }
573
- // 切流「隐私合规」且非首次支付
574
- console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and when not first time to pay');
575
- _context5.next = 20;
437
+ _context4.next = 10;
576
438
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
577
- case 20:
578
- _context5.next = 24;
439
+ case 10:
440
+ this.logger.logInfo({
441
+ title: 'a3753.b101271.c388193.d514078'
442
+ }, {
443
+ riskSdkInfo: shouldInitSecuritySDK ? RiskSdkInfoEnum.NEED : RiskSdkInfoEnum.NO_NEED
444
+ });
445
+ _context4.next = 15;
579
446
  break;
580
- case 22:
581
- _context5.prev = 22;
582
- _context5.t0 = _context5["catch"](0);
583
- case 24:
447
+ case 13:
448
+ _context4.prev = 13;
449
+ _context4.t0 = _context4["catch"](0);
450
+ case 15:
584
451
  case "end":
585
- return _context5.stop();
452
+ return _context4.stop();
586
453
  }
587
- }, _callee5, this, [[0, 22]]);
454
+ }, _callee4, this, [[0, 13]]);
588
455
  }));
589
456
  function initSecuritySDK() {
590
457
  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;
@@ -9,9 +9,10 @@ export declare class ContainerService implements Service {
9
9
  private logService;
10
10
  private displayInfo;
11
11
  private webApp;
12
+ private _webAppHeartBeatTimeoutFn;
12
13
  private customizedLoadingListener;
13
14
  destroy(): void;
14
- init(initOptions: IOptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
15
+ init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
15
16
  update(): void;
16
17
  load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
17
18
  cleanContainer(displayInfo: DisplayInfo): void;
@@ -24,5 +25,6 @@ export declare class ContainerService implements Service {
24
25
  private addCapabilityToEventCenter;
25
26
  private addCapabilityToApiBusManager;
26
27
  private handleSizeChanged;
28
+ private handleAppHeartBeat;
27
29
  private changeCloseBtnVisibility;
28
30
  }