@alipay/ams-checkout 0.0.1723203704-dev.3 → 0.0.1723203704-dev.5

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.
@@ -171,10 +171,6 @@ export declare const EVENT: {
171
171
  name: string;
172
172
  uniqueKey: string;
173
173
  };
174
- onGetValue: {
175
- name: string;
176
- uniqueKey: string;
177
- };
178
174
  };
179
175
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
180
176
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -170,10 +170,6 @@ export var EVENT = {
170
170
  onChange: {
171
171
  name: 'onChange',
172
172
  uniqueKey: 'userChange'
173
- },
174
- onGetValue: {
175
- name: 'onAddressResult',
176
- uniqueKey: 'userGetValue'
177
173
  }
178
174
  };
179
175
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -1,34 +1,6 @@
1
- import ComponentApp from '../../plugin/address';
2
- import { componentSignEnum, IoptionsParams, IpaymentSessionMetaData, Iselector } from '../../types';
3
- import { addressInitOption } from '../../types/address';
4
- import CoreInstance from '../instance/address';
5
- export declare const getComponentSign: (params: IpaymentSessionMetaData) => componentSignEnum;
6
- export declare class AddressComponent extends CoreInstance {
7
- _componentApp: ComponentApp;
8
- channelType: componentSignEnum[];
9
- productSceneVersion: string;
10
- timer: any;
1
+ import { IoptionsParams } from '../../types';
2
+ import { AMSComponent } from './index';
3
+ export declare class AddressComponent extends AMSComponent {
11
4
  constructor(options: IoptionsParams);
12
- private parameterInitAndCheck;
13
- private pluginAppendIframe;
14
- private savePreviousChannel;
15
- /**
16
- * 初始化 Bus总线的能力
17
- */
18
- private registerBusAbility;
19
- preloadComponent(channelType: any, productSceneVersion: any): void;
20
- private clearPreloadIframe;
21
- /**
22
- * @description Create and render components in the specified element area
23
- * @param params - The data source created by the component, necessary sessionData, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
24
- * @param selector - Necessary element selector ID
25
- */
26
- mountComponent(params: addressInitOption, selector: Iselector): Promise<void>;
27
- private mountComponentProcess;
28
- /**
29
- * @description Execute payment submission process
30
- * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
31
- * @param data - Transfer information in the submission interface according to your requirements (optional)
32
- */
33
5
  getValue(data?: any): Promise<unknown>;
34
6
  }
@@ -1,9 +1,9 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
2
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
4
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
7
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
8
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -11,9 +11,6 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
11
11
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
- 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; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
- 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); }
17
14
  /**
18
15
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
19
16
  *
@@ -22,265 +19,42 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
22
19
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
23
20
  */
24
21
  import { v4 as uuid } from 'uuid';
25
- import { COMPONENTPLUGINID, EVENT } from "../../constant";
26
- import { ApplePayBusSubscriber } from "../../plugin/applepay";
27
- import ComponentApp from "../../plugin/address";
28
- import { PaypalBusSubscriber } from "../../plugin/paypal";
29
- import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, renderDisplayTypeEnum } from "../../types";
30
- import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
31
22
  import { BusManager, BusMessage } from "../bus";
32
- import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
33
- import { SecurityBusSubscriber } from "../bus/ability/security";
34
- import { TrackerBusSubscriber } from "../bus/ability/tracker";
35
- import CoreInstance from "../instance/address";
36
- export var getComponentSign = function getComponentSign(params) {
37
- var _params$paymentSessio = params.paymentSessionConfig,
38
- _params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
39
- _params$paymentSessio3 = _params$paymentSessio2.productScene,
40
- productScene = _params$paymentSessio3 === void 0 ? '' : _params$paymentSessio3,
41
- _params$paymentSessio4 = _params$paymentSessio2.paymentMethodCategoryType,
42
- paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
43
- if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType);
44
- if (productScene) return "".concat(productScene);
45
- return componentSignEnum.NONE;
46
- };
47
- var handleParams = function handleParams(params) {
48
- var _params = Object.assign(params);
49
- // 地址组件不通过传参 固定
50
- var componentSign = componentSignEnum.ELEMENT_ADDRESS;
51
- return Promise.resolve({
52
- iframeNodesParams: _params,
53
- componentSign: componentSign
54
- });
55
- };
56
- export var AddressComponent = /*#__PURE__*/function (_CoreInstance) {
57
- _inherits(AddressComponent, _CoreInstance);
23
+ import { AMSComponent } from "./index";
24
+ export var AddressComponent = /*#__PURE__*/function (_AMSComponent) {
25
+ _inherits(AddressComponent, _AMSComponent);
58
26
  var _super = _createSuper(AddressComponent);
59
27
  function AddressComponent(options) {
60
- var _this;
61
28
  _classCallCheck(this, AddressComponent);
62
- _this = _super.call(this, options);
63
- // Instantiate the plug-in and set render
64
- _defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
65
- _defineProperty(_assertThisInitialized(_this), "channelType", void 0);
66
- _defineProperty(_assertThisInitialized(_this), "productSceneVersion", void 0);
67
- _defineProperty(_assertThisInitialized(_this), "timer", void 0);
68
- var ComponentPlugin = new ComponentApp();
69
- ComponentPlugin.setRender(createIframeNode);
70
- ComponentPlugin.setPreloadRender(createPreloadIframeNode);
71
- // Register Cashier Application Plug in
72
- _this._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
73
- _this._componentApp = _this._getPlugin(COMPONENTPLUGINID);
74
- _this.registerBusAbility();
75
- return _this;
29
+ return _super.call(this, options);
76
30
  }
77
31
  _createClass(AddressComponent, [{
78
- key: "parameterInitAndCheck",
79
- value: function parameterInitAndCheck(_ref) {
80
- var params = _ref.params,
81
- selector = _ref.selector,
82
- renderDisplayType = _ref.renderDisplayType;
83
- this.options.mode = modeEnum.component;
84
- this.options.networkMode = this.options.networkMode || networkModeEnum.session;
85
- var _params = Object.assign({
86
- selector: selector,
87
- renderDisplayType: renderDisplayType
88
- }, params);
89
- return Promise.resolve(_params);
90
- }
91
- }, {
92
- key: "pluginAppendIframe",
93
- value: function pluginAppendIframe(appendParams) {
94
- try {
95
- return this._componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams);
96
- } catch (error) {
97
- return Promise.reject(error);
98
- }
99
- }
100
- }, {
101
- key: "savePreviousChannel",
102
- value: function savePreviousChannel(iframeNodesParams) {
103
- var _ref2 = iframeNodesParams || {},
104
- componentSign = _ref2.componentSign;
105
- var channelType = componentSign;
106
- if (Array.isArray(this.channelType) && this.channelType.includes(channelType)) {
107
- this.logger.logInfo({
108
- title: 'preload_match'
109
- }, {
110
- preloadChannel: this.channelType,
111
- preloadVersion: this.productSceneVersion,
112
- sessionDataChannel: channelType
113
- });
114
- } else {
115
- this.logger.logInfo({
116
- title: 'preload_no_match'
117
- }, {
118
- preloadChannel: this.channelType,
119
- preloadVersion: this.productSceneVersion,
120
- sessionDataChannel: channelType
121
- });
122
- }
123
- var previousChannel = {
124
- channelType: channelType,
125
- productSceneVersion: this.productSceneVersion
126
- };
127
- localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
128
- }
129
- /**
130
- * 初始化 Bus总线的能力
131
- */
132
- }, {
133
- key: "registerBusAbility",
134
- value: function registerBusAbility() {
135
- var _this$originOptions,
136
- _this2 = this;
137
- BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod, this.logger);
138
- BusManager.clear();
139
- BusManager.addInterceptor({
140
- onPublishException: function onPublishException(message, e) {
141
- _this2.logger.logError({
142
- title: 'onBusPublishException'
143
- }, _objectSpread(_objectSpread({}, message), {}, {
144
- errorMessage: JSON.stringify(e)
145
- }));
146
- }
147
- });
148
- // subscribe basic ablility
149
- BusManager.subscribe(new SDKCallbackBusSubscriber(function (state) {
150
- var _this2$_componentApp;
151
- (_this2$_componentApp = _this2._componentApp) === null || _this2$_componentApp === void 0 || (_this2$_componentApp = _this2$_componentApp.AMSSDK) === null || _this2$_componentApp === void 0 || _this2$_componentApp._eventCenter.emit(EVENT.eventCallback.name, state);
152
- }));
153
- BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) {
154
- var _this2$_componentApp2;
155
- return (_this2$_componentApp2 = _this2._componentApp) === null || _this2$_componentApp2 === void 0 ? void 0 : _this2$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling);
156
- }));
157
- BusManager.subscribe(new TrackerBusSubscriber(this.logger));
158
- // subscribe plugin
159
- BusManager.subscribe(new ApplePayBusSubscriber(this.logger));
160
- BusManager.subscribe(new PaypalBusSubscriber(this.logger));
161
- }
162
- }, {
163
- key: "preloadComponent",
164
- value: function preloadComponent(channelType, productSceneVersion) {
165
- var _this3 = this;
166
- this.channelType = channelType;
167
- this.productSceneVersion = productSceneVersion;
168
- var MAX_CLEAR_TIME = 10000;
169
- if (Array.isArray(channelType)) {
170
- for (var i = 0; i < channelType.length; i++) {
171
- this._componentApp.appendPreloadIframeNodes(channelType[i], productSceneVersion);
172
- }
173
- } else {
174
- this.logger.logError({
175
- title: 'performance_optimization_channelType_error'
176
- }, {
177
- channelType: channelType
178
- });
179
- }
180
- this.timer = setTimeout(function () {
181
- _this3.clearPreloadIframe(true);
182
- }, MAX_CLEAR_TIME);
183
- }
184
- }, {
185
- key: "clearPreloadIframe",
186
- value: function clearPreloadIframe() {
187
- var isTimeOut = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
188
- !isTimeOut && clearTimeout(this.timer);
189
- if (Array.isArray(this.channelType)) {
190
- for (var i = 0; i < this.channelType.length; i++) {
191
- var iframe = document.getElementById("ams-checkout-component-".concat(this.channelType[i], "-").concat(this.productSceneVersion));
192
- iframe && document.body.removeChild(iframe);
193
- }
194
- }
195
- if (!isTimeOut) {
196
- this.logger.logInfo({
197
- title: 'performance_optimization_clearPreloadIframe'
198
- });
199
- } else {
200
- this.logger.logInfo({
201
- title: 'performance_optimization_clearPreloadIframe_timeout'
202
- });
203
- }
204
- }
205
- /**
206
- * @description Create and render components in the specified element area
207
- * @param params - The data source created by the component, necessary sessionData, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
208
- * @param selector - Necessary element selector ID
209
- */
210
- }, {
211
- key: "mountComponent",
212
- value: function mountComponent(params, selector) {
213
- var _this4 = this;
214
- this.clearPreloadIframe();
215
- this.logger.setComponentStartTime(Date.now());
216
- return this.parameterInitAndCheck({
217
- params: params,
218
- renderDisplayType: renderDisplayTypeEnum.inline,
219
- selector: selector
220
- }).then(function (_params) {
221
- return handleParams(_params);
222
- }).catch(function (error) {
223
- _this4.logger.logError({
224
- title: 'sdk_error_parameter'
225
- }, {
226
- params: JSON.stringify(params)
227
- }).send();
228
- _this4._eventCenter.emit(EVENT.error.name, error);
229
- return Promise.reject(error);
230
- }).then(function (appendParams) {
231
- return _this4.mountComponentProcess(appendParams);
232
- });
233
- }
234
- }, {
235
- key: "mountComponentProcess",
236
- value: function mountComponentProcess(appendParams) {
237
- var _this$getBusActionNam;
238
- this._appendParams = appendParams;
239
- var actionName = (_this$getBusActionNam = this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.mountComponent;
240
- if (actionName && BusManager.isSubscribed(actionName)) {
241
- // 执行出错了,在通用拦截器返回
242
- BusManager.publish(new BusMessage(actionName, JSON.stringify({
243
- appendParams: appendParams,
244
- options: this.originOptions
245
- })));
246
- return Promise.resolve();
247
- }
248
- this.savePreviousChannel(appendParams);
249
- return this.pluginAppendIframe(appendParams);
250
- }
251
-
252
- /**
253
- * @description Execute payment submission process
254
- * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
255
- * @param data - Transfer information in the submission interface according to your requirements (optional)
256
- */
257
- }, {
258
32
  key: "getValue",
259
33
  value: function getValue(data) {
260
- var _this5 = this;
34
+ var _this = this;
261
35
  return new Promise(function (resolve, reject) {
262
36
  try {
263
- var _this5$getBusActionNa;
37
+ var _this$getBusActionNam;
264
38
  var eventCallbackId = uuid();
265
- _this5.logger.logInfo({
39
+ _this.logger.logInfo({
266
40
  title: 'sdk_event_apiGetValue'
267
41
  });
268
- var actionName = (_this5$getBusActionNa = _this5.getBusActionNames()) === null || _this5$getBusActionNa === void 0 ? void 0 : _this5$getBusActionNa.getValue;
42
+ var actionName = (_this$getBusActionNam = _this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.getValue;
269
43
  if (actionName && BusManager.isSubscribed(actionName)) {
270
44
  // 执行出错了,在通用拦截器返回
271
45
  BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
272
- appendParams: _this5._appendParams,
273
- options: _this5.originOptions,
46
+ appendParams: _this._appendParams,
47
+ options: _this.originOptions,
274
48
  data: data
275
49
  }))).then(function (busMessage) {
276
50
  resolve(busMessage === null || busMessage === void 0 ? void 0 : busMessage.getJSONObject());
277
51
  });
278
52
  } else {
279
53
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
280
- _this5._eventCenter.once(eventCallbackId, function (_data) {
54
+ _this._eventCenter.once(eventCallbackId, function (_data) {
281
55
  resolve(_data);
282
56
  });
283
- _this5._componentApp.dispatchToApp({
57
+ _this._componentApp.dispatchToApp({
284
58
  context: {
285
59
  event: 'getValue',
286
60
  eventCallbackId: eventCallbackId,
@@ -295,4 +69,4 @@ export var AddressComponent = /*#__PURE__*/function (_CoreInstance) {
295
69
  }
296
70
  }]);
297
71
  return AddressComponent;
298
- }(CoreInstance);
72
+ }(AMSComponent);
@@ -91,7 +91,7 @@ var handleSessionData = function handleSessionData(originSessionData) {
91
91
  resetEasyPaySceneVersion(parseData);
92
92
  return [parseData !== null && parseData !== void 0 ? parseData : {}, sessionData];
93
93
  };
94
- var handleParams = function handleParams(params) {
94
+ var handleParams = function handleParams(params, _this) {
95
95
  var _params = Object.assign({
96
96
  paymentSessionMetaData: {},
97
97
  renderDisplayType: renderDisplayTypeEnum.popup
@@ -107,6 +107,9 @@ var handleParams = function handleParams(params) {
107
107
  message: "unsupported payment method"
108
108
  });
109
109
  }
110
+ if (_this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
111
+ componentSign = componentSignEnum.ELEMENT_ADDRESS;
112
+ }
110
113
  if (componentSign === componentSignEnum.NONE) {
111
114
  // eslint-disable-next-line prefer-promise-reject-errors
112
115
  return Promise.reject({
@@ -130,22 +133,22 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
130
133
  _inherits(AMSComponent, _CoreInstance);
131
134
  var _super = _createSuper(AMSComponent);
132
135
  function AMSComponent(options) {
133
- var _this;
136
+ var _this2;
134
137
  _classCallCheck(this, AMSComponent);
135
- _this = _super.call(this, options);
138
+ _this2 = _super.call(this, options);
136
139
  // Instantiate the plug-in and set render
137
- _defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
138
- _defineProperty(_assertThisInitialized(_this), "channelType", void 0);
139
- _defineProperty(_assertThisInitialized(_this), "productSceneVersion", void 0);
140
- _defineProperty(_assertThisInitialized(_this), "timer", void 0);
140
+ _defineProperty(_assertThisInitialized(_this2), "_componentApp", void 0);
141
+ _defineProperty(_assertThisInitialized(_this2), "channelType", void 0);
142
+ _defineProperty(_assertThisInitialized(_this2), "productSceneVersion", void 0);
143
+ _defineProperty(_assertThisInitialized(_this2), "timer", void 0);
141
144
  var ComponentPlugin = new ComponentApp();
142
145
  ComponentPlugin.setRender(createIframeNode);
143
146
  ComponentPlugin.setPreloadRender(createPreloadIframeNode);
144
147
  // Register Cashier Application Plug in
145
- _this._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
146
- _this._componentApp = _this._getPlugin(COMPONENTPLUGINID);
147
- _this.registerBusAbility();
148
- return _this;
148
+ _this2._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
149
+ _this2._componentApp = _this2._getPlugin(COMPONENTPLUGINID);
150
+ _this2.registerBusAbility();
151
+ return _this2;
149
152
  }
150
153
  _createClass(AMSComponent, [{
151
154
  key: "parameterInitAndCheck",
@@ -159,7 +162,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
159
162
  selector: selector,
160
163
  renderDisplayType: renderDisplayType
161
164
  }, params);
162
- if (_params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
165
+ if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS && _params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
163
166
  return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
164
167
  }
165
168
  if (this.options.networkMode === networkModeEnum.proxy) {
@@ -244,12 +247,12 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
244
247
  key: "registerBusAbility",
245
248
  value: function registerBusAbility() {
246
249
  var _this$originOptions,
247
- _this2 = this;
250
+ _this3 = this;
248
251
  BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod, this.logger);
249
252
  BusManager.clear();
250
253
  BusManager.addInterceptor({
251
254
  onPublishException: function onPublishException(message, e) {
252
- _this2.logger.logError({
255
+ _this3.logger.logError({
253
256
  title: 'onBusPublishException'
254
257
  }, _objectSpread(_objectSpread({}, message), {}, {
255
258
  errorMessage: JSON.stringify(e)
@@ -258,12 +261,12 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
258
261
  });
259
262
  // subscribe basic ablility
260
263
  BusManager.subscribe(new SDKCallbackBusSubscriber(function (state) {
261
- var _this2$_componentApp;
262
- (_this2$_componentApp = _this2._componentApp) === null || _this2$_componentApp === void 0 || (_this2$_componentApp = _this2$_componentApp.AMSSDK) === null || _this2$_componentApp === void 0 || _this2$_componentApp._eventCenter.emit(EVENT.eventCallback.name, state);
264
+ var _this3$_componentApp;
265
+ (_this3$_componentApp = _this3._componentApp) === null || _this3$_componentApp === void 0 || (_this3$_componentApp = _this3$_componentApp.AMSSDK) === null || _this3$_componentApp === void 0 || _this3$_componentApp._eventCenter.emit(EVENT.eventCallback.name, state);
263
266
  }));
264
267
  BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) {
265
- var _this2$_componentApp2;
266
- return (_this2$_componentApp2 = _this2._componentApp) === null || _this2$_componentApp2 === void 0 ? void 0 : _this2$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling);
268
+ var _this3$_componentApp2;
269
+ return (_this3$_componentApp2 = _this3._componentApp) === null || _this3$_componentApp2 === void 0 ? void 0 : _this3$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling);
267
270
  }));
268
271
  BusManager.subscribe(new TrackerBusSubscriber(this.logger));
269
272
  // subscribe plugin
@@ -278,7 +281,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
278
281
  }
279
282
  var paymentChannelMatcher = item.paymentChannelMatcher;
280
283
  if (paymentChannelMatcher) {
281
- _this2._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames);
284
+ _this3._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames);
282
285
  }
283
286
  var sessionMatcher = item.sessionMatcher;
284
287
  if (sessionMatcher) {
@@ -286,15 +289,15 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
286
289
  if (sessionMatcher.paymentMethodTypes) {
287
290
  sessionMatcher.paymentMethodTypes.forEach(function (paymentMethodType) {
288
291
  var subPluginKey = pluginKey + paymentMethodType;
289
- _this2._registerPlugin(subPluginKey, item.busActionNames);
292
+ _this3._registerPlugin(subPluginKey, item.busActionNames);
290
293
  });
291
294
  } else {
292
- _this2._registerPlugin(pluginKey, item.busActionNames);
295
+ _this3._registerPlugin(pluginKey, item.busActionNames);
293
296
  }
294
297
  }
295
298
  var optInit = item === null || item === void 0 || (_item$busActionNames = item.busActionNames) === null || _item$busActionNames === void 0 ? void 0 : _item$busActionNames.optional_init;
296
299
  if (optInit) {
297
- BusManager.publish(new BusMessage(optInit, JSON.stringify(_this2.originOptions)));
300
+ BusManager.publish(new BusMessage(optInit, JSON.stringify(_this3.originOptions)));
298
301
  }
299
302
  });
300
303
  }
@@ -308,14 +311,14 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
308
311
  }, {
309
312
  key: "canMakePayments",
310
313
  value: function canMakePayments(paymentMethod, subPaymentMethod) {
311
- var _this3 = this;
314
+ var _this4 = this;
312
315
  // 判断支付方式是否可用
313
316
  return new Promise(function (resolve) {
314
- var _this3$_getPlugin;
317
+ var _this4$_getPlugin;
315
318
  if (!paymentMethod) {
316
319
  return resolve(true);
317
320
  }
318
- var actionName = (_this3$_getPlugin = _this3._getPlugin(paymentMethod)) === null || _this3$_getPlugin === void 0 ? void 0 : _this3$_getPlugin.canMakePayments;
321
+ var actionName = (_this4$_getPlugin = _this4._getPlugin(paymentMethod)) === null || _this4$_getPlugin === void 0 ? void 0 : _this4$_getPlugin.canMakePayments;
319
322
  if (actionName && BusManager.isSubscribed(actionName)) {
320
323
  BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
321
324
  paymentMethod: paymentMethod,
@@ -325,7 +328,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
325
328
  }).then(function (message) {
326
329
  resolve(message.getJSONObject());
327
330
  }).catch(function (e) {
328
- _this3.logger.logInfo({
331
+ _this4.logger.logInfo({
329
332
  title: 'canMakePayments_error'
330
333
  }, {
331
334
  params: JSON.stringify(e)
@@ -344,26 +347,26 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
344
347
  }, {
345
348
  key: "createComponent",
346
349
  value: function createComponent(params) {
347
- var _this4 = this;
350
+ var _this5 = this;
348
351
  this.clearPreloadIframe();
349
352
  this.logger.setComponentStartTime(Date.now());
350
353
  return this.parameterInitAndCheck({
351
354
  params: params,
352
355
  renderDisplayType: renderDisplayTypeEnum.popup
353
356
  }).then(function (_params) {
354
- return handleParams(_params);
357
+ return handleParams(_params, _this5);
355
358
  }).catch(function (error) {
356
- _this4.logger.logError({
359
+ _this5.logger.logError({
357
360
  title: 'sdk_error_parameter'
358
361
  }, {
359
362
  params: JSON.stringify(params)
360
363
  }).send();
361
- _this4._eventCenter.emit(EVENT.error.name, error);
364
+ _this5._eventCenter.emit(EVENT.error.name, error);
362
365
  return Promise.reject(error);
363
366
  }).then(function (appendParams) {
364
367
  var iframeNodesParams = appendParams.iframeNodesParams;
365
- _this4.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
366
- return _this4.createComponentProcess(appendParams);
368
+ _this5.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
369
+ return _this5.createComponentProcess(appendParams);
367
370
  });
368
371
  }
369
372
  }, {
@@ -387,7 +390,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
387
390
  }, {
388
391
  key: "preloadComponent",
389
392
  value: function preloadComponent(channelType, productSceneVersion) {
390
- var _this5 = this;
393
+ var _this6 = this;
391
394
  this.channelType = channelType;
392
395
  this.productSceneVersion = productSceneVersion;
393
396
  var MAX_CLEAR_TIME = 10000;
@@ -403,7 +406,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
403
406
  });
404
407
  }
405
408
  this.timer = setTimeout(function () {
406
- _this5.clearPreloadIframe(true);
409
+ _this6.clearPreloadIframe(true);
407
410
  }, MAX_CLEAR_TIME);
408
411
  }
409
412
  }, {
@@ -435,7 +438,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
435
438
  }, {
436
439
  key: "mountComponent",
437
440
  value: function mountComponent(params, selector) {
438
- var _this6 = this;
441
+ var _this7 = this;
439
442
  this.clearPreloadIframe();
440
443
  this.logger.setComponentStartTime(Date.now());
441
444
  return this.parameterInitAndCheck({
@@ -443,19 +446,19 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
443
446
  renderDisplayType: renderDisplayTypeEnum.inline,
444
447
  selector: selector
445
448
  }).then(function (_params) {
446
- return handleParams(_params);
449
+ return handleParams(_params, _this7);
447
450
  }).catch(function (error) {
448
- _this6.logger.logError({
451
+ _this7.logger.logError({
449
452
  title: 'sdk_error_parameter'
450
453
  }, {
451
454
  params: JSON.stringify(params)
452
455
  }).send();
453
- _this6._eventCenter.emit(EVENT.error.name, error);
456
+ _this7._eventCenter.emit(EVENT.error.name, error);
454
457
  return Promise.reject(error);
455
458
  }).then(function (appendParams) {
456
459
  var iframeNodesParams = appendParams.iframeNodesParams;
457
- _this6.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
458
- return _this6.mountComponentProcess(appendParams);
460
+ _this7.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
461
+ return _this7.mountComponentProcess(appendParams);
459
462
  });
460
463
  }
461
464
  }, {
@@ -473,7 +476,9 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
473
476
  return Promise.resolve();
474
477
  }
475
478
  var iframeNodesParams = appendParams.iframeNodesParams;
476
- this.savePreviousChannel(iframeNodesParams);
479
+ if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS) {
480
+ this.savePreviousChannel(appendParams);
481
+ }
477
482
  return this.pluginAppendIframe(appendParams);
478
483
  }
479
484
  /**
@@ -484,30 +489,30 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
484
489
  }, {
485
490
  key: "submit",
486
491
  value: function submit(data) {
487
- var _this7 = this;
492
+ var _this8 = this;
488
493
  return new Promise(function (resolve, reject) {
489
494
  try {
490
- var _this7$getBusActionNa;
495
+ var _this8$getBusActionNa;
491
496
  var eventCallbackId = uuid();
492
- _this7.logger.logInfo({
497
+ _this8.logger.logInfo({
493
498
  title: 'sdk_event_apiSubmit'
494
499
  });
495
- var actionName = (_this7$getBusActionNa = _this7.getBusActionNames()) === null || _this7$getBusActionNa === void 0 ? void 0 : _this7$getBusActionNa.submit;
500
+ var actionName = (_this8$getBusActionNa = _this8.getBusActionNames()) === null || _this8$getBusActionNa === void 0 ? void 0 : _this8$getBusActionNa.submit;
496
501
  if (actionName && BusManager.isSubscribed(actionName)) {
497
502
  // 执行出错了,在通用拦截器返回
498
503
  BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
499
- appendParams: _this7._appendParams,
500
- options: _this7.originOptions,
504
+ appendParams: _this8._appendParams,
505
+ options: _this8.originOptions,
501
506
  data: data
502
507
  }))).then(function (busMessage) {
503
508
  resolve(busMessage === null || busMessage === void 0 ? void 0 : busMessage.getJSONObject());
504
509
  });
505
510
  } else {
506
511
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
507
- _this7._eventCenter.once(eventCallbackId, function (_data) {
512
+ _this8._eventCenter.once(eventCallbackId, function (_data) {
508
513
  resolve(_data);
509
514
  });
510
- _this7._componentApp.dispatchToApp({
515
+ _this8._componentApp.dispatchToApp({
511
516
  context: {
512
517
  event: 'submitPay',
513
518
  eventCallbackId: eventCallbackId,