@alipay/ams-checkout 0.0.1726734012-dev.17 → 0.0.1726734012-dev.18

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 (38) 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 +0 -7
  13. package/esm/core/component/index.js +3 -26
  14. package/esm/core/instance/index.d.ts +1 -1
  15. package/esm/core/instance/index.js +13 -6
  16. package/esm/foundation/core/index.d.ts +0 -6
  17. package/esm/foundation/core/index.js +5 -15
  18. package/esm/foundation/index.d.ts +1 -1
  19. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -3
  20. package/esm/foundation/product-processor/easysafepay/index.js +30 -79
  21. package/esm/foundation/service/container/index.d.ts +0 -2
  22. package/esm/foundation/service/container/index.js +46 -49
  23. package/esm/foundation/utils/payment_product_utils.d.ts +1 -1
  24. package/esm/foundation/utils/payment_product_utils.js +2 -2
  25. package/esm/foundation/utils/preload_helper.d.ts +21 -0
  26. package/esm/foundation/utils/preload_helper.js +129 -0
  27. package/esm/index.d.ts +7 -7
  28. package/esm/index.js +79 -27
  29. package/esm/plugin/applepay/interface.d.ts +2 -2
  30. package/esm/plugin/component/channel.d.ts +41 -1
  31. package/esm/plugin/component/channel.js +589 -1
  32. package/esm/plugin/component/index.d.ts +1 -1
  33. package/esm/plugin/component/index.js +75 -40
  34. package/esm/types/index.d.ts +32 -2
  35. package/esm/types/index.js +3 -2
  36. package/esm/util/cashierPaymentUtils.d.ts +1 -0
  37. package/esm/util/cashierPaymentUtils.js +15 -0
  38. 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
- static isSuccessfullyPreloaded: boolean;
15
14
  constructor(options: IAMSComponentOptions);
16
15
  private parameterInitAndCheck;
17
16
  private pluginAppendIframe;
@@ -49,10 +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
- static preload(_options: {
53
- appVersion: string;
54
- securityRegion?: 'US' | 'SG' | 'DE';
55
- channelType: ComponentSignEnum[];
56
- productSceneVersion: string;
57
- }): void;
58
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";
@@ -101,7 +101,7 @@ var handleParams = function handleParams(params, _this) {
101
101
  parseData = _handleSessionData2[0],
102
102
  sessionData = _handleSessionData2[1];
103
103
  var componentSign = getComponentSign(parseData);
104
- if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup) {
104
+ if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup && window.location.href.indexOf('popup=true') === -1) {
105
105
  return Promise.reject({
106
106
  code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
107
107
  message: "unsupported payment method"
@@ -384,8 +384,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
384
384
  this.savePreviousChannel(iframeNodesParams);
385
385
  return this.pluginAppendIframe(appendParams);
386
386
  }
387
-
388
- // TODO 老逻辑predload
389
387
  }, {
390
388
  key: "preloadComponent",
391
389
  value: function preloadComponent(channelType, productSceneVersion) {
@@ -524,27 +522,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
524
522
  }
525
523
  });
526
524
  }
527
-
528
- // 预加载
529
- }], [{
530
- key: "preload",
531
- value: function preload(_options) {
532
- try {
533
- var _options$channelType;
534
- var currentCompoentApp = new AMSComponent(_objectSpread({}, _options));
535
- currentCompoentApp.preloadComponent(_options.channelType, _options.productSceneVersion || '1.0');
536
- if (_options.channelType && (_options$channelType = _options.channelType) !== null && _options$channelType !== void 0 && _options$channelType.some(function (val) {
537
- return val === ComponentSignEnum.EASY_PAY_WALLET || val === ComponentSignEnum.EASY_PAY_APM;
538
- })) return;
539
- currentCompoentApp._componentApp.AMSSDK.initSecurity({
540
- product: currentCompoentApp.options.product,
541
- securityRegion: _options.securityRegion
542
- });
543
- } catch (err) {
544
- console.log('web-sdk preload error', err);
545
- }
546
- }
547
525
  }]);
548
526
  return AMSComponent;
549
- }(CoreInstance);
550
- _defineProperty(AMSComponent, "isSuccessfullyPreloaded", void 0);
527
+ }(CoreInstance);
@@ -33,7 +33,7 @@ export default class AMSSDK {
33
33
  * @param product Product Scenarios
34
34
  * @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
35
35
  */
36
- initSecurity({ product, scene, securityRegion, }: InitSecurityConfig & {
36
+ initSecurity({ product, scene, }: InitSecurityConfig & {
37
37
  scene?: string;
38
38
  }): void;
39
39
  /**
@@ -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);
@@ -159,22 +160,22 @@ var AMSSDK = /*#__PURE__*/function () {
159
160
  var _ref$product = _ref.product,
160
161
  product = _ref$product === void 0 ? ProductSceneEnum.EASY_PAY : _ref$product,
161
162
  _ref$scene = _ref.scene,
162
- scene = _ref$scene === void 0 ? ProductSceneEnum.EASY_PAY : _ref$scene,
163
- _ref$securityRegion = _ref.securityRegion,
164
- securityRegion = _ref$securityRegion === void 0 ? 'SG' : _ref$securityRegion;
163
+ scene = _ref$scene === void 0 ? ProductSceneEnum.EASY_PAY : _ref$scene;
165
164
  this.logger.logInfo({
166
165
  title: 'sdk_event_securitySdkPreInit'
167
166
  }, {
168
167
  productScene: product
169
168
  }).send();
170
- console.log('web-preloadsdk initSecurity securityRegion', securityRegion);
171
169
  var sdk = this._getSecuritySDKByProductScene({
172
170
  product: product || scene
173
171
  });
174
- if (sdk) return;
172
+ if (sdk) {
173
+ console.log('[web-sdk] skip init security sdk because it is already loaded');
174
+ return;
175
+ }
175
176
  this._newSecuritySDKByScene({
176
177
  product: product || scene,
177
- region: securityRegion || SecurityRegionEnum.SG
178
+ region: SecurityRegionEnum.SG
178
179
  }, function () {
179
180
  _this.logger.logInfo({
180
181
  title: 'sdk_event_securitySdkPreInitSuccess'
@@ -200,6 +201,12 @@ var AMSSDK = /*#__PURE__*/function () {
200
201
  var storage = this.getSecurityConfigStorage(securityConfig.product);
201
202
  var scene = storage.scene || getSecurityScene(securityConfig.product);
202
203
  var securitySdk = this.securitySdkMap.get(scene);
204
+ if (!securitySdk) {
205
+ var _securitySdk = PreloadHelper.getSecuritySdk(scene);
206
+ if (_securitySdk) {
207
+ this.securitySdkMap.set(scene, _securitySdk);
208
+ }
209
+ }
203
210
  return securitySdk;
204
211
  }
205
212
  /**
@@ -16,12 +16,6 @@ export declare class AntomSDKCore {
16
16
  constructor();
17
17
  registerProcessor(productScene: string, paymentMethod: string, processor: ProductProcessor): void;
18
18
  init(options: IoptionsParams, productScene: ProductSceneEnum): void;
19
- transferEasyPaySDKVersion(): {
20
- webAppVersion: string;
21
- greyscaleId: number;
22
- productScene: ProductSceneEnum.EASY_PAY;
23
- sdkVersion: string;
24
- };
25
19
  private prepare;
26
20
  startBizFlow(options: StartBizFlowOptions): Promise<void>;
27
21
  getServiceProvider(): ServiceProvider;
@@ -10,7 +10,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
10
10
  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; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
- import { DisplayTypeEnum, ProductSceneEnum, eventCodeEnum } from "../../types";
13
+ import { DisplayTypeEnum, eventCodeEnum } from "../../types";
14
14
  import { DisplayInfo } from "../index";
15
15
  import { v4 as uuid } from 'uuid';
16
16
  import { ServiceProvider } from "../service";
@@ -59,16 +59,6 @@ export var AntomSDKCore = /*#__PURE__*/function () {
59
59
  ServiceProvider.getInstance(this.instanceId).init(options, this.sdkMetaData);
60
60
  this.prepare(options, this.sdkMetaData);
61
61
  }
62
- }, {
63
- key: "transferEasyPaySDKVersion",
64
- value: function transferEasyPaySDKVersion() {
65
- return this.sdkMetaData = {
66
- webAppVersion: '',
67
- greyscaleId: getGrayscaleId(),
68
- productScene: ProductSceneEnum.EASY_PAY,
69
- sdkVersion: sdkVersion
70
- };
71
- }
72
62
  }, {
73
63
  key: "prepare",
74
64
  value: function prepare(options, sdkMetaData) {
@@ -188,7 +178,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
188
178
  key: "startBizFlow",
189
179
  value: function () {
190
180
  var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
191
- var _this$paymentContext$, _this$paymentContext$2;
181
+ var _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3;
192
182
  var paymentSession, displayInfo, _convertPaymentSessio, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
193
183
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
194
184
  while (1) switch (_context3.prev = _context3.next) {
@@ -211,7 +201,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
211
201
  sdkMetaData: this.sdkMetaData
212
202
  };
213
203
  // upgrade WebApp version
214
- mid = this.paymentContext.paymentSessionObj.clientId;
204
+ mid = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.clientId;
215
205
  webAppMatchConfig = parseWebAppMatchConfig(this.paymentContext.paymentSessionObj.extendInfo);
216
206
  webAppVersion = getWebAppVersion(this.sdkMetaData, mid, webAppMatchConfig);
217
207
  this.sdkMetaData.webAppVersion = webAppVersion;
@@ -221,8 +211,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
221
211
  ServiceProvider.getInstance(this.instanceId).update(this.paymentContext);
222
212
 
223
213
  // Invoke processor
224
- 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;
225
- 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;
226
216
  _context3.prev = 13;
227
217
  if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
228
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;
@@ -9,11 +9,8 @@ export declare class EasySafePayProcessor implements ProductProcessor {
9
9
  private allowSubmitPayCallAhead;
10
10
  private channelBehavior?;
11
11
  private SECURITY_SDK_INIT_TIMEOUT;
12
- static isSuccessfullyPreloaded: boolean;
13
12
  init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
14
13
  startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
15
- static preloadWebApp(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
16
- private buildWebAppPreloadUrl;
17
14
  private buildWebAppUrl;
18
15
  private buildRedirectResult;
19
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 "../../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,9 +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
- if (!EasySafePayProcessor.isSuccessfullyPreloaded) {
43
- EasySafePayProcessor.preloadWebApp(config, this.instanceId, sdkMetaData);
44
- }
43
+
44
+ // preload web app
45
+ PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment);
45
46
  }
46
47
  }, {
47
48
  key: "startBizFlow",
@@ -105,43 +106,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
105
106
  }
106
107
  return startBizFlow;
107
108
  }()
108
- }, {
109
- key: "buildWebAppPreloadUrl",
110
- value: function buildWebAppPreloadUrl(initConfig, instanceId, sdkMetaData) {
111
- var _this = this,
112
- _initConfig$analytics;
113
- var previousProductInfo = ProductInfoCacheUtil.getPreviousProductInfo(ProductSceneEnum.EASY_PAY, function (errorMsg) {
114
- if (errorMsg) {
115
- _this.logger.logError({
116
- title: 'performance_optimization_get_previousChannel_error'
117
- }, {
118
- errorMessage: errorMsg
119
- });
120
- }
121
- });
122
- var paymentMethodCategoryType = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.paymentMethodCategoryType;
123
- var productSceneVersion = (previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.productSceneVersion) || '2.0';
124
- var taskId = "ams-checkout-component-".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
125
- var hostSign = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.hostSign;
126
- var webUrl = WebAppUrlUtil.getWebAppUrl({
127
- environment: initConfig.environment,
128
- paymentMethodCategoryType: paymentMethodCategoryType,
129
- sdkMetaData: sdkMetaData,
130
- isPreload: true,
131
- productSceneVersion: productSceneVersion,
132
- query: {
133
- analyticsEnabled: (_initConfig$analytics = initConfig.analytics) === null || _initConfig$analytics === void 0 ? void 0 : _initConfig$analytics.enabled,
134
- displayType: DisplayTypeEnum.popup,
135
- instanceId: instanceId,
136
- locale: initConfig.locale,
137
- hostSign: hostSign
138
- }
139
- });
140
- return {
141
- webUrl: webUrl,
142
- taskId: taskId
143
- };
144
- }
145
109
  }, {
146
110
  key: "buildWebAppUrl",
147
111
  value: function buildWebAppUrl() {
@@ -197,7 +161,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
197
161
  }, {
198
162
  key: "sendRequestAndWaitWebLaunch",
199
163
  value: function sendRequestAndWaitWebLaunch() {
200
- var _this2 = this;
164
+ var _this = this;
201
165
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
202
166
  var webLaunchPromise = new Promise(function (resolve) {
203
167
  eventCenter.listen('onLaunch', function (res) {
@@ -207,25 +171,25 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
207
171
 
208
172
  // 等请求和 Web启动都Ready之后,发送renderComponent
209
173
  Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
210
- 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;
211
175
  var _ref2 = _slicedToArray(_ref, 3),
212
176
  _initSecurityRes = _ref2[0],
213
177
  submitRes = _ref2[1],
214
178
  _webLaunchRes = _ref2[2];
215
- var logMetaData = _this2.logger.getLogConfig().mdata;
179
+ var logMetaData = _this.logger.getLogConfig().mdata;
216
180
  eventCenter.dispatchToApp({
217
181
  event: 'renderComponent',
218
182
  data: {
219
- 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,
220
184
  submitResult: submitRes,
221
- 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,
222
186
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
223
- renderDisplayType: _this2.paymentContext.displayInfo.type,
224
- appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
225
- notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
226
- isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
227
- merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
228
- 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,
229
193
  envInfo: {
230
194
  screenHeight: screen.height,
231
195
  screenWidth: screen.width
@@ -234,7 +198,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
234
198
  trackId: logMetaData.requestSeq,
235
199
  platform: logMetaData.platform,
236
200
  firstLogTime: logMetaData.firstLogTime
237
- }, ((_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) || {}), {}, {
238
202
  renderDisplayType: logMetaData.renderDisplayType,
239
203
  sdkVersion: logMetaData.sdkVersion,
240
204
  merchantId: logMetaData.merchantId,
@@ -249,21 +213,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
249
213
  key: "processSubmitPay",
250
214
  value: function () {
251
215
  var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
252
- var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$2;
253
- 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;
254
218
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
255
219
  while (1) switch (_context2.prev = _context2.next) {
256
220
  case 0:
257
221
  submitParams = {
258
- paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionId) || '',
259
- 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
260
224
  };
261
225
  _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
262
- _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;
263
227
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
264
228
  ///EasyPay 2.0 首次传signAgreement字段
265
229
  submitParams['signAgreement'] = enableSignAgreement;
266
- 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;
267
231
  isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
268
232
  if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
269
233
  backScheme = getBackScheme(undefined, this.logger);
@@ -294,7 +258,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
294
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, {
295
259
  instanceId: this.instanceId,
296
260
  locale: this.initConfig.locale,
297
- 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,
298
262
  paymentSessionData: this.paymentContext.paymentSessionId,
299
263
  env: this.initConfig.environment,
300
264
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
@@ -361,13 +325,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
361
325
  key: "acquireApdidToken",
362
326
  value: function () {
363
327
  var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
364
- var _this$paymentContext$3;
328
+ var _this$paymentContext$7;
365
329
  var securityService, productScene, deviceId;
366
330
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
367
331
  while (1) switch (_context3.prev = _context3.next) {
368
332
  case 0:
369
333
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
370
- 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;
371
335
  deviceId = securityService.getDeviceId({
372
336
  productScene: productScene
373
337
  });
@@ -387,14 +351,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
387
351
  key: "initSecuritySDK",
388
352
  value: function () {
389
353
  var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
390
- 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;
391
355
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
392
356
  while (1) switch (_context4.prev = _context4.next) {
393
357
  case 0:
394
358
  _context4.prev = 0;
395
359
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
396
- nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
397
- 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;
398
362
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
399
363
  shouldInitSecuritySDK = false;
400
364
  if (nonInitSecuritySDK) {
@@ -451,19 +415,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
451
415
  }
452
416
  return initSecuritySDK;
453
417
  }()
454
- }], [{
455
- key: "preloadWebApp",
456
- value: function preloadWebApp(config, instanceId, sdkMetaData) {
457
- // trigger preload
458
- var ClassEasySafePayProcessor = new EasySafePayProcessor();
459
- var containerService = ServiceProvider.getInstance(ClassEasySafePayProcessor.instanceId).getService('Container');
460
- var _ClassEasySafePayProc = ClassEasySafePayProcessor.buildWebAppPreloadUrl(config, instanceId, sdkMetaData),
461
- taskId = _ClassEasySafePayProc.taskId,
462
- webUrl = _ClassEasySafePayProc.webUrl;
463
- EasySafePayProcessor.isSuccessfullyPreloaded = true;
464
- containerService.preload(taskId, webUrl);
465
- }
466
418
  }]);
467
419
  return EasySafePayProcessor;
468
- }();
469
- _defineProperty(EasySafePayProcessor, "isSuccessfullyPreloaded", void 0);
420
+ }();
@@ -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,35 +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
- console.log('web-preloadsdk web app', url);
102
- var timerId = setTimeout(function () {
103
- console.log('clear web-preloadsdk web app', url);
104
- _this.clearPreloadContainer(taskId);
105
- }, MAX_CLEAR_TIME);
106
- this.clearTimerIdMapping[taskId] = timerId;
107
- }
108
- }, {
109
- key: "clearPreloadContainer",
110
- value: function clearPreloadContainer(taskId) {
111
- var timerId = this.clearTimerIdMapping[taskId];
112
- if (timerId) {
113
- clearTimeout(timerId);
114
- }
115
- var container = document.getElementById(taskId);
116
- if (container) {
117
- document.body.removeChild(container);
118
- }
119
- }
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
+ // }
120
117
  }, {
121
118
  key: "showLoading",
122
119
  value: function showLoading(container, displayInfo) {
@@ -170,13 +167,13 @@ export var ContainerService = /*#__PURE__*/function () {
170
167
  }, {
171
168
  key: "addCapabilityToEventCenter",
172
169
  value: function addCapabilityToEventCenter() {
173
- var _this2 = this;
170
+ var _this = this;
174
171
  this.eventCenter.listen(EVENT.dismissLoading.name, function () {
175
- _this2.dismissLoading();
172
+ _this.dismissLoading();
176
173
  });
177
174
  this.eventCenter.listen(EVENT.getUserAgentFromSdk.name, function (data, payload) {
178
175
  var _payload$context;
179
- _this2.eventCenter.dispatchToApp({
176
+ _this.eventCenter.dispatchToApp({
180
177
  event: 'appEventCallback',
181
178
  eventCallbackId: (_payload$context = payload.context) === null || _payload$context === void 0 ? void 0 : _payload$context.eventCallbackId,
182
179
  data: {
@@ -185,34 +182,34 @@ export var ContainerService = /*#__PURE__*/function () {
185
182
  });
186
183
  });
187
184
  this.eventCenter.listen(EVENT.popupWindow.name, function (data) {
188
- var _this2$displayInfo;
185
+ var _this$displayInfo2;
189
186
  if (data.paymentElementOldModel) return;
190
- _this2.popupManager.popup(_objectSpread({
191
- 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
192
189
  }, data)).catch(function (error) {
193
- _this2.logService.logError({
190
+ _this.logService.logError({
194
191
  title: (error === null || error === void 0 ? void 0 : error.title) || 'sdk_error_create_pop_up'
195
192
  }, error);
196
- _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);
197
194
  });
198
195
  });
199
196
  this.eventCenter.listen(EVENT.popWindow.name, function () {
200
- _this2.popupManager.pop();
197
+ _this.popupManager.pop();
201
198
  });
202
199
  this.eventCenter.listen(EVENT.sizeChanged.name, function (data) {
203
- _this2.handleSizeChanged(_objectSpread({}, data));
200
+ _this.handleSizeChanged(_objectSpread({}, data));
204
201
  });
205
202
  this.eventCenter.listen(EVENT.showCloseButton.name, function () {
206
- _this2.changeCloseBtnVisibility(true);
203
+ _this.changeCloseBtnVisibility(true);
207
204
  });
208
205
  this.eventCenter.listen(EVENT.hideCloseButton.name, function () {
209
- _this2.changeCloseBtnVisibility(false);
206
+ _this.changeCloseBtnVisibility(false);
210
207
  });
211
208
  this.eventCenter.listen(EVENT.setMaskCloseButton.name, function (data) {
212
- _this2.handleMaskCloseBtnShow(data);
209
+ _this.handleMaskCloseBtnShow(data);
213
210
  });
214
211
  this.eventCenter.listen(EVENT.appHeartBeat.name, function () {
215
- _this2.handleAppHeartBeat();
212
+ _this.handleAppHeartBeat();
216
213
  });
217
214
  }
218
215
  }, {
@@ -273,12 +270,12 @@ export var ContainerService = /*#__PURE__*/function () {
273
270
  }, {
274
271
  key: "handleAppHeartBeat",
275
272
  value: function handleAppHeartBeat() {
276
- var _this3 = this;
273
+ var _this2 = this;
277
274
  try {
278
275
  if (!this._webAppHeartBeatTimeoutFn) {
279
276
  this._webAppHeartBeatTimeoutFn = function () {
280
- if (_this3.webApp && _this3.displayInfo) {
281
- _this3.logService.logError({
277
+ if (_this2.webApp && _this2.displayInfo) {
278
+ _this2.logService.logError({
282
279
  title: 'sdk_error_appHeartBeatTimeout'
283
280
  });
284
281
  }
@@ -292,8 +289,8 @@ export var ContainerService = /*#__PURE__*/function () {
292
289
  window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
293
290
  }
294
291
  setTimeout(function () {
295
- if (_this3.webApp && _this3.displayInfo) {
296
- _this3.eventCenter.dispatchToApp({
292
+ if (_this2.webApp && _this2.displayInfo) {
293
+ _this2.eventCenter.dispatchToApp({
297
294
  event: 'sdkHeartBeat',
298
295
  data: {}
299
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;