@alipay/ams-checkout 0.0.1726734012-dev.2 → 0.0.1726734012-dev.20

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 (36) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +7 -7
  3. package/esm/config/index.js +7 -7
  4. package/esm/constant/index.d.ts +9 -0
  5. package/esm/constant/index.js +9 -0
  6. package/esm/core/component/element/index.d.ts +1 -0
  7. package/esm/core/component/element/index.js +75 -67
  8. package/esm/core/component/element/mock.d.ts +2 -0
  9. package/esm/core/component/element/mock.js +129 -53
  10. package/esm/core/component/element/type.d.ts +2 -2
  11. package/esm/core/component/element/type.js +2 -2
  12. package/esm/core/component/index.d.ts +1 -3
  13. package/esm/core/component/index.js +14 -52
  14. package/esm/core/instance/index.js +12 -2
  15. package/esm/foundation/core/index.js +4 -4
  16. package/esm/foundation/index.d.ts +1 -1
  17. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -2
  18. package/esm/foundation/product-processor/easysafepay/index.js +29 -73
  19. package/esm/foundation/service/container/index.d.ts +0 -2
  20. package/esm/foundation/service/container/index.js +46 -47
  21. package/esm/foundation/utils/payment_product_utils.d.ts +1 -1
  22. package/esm/foundation/utils/payment_product_utils.js +2 -2
  23. package/esm/foundation/utils/preload_helper.d.ts +21 -0
  24. package/esm/foundation/utils/preload_helper.js +142 -0
  25. package/esm/index.d.ts +7 -2
  26. package/esm/index.js +95 -10
  27. package/esm/plugin/applepay/interface.d.ts +2 -2
  28. package/esm/plugin/component/channel.d.ts +41 -1
  29. package/esm/plugin/component/channel.js +589 -1
  30. package/esm/plugin/component/index.d.ts +1 -1
  31. package/esm/plugin/component/index.js +75 -39
  32. package/esm/types/index.d.ts +38 -2
  33. package/esm/types/index.js +3 -2
  34. package/esm/util/cashierPaymentUtils.d.ts +1 -0
  35. package/esm/util/cashierPaymentUtils.js +15 -0
  36. package/package.json +1 -1
@@ -11,7 +11,6 @@ export declare class AMSComponent extends CoreInstance {
11
11
  channelType: ComponentSignEnum[];
12
12
  productSceneVersion: string;
13
13
  timer: any;
14
- isSuccessfullyPreloaded: boolean;
15
14
  constructor(options: IAMSComponentOptions);
16
15
  private parameterInitAndCheck;
17
16
  private pluginAppendIframe;
@@ -34,7 +33,7 @@ export declare class AMSComponent extends CoreInstance {
34
33
  */
35
34
  createComponent(params: IcreateComponent): Promise<void>;
36
35
  private createComponentProcess;
37
- preloadComponent(): void;
36
+ preloadComponent(channelType: any, productSceneVersion: any): void;
38
37
  private clearPreloadIframe;
39
38
  /**
40
39
  * @description Create and render components in the specified element area
@@ -49,5 +48,4 @@ export declare class AMSComponent extends CoreInstance {
49
48
  * @param data - Transfer information in the submission interface according to your requirements (optional)
50
49
  */
51
50
  submit(data?: Isubmit): Promise<unknown>;
52
- preload(_options: any): void;
53
51
  }
@@ -40,7 +40,7 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
40
40
  import ComponentApp from "../../plugin/component";
41
41
  import { ExtendPlugin } from "../../plugin/const";
42
42
  import { PaypalBusSubscriber } from "../../plugin/paypal";
43
- import { ComponentSignEnum, ComponentSignEnumV2, EnvironmentEnum, modeEnum, networkModeEnum, ProductSceneEnum, DisplayTypeEnum } from "../../types";
43
+ import { ComponentSignEnum, ComponentSignEnumV2, DisplayTypeEnum, EnvironmentEnum, modeEnum, networkModeEnum, ProductSceneEnum } from "../../types";
44
44
  import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
45
45
  import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
46
46
  import { getSecurityConfigStorageKey } from "../../util/security";
@@ -50,6 +50,7 @@ import { SecurityBusSubscriber } from "../bus/ability/security";
50
50
  import { TrackerBusSubscriber } from "../bus/ability/tracker";
51
51
  import CoreInstance from "../instance/index";
52
52
  import { loadChannelPneumaticControl } from "./appPreloadProcessing";
53
+ import PreloadHelper from "../../foundation/utils/preload_helper";
53
54
  export var getComponentSign = function getComponentSign(params) {
54
55
  var _params$paymentSessio = params.paymentSessionConfig,
55
56
  _params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
@@ -101,7 +102,7 @@ var handleParams = function handleParams(params, _this) {
101
102
  parseData = _handleSessionData2[0],
102
103
  sessionData = _handleSessionData2[1];
103
104
  var componentSign = getComponentSign(parseData);
104
- if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup) {
105
+ if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup && window.location.href.indexOf('popup=true') === -1) {
105
106
  return Promise.reject({
106
107
  code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
107
108
  message: "unsupported payment method"
@@ -140,7 +141,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
140
141
  _defineProperty(_assertThisInitialized(_this2), "channelType", void 0);
141
142
  _defineProperty(_assertThisInitialized(_this2), "productSceneVersion", void 0);
142
143
  _defineProperty(_assertThisInitialized(_this2), "timer", void 0);
143
- _defineProperty(_assertThisInitialized(_this2), "isSuccessfullyPreloaded", void 0);
144
144
  var ComponentPlugin = new ComponentApp({
145
145
  appVersion: options.appVersion
146
146
  });
@@ -346,11 +346,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
346
346
  key: "createComponent",
347
347
  value: function createComponent(params) {
348
348
  var _this5 = this;
349
- if (!this.isSuccessfullyPreloaded) {
350
- this.preloadComponent();
351
- }
352
- ;
353
- console.log('执行了createComponent', params);
354
349
  this.clearPreloadIframe();
355
350
  this.logger.setComponentStartTime(Date.now());
356
351
  return this.parameterInitAndCheck({
@@ -390,42 +385,26 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
390
385
  this.savePreviousChannel(iframeNodesParams);
391
386
  return this.pluginAppendIframe(appendParams);
392
387
  }
393
-
394
- // preloadComponent(channelType, productSceneVersion) {
395
- // this.channelType = channelType;
396
- // this.productSceneVersion = productSceneVersion;
397
- // const MAX_CLEAR_TIME = 10000;
398
-
399
- // if (Array.isArray(channelType)) {
400
- // for (let i = 0; i < channelType.length; i++) {
401
- // this._componentApp.appendPreloadIframeNodes(channelType[i], productSceneVersion);
402
- // }
403
- // } else {
404
- // this.logger.logError(
405
- // { title: 'performance_optimization_channelType_error' },
406
- // { eventMessage: channelType }
407
- // );
408
- // }
409
- // this.timer = setTimeout(() => {
410
- // this.clearPreloadIframe(true);
411
- // }, MAX_CLEAR_TIME);
412
- // }
413
388
  }, {
414
389
  key: "preloadComponent",
415
- value: function preloadComponent() {
390
+ value: function preloadComponent(channelType, productSceneVersion) {
416
391
  var _this6 = this;
417
- console.log('执行了preloadComponent');
392
+ if (PreloadHelper.isWebAppPreloaded) {
393
+ console.log('[web-sdk] web app already preloaded');
394
+ return;
395
+ }
396
+ this.channelType = channelType;
397
+ this.productSceneVersion = productSceneVersion;
418
398
  var MAX_CLEAR_TIME = 10000;
419
- if (Array.isArray(this.channelType)) {
420
- for (var i = 0; i < this.channelType.length; i++) {
421
- this._componentApp.appendPreloadIframeNodes(this.channelType[i], this.productSceneVersion);
399
+ if (Array.isArray(channelType)) {
400
+ for (var i = 0; i < channelType.length; i++) {
401
+ this._componentApp.appendPreloadIframeNodes(channelType[i], productSceneVersion);
422
402
  }
423
- this.isSuccessfullyPreloaded = true;
424
403
  } else {
425
404
  this.logger.logError({
426
405
  title: 'performance_optimization_channelType_error'
427
406
  }, {
428
- eventMessage: this.channelType
407
+ eventMessage: channelType
429
408
  });
430
409
  }
431
410
  this.timer = setTimeout(function () {
@@ -463,10 +442,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
463
442
  value: function mountComponent(params, selector) {
464
443
  var _this7 = this;
465
444
  this.clearPreloadIframe();
466
- if (!this.isSuccessfullyPreloaded) {
467
- this.preloadComponent();
468
- }
469
- ;
470
445
  this.logger.setComponentStartTime(Date.now());
471
446
  return this.parameterInitAndCheck({
472
447
  params: params,
@@ -552,19 +527,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
552
527
  }
553
528
  });
554
529
  }
555
-
556
- // 预加载
557
- }, {
558
- key: "preload",
559
- value: function preload(_options) {
560
- this.preloadComponent();
561
- if (this.channelType.some(function (val) {
562
- return val === ComponentSignEnum.EASY_PAY_WALLET || val === ComponentSignEnum.EASY_PAY_APM;
563
- })) return;
564
- this._componentApp.AMSSDK.initSecurity({
565
- product: this.options.product
566
- });
567
- }
568
530
  }]);
569
531
  return AMSComponent;
570
532
  }(CoreInstance);
@@ -31,6 +31,7 @@ import { LogConfig, Logger } from "../../util/logger";
31
31
  import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
32
32
  import { compareVersion } from "../../util/versionCompare";
33
33
  import { BusManager, BusMessage } from "../bus";
34
+ import PreloadHelper from "../../foundation/utils/preload_helper";
34
35
  var AMSSDK = /*#__PURE__*/function () {
35
36
  function AMSSDK(options) {
36
37
  _classCallCheck(this, AMSSDK);
@@ -160,7 +161,6 @@ var AMSSDK = /*#__PURE__*/function () {
160
161
  product = _ref$product === void 0 ? ProductSceneEnum.EASY_PAY : _ref$product,
161
162
  _ref$scene = _ref.scene,
162
163
  scene = _ref$scene === void 0 ? ProductSceneEnum.EASY_PAY : _ref$scene;
163
- console.log('执行了initSecurity');
164
164
  this.logger.logInfo({
165
165
  title: 'sdk_event_securitySdkPreInit'
166
166
  }, {
@@ -169,7 +169,10 @@ var AMSSDK = /*#__PURE__*/function () {
169
169
  var sdk = this._getSecuritySDKByProductScene({
170
170
  product: product || scene
171
171
  });
172
- if (sdk) return;
172
+ if (sdk) {
173
+ console.log('[web-sdk] skip init security sdk because it is already loaded');
174
+ return;
175
+ }
173
176
  this._newSecuritySDKByScene({
174
177
  product: product || scene,
175
178
  region: SecurityRegionEnum.SG
@@ -198,6 +201,13 @@ var AMSSDK = /*#__PURE__*/function () {
198
201
  var storage = this.getSecurityConfigStorage(securityConfig.product);
199
202
  var scene = storage.scene || getSecurityScene(securityConfig.product);
200
203
  var securitySdk = this.securitySdkMap.get(scene);
204
+ if (!securitySdk) {
205
+ securitySdk = PreloadHelper.getSecuritySdk(scene);
206
+ if (securitySdk) {
207
+ console.log('[web-sdk] return security sdk from preloaded');
208
+ this.securitySdkMap.set(scene, securitySdk);
209
+ }
210
+ }
201
211
  return securitySdk;
202
212
  }
203
213
  /**
@@ -178,7 +178,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
178
178
  key: "startBizFlow",
179
179
  value: function () {
180
180
  var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
181
- var _this$paymentContext$, _this$paymentContext$2;
181
+ var _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3;
182
182
  var paymentSession, displayInfo, _convertPaymentSessio, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
183
183
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
184
184
  while (1) switch (_context3.prev = _context3.next) {
@@ -201,7 +201,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
201
201
  sdkMetaData: this.sdkMetaData
202
202
  };
203
203
  // upgrade WebApp version
204
- mid = this.paymentContext.paymentSessionObj.clientId;
204
+ mid = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.clientId;
205
205
  webAppMatchConfig = parseWebAppMatchConfig(this.paymentContext.paymentSessionObj.extendInfo);
206
206
  webAppVersion = getWebAppVersion(this.sdkMetaData, mid, webAppMatchConfig);
207
207
  this.sdkMetaData.webAppVersion = webAppVersion;
@@ -211,8 +211,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
211
211
  ServiceProvider.getInstance(this.instanceId).update(this.paymentContext);
212
212
 
213
213
  // Invoke processor
214
- productScene = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentSessionConfig) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.productScene;
215
- paymentMethod = (_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;
214
+ 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;
215
+ paymentMethod = (_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;
216
216
  _context3.prev = 13;
217
217
  if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
218
218
  _context3.next = 20;
@@ -67,7 +67,7 @@ export interface SDKMetaData {
67
67
  productScene: ProductSceneEnum;
68
68
  sdkVersion: string;
69
69
  webAppVersion: string;
70
- greyscaleId: number;
70
+ greyscaleId?: number;
71
71
  }
72
72
  export interface InitContext {
73
73
  initOptions: IoptionsParams;
@@ -11,8 +11,6 @@ export declare class EasySafePayProcessor implements ProductProcessor {
11
11
  private SECURITY_SDK_INIT_TIMEOUT;
12
12
  init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
13
13
  startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
14
- private preloadWebApp;
15
- private buildWebAppPreloadUrl;
16
14
  private buildWebAppUrl;
17
15
  private buildRedirectResult;
18
16
  /**
@@ -16,7 +16,8 @@ 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, isPC, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
19
+ import PreloadHelper from "../../../foundation/utils/preload_helper";
20
+ import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
20
21
  export var EasySafePayProcessor = /*#__PURE__*/function () {
21
22
  function EasySafePayProcessor() {
22
23
  _classCallCheck(this, EasySafePayProcessor);
@@ -39,7 +40,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
39
40
  this.instanceId = instanceId;
40
41
  this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
41
42
  this.securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
42
- this.preloadWebApp(config, this.instanceId, sdkMetaData);
43
+
44
+ // preload web app
45
+ PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment);
43
46
  }
44
47
  }, {
45
48
  key: "startBizFlow",
@@ -103,53 +106,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
103
106
  }
104
107
  return startBizFlow;
105
108
  }()
106
- }, {
107
- key: "preloadWebApp",
108
- value: function preloadWebApp(config, instanceId, sdkMetaData) {
109
- // trigger preload
110
- var containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
111
- var _this$buildWebAppPrel = this.buildWebAppPreloadUrl(config, instanceId, sdkMetaData),
112
- taskId = _this$buildWebAppPrel.taskId,
113
- webUrl = _this$buildWebAppPrel.webUrl;
114
- containerService.preload(taskId, webUrl);
115
- }
116
- }, {
117
- key: "buildWebAppPreloadUrl",
118
- value: function buildWebAppPreloadUrl(initConfig, instanceId, sdkMetaData) {
119
- var _this = this,
120
- _initConfig$analytics;
121
- var previousProductInfo = ProductInfoCacheUtil.getPreviousProductInfo(ProductSceneEnum.EASY_PAY, function (errorMsg) {
122
- if (errorMsg) {
123
- _this.logger.logError({
124
- title: 'performance_optimization_get_previousChannel_error'
125
- }, {
126
- errorMessage: errorMsg
127
- });
128
- }
129
- });
130
- var paymentMethodCategoryType = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.paymentMethodCategoryType;
131
- var productSceneVersion = (previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.productSceneVersion) || '2.0';
132
- var taskId = "ams-checkout-component-".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
133
- var hostSign = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.hostSign;
134
- var webUrl = WebAppUrlUtil.getWebAppUrl({
135
- environment: initConfig.environment,
136
- paymentMethodCategoryType: paymentMethodCategoryType,
137
- sdkMetaData: sdkMetaData,
138
- isPreload: true,
139
- productSceneVersion: productSceneVersion,
140
- query: {
141
- analyticsEnabled: (_initConfig$analytics = initConfig.analytics) === null || _initConfig$analytics === void 0 ? void 0 : _initConfig$analytics.enabled,
142
- displayType: DisplayTypeEnum.popup,
143
- instanceId: instanceId,
144
- locale: initConfig.locale,
145
- hostSign: hostSign
146
- }
147
- });
148
- return {
149
- webUrl: webUrl,
150
- taskId: taskId
151
- };
152
- }
153
109
  }, {
154
110
  key: "buildWebAppUrl",
155
111
  value: function buildWebAppUrl() {
@@ -205,7 +161,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
205
161
  }, {
206
162
  key: "sendRequestAndWaitWebLaunch",
207
163
  value: function sendRequestAndWaitWebLaunch() {
208
- var _this2 = this;
164
+ var _this = this;
209
165
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
210
166
  var webLaunchPromise = new Promise(function (resolve) {
211
167
  eventCenter.listen('onLaunch', function (res) {
@@ -215,25 +171,25 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
215
171
 
216
172
  // 等请求和 Web启动都Ready之后,发送renderComponent
217
173
  Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
218
- var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6;
174
+ var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext$4;
219
175
  var _ref2 = _slicedToArray(_ref, 3),
220
176
  _initSecurityRes = _ref2[0],
221
177
  submitRes = _ref2[1],
222
178
  _webLaunchRes = _ref2[2];
223
- var logMetaData = _this2.logger.getLogConfig().mdata;
179
+ var logMetaData = _this.logger.getLogConfig().mdata;
224
180
  eventCenter.dispatchToApp({
225
181
  event: 'renderComponent',
226
182
  data: {
227
- sessionResult: (_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj,
183
+ sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
228
184
  submitResult: submitRes,
229
- paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSessionId,
185
+ paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
230
186
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
231
- renderDisplayType: _this2.paymentContext.displayInfo.type,
232
- appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
233
- notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
234
- isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
235
- merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
236
- allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
187
+ renderDisplayType: _this.paymentContext.displayInfo.type,
188
+ appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
189
+ notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
190
+ isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
191
+ merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
192
+ allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
237
193
  envInfo: {
238
194
  screenHeight: screen.height,
239
195
  screenWidth: screen.width
@@ -242,7 +198,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
242
198
  trackId: logMetaData.requestSeq,
243
199
  platform: logMetaData.platform,
244
200
  firstLogTime: logMetaData.firstLogTime
245
- }, ((_this2$paymentContext6 = _this2.paymentContext.paymentSessionObj) === null || _this2$paymentContext6 === void 0 ? void 0 : _this2$paymentContext6.paymentSessionConfig) || {}), {}, {
201
+ }, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
246
202
  renderDisplayType: logMetaData.renderDisplayType,
247
203
  sdkVersion: logMetaData.sdkVersion,
248
204
  merchantId: logMetaData.merchantId,
@@ -257,21 +213,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
257
213
  key: "processSubmitPay",
258
214
  value: function () {
259
215
  var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
260
- var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$2;
261
- 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;
216
+ var _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$6;
217
+ var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$5, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
262
218
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
263
219
  while (1) switch (_context2.prev = _context2.next) {
264
220
  case 0:
265
221
  submitParams = {
266
- paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionId) || '',
267
- 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
222
+ paymentSessionData: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionId) || '',
223
+ paymentSessionConfig: (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionConfig
268
224
  };
269
225
  _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
270
- _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;
226
+ _ref4 = ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
271
227
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
272
228
  ///EasyPay 2.0 首次传signAgreement字段
273
229
  submitParams['signAgreement'] = enableSignAgreement;
274
- 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;
230
+ paymentMethodType = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$5 === void 0 || (_this$paymentContext$5 = _this$paymentContext$5.paymentMethodInfoView) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.paymentMethodType;
275
231
  isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
276
232
  if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
277
233
  backScheme = getBackScheme(undefined, this.logger);
@@ -302,7 +258,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
302
258
  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, {
303
259
  instanceId: this.instanceId,
304
260
  locale: this.initConfig.locale,
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,
261
+ paymentMethodType: (_this$paymentContext$6 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$6 === void 0 || (_this$paymentContext$6 = _this$paymentContext$6.paymentMethodInfoView) === null || _this$paymentContext$6 === void 0 ? void 0 : _this$paymentContext$6.paymentMethodType,
306
262
  paymentSessionData: this.paymentContext.paymentSessionId,
307
263
  env: this.initConfig.environment,
308
264
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
@@ -369,13 +325,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
369
325
  key: "acquireApdidToken",
370
326
  value: function () {
371
327
  var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
372
- var _this$paymentContext$3;
328
+ var _this$paymentContext$7;
373
329
  var securityService, productScene, deviceId;
374
330
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
375
331
  while (1) switch (_context3.prev = _context3.next) {
376
332
  case 0:
377
333
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
378
- 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;
334
+ productScene = (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentSessionConfig) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.productScene;
379
335
  deviceId = securityService.getDeviceId({
380
336
  productScene: productScene
381
337
  });
@@ -395,14 +351,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
395
351
  key: "initSecuritySDK",
396
352
  value: function () {
397
353
  var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
398
- var _this$paymentContext$4, _this$paymentContext$5, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay, shouldInitSecuritySDK;
354
+ var _this$paymentContext$8, _this$paymentContext$9, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay, shouldInitSecuritySDK;
399
355
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
400
356
  while (1) switch (_context4.prev = _context4.next) {
401
357
  case 0:
402
358
  _context4.prev = 0;
403
359
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
404
- nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
405
- nonInitSecuritySDK = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.nonInitSecuritySDK;
360
+ nonCompliant = (_this$paymentContext$8 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.nonCompliant;
361
+ nonInitSecuritySDK = (_this$paymentContext$9 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$9 === void 0 ? void 0 : _this$paymentContext$9.nonInitSecuritySDK;
406
362
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
407
363
  shouldInitSecuritySDK = false;
408
364
  if (nonInitSecuritySDK) {
@@ -16,8 +16,6 @@ export declare class ContainerService implements Service {
16
16
  update(): void;
17
17
  load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
18
18
  cleanContainer(displayInfo: DisplayInfo): void;
19
- preload(taskId: string, url: string): void;
20
- clearPreloadContainer(taskId: string): void;
21
19
  showLoading(container: HTMLDivElement, displayInfo: DisplayInfo): void;
22
20
  dismissLoading(isKeepMockup?: boolean): void;
23
21
  customizeLoading(listener: (event: 'SDK_START_OF_LOADING' | 'SDK_END_OF_LOADING') => void): void;
@@ -8,7 +8,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
9
  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); }
10
10
  import { DisplayTypeEnum } from "../../../types";
11
- import { createIframe, createPreloadIframe, startSizeChangeAnim } from "./utils";
11
+ import { createIframe, startSizeChangeAnim } from "./utils";
12
12
  import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
13
13
  import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
14
14
  import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, LOADING_ID, MOCKUP_ID } from "../../../constant";
@@ -88,33 +88,32 @@ export var ContainerService = /*#__PURE__*/function () {
88
88
  // animation
89
89
  (_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(displayInfo.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
90
90
  }
91
- }, {
92
- key: "preload",
93
- value: function preload(taskId, url) {
94
- var _this = this;
95
- var preloadIframe = createPreloadIframe(taskId);
96
- preloadIframe.src = url;
97
- var body = document.body || null;
98
- if (body) {
99
- body.appendChild(preloadIframe);
100
- }
101
- var timerId = setTimeout(function () {
102
- _this.clearPreloadContainer(taskId);
103
- }, MAX_CLEAR_TIME);
104
- this.clearTimerIdMapping[taskId] = timerId;
105
- }
106
- }, {
107
- key: "clearPreloadContainer",
108
- value: function clearPreloadContainer(taskId) {
109
- var timerId = this.clearTimerIdMapping[taskId];
110
- if (timerId) {
111
- clearTimeout(timerId);
112
- }
113
- var container = document.getElementById(taskId);
114
- if (container) {
115
- document.body.removeChild(container);
116
- }
117
- }
91
+
92
+ // preload(taskId: string, url: string) {
93
+ // const preloadIframe = createPreloadIframe(taskId);
94
+ // preloadIframe.src = url;
95
+ // const body = document.body || null
96
+ // if (body) {
97
+ // body.appendChild(preloadIframe)
98
+ // }
99
+ // console.log('web-preloadsdk web app', url);
100
+ // const timerId = setTimeout(() => {
101
+ // console.log('clear web-preloadsdk web app', url);
102
+ // this.clearPreloadContainer(taskId);
103
+ // }, MAX_CLEAR_TIME);
104
+ // this.clearTimerIdMapping[taskId] = timerId;
105
+ // }
106
+
107
+ // public clearPreloadContainer(taskId: string) {
108
+ // const timerId = this.clearTimerIdMapping[taskId];
109
+ // if (timerId) {
110
+ // clearTimeout(timerId);
111
+ // }
112
+ // const container = document.getElementById(taskId);
113
+ // if (container) {
114
+ // document.body.removeChild(container);
115
+ // }
116
+ // }
118
117
  }, {
119
118
  key: "showLoading",
120
119
  value: function showLoading(container, displayInfo) {
@@ -168,13 +167,13 @@ export var ContainerService = /*#__PURE__*/function () {
168
167
  }, {
169
168
  key: "addCapabilityToEventCenter",
170
169
  value: function addCapabilityToEventCenter() {
171
- var _this2 = this;
170
+ var _this = this;
172
171
  this.eventCenter.listen(EVENT.dismissLoading.name, function () {
173
- _this2.dismissLoading();
172
+ _this.dismissLoading();
174
173
  });
175
174
  this.eventCenter.listen(EVENT.getUserAgentFromSdk.name, function (data, payload) {
176
175
  var _payload$context;
177
- _this2.eventCenter.dispatchToApp({
176
+ _this.eventCenter.dispatchToApp({
178
177
  event: 'appEventCallback',
179
178
  eventCallbackId: (_payload$context = payload.context) === null || _payload$context === void 0 ? void 0 : _payload$context.eventCallbackId,
180
179
  data: {
@@ -183,34 +182,34 @@ export var ContainerService = /*#__PURE__*/function () {
183
182
  });
184
183
  });
185
184
  this.eventCenter.listen(EVENT.popupWindow.name, function (data) {
186
- var _this2$displayInfo;
185
+ var _this$displayInfo2;
187
186
  if (data.paymentElementOldModel) return;
188
- _this2.popupManager.popup(_objectSpread({
189
- platform: (_this2$displayInfo = _this2.displayInfo) === null || _this2$displayInfo === void 0 ? void 0 : _this2$displayInfo.platform
187
+ _this.popupManager.popup(_objectSpread({
188
+ platform: (_this$displayInfo2 = _this.displayInfo) === null || _this$displayInfo2 === void 0 ? void 0 : _this$displayInfo2.platform
190
189
  }, data)).catch(function (error) {
191
- _this2.logService.logError({
190
+ _this.logService.logError({
192
191
  title: (error === null || error === void 0 ? void 0 : error.title) || 'sdk_error_create_pop_up'
193
192
  }, error);
194
- _this2.eventCenter.emit(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
193
+ _this.eventCenter.emit(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
195
194
  });
196
195
  });
197
196
  this.eventCenter.listen(EVENT.popWindow.name, function () {
198
- _this2.popupManager.pop();
197
+ _this.popupManager.pop();
199
198
  });
200
199
  this.eventCenter.listen(EVENT.sizeChanged.name, function (data) {
201
- _this2.handleSizeChanged(_objectSpread({}, data));
200
+ _this.handleSizeChanged(_objectSpread({}, data));
202
201
  });
203
202
  this.eventCenter.listen(EVENT.showCloseButton.name, function () {
204
- _this2.changeCloseBtnVisibility(true);
203
+ _this.changeCloseBtnVisibility(true);
205
204
  });
206
205
  this.eventCenter.listen(EVENT.hideCloseButton.name, function () {
207
- _this2.changeCloseBtnVisibility(false);
206
+ _this.changeCloseBtnVisibility(false);
208
207
  });
209
208
  this.eventCenter.listen(EVENT.setMaskCloseButton.name, function (data) {
210
- _this2.handleMaskCloseBtnShow(data);
209
+ _this.handleMaskCloseBtnShow(data);
211
210
  });
212
211
  this.eventCenter.listen(EVENT.appHeartBeat.name, function () {
213
- _this2.handleAppHeartBeat();
212
+ _this.handleAppHeartBeat();
214
213
  });
215
214
  }
216
215
  }, {
@@ -271,12 +270,12 @@ export var ContainerService = /*#__PURE__*/function () {
271
270
  }, {
272
271
  key: "handleAppHeartBeat",
273
272
  value: function handleAppHeartBeat() {
274
- var _this3 = this;
273
+ var _this2 = this;
275
274
  try {
276
275
  if (!this._webAppHeartBeatTimeoutFn) {
277
276
  this._webAppHeartBeatTimeoutFn = function () {
278
- if (_this3.webApp && _this3.displayInfo) {
279
- _this3.logService.logError({
277
+ if (_this2.webApp && _this2.displayInfo) {
278
+ _this2.logService.logError({
280
279
  title: 'sdk_error_appHeartBeatTimeout'
281
280
  });
282
281
  }
@@ -290,8 +289,8 @@ export var ContainerService = /*#__PURE__*/function () {
290
289
  window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
291
290
  }
292
291
  setTimeout(function () {
293
- if (_this3.webApp && _this3.displayInfo) {
294
- _this3.eventCenter.dispatchToApp({
292
+ if (_this2.webApp && _this2.displayInfo) {
293
+ _this2.eventCenter.dispatchToApp({
295
294
  event: 'sdkHeartBeat',
296
295
  data: {}
297
296
  });
@@ -5,7 +5,7 @@ export declare class ProductInfoCacheUtil {
5
5
  paymentMethodCategoryType: string;
6
6
  hostSign: string;
7
7
  }): void;
8
- static getPreviousProductInfo(productScene: ProductSceneEnum, onError: (msg: string) => void): {
8
+ static getPreviousProductInfo(productScene: ProductSceneEnum): {
9
9
  productSceneVersion: string;
10
10
  paymentMethodCategoryType: string;
11
11
  hostSign: string;