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

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 (145) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +19 -0
  3. package/esm/component/channel.js +87 -0
  4. package/esm/component/component.inline.style.d.ts +10 -0
  5. package/esm/component/component.inline.style.js +121 -0
  6. package/esm/component/component.popup.style.d.ts +25 -0
  7. package/esm/component/component.popup.style.js +203 -0
  8. package/esm/component/popupWindow.style.d.ts +11 -0
  9. package/esm/component/popupWindow.style.js +121 -0
  10. package/esm/config/index.d.ts +11 -0
  11. package/esm/config/index.js +20 -1
  12. package/esm/constant/index.d.ts +25 -0
  13. package/esm/constant/index.js +28 -0
  14. package/esm/core/bus/index.d.ts +3 -3
  15. package/esm/core/bus/index.js +14 -14
  16. package/esm/core/component/address.d.ts +8 -0
  17. package/esm/core/component/address.js +72 -0
  18. package/esm/core/component/appPreloadProcessing.js +2 -2
  19. package/esm/core/component/ckp/index.js +12 -8
  20. package/esm/core/component/element/components/address.d.ts +19 -0
  21. package/esm/core/component/element/components/address.js +68 -0
  22. package/esm/core/component/element/components/auth.d.ts +17 -0
  23. package/esm/core/component/element/components/auth.js +60 -0
  24. package/esm/core/component/element/components/payment.d.ts +19 -0
  25. package/esm/core/component/element/components/payment.js +74 -0
  26. package/esm/core/component/element/index.d.ts +47 -0
  27. package/esm/core/component/element/index.js +817 -0
  28. package/esm/core/component/element/mock.d.ts +4 -0
  29. package/esm/core/component/element/mock.js +491 -0
  30. package/esm/core/component/element/type.d.ts +191 -0
  31. package/esm/core/component/element/type.js +36 -0
  32. package/esm/core/component/element/utils.d.ts +13 -0
  33. package/esm/core/component/element/utils.js +6 -0
  34. package/esm/core/component/index.d.ts +12 -7
  35. package/esm/core/component/index.js +132 -78
  36. package/esm/core/drop-in/index.js +2 -2
  37. package/esm/core/instance/index.d.ts +1 -0
  38. package/esm/core/instance/index.js +24 -11
  39. package/esm/foundation/core/index.d.ts +28 -0
  40. package/esm/foundation/core/index.js +396 -0
  41. package/esm/foundation/index.d.ts +75 -0
  42. package/esm/foundation/index.js +42 -0
  43. package/esm/foundation/product-processor/easysafepay/deps.d.ts +18 -0
  44. package/esm/foundation/product-processor/easysafepay/deps.js +12 -0
  45. package/esm/foundation/product-processor/easysafepay/index.d.ts +26 -0
  46. package/esm/foundation/product-processor/easysafepay/index.js +464 -0
  47. package/esm/foundation/service/api-bus/ability/callback.d.ts +9 -0
  48. package/esm/foundation/service/api-bus/ability/callback.js +55 -0
  49. package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
  50. package/esm/foundation/service/api-bus/ability/globalData.js +89 -0
  51. package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
  52. package/esm/foundation/service/api-bus/ability/request.js +151 -0
  53. package/esm/foundation/service/api-bus/ability/security.d.ts +12 -0
  54. package/esm/foundation/service/api-bus/ability/security.js +161 -0
  55. package/esm/foundation/service/api-bus/ability/tracker.d.ts +9 -0
  56. package/esm/foundation/service/api-bus/ability/tracker.js +80 -0
  57. package/esm/foundation/service/api-bus/busManager.d.ts +127 -0
  58. package/esm/foundation/service/api-bus/busManager.js +398 -0
  59. package/esm/foundation/service/api-bus/index.d.ts +20 -0
  60. package/esm/foundation/service/api-bus/index.js +88 -0
  61. package/esm/foundation/service/api-bus/interface.d.ts +48 -0
  62. package/esm/foundation/service/api-bus/interface.js +54 -0
  63. package/esm/foundation/service/container/index.d.ts +32 -0
  64. package/esm/foundation/service/container/index.js +330 -0
  65. package/esm/foundation/service/container/popup.d.ts +17 -0
  66. package/esm/foundation/service/container/popup.js +103 -0
  67. package/esm/foundation/service/container/utils.d.ts +7 -0
  68. package/esm/foundation/service/container/utils.js +48 -0
  69. package/esm/foundation/service/event-center.d.ts +82 -0
  70. package/esm/foundation/service/event-center.js +274 -0
  71. package/esm/foundation/service/global-data/index.d.ts +11 -0
  72. package/esm/foundation/service/global-data/index.js +68 -0
  73. package/esm/foundation/service/index.d.ts +19 -0
  74. package/esm/foundation/service/index.js +82 -0
  75. package/esm/foundation/service/log/index.d.ts +43 -0
  76. package/esm/foundation/service/log/index.js +250 -0
  77. package/esm/foundation/service/log/keys.d.ts +13 -0
  78. package/esm/foundation/service/log/keys.js +103 -0
  79. package/esm/foundation/service/log/processor.d.ts +9 -0
  80. package/esm/foundation/service/log/processor.js +148 -0
  81. package/esm/foundation/service/log/types.d.ts +32 -0
  82. package/esm/foundation/service/log/types.js +1 -0
  83. package/esm/foundation/service/requester/deps.d.ts +17 -0
  84. package/esm/foundation/service/requester/deps.js +11 -0
  85. package/esm/foundation/service/requester/requester.d.ts +22 -0
  86. package/esm/foundation/service/requester/requester.js +217 -0
  87. package/esm/foundation/service/security/index.d.ts +28 -0
  88. package/esm/foundation/service/security/index.js +284 -0
  89. package/esm/foundation/service/security/security.d.ts +33 -0
  90. package/esm/foundation/service/security/security.js +182 -0
  91. package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
  92. package/esm/foundation/utils/gray_scale_utils.js +40 -0
  93. package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
  94. package/esm/foundation/utils/payment_context_utils.js +57 -0
  95. package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
  96. package/esm/foundation/utils/payment_product_utils.js +38 -0
  97. package/esm/foundation/utils/redirect_utils.d.ts +11 -0
  98. package/esm/foundation/utils/redirect_utils.js +262 -0
  99. package/esm/foundation/utils/system_events.d.ts +4 -0
  100. package/esm/foundation/utils/system_events.js +66 -0
  101. package/esm/foundation/utils/web_app_url_utils.d.ts +46 -0
  102. package/esm/foundation/utils/web_app_url_utils.js +112 -0
  103. package/esm/index.d.ts +19 -12
  104. package/esm/index.js +110 -56
  105. package/esm/plugin/applepay/component.js +13 -11
  106. package/esm/plugin/applepay/index.js +10 -6
  107. package/esm/plugin/applepay/service.d.ts +2 -2
  108. package/esm/plugin/applepay/service.js +26 -18
  109. package/esm/plugin/component/cashierApp.d.ts +10 -8
  110. package/esm/plugin/component/cashierApp.js +48 -11
  111. package/esm/plugin/component/channel.d.ts +4 -3
  112. package/esm/plugin/component/channel.js +39 -2
  113. package/esm/plugin/component/component.inline.style.d.ts +9 -10
  114. package/esm/plugin/component/component.inline.style.js +93 -10
  115. package/esm/plugin/component/component.popup.style.d.ts +15 -6
  116. package/esm/plugin/component/component.popup.style.js +30 -7
  117. package/esm/plugin/component/index.d.ts +14 -8
  118. package/esm/plugin/component/index.js +383 -187
  119. package/esm/plugin/component/popupWindow.style.d.ts +5 -2
  120. package/esm/plugin/component/popupWindow.style.js +70 -14
  121. package/esm/plugin/const.js +5 -5
  122. package/esm/plugin/drop-in/index.d.ts +5 -5
  123. package/esm/plugin/drop-in/index.js +7 -7
  124. package/esm/plugin/payment-element/utils.d.ts +2 -0
  125. package/esm/plugin/payment-element/utils.js +6 -0
  126. package/esm/plugin/paypal/index.js +2 -1
  127. package/esm/plugin/type.d.ts +4 -3
  128. package/esm/service/element.d.ts +4 -0
  129. package/esm/service/element.js +51 -0
  130. package/esm/service/index.d.ts +1 -0
  131. package/esm/service/index.js +6 -2
  132. package/esm/types/index.d.ts +337 -40
  133. package/esm/types/index.js +119 -55
  134. package/esm/util/createIframeNode.d.ts +2 -2
  135. package/esm/util/createIframeNode.js +3 -3
  136. package/esm/util/getBackScheme.d.ts +5 -0
  137. package/esm/util/getBackScheme.js +133 -0
  138. package/esm/util/index.js +4 -8
  139. package/esm/util/logger.d.ts +3 -3
  140. package/esm/util/logger.js +49 -13
  141. package/esm/util/security.d.ts +3 -2
  142. package/esm/util/security.js +2 -2
  143. package/esm/util/spm-map.d.ts +172 -0
  144. package/esm/util/spm-map.js +172 -0
  145. package/package.json +3 -1
@@ -19,20 +19,22 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
19
  /* eslint-disable @typescript-eslint/no-explicit-any */
20
20
  import { v4 as uuid } from 'uuid';
21
21
  import { sdkVersion } from "../../config";
22
- import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
22
+ import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
23
23
  import { queryPaymentInfo, submitPayInfo } from "../../service";
24
- import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
24
+ import { ComponentSignEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, DisplayTypeEnum, TargetEnum } from "../../types";
25
25
  import { getType, isJsonString, isPC } from "../../util";
26
26
  import { isLocalMock } from "../../util/mock";
27
27
  import { matchVersion } from "../../util/versionCompare";
28
+ import { getBackScheme } from "../../util/getBackScheme";
29
+ import { handlePaymentSessionConfig } from "../payment-element/utils";
28
30
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
29
- import { getChannelBehavior } from "./channel";
31
+ import { getChannelBehavior, handleGooglePay } from "./channel";
30
32
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
31
- import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
32
- import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
33
+ import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
34
+ import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
33
35
  window.changingPageHeight = window.innerHeight;
34
36
  var ComponentApp = /*#__PURE__*/function () {
35
- function ComponentApp() {
37
+ function ComponentApp(componentOption) {
36
38
  _classCallCheck(this, ComponentApp);
37
39
  _defineProperty(this, "app", void 0);
38
40
  _defineProperty(this, "AMSSDK", void 0);
@@ -52,13 +54,14 @@ var ComponentApp = /*#__PURE__*/function () {
52
54
  _defineProperty(this, "_actionQueryPromise", null);
53
55
  _defineProperty(this, "_actionSubmitPromise", null);
54
56
  _defineProperty(this, "_renderParams", null);
55
- _defineProperty(this, "_componentSign", componentSignEnum.NONE);
57
+ _defineProperty(this, "_componentSign", ComponentSignEnum.NONE);
56
58
  _defineProperty(this, "_appLocationSearch", void 0);
57
- _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
59
+ _defineProperty(this, "_renderDisplayType", DisplayTypeEnum.popup);
58
60
  _defineProperty(this, "_multipleCallbackEvents", void 0);
61
+ _defineProperty(this, "_isAppWebview", void 0);
59
62
  _defineProperty(this, "_merchantAppointParam", void 0);
60
63
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
61
- this._appVersion = '1.20.2';
64
+ this._appVersion = componentOption.appVersion;
62
65
  this._isInitComponent = false;
63
66
  this._selector = "#".concat(COMPONENT_SECTION_ID);
64
67
  this.createIframeNode = function () {
@@ -67,7 +70,7 @@ var ComponentApp = /*#__PURE__*/function () {
67
70
  this.createPreloadIframeNode = function () {
68
71
  return Promise.resolve();
69
72
  };
70
- this.platform = isPC() ? platformEnum.desktop : platformEnum.mobile;
73
+ this.platform = isPC() ? PlatformEnum.desktop : PlatformEnum.mobile;
71
74
  this._isRetention = true;
72
75
  this._appLocationSearch = '';
73
76
  this._performanceData.push({
@@ -102,12 +105,12 @@ var ComponentApp = /*#__PURE__*/function () {
102
105
  var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
103
106
  var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
104
107
  this.AMSSDK.logger.setMedta({
105
- platform: this.platform === platformEnum.desktop ? 'PC' : 'WAP',
108
+ platform: this.platform === PlatformEnum.desktop ? 'PC' : 'WAP',
106
109
  // PC/WAP,
107
110
  sdkVersion: sdkVersion,
108
111
  webAppVersion: this._appVersion,
109
112
  instanceId: this.AMSSDK._instanceId,
110
- storageId: this.AMSSDK._storageId,
113
+ deviceId: this.AMSSDK._storageId,
111
114
  // the better way to use md5 paymentSesionID
112
115
  renderDisplayType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 ? void 0 : paymentSessionMetaData.renderDisplayType,
113
116
  merchantId: paymentSessionMetaData === null || paymentSessionMetaData === void 0 ? void 0 : paymentSessionMetaData.clientId,
@@ -139,12 +142,12 @@ var ComponentApp = /*#__PURE__*/function () {
139
142
  var _this$_renderParams4,
140
143
  _this = this;
141
144
  var product = (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionMetaData) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionConfig) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.productScene;
142
- if (componentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
143
- if (componentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
145
+ if (ComponentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
146
+ if (ComponentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
144
147
  this.AMSSDK.logger.logInfo({
145
148
  title: 'sdk_event_security_unneeded_scenarios'
146
149
  }, {
147
- product: product
150
+ productScene: product
148
151
  });
149
152
  }
150
153
  var securitySDK = this.AMSSDK._getSecuritySDKByProductScene({
@@ -177,15 +180,13 @@ var ComponentApp = /*#__PURE__*/function () {
177
180
  this.AMSSDK.logger.logInfo({
178
181
  title: 'sdk_event_securitySdkGetTokenSuccess'
179
182
  }, {
180
- deviceId: deviceId,
181
- time: time
183
+ eventMessage: time
182
184
  }).send();
183
185
  } else {
184
186
  this.AMSSDK.logger.logInfo({
185
187
  title: 'sdk_error_securitySdkGetTokenFailed'
186
188
  }, {
187
- deviceId: deviceId,
188
- time: time
189
+ eventMessage: time
189
190
  }).send();
190
191
  }
191
192
  }
@@ -249,6 +250,12 @@ var ComponentApp = /*#__PURE__*/function () {
249
250
  key: "appendIframeNodes",
250
251
  value: function appendIframeNodes(componentSign, renderParams) {
251
252
  var _renderParams,
253
+ _renderParams2,
254
+ _this$_selector,
255
+ _this$_selector$index,
256
+ _this$_selector2,
257
+ _this$_selector2$slic,
258
+ _renderParams3,
252
259
  _this$_renderParams5,
253
260
  _this$_renderParams6,
254
261
  _this$_renderParams7,
@@ -259,13 +266,19 @@ var ComponentApp = /*#__PURE__*/function () {
259
266
  return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
260
267
  }
261
268
  renderParams = this.setParameterDefaultValues(componentSign, renderParams);
269
+ this._merchantAppointParam = renderParams.merchantAppointParam;
262
270
  this._isInitComponent = true;
263
271
  this._renderParams = renderParams;
264
272
  this._componentSign = componentSign;
265
273
  if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
266
- this._renderDisplayType = renderParams.renderDisplayType;
267
- this._merchantAppointParam = renderParams.merchantAppointParam;
268
- var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
274
+ this._renderDisplayType = (_renderParams2 = renderParams) === null || _renderParams2 === void 0 ? void 0 : _renderParams2.renderDisplayType;
275
+ // connect element模式会存在加载多个sdk,appendAliasContainerId为true来判断,给容器inlineId添加标识,id中不能存在#需在这里提前过滤一下
276
+ var _selector = (this === null || this === void 0 || (_this$_selector = this._selector) === null || _this$_selector === void 0 || (_this$_selector$index = _this$_selector.indexOf) === null || _this$_selector$index === void 0 ? void 0 : _this$_selector$index.call(_this$_selector, '#')) === -1 ? this === null || this === void 0 ? void 0 : this._selector : this === null || this === void 0 || (_this$_selector2 = this._selector) === null || _this$_selector2 === void 0 || (_this$_selector2$slic = _this$_selector2.slice) === null || _this$_selector2$slic === void 0 ? void 0 : _this$_selector2$slic.call(_this$_selector2, 1);
277
+ // 修改需当前文件搜索,这段注释appendAliasContainerId
278
+ var appendAliasContainerId = (_renderParams3 = renderParams) !== null && _renderParams3 !== void 0 && _renderParams3.appendAliasContainerId ? "-".concat(_selector) : '';
279
+ var inlineId = "".concat(COMPONENT_CONTAINER_ID).concat(appendAliasContainerId);
280
+ var insertedNode = (this === null || this === void 0 ? void 0 : this._renderDisplayType) === DisplayTypeEnum.inline ? "#".concat(inlineId) : this === null || this === void 0 ? void 0 : this._selector;
281
+ this._isAppWebview = renderParams.isAppWebview;
269
282
  this.initLoggerMeta();
270
283
  this.initSecurity();
271
284
  this._performanceData.push({
@@ -294,17 +307,16 @@ var ComponentApp = /*#__PURE__*/function () {
294
307
  this.AMSSDK.logger.logInfo({
295
308
  title: 'sdk_event_createComponent'
296
309
  }, {
297
- version: productSceneVersion,
298
- product: this.AMSSDK.options.product
310
+ productScene: this.AMSSDK.options.product
299
311
  }).send();
300
- if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
301
- if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
312
+ if (ComponentSignEnum.EASY_PAY_WALLET === this._componentSign) {
313
+ if (productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
302
314
  // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
303
315
  this.handleAuthUrlInfo(authUrlInfo);
304
316
  return;
305
317
  }
306
318
  }
307
- if (componentSignEnum.AUTO_DEBIT_WALLET === this._componentSign) {
319
+ if (ComponentSignEnum.AUTO_DEBIT_WALLET === this._componentSign) {
308
320
  var _this$_renderParams9, _action$web, _action$wap;
309
321
  var action = ((_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 || (_this$_renderParams9 = _this$_renderParams9.paymentSessionMetaData) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.action) || {};
310
322
  var signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
@@ -315,7 +327,7 @@ var ComponentApp = /*#__PURE__*/function () {
315
327
  return;
316
328
  }
317
329
  }
318
- if (componentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
330
+ if (ComponentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
319
331
  if (requireFastSdk === true && productSceneVersion === '1.0') {
320
332
  // REDIRECT,requireFastSdk为true,不需要接口请求
321
333
  this.handleAuthUrlInfo(authUrlInfo);
@@ -330,12 +342,12 @@ var ComponentApp = /*#__PURE__*/function () {
330
342
  this.dispatchToSDK(EVENT.eventCallback.name, {
331
343
  code: eventCodeEnum.SDK_START_OF_LOADING
332
344
  });
333
- if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
334
- var container = createInlineBaseElement(this._selector);
345
+ if (this._renderDisplayType === DisplayTypeEnum.inline) {
346
+ var container = createInlineBaseElement(this._selector, COMPONENT_CONTAINER_ID, inlineId);
335
347
  if (container) this.renderInlineLoading(renderParams, container);
336
348
  insertStyleSheet();
337
349
  }
338
- if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
350
+ if (this._renderDisplayType === DisplayTypeEnum.popup) {
339
351
  var _this$_renderParams10;
340
352
  createBaseElement(this.platform, this.closeBtnFunc.bind(this));
341
353
  createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
@@ -344,9 +356,11 @@ var ComponentApp = /*#__PURE__*/function () {
344
356
  if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
345
357
  onClickOutside = this.closeBtnFunc.bind(this);
346
358
  }
359
+ var closeBtnFunc = this.closeBtnFunc.bind(this);
347
360
  createMockup({
348
361
  platform: this.platform,
349
- onClickOutside: onClickOutside
362
+ onClickOutside: onClickOutside,
363
+ closeBtnFunc: closeBtnFunc
350
364
  });
351
365
  this.renderPopupLoading(renderParams);
352
366
  }
@@ -370,7 +384,6 @@ var ComponentApp = /*#__PURE__*/function () {
370
384
  this.AMSSDK.logger.logInfo({
371
385
  title: 'performance_optimization_preload'
372
386
  }, {
373
- componentSign: componentSign,
374
387
  productSceneVersion: productSceneVersion
375
388
  });
376
389
  }
@@ -378,7 +391,7 @@ var ComponentApp = /*#__PURE__*/function () {
378
391
  key: "setParameterDefaultValues",
379
392
  value: function setParameterDefaultValues(componentSign, renderParams) {
380
393
  var newParams = Object.assign({}, renderParams);
381
- if (componentSign === componentSignEnum.VAULTING_CARD) {
394
+ if (componentSign === ComponentSignEnum.VAULTING_CARD) {
382
395
  var _newParams$notRedirec;
383
396
  newParams.notRedirectAfterComplete = (_newParams$notRedirec = newParams === null || newParams === void 0 ? void 0 : newParams.notRedirectAfterComplete) !== null && _newParams$notRedirec !== void 0 ? _newParams$notRedirec : true;
384
397
  }
@@ -387,10 +400,22 @@ var ComponentApp = /*#__PURE__*/function () {
387
400
  }, {
388
401
  key: "renderInlineLoading",
389
402
  value: function renderInlineLoading(renderParams, selector) {
390
- var _renderParams$appeara;
403
+ var _renderParams$appeara, _this$_renderParams11;
391
404
  var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
392
405
  showLoading = typeof showLoading === 'boolean' ? showLoading : true;
393
- if (showLoading) addInlineLoading(selector, this.platform);
406
+ var extendInfo = renderParams.paymentSessionMetaData.extendInfo;
407
+ var isExpressCheckout = false;
408
+ try {
409
+ // expressCheckout可能出现string(false) JSON.parse再转一次
410
+ isExpressCheckout = JSON.parse(JSON.parse(extendInfo).expressCheckout);
411
+ } catch (error) {
412
+ // 遇到JSON解析错误,默认false
413
+ }
414
+ if (showLoading) addInlineLoading(selector, this.platform, {
415
+ componentSign: this._componentSign,
416
+ type: (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.appearance) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.layout) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.type,
417
+ isExpressCheckout: isExpressCheckout
418
+ });
394
419
  }
395
420
  }, {
396
421
  key: "renderPopupLoading",
@@ -427,9 +452,7 @@ var ComponentApp = /*#__PURE__*/function () {
427
452
  }, {
428
453
  key: "createActionQueryPromise",
429
454
  value: function createActionQueryPromise() {
430
- var _this$_renderParams11,
431
- _this5 = this;
432
- var paymentMethodType = (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentSessionMetaData) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentMethodInfoView) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.paymentMethodType;
455
+ var _this5 = this;
433
456
  this._performanceData.push({
434
457
  key: 'sdk_action_query_start',
435
458
  value: Date.now()
@@ -437,8 +460,8 @@ var ComponentApp = /*#__PURE__*/function () {
437
460
  // eslint-disable-next-line no-async-promise-executor
438
461
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
439
462
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
440
- var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
441
- var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _this5$_renderParams8, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _ref9, _ref9$action, _ref9$action2, _ref9$action2$autoDeb, autoDebitWithToken, _this5$_renderParams9, _action$web2, _action$wap2, action, signType;
463
+ var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6, _this5$_renderParams7;
464
+ var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams8, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _this5$_renderParams9, _action$web2, _action$wap2, action, signType;
442
465
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
443
466
  while (1) switch (_context2.prev = _context2.next) {
444
467
  case 0:
@@ -474,22 +497,43 @@ var ComponentApp = /*#__PURE__*/function () {
474
497
  success: true
475
498
  }));
476
499
  case 9:
477
- if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
478
- _context2.next = 21;
500
+ if (ComponentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
501
+ params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
502
+ }
503
+ if (!(ComponentSignEnum.ELEMENT_PAYMENT === _this5._componentSign && _this5 !== null && _this5 !== void 0 && (_this5$_renderParams6 = _this5._renderParams) !== null && _this5$_renderParams6 !== void 0 && (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) !== null && _this5$_renderParams6 !== void 0 && (_this5$_renderParams6 = _this5$_renderParams6.connectFactor) !== null && _this5$_renderParams6 !== void 0 && _this5$_renderParams6.enableConnect)) {
504
+ _context2.next = 12;
505
+ break;
506
+ }
507
+ return _context2.abrupt("return", resolve({
508
+ message: 'sdk no need to make query request',
509
+ success: true
510
+ }));
511
+ case 12:
512
+ if (!(ComponentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
513
+ _context2.next = 14;
514
+ break;
515
+ }
516
+ return _context2.abrupt("return", resolve({
517
+ message: 'sdk no need to make query request',
518
+ success: true
519
+ }));
520
+ case 14:
521
+ if (!(ComponentSignEnum.VAULTING_CARD === _this5._componentSign)) {
522
+ _context2.next = 26;
479
523
  break;
480
524
  }
481
525
  if (!enableVaultingApiOptimize) {
482
- _context2.next = 21;
526
+ _context2.next = 26;
483
527
  break;
484
528
  }
485
529
  if (!skipSdkQueryForm) {
486
- _context2.next = 18;
530
+ _context2.next = 23;
487
531
  break;
488
532
  }
489
533
  // 优先判断 skipSdkQueryForm
490
534
  ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
491
535
  if (!ifSkip) {
492
- _context2.next = 16;
536
+ _context2.next = 21;
493
537
  break;
494
538
  }
495
539
  resolve({
@@ -497,12 +541,12 @@ var ComponentApp = /*#__PURE__*/function () {
497
541
  success: true
498
542
  });
499
543
  return _context2.abrupt("return");
500
- case 16:
501
- _context2.next = 21;
544
+ case 21:
545
+ _context2.next = 26;
502
546
  break;
503
- case 18:
547
+ case 23:
504
548
  if (!skipSdkQuery) {
505
- _context2.next = 21;
549
+ _context2.next = 26;
506
550
  break;
507
551
  }
508
552
  resolve({
@@ -510,10 +554,10 @@ var ComponentApp = /*#__PURE__*/function () {
510
554
  success: true
511
555
  });
512
556
  return _context2.abrupt("return");
513
- case 21:
514
- channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
557
+ case 26:
558
+ channelBehavior = getChannelBehavior((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
515
559
  if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
516
- _context2.next = 24;
560
+ _context2.next = 29;
517
561
  break;
518
562
  }
519
563
  return _context2.abrupt("return", resolve({
@@ -521,84 +565,82 @@ var ComponentApp = /*#__PURE__*/function () {
521
565
  amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
522
566
  success: true
523
567
  }));
524
- case 24:
525
- if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
526
- _context2.next = 30;
568
+ case 29:
569
+ if (!(ComponentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || ComponentSignEnum.VAULTING_CARD === _this5._componentSign)) {
570
+ _context2.next = 35;
527
571
  break;
528
572
  }
529
573
  params.paymentMethodType = 'CARD';
530
- _context2.next = 28;
574
+ _context2.next = 33;
531
575
  return _this5.getDeviceIdAndLog();
532
- case 28:
576
+ case 33:
533
577
  envInfo.deviceId = _context2.sent;
534
578
  if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
535
579
  envInfo.extendInfo = {
536
580
  WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
537
581
  };
538
582
  }
539
- case 30:
540
- if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
541
- _context2.next = 40;
583
+ case 35:
584
+ if (!(ComponentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
585
+ _context2.next = 44;
542
586
  break;
543
587
  }
544
588
  _ref8 = params.paymentSessionConfig || {}, _ref8$productSceneVer = _ref8.productSceneVersion, productSceneVersion = _ref8$productSceneVer === void 0 ? '' : _ref8$productSceneVer, _ref8$productScene = _ref8.productScene, productScene = _ref8$productScene === void 0 ? '' : _ref8$productScene;
545
- _ref9 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData) || {}, _ref9$action = _ref9.action, _ref9$action2 = _ref9$action === void 0 ? {} : _ref9$action, _ref9$action2$autoDeb = _ref9$action2.autoDebitWithToken, autoDebitWithToken = _ref9$action2$autoDeb === void 0 ? false : _ref9$action2$autoDeb;
546
589
  if (!((_this5$_renderParams8 = _this5._renderParams) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.action) !== null && _this5$_renderParams8 !== void 0 && _this5$_renderParams8.skipSdkQuery && enableEasypayApiOptimize)) {
547
- _context2.next = 35;
590
+ _context2.next = 39;
548
591
  break;
549
592
  }
550
593
  return _context2.abrupt("return", resolve({
551
594
  message: 'sdk no need to make query request',
552
595
  success: true
553
596
  }));
554
- case 35:
555
- if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
556
- _context2.next = 37;
597
+ case 39:
598
+ if (!(productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
599
+ _context2.next = 41;
557
600
  break;
558
601
  }
559
602
  return _context2.abrupt("return", resolve({
560
603
  message: 'sdk no need to make query request',
561
604
  success: true
562
605
  }));
563
- case 37:
564
- _context2.next = 39;
606
+ case 41:
607
+ _context2.next = 43;
565
608
  return _this5.getDeviceIdAndLog();
566
- case 39:
609
+ case 43:
567
610
  envInfo.deviceId = _context2.sent;
568
- case 40:
569
- if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
570
- _context2.next = 50;
611
+ case 44:
612
+ if (!(ComponentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
613
+ _context2.next = 54;
571
614
  break;
572
615
  }
573
616
  action = ((_this5$_renderParams9 = _this5._renderParams) === null || _this5$_renderParams9 === void 0 || (_this5$_renderParams9 = _this5$_renderParams9.paymentSessionMetaData) === null || _this5$_renderParams9 === void 0 ? void 0 : _this5$_renderParams9.action) || {};
574
617
  signType = isPC() ? action === null || action === void 0 || (_action$web2 = action.web) === null || _action$web2 === void 0 ? void 0 : _action$web2.signType : action === null || action === void 0 || (_action$wap2 = action.wap) === null || _action$wap2 === void 0 ? void 0 : _action$wap2.signType;
575
618
  if (!(signType === 'SMS')) {
576
- _context2.next = 45;
619
+ _context2.next = 49;
577
620
  break;
578
621
  }
579
622
  return _context2.abrupt("return", resolve({
580
623
  message: 'sdk no need to make query request',
581
624
  success: true
582
625
  }));
583
- case 45:
626
+ case 49:
584
627
  if (!(!signType || signType !== 'REDIRECT')) {
585
- _context2.next = 47;
628
+ _context2.next = 51;
586
629
  break;
587
630
  }
588
631
  return _context2.abrupt("return", resolve({
589
632
  success: false
590
633
  }));
591
- case 47:
592
- _context2.next = 49;
634
+ case 51:
635
+ _context2.next = 53;
593
636
  return _this5.getDeviceIdAndLog();
594
- case 49:
637
+ case 53:
595
638
  envInfo.deviceId = _context2.sent;
596
- case 50:
639
+ case 54:
597
640
  _this5.AMSSDK.logger.logInfo({
598
641
  title: 'sdk_event_sdkQuery'
599
642
  }, {
600
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
601
- requestBody: params
643
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
602
644
  }).send();
603
645
  queryPaymentInfo(params, {
604
646
  env: _this5.AMSSDK.options.env.environment,
@@ -612,11 +654,10 @@ var ComponentApp = /*#__PURE__*/function () {
612
654
  _this5.AMSSDK.logger.logInfo({
613
655
  title: 'sdk_event_sdkQueryEnd'
614
656
  }, {
615
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
616
- responseBody: res
657
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
617
658
  }).send();
618
659
  }).catch(function (err) {
619
- if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
660
+ if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.VAULTING_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
620
661
  return resolve({
621
662
  success: false
622
663
  });
@@ -628,11 +669,11 @@ var ComponentApp = /*#__PURE__*/function () {
628
669
  title: 'sdk_event_sdkQuery_failed'
629
670
  }, {
630
671
  paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
631
- errorReason: err
672
+ errorMessage: err
632
673
  }).send();
633
674
  reject(err);
634
675
  });
635
- case 52:
676
+ case 56:
636
677
  case "end":
637
678
  return _context2.stop();
638
679
  }
@@ -664,43 +705,58 @@ var ComponentApp = /*#__PURE__*/function () {
664
705
  var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
665
706
  // eslint-disable-next-line no-async-promise-executor
666
707
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
667
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
708
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
668
709
  var _channelBehavior$buil, _this6$_renderParams$;
669
- var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, extParams;
710
+ var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _this6$_renderParams3, _ref10, _ref10$productSceneVe, productSceneVersion, _ref10$productScene, productScene, _ref11, _ref11$action, _ref11$action2, _ref11$action2$enable, enableSignAgreement, _ref11$action2$autoDe, autoDebitWithToken, _ref12, _ref12$paymentMethodI, _ref12$paymentMethodI2, _ref12$paymentMethodI3, paymentMethodType, isAppWebview, backScheme, extParams;
670
711
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
671
712
  while (1) switch (_context3.prev = _context3.next) {
672
713
  case 0:
714
+ if (!(_this6.AMSSDK.options.product === ProductSceneEnum.ELEMENT_ADDRESS)) {
715
+ _context3.next = 2;
716
+ break;
717
+ }
718
+ return _context3.abrupt("return", resolve({
719
+ message: 'sdk no need to make submitPay request',
720
+ success: true
721
+ }));
722
+ case 2:
673
723
  shouldSkipSubmitPayInSDK = false;
674
724
  if (channelBehavior) {
675
725
  // 新逻辑走 channelBehavior判断
676
726
  shouldSkipSubmitPayInSDK = !channelBehavior.submitPayInSdk;
677
727
  } else {
678
- shouldSkipSubmitPayInSDK = !((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign;
728
+ shouldSkipSubmitPayInSDK = !((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || ComponentSignEnum.EASY_PAY_WALLET !== _this6._componentSign;
679
729
  }
680
- if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
681
- _ref11 = params.paymentSessionConfig || {}, _ref11$productSceneVe = _ref11.productSceneVersion, productSceneVersion = _ref11$productSceneVe === void 0 ? '' : _ref11$productSceneVe, _ref11$productScene = _ref11.productScene, productScene = _ref11$productScene === void 0 ? '' : _ref11$productScene;
682
- _ref12 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref12$action = _ref12.action, _ref12$action2 = _ref12$action === void 0 ? {} : _ref12$action, _ref12$action2$enable = _ref12$action2.enableSignAgreement, enableSignAgreement = _ref12$action2$enable === void 0 ? false : _ref12$action2$enable, _ref12$action2$autoDe = _ref12$action2.autoDebitWithToken, autoDebitWithToken = _ref12$action2$autoDe === void 0 ? false : _ref12$action2$autoDe;
683
- if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
684
- ///EasyPay 2.0 首次传signAgreement字段
730
+ if (ComponentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
731
+ _ref10 = params.paymentSessionConfig || {}, _ref10$productSceneVe = _ref10.productSceneVersion, productSceneVersion = _ref10$productSceneVe === void 0 ? '' : _ref10$productSceneVe, _ref10$productScene = _ref10.productScene, productScene = _ref10$productScene === void 0 ? '' : _ref10$productScene;
732
+ _ref11 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref11$action = _ref11.action, _ref11$action2 = _ref11$action === void 0 ? {} : _ref11$action, _ref11$action2$enable = _ref11$action2.enableSignAgreement, enableSignAgreement = _ref11$action2$enable === void 0 ? false : _ref11$action2$enable, _ref11$action2$autoDe = _ref11$action2.autoDebitWithToken, autoDebitWithToken = _ref11$action2$autoDe === void 0 ? false : _ref11$action2$autoDe;
733
+ _ref12 = ((_this6$_renderParams3 = _this6._renderParams) === null || _this6$_renderParams3 === void 0 ? void 0 : _this6$_renderParams3.paymentSessionMetaData) || {}, _ref12$paymentMethodI = _ref12.paymentMethodInfoView, _ref12$paymentMethodI2 = _ref12$paymentMethodI === void 0 ? {} : _ref12$paymentMethodI, _ref12$paymentMethodI3 = _ref12$paymentMethodI2.paymentMethodType, paymentMethodType = _ref12$paymentMethodI3 === void 0 ? '' : _ref12$paymentMethodI3;
734
+ if (productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
735
+ isAppWebview = _this6._isAppWebview || false; ///EasyPay 2.0 首次传signAgreement字段
685
736
  params['signAgreement'] = enableSignAgreement;
737
+ if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
738
+ backScheme = getBackScheme(undefined, _this6.AMSSDK.logger);
739
+ if (backScheme && backScheme !== 'https') {
740
+ params['h5FromApp'] = encodeURIComponent(backScheme);
741
+ }
742
+ }
686
743
  }
687
744
  }
688
745
  // 带上标记告知WebCheckOut SDK已发送submitpay请求
689
746
  _this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
690
747
  if (!shouldSkipSubmitPayInSDK) {
691
- _context3.next = 6;
748
+ _context3.next = 8;
692
749
  break;
693
750
  }
694
751
  return _context3.abrupt("return", resolve({
695
752
  message: 'sdk no need to make submitPay request',
696
753
  success: true
697
754
  }));
698
- case 6:
755
+ case 8:
699
756
  _this6.AMSSDK.logger.logInfo({
700
757
  title: 'sdk_event_submitPay'
701
758
  }, {
702
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
703
- requestBody: params
759
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
704
760
  }).send();
705
761
  extParams = (channelBehavior === null || channelBehavior === void 0 || (_channelBehavior$buil = channelBehavior.buildSubmitPayExtParams) === null || _channelBehavior$buil === void 0 ? void 0 : _channelBehavior$buil.call(channelBehavior, {
706
762
  instanceId: _this6.AMSSDK._instanceId,
@@ -714,9 +770,9 @@ var ComponentApp = /*#__PURE__*/function () {
714
770
  _context3.t0 = submitPayInfo;
715
771
  _context3.t1 = params;
716
772
  _context3.t2 = _this6.AMSSDK.options.env.environment;
717
- _context3.next = 14;
773
+ _context3.next = 16;
718
774
  return _this6.getDeviceIdAndLog();
719
- case 14:
775
+ case 16:
720
776
  _context3.t3 = _context3.sent;
721
777
  _context3.t4 = {
722
778
  deviceId: _context3.t3
@@ -735,29 +791,27 @@ var ComponentApp = /*#__PURE__*/function () {
735
791
  _this6.AMSSDK.logger.logInfo({
736
792
  title: 'sdk_event_submitPayEnd'
737
793
  }, {
738
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
739
- responseBody: res
794
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
740
795
  }).send();
741
796
  resolve(res);
742
797
  }).catch(function (err) {
743
798
  _this6.AMSSDK.logger.logError({
744
799
  title: 'sdk_event_submitPay_failed'
745
800
  }, {
746
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
747
- responseBody: err
801
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
748
802
  }).send();
749
803
  resolve({
750
804
  success: false
751
805
  });
752
806
  });
753
- case 19:
807
+ case 21:
754
808
  case "end":
755
809
  return _context3.stop();
756
810
  }
757
811
  }, _callee3);
758
812
  }));
759
813
  return function (_x3) {
760
- return _ref10.apply(this, arguments);
814
+ return _ref9.apply(this, arguments);
761
815
  };
762
816
  }());
763
817
  }
@@ -798,19 +852,17 @@ var ComponentApp = /*#__PURE__*/function () {
798
852
  value: function createPreloadApp(componentSign) {
799
853
  var productSceneVersion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.0';
800
854
  var preloadIframe = createPreloadIframe(componentSign, productSceneVersion);
855
+ var productScene = componentSign.split(/_(?=[^_]*$)/)[0];
801
856
  var _getIframeUrl = getIframeUrl({
802
- renderDisplayType: renderDisplayTypeEnum.popup,
857
+ renderDisplayType: DisplayTypeEnum.popup,
803
858
  componentSign: componentSign,
804
859
  analytics: {
805
860
  enabled: false
806
861
  },
807
- productScene: componentSign,
862
+ productScene: productScene,
808
863
  productSceneVersion: productSceneVersion,
809
864
  environment: this.AMSSDK.options.env.environment,
810
- // TODO 确定一下这个参数是干啥的
811
865
  appVersion: this._appVersion,
812
- extendInfo: '',
813
- locale: '',
814
866
  instanceId: '',
815
867
  isPreload: 'true',
816
868
  mid: ''
@@ -822,8 +874,7 @@ var ComponentApp = /*#__PURE__*/function () {
822
874
  this.AMSSDK.logger.logError({
823
875
  title: 'performance_optimization_preload_path_error'
824
876
  }, {
825
- path: path,
826
- locationSearch: locationSearch
877
+ eventMessage: path
827
878
  });
828
879
  }
829
880
  return preloadIframe;
@@ -843,7 +894,7 @@ var ComponentApp = /*#__PURE__*/function () {
843
894
  value: Date.now()
844
895
  });
845
896
  try {
846
- var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4;
897
+ var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4, _renderParams$element, _renderParams$element2;
847
898
  var productSceneVersion = (renderParams === null || renderParams === void 0 || (_renderParams$payment = renderParams.paymentSessionMetaData) === null || _renderParams$payment === void 0 || (_renderParams$payment = _renderParams$payment.paymentSessionConfig) === null || _renderParams$payment === void 0 ? void 0 : _renderParams$payment.productSceneVersion) || '';
848
899
  var productScene = (renderParams === null || renderParams === void 0 || (_renderParams$payment2 = renderParams.paymentSessionMetaData) === null || _renderParams$payment2 === void 0 || (_renderParams$payment2 = _renderParams$payment2.paymentSessionConfig) === null || _renderParams$payment2 === void 0 ? void 0 : _renderParams$payment2.productScene) || '';
849
900
  var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment3 = renderParams.paymentSessionMetaData) === null || _renderParams$payment3 === void 0 ? void 0 : _renderParams$payment3.extendInfo) || '';
@@ -856,7 +907,8 @@ var ComponentApp = /*#__PURE__*/function () {
856
907
  productScene: productScene,
857
908
  productSceneVersion: productSceneVersion,
858
909
  extendInfo: extendInfo,
859
- mid: mid
910
+ mid: mid,
911
+ elementLink: renderParams === null || renderParams === void 0 || (_renderParams$element = renderParams.elementProps) === null || _renderParams$element === void 0 ? void 0 : _renderParams$element.elementLink // TODO Connect本地调试link
860
912
  });
861
913
  this.app = createIframe(this.AMSSDK.options.mode, this.platform);
862
914
  var hostSign = ((renderParams === null || renderParams === void 0 ? void 0 : renderParams.sessionData) || '').split('&&')[1] || '';
@@ -872,7 +924,8 @@ var ComponentApp = /*#__PURE__*/function () {
872
924
  locale: this.AMSSDK.options.locale,
873
925
  instanceId: this.AMSSDK._instanceId,
874
926
  hostSign: hostSign,
875
- mid: mid
927
+ mid: mid,
928
+ elementLink: renderParams === null || renderParams === void 0 || (_renderParams$element2 = renderParams.elementProps) === null || _renderParams$element2 === void 0 ? void 0 : _renderParams$element2.elementLink // TODO Connect本地调试link
876
929
  }),
877
930
  path = _getIframeUrl2.path,
878
931
  locationSearch = _getIframeUrl2.locationSearch;
@@ -907,7 +960,7 @@ var ComponentApp = /*#__PURE__*/function () {
907
960
  var isJson = isJsonString(e.data);
908
961
  if (isJson) {
909
962
  var data = JSON.parse(e.data);
910
- if (data.name !== messageName.APP_TO_SDK && data.name !== messageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId) return;
963
+ if (data.name !== MessageName.APP_TO_SDK && data.name !== MessageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId) return;
911
964
  this._handleAppMessage(data);
912
965
  } else {
913
966
  console.warn(ERRORMESSAGE.NOT_JSON_FORMAT);
@@ -934,7 +987,7 @@ var ComponentApp = /*#__PURE__*/function () {
934
987
  key: "createDialog",
935
988
  value: function () {
936
989
  var _createDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
937
- var pageUrl, isLoad, timeout, logTimeout;
990
+ var pageUrl, _data$device, isLoad, timeout, logTimeout;
938
991
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
939
992
  while (1) switch (_context4.prev = _context4.next) {
940
993
  case 0:
@@ -944,8 +997,8 @@ var ComponentApp = /*#__PURE__*/function () {
944
997
  _context4.next = 5;
945
998
  return createModal({
946
999
  widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
947
- heightPadding: data === null || data === void 0 ? void 0 : data.heightPadding,
948
- device: this.platform,
1000
+ device: (_data$device = data === null || data === void 0 ? void 0 : data.device) !== null && _data$device !== void 0 ? _data$device : this.platform,
1001
+ loadingConfig: data === null || data === void 0 ? void 0 : data.loadingConfig,
949
1002
  url: pageUrl
950
1003
  });
951
1004
  case 5:
@@ -964,6 +1017,7 @@ var ComponentApp = /*#__PURE__*/function () {
964
1017
  }, POPUP_LOADTIME_LOG_LIMIT);
965
1018
  this.popupApp.onload = function () {
966
1019
  isLoad = true;
1020
+ removePopupLoading();
967
1021
  clearTimeout(timeout);
968
1022
  clearTimeout(logTimeout);
969
1023
  };
@@ -975,7 +1029,7 @@ var ComponentApp = /*#__PURE__*/function () {
975
1029
  this.AMSSDK.logger.logError({
976
1030
  title: (_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.title) || 'sdk_error_create_pop_up'
977
1031
  }, {
978
- message: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message,
1032
+ errorMessage: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message,
979
1033
  url: pageUrl
980
1034
  });
981
1035
  this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
@@ -1113,6 +1167,8 @@ var ComponentApp = /*#__PURE__*/function () {
1113
1167
  }, {
1114
1168
  key: "_handleAppMessage",
1115
1169
  value: function _handleAppMessage(data) {
1170
+ var _data$context2,
1171
+ _this7 = this;
1116
1172
  var eventKeyMap = Object.keys(EVENT).map(function (key) {
1117
1173
  return EVENT[key].name;
1118
1174
  });
@@ -1196,6 +1252,10 @@ var ComponentApp = /*#__PURE__*/function () {
1196
1252
  this.handleCloseBtnShow(true);
1197
1253
  return;
1198
1254
  }
1255
+ if (data.context.event === EVENT.setMaskCloseButton.name) {
1256
+ this.handleMaskCloseBtnShow(data.context.data);
1257
+ return;
1258
+ }
1199
1259
  if (data.context.event === EVENT.setAllowRetention.name) {
1200
1260
  if (data.context.data === true) this._isRetention = true;
1201
1261
  if (data.context.data === false) this._isRetention = false;
@@ -1237,9 +1297,57 @@ var ComponentApp = /*#__PURE__*/function () {
1237
1297
  title: 'sdk_event_event_callback'
1238
1298
  }).send();
1239
1299
  }
1300
+ if ((data === null || data === void 0 || (_data$context2 = data.context) === null || _data$context2 === void 0 ? void 0 : _data$context2.event) === EVENT.getGooglePayToken.name) {
1301
+ handleGooglePay(data).then(function (res) {
1302
+ _this7.dispatchToApp({
1303
+ context: {
1304
+ event: 'getGooglePayToken',
1305
+ data: _objectSpread({}, res)
1306
+ }
1307
+ });
1308
+ }).catch(function (err) {
1309
+ _this7.dispatchToApp({
1310
+ context: {
1311
+ event: 'getGooglePayToken',
1312
+ data: {
1313
+ err: err
1314
+ }
1315
+ }
1316
+ });
1317
+ });
1318
+ return;
1319
+ }
1240
1320
 
1241
- // The plug-in communicates with the sdk after processing
1242
- this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
1321
+ // log event before sending the callback
1322
+ this.logEventCallback(data, "sdk_event_event_callback");
1323
+ try {
1324
+ // The plug-in communicates with the sdk after processing
1325
+ this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
1326
+ // log event after sending the callback
1327
+ this.logEventCallback(data, "sdk_event_afterEventCallback");
1328
+ } catch (e) {
1329
+ console.error(e);
1330
+ }
1331
+ }
1332
+ }, {
1333
+ key: "logEventCallback",
1334
+ value: function logEventCallback(data, title) {
1335
+ if (data.context.event === EVENT.eventCallback.name) {
1336
+ var _data$context4;
1337
+ var callbackData = "";
1338
+ try {
1339
+ var _data$context3;
1340
+ callbackData = JSON.stringify((data === null || data === void 0 || (_data$context3 = data.context) === null || _data$context3 === void 0 ? void 0 : _data$context3.data) || "");
1341
+ } catch (e) {
1342
+ console.error(e);
1343
+ }
1344
+ this.AMSSDK.logger.logInfo({
1345
+ title: title
1346
+ }, {
1347
+ callbackData: callbackData,
1348
+ callbackId: (data === null || data === void 0 || (_data$context4 = data.context) === null || _data$context4 === void 0 ? void 0 : _data$context4.eventCallbackId) || ""
1349
+ }).send();
1350
+ }
1243
1351
  }
1244
1352
  }, {
1245
1353
  key: "dismissLoadingFunc",
@@ -1253,15 +1361,34 @@ var ComponentApp = /*#__PURE__*/function () {
1253
1361
  }
1254
1362
  (_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.remove();
1255
1363
  }
1364
+ }, {
1365
+ key: "updateMaskCloseBtn",
1366
+ value: function updateMaskCloseBtn(data) {
1367
+ var maskCloseBtn = document.getElementById("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID));
1368
+ if (maskCloseBtn) {
1369
+ if (this.platform === 'desktop') {
1370
+ var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1371
+ var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
1372
+ maskCloseBtn.style.top = "".concat((windowHeight - data.height) / 2 - 42, "px");
1373
+ maskCloseBtn.style.right = "".concat((windowWidth - data.width) / 2 + 18, "px");
1374
+ } else {
1375
+ maskCloseBtn.style.bottom = "".concat(data.height + 2, "px");
1376
+ }
1377
+ }
1378
+ }
1256
1379
  }, {
1257
1380
  key: "handleSizeChanged",
1258
1381
  value: function handleSizeChanged(data) {
1259
- var _data$context$data4;
1260
- var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
1261
- if (((_data$context$data4 = data.context.data) === null || _data$context$data4 === void 0 ? void 0 : _data$context$data4.height) <= 1 || data.context.data.height === parseInt(cashier.style.height)) return;
1382
+ var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _data$context$data4, _cashier$style;
1383
+ var _selector = (this === null || this === void 0 || (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 || (_this$_renderParams15 = _this$_renderParams15.selector) === null || _this$_renderParams15 === void 0 || (_this$_renderParams16 = _this$_renderParams15.indexOf) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.call(_this$_renderParams15, '#')) === -1 ? this === null || this === void 0 || (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.selector : this === null || this === void 0 || (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 || (_this$_renderParams18 = _this$_renderParams18.selector) === null || _this$_renderParams18 === void 0 || (_this$_renderParams19 = _this$_renderParams18.slice) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.call(_this$_renderParams18, 1);
1384
+ // 修改需当前文件搜索,这段注释appendAliasContainerId
1385
+ var appendAliasContainerId = this === null || this === void 0 || (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.appendAliasContainerId;
1386
+ var selectorId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat(_selector) : COMPONENT_CONTAINER_ID;
1387
+ var cashier = document.getElementById(selectorId);
1388
+ if (((_data$context$data4 = data.context.data) === null || _data$context$data4 === void 0 ? void 0 : _data$context$data4.height) <= 1 || data.context.data.height === parseInt(cashier === null || cashier === void 0 || (_cashier$style = cashier.style) === null || _cashier$style === void 0 ? void 0 : _cashier$style.height)) return;
1262
1389
  cashier.style.height = "".concat(data.context.data.height, "px");
1263
1390
  this.app.style.opacity = '1';
1264
- if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
1391
+ if (this._renderDisplayType === DisplayTypeEnum.popup) {
1265
1392
  if (this.platform === 'desktop') {
1266
1393
  if (data.context.data.width) cashier.style.width = "".concat(data.context.data.width, "px");
1267
1394
  cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
@@ -1275,9 +1402,8 @@ var ComponentApp = /*#__PURE__*/function () {
1275
1402
 
1276
1403
  // 此style用于弹窗出现和高度变化时动画,动画不同,属性不同
1277
1404
  this.app.style.height = parseInt(this.app.style.height) > 0 ? '100%' : "".concat(data.context.data.height, "px");
1278
-
1279
1405
  // 弹出和弹入动画
1280
- var runkeyframes = "@keyframes ".concat(COMPONENT_CONTAINER_ID, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(data.context.data.height, "px;\n }\n }\n @keyframes ").concat(COMPONENT_CONTAINER_ID, "-slide-out {\n 0% {\n height: ").concat(data.context.data.height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
1406
+ var runkeyframes = slideInAndOutKeyframes(COMPONENT_CONTAINER_ID, data.context.data.height);
1281
1407
  // 创建style标签
1282
1408
  var style = document.createElement('style');
1283
1409
  style.id = animationStyleId;
@@ -1287,7 +1413,6 @@ var ComponentApp = /*#__PURE__*/function () {
1287
1413
  style.innerHTML = runkeyframes;
1288
1414
  // 将style样式存放到head标签
1289
1415
  document.getElementsByTagName('head')[0].appendChild(style);
1290
-
1291
1416
  // size变动时动画
1292
1417
  setTimeout(function () {
1293
1418
  cashier.style.transition = 'height 0.28s ease-in-out';
@@ -1295,8 +1420,10 @@ var ComponentApp = /*#__PURE__*/function () {
1295
1420
  }
1296
1421
  // 关闭loading,保留蒙层
1297
1422
  this.dismissLoadingFunc();
1423
+ // 更新弹窗关闭按钮位置
1424
+ this.updateMaskCloseBtn(data.context.data);
1298
1425
  }
1299
- if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
1426
+ if (this._renderDisplayType === DisplayTypeEnum.inline) {
1300
1427
  var _document$getElementB3;
1301
1428
  (_document$getElementB3 = document.getElementById(LOADING_ID)) === null || _document$getElementB3 === void 0 || _document$getElementB3.remove();
1302
1429
  this.app.style.height = "".concat(data.context.data.height, "px");
@@ -1325,7 +1452,12 @@ var ComponentApp = /*#__PURE__*/function () {
1325
1452
  key: "handleRedirect",
1326
1453
  value: function handleRedirect(data) {
1327
1454
  var _data$isDestroy,
1328
- _this7 = this;
1455
+ _data$isCallApp,
1456
+ _data$callAppDetectSu,
1457
+ _data$isDestroy2,
1458
+ _data$isCallApp2,
1459
+ _data$callAppDetectSu2,
1460
+ _this8 = this;
1329
1461
  var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1330
1462
  var _data = typeof data === 'string' ? {
1331
1463
  normalUrl: data
@@ -1334,48 +1466,69 @@ var ComponentApp = /*#__PURE__*/function () {
1334
1466
  schemeUrl: (data === null || data === void 0 ? void 0 : data.schemeUrl) || '',
1335
1467
  normalUrl: (data === null || data === void 0 ? void 0 : data.normalUrl) || '',
1336
1468
  target: data === null || data === void 0 ? void 0 : data.target,
1337
- isDestroy: (_data$isDestroy = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy !== void 0 ? _data$isDestroy : true
1469
+ isDestroy: (_data$isDestroy = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy !== void 0 ? _data$isDestroy : true,
1470
+ isCallApp: (_data$isCallApp = data === null || data === void 0 ? void 0 : data.isCallApp) !== null && _data$isCallApp !== void 0 ? _data$isCallApp : false,
1471
+ callAppDetectSuccessDelay: (_data$callAppDetectSu = data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) !== null && _data$callAppDetectSu !== void 0 ? _data$callAppDetectSu : 2000
1338
1472
  });
1473
+ var logParams = {
1474
+ applinkUrl: (data === null || data === void 0 ? void 0 : data.applinkUrl) || '',
1475
+ schemeUrl: (data === null || data === void 0 ? void 0 : data.schemeUrl) || '',
1476
+ normalUrl: (data === null || data === void 0 ? void 0 : data.normalUrl) || '',
1477
+ target: data === null || data === void 0 ? void 0 : data.target,
1478
+ isDestroy: (_data$isDestroy2 = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy2 !== void 0 ? _data$isDestroy2 : true,
1479
+ isCallApp: (_data$isCallApp2 = data === null || data === void 0 ? void 0 : data.isCallApp) !== null && _data$isCallApp2 !== void 0 ? _data$isCallApp2 : false,
1480
+ callAppDetectSuccessDelay: (_data$callAppDetectSu2 = data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) !== null && _data$callAppDetectSu2 !== void 0 ? _data$callAppDetectSu2 : 2000
1481
+ };
1339
1482
  this.AMSSDK.logger.logInfo({
1340
1483
  title: 'sdk_event_call_url_start'
1341
- }, _objectSpread({}, data)).send();
1342
- var successCallback = function successCallback(type, url) {
1343
- _this7.dispatchToSDK(EVENT.eventCallback.name, {
1484
+ }, {
1485
+ redirectInfo: JSON.stringify(logParams)
1486
+ }).send();
1487
+ var successCallback = function successCallback(type, url, durationInSeconds) {
1488
+ _this8.dispatchToSDK(EVENT.eventCallback.name, {
1344
1489
  code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
1345
1490
  message: "Successfully opened the app,".concat(type, ": ").concat(url)
1346
1491
  });
1347
- _this7.AMSSDK.logger.logInfo({
1348
- title: 'sdk_event_call_url_success'
1349
- }, {
1492
+ var extra = {
1350
1493
  redirectInfo: JSON.stringify(_data),
1351
1494
  openType: type,
1352
1495
  url: url,
1353
1496
  fromFastSdk: fromFastSdk
1354
- }).send();
1497
+ };
1498
+ if (durationInSeconds) {
1499
+ extra['durationInSeconds'] = durationInSeconds;
1500
+ }
1501
+ _this8.AMSSDK.logger.logInfo({
1502
+ title: 'sdk_event_call_url_success'
1503
+ }, extra).send();
1355
1504
  };
1356
- var failCallback = function failCallback(type, url) {
1357
- _this7.dispatchToSDK(EVENT.eventCallback.name, {
1505
+ var failCallback = function failCallback(type, url, durationInSeconds) {
1506
+ _this8.dispatchToSDK(EVENT.eventCallback.name, {
1358
1507
  code: eventCodeEnum.SDK_CALL_URL_ERROR,
1359
1508
  message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
1360
1509
  });
1361
- _this7.AMSSDK.logger.logInfo({
1362
- title: 'sdk_error_call_url_failed'
1363
- }, {
1510
+ var extra = {
1364
1511
  redirectInfo: JSON.stringify(_data),
1365
1512
  openType: type,
1366
1513
  url: url,
1367
1514
  fromFastSdk: fromFastSdk
1368
- }).send();
1515
+ };
1516
+ if (durationInSeconds) {
1517
+ extra['durationInSeconds'] = durationInSeconds;
1518
+ }
1519
+ _this8.AMSSDK.logger.logInfo({
1520
+ title: 'sdk_error_call_url_failed'
1521
+ }, extra).send();
1369
1522
  };
1370
1523
 
1371
1524
  // 支持 target: _blank,新开tab页打开
1372
- if (_data.target === targetEnum.BLANK) {
1525
+ if (_data.target === TargetEnum.BLANK) {
1373
1526
  if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
1374
1527
  successCallback(RedirectType.NormalUrl, _data.normalUrl);
1375
1528
  window.open(_data.normalUrl);
1376
1529
  return;
1377
1530
  }
1378
- if (_data.target === targetEnum.REPLACE && !(_data !== null && _data !== void 0 && _data.applinkUrl) && !(_data !== null && _data !== void 0 && _data.schemeUrl)) {
1531
+ if (_data.target === TargetEnum.REPLACE && !(_data !== null && _data !== void 0 && _data.applinkUrl) && !(_data !== null && _data !== void 0 && _data.schemeUrl)) {
1379
1532
  if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
1380
1533
  successCallback(RedirectType.NormalUrl, _data.normalUrl);
1381
1534
  window.location.replace(_data.normalUrl);
@@ -1383,20 +1536,40 @@ var ComponentApp = /*#__PURE__*/function () {
1383
1536
  }
1384
1537
  // 销毁iframe和全局loading
1385
1538
  if (_data !== null && _data !== void 0 && _data.isDestroy) this.cleanContainer();
1539
+ // 唤端
1540
+ if (_data !== null && _data !== void 0 && _data.isCallApp && _data !== null && _data !== void 0 && _data.schemeUrl) {
1541
+ var startCallAppTime = new Date();
1542
+ var detectSuccessDelay = typeof (data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) === 'number' ? data.callAppDetectSuccessDelay : 5000;
1543
+ this.AMSSDK._redirect({
1544
+ schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl,
1545
+ callAppJudgeTime: detectSuccessDelay
1546
+ }).then(function () {
1547
+ var endCallAppTime = new Date();
1548
+ var durationInMilliseconds = endCallAppTime.getTime() - startCallAppTime.getTime();
1549
+ var durationInSeconds = durationInMilliseconds / 1000;
1550
+ successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl, durationInSeconds);
1551
+ }).catch(function () {
1552
+ var endCallAppTime = new Date();
1553
+ var durationInMilliseconds = endCallAppTime.getTime() - startCallAppTime.getTime();
1554
+ var durationInSeconds = durationInMilliseconds / 1000;
1555
+ failCallback(RedirectType.SchemeUrl, _data.schemeUrl, durationInSeconds);
1556
+ });
1557
+ return;
1558
+ }
1386
1559
  this.AMSSDK._redirect({
1387
1560
  applinkUrl: _data === null || _data === void 0 ? void 0 : _data.applinkUrl
1388
1561
  }).then(function () {
1389
1562
  successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
1390
1563
  }).catch(function () {
1391
1564
  if (_data !== null && _data !== void 0 && _data.applinkUrl) failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
1392
- return _this7.AMSSDK._redirect({
1565
+ return _this8.AMSSDK._redirect({
1393
1566
  schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
1394
1567
  });
1395
1568
  }).then(function () {
1396
1569
  successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
1397
1570
  }).catch(function () {
1398
1571
  if (_data !== null && _data !== void 0 && _data.schemeUrl) failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
1399
- return _this7.AMSSDK._redirect({
1572
+ return _this8.AMSSDK._redirect({
1400
1573
  normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
1401
1574
  });
1402
1575
  }).then(function () {
@@ -1435,12 +1608,12 @@ var ComponentApp = /*#__PURE__*/function () {
1435
1608
  }, {
1436
1609
  key: "handleAppHeartBeat",
1437
1610
  value: function handleAppHeartBeat() {
1438
- var _this8 = this;
1611
+ var _this9 = this;
1439
1612
  try {
1440
1613
  if (!this._webAppHeartBeatTimeoutFn) {
1441
1614
  this._webAppHeartBeatTimeoutFn = function () {
1442
- if (_this8.isAppAttached()) {
1443
- _this8.AMSSDK.logger.logError({
1615
+ if (_this9.isAppAttached()) {
1616
+ _this9.AMSSDK.logger.logError({
1444
1617
  title: 'sdk_error_appHeartBeatTimeout'
1445
1618
  });
1446
1619
  }
@@ -1454,8 +1627,8 @@ var ComponentApp = /*#__PURE__*/function () {
1454
1627
  window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
1455
1628
  }
1456
1629
  setTimeout(function () {
1457
- if (_this8.isAppAttached()) {
1458
- _this8.dispatchToApp({
1630
+ if (_this9.isAppAttached()) {
1631
+ _this9.dispatchToApp({
1459
1632
  context: {
1460
1633
  event: 'sdkHeartBeat',
1461
1634
  data: {}
@@ -1492,6 +1665,16 @@ var ComponentApp = /*#__PURE__*/function () {
1492
1665
  closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
1493
1666
  }
1494
1667
  }
1668
+ }, {
1669
+ key: "handleMaskCloseBtnShow",
1670
+ value: function handleMaskCloseBtnShow(data) {
1671
+ var closeBlock = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
1672
+ if ((data === null || data === void 0 ? void 0 : data.status) === 'show') {
1673
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
1674
+ } else {
1675
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
1676
+ }
1677
+ }
1495
1678
 
1496
1679
  /**
1497
1680
  * @description Send message to SDK
@@ -1511,7 +1694,7 @@ var ComponentApp = /*#__PURE__*/function () {
1511
1694
  value: function dispatchToApp(payload) {
1512
1695
  var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1513
1696
  var data = Object.assign({}, payload, {
1514
- name: messageName.SDK_TO_APP,
1697
+ name: MessageName.SDK_TO_APP,
1515
1698
  mode: this.AMSSDK.options.mode,
1516
1699
  appId: COMPONENTPLUGINID,
1517
1700
  instanceId: this.AMSSDK._instanceId
@@ -1550,24 +1733,25 @@ var ComponentApp = /*#__PURE__*/function () {
1550
1733
  key: "sendRenderEvent",
1551
1734
  value: (function () {
1552
1735
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1553
- var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$AMSSDK$logger, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$AMSSDK, _this$_renderParams24, res, submitRes;
1736
+ var _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$_renderParams24, _this$_renderParams25, _this$_renderParams26, _this$_renderParams27, _this$_renderParams28, _this$_renderParams29, _this$AMSSDK$logger, _this$_renderParams30, _this$_renderParams31, _this$_renderParams32, _this$AMSSDK, _this$_renderParams33, isAddressElement, res, submitRes;
1554
1737
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1555
1738
  while (1) switch (_context8.prev = _context8.next) {
1556
1739
  case 0:
1557
1740
  _context8.prev = 0;
1558
- if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
1559
- _context8.next = 3;
1741
+ isAddressElement = this.AMSSDK.options.product === ProductSceneEnum.ELEMENT_ADDRESS;
1742
+ if (!((!this._actionQueryPromise || !this._actionSubmitPromise) && !isAddressElement)) {
1743
+ _context8.next = 4;
1560
1744
  break;
1561
1745
  }
1562
1746
  return _context8.abrupt("return");
1563
- case 3:
1564
- _context8.next = 5;
1747
+ case 4:
1748
+ _context8.next = 6;
1565
1749
  return this._actionQueryPromise;
1566
- case 5:
1750
+ case 6:
1567
1751
  res = _context8.sent;
1568
- _context8.next = 8;
1752
+ _context8.next = 9;
1569
1753
  return this._actionSubmitPromise;
1570
- case 8:
1754
+ case 9:
1571
1755
  submitRes = _context8.sent;
1572
1756
  this._performanceData.push({
1573
1757
  key: 'sdk_render_component',
@@ -1579,29 +1763,34 @@ var ComponentApp = /*#__PURE__*/function () {
1579
1763
  data: {
1580
1764
  queryResult: res,
1581
1765
  submitResult: submitRes,
1582
- sessionResult: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.paymentSessionMetaData,
1583
- paymentSessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
1766
+ sessionResult: (_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionMetaData,
1767
+ paymentSessionData: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.sessionData,
1584
1768
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
1585
- renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
1586
- appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
1587
- notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
1769
+ renderDisplayType: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.renderDisplayType,
1770
+ appearance: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.appearance,
1771
+ notRedirectAfterComplete: ((_this$_renderParams25 = this._renderParams) === null || _this$_renderParams25 === void 0 ? void 0 : _this$_renderParams25.notRedirectAfterComplete) === true,
1772
+ isAppWebview: this._isAppWebview,
1588
1773
  merchantAppointParam: this._merchantAppointParam,
1589
1774
  allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
1775
+ /** 地址组件集成的参数 */
1776
+ configParams: (_this$_renderParams26 = this._renderParams) === null || _this$_renderParams26 === void 0 ? void 0 : _this$_renderParams26.configParams,
1777
+ prefillValue: (_this$_renderParams27 = this._renderParams) === null || _this$_renderParams27 === void 0 ? void 0 : _this$_renderParams27.prefillValue,
1778
+ componentSession: (_this$_renderParams28 = this._renderParams) === null || _this$_renderParams28 === void 0 ? void 0 : _this$_renderParams28.componentSession,
1590
1779
  envInfo: {
1591
1780
  screenHeight: screen.height,
1592
1781
  screenWidth: screen.width
1593
1782
  },
1594
1783
  logMetaData: _objectSpread(_objectSpread({
1595
- trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
1784
+ trackId: (_this$_renderParams29 = this._renderParams) === null || _this$_renderParams29 === void 0 ? void 0 : _this$_renderParams29.sessionData,
1596
1785
  platform: this.platform,
1597
1786
  firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
1598
- }, ((_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 || (_this$_renderParams21 = _this$_renderParams21.paymentSessionMetaData) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionConfig) || {}), {}, {
1599
- renderDisplayType: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.renderDisplayType,
1787
+ }, ((_this$_renderParams30 = this._renderParams) === null || _this$_renderParams30 === void 0 || (_this$_renderParams30 = _this$_renderParams30.paymentSessionMetaData) === null || _this$_renderParams30 === void 0 ? void 0 : _this$_renderParams30.paymentSessionConfig) || {}), {}, {
1788
+ renderDisplayType: (_this$_renderParams31 = this._renderParams) === null || _this$_renderParams31 === void 0 ? void 0 : _this$_renderParams31.renderDisplayType,
1600
1789
  sdkVersion: this._appVersion,
1601
- merchantId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.clientId,
1790
+ merchantId: (_this$_renderParams32 = this._renderParams) === null || _this$_renderParams32 === void 0 || (_this$_renderParams32 = _this$_renderParams32.paymentSessionMetaData) === null || _this$_renderParams32 === void 0 ? void 0 : _this$_renderParams32.clientId,
1602
1791
  instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1603
1792
  performanceData: this._performanceData,
1604
- paymentMethodType: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentMethodInfoView) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentMethodType
1793
+ paymentMethodType: (_this$_renderParams33 = this._renderParams) === null || _this$_renderParams33 === void 0 || (_this$_renderParams33 = _this$_renderParams33.paymentSessionMetaData) === null || _this$_renderParams33 === void 0 || (_this$_renderParams33 = _this$_renderParams33.paymentMethodInfoView) === null || _this$_renderParams33 === void 0 ? void 0 : _this$_renderParams33.paymentMethodType
1605
1794
  })
1606
1795
  }
1607
1796
  }
@@ -1618,16 +1807,16 @@ var ComponentApp = /*#__PURE__*/function () {
1618
1807
  }
1619
1808
  });
1620
1809
  // eslint-disable-next-line no-empty
1621
- _context8.next = 17;
1810
+ _context8.next = 18;
1622
1811
  break;
1623
- case 15:
1624
- _context8.prev = 15;
1812
+ case 16:
1813
+ _context8.prev = 16;
1625
1814
  _context8.t0 = _context8["catch"](0);
1626
- case 17:
1815
+ case 18:
1627
1816
  case "end":
1628
1817
  return _context8.stop();
1629
1818
  }
1630
- }, _callee8, this, [[0, 15]]);
1819
+ }, _callee8, this, [[0, 16]]);
1631
1820
  }));
1632
1821
  function sendRenderEvent() {
1633
1822
  return _sendRenderEvent.apply(this, arguments);
@@ -1642,9 +1831,11 @@ var ComponentApp = /*#__PURE__*/function () {
1642
1831
  key: "cleanContainer",
1643
1832
  value: function cleanContainer() {
1644
1833
  var _document$getElementB4,
1645
- _this9 = this;
1834
+ _document$getElementB5,
1835
+ _this10 = this;
1646
1836
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1647
- (_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
1837
+ (_document$getElementB4 = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
1838
+ (_document$getElementB5 = document.getElementById(LOADING_ID)) === null || _document$getElementB5 === void 0 || _document$getElementB5.remove();
1648
1839
  this.hideComponentAnimation();
1649
1840
  var mockup = document.getElementById(MOCKUP_ID);
1650
1841
  mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
@@ -1654,21 +1845,26 @@ var ComponentApp = /*#__PURE__*/function () {
1654
1845
  this.app = null;
1655
1846
  if (immediately) this.cleanElement();else {
1656
1847
  setTimeout(function () {
1657
- _this9.cleanElement();
1848
+ _this10.cleanElement();
1658
1849
  }, 300);
1659
1850
  }
1660
1851
  }
1661
1852
  }, {
1662
1853
  key: "hideComponentAnimation",
1663
1854
  value: function hideComponentAnimation() {
1664
- var container = document.getElementById(COMPONENT_CONTAINER_ID);
1665
- if (this.app) this.app.style.height = container.style.height;
1855
+ var _this$_renderParams34, _this$_renderParams35, _this$_renderParams36, _this$_renderParams37, _this$_renderParams38, _this$_renderParams39, _container$style;
1856
+ // 修改需当前文件搜索,这段注释appendAliasContainerId
1857
+ var _selector = (this === null || this === void 0 || (_this$_renderParams34 = this._renderParams) === null || _this$_renderParams34 === void 0 || (_this$_renderParams34 = _this$_renderParams34.selector) === null || _this$_renderParams34 === void 0 || (_this$_renderParams35 = _this$_renderParams34.indexOf) === null || _this$_renderParams35 === void 0 ? void 0 : _this$_renderParams35.call(_this$_renderParams34, '#')) === -1 ? this === null || this === void 0 || (_this$_renderParams36 = this._renderParams) === null || _this$_renderParams36 === void 0 ? void 0 : _this$_renderParams36.selector : this === null || this === void 0 || (_this$_renderParams37 = this._renderParams) === null || _this$_renderParams37 === void 0 || (_this$_renderParams37 = _this$_renderParams37.selector) === null || _this$_renderParams37 === void 0 || (_this$_renderParams38 = _this$_renderParams37.slice) === null || _this$_renderParams38 === void 0 ? void 0 : _this$_renderParams38.call(_this$_renderParams37, 1);
1858
+ var appendAliasContainerId = this !== null && this !== void 0 && (_this$_renderParams39 = this._renderParams) !== null && _this$_renderParams39 !== void 0 && _this$_renderParams39.appendAliasContainerId ? "-".concat(_selector) : '';
1859
+ var inlineId = "".concat(COMPONENT_CONTAINER_ID).concat(appendAliasContainerId);
1860
+ var container = document.getElementById(inlineId);
1861
+ if (this.app && container) this.app.style.height = container === null || container === void 0 || (_container$style = container.style) === null || _container$style === void 0 ? void 0 : _container$style.height;
1666
1862
  if (container) {
1667
1863
  // size变化动画取消
1668
1864
  container.style.transition = '';
1669
- container === null || container === void 0 || container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform));
1670
- container === null || container === void 0 || container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
1671
- container === null || container === void 0 || container.classList.add("".concat(COMPONENT_CONTAINER_ID, "-hidden-").concat(this.platform));
1865
+ container === null || container === void 0 || container.classList.remove("".concat(inlineId, "-").concat(this.platform));
1866
+ container === null || container === void 0 || container.classList.remove("".concat(inlineId, "-").concat(this.platform, "-animation"));
1867
+ container === null || container === void 0 || container.classList.add("".concat(inlineId, "-hidden-").concat(this.platform));
1672
1868
  }
1673
1869
  }
1674
1870
  }, {