@alipay/ams-checkout 0.0.1726713131-dev.3 → 0.0.1726734012-dev.1

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.
@@ -1,14 +1,3 @@
1
1
  export declare const marmotMap: Record<string, string>;
2
2
  export declare const marmotConfigMap: Record<string, string>;
3
- export declare const elementAppMarmotMap: Record<string, string>;
4
3
  export declare const sdkVersion: string;
5
- /**
6
- * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
7
- */
8
- export declare const AMSCheckoutAppVersion = "1.21.0";
9
- export declare const AMSAutoDebitAppVersion = "1.21.0";
10
- export declare const AMSEasyPayAppVersion = "1.21.0";
11
- export declare const AMSCashierPaymentAppVersion = "1.21.0";
12
- export declare const AMSVaultingAppVersion = "1.21.0";
13
- export declare const AMSPaymentElementAppVersion = "1.21.0";
14
- export declare const ADDRESSElementAppVersion = "1.21.0";
@@ -22,23 +22,4 @@ export var marmotConfigMap = {
22
22
  light_sandbox: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
23
23
  prod: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json'
24
24
  };
25
- export var elementAppMarmotMap = {
26
- dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
27
- sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
28
- pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
29
- sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
30
- light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
31
- prod: 'https://ac.alipay.com/page/antom-web-checkout-v2'
32
- };
33
- export var sdkVersion = json.version;
34
-
35
- /**
36
- * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
37
- */
38
- export var AMSCheckoutAppVersion = '1.21.0'; // 兜底版本号
39
- export var AMSAutoDebitAppVersion = '1.21.0'; // 代扣
40
- export var AMSEasyPayAppVersion = '1.21.0'; // easypay
41
- export var AMSCashierPaymentAppVersion = '1.21.0'; // 收银台(卡、apm)
42
- export var AMSVaultingAppVersion = '1.21.0'; // 绑卡
43
- export var AMSPaymentElementAppVersion = '1.21.0'; // payment element
44
- export var ADDRESSElementAppVersion = '1.21.0'; // address element
25
+ export var sdkVersion = json.version;
@@ -175,10 +175,6 @@ export declare const EVENT: {
175
175
  name: string;
176
176
  uniqueKey: string;
177
177
  };
178
- onChange: {
179
- name: string;
180
- uniqueKey: string;
181
- };
182
178
  };
183
179
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
184
180
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -187,7 +183,6 @@ export declare const COMPONENT_CLOSE_BLOCK_ID = "asm-component-close-block";
187
183
  export declare const COMPONENT_RETENTION_ID = "ams-component-retention";
188
184
  export declare const MOCKUP_ID = "ams-component-mockup";
189
185
  export declare const LOADING_ID = "ams-component-loading";
190
- export declare const POPUPLOADING_ID = "ams-component-popup-loading";
191
186
  export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
192
187
  export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
193
188
  export declare const INLINE_IMG_CLASSNAME = "inline-loading";
@@ -174,10 +174,6 @@ export var EVENT = {
174
174
  beforeSubmitDone: {
175
175
  name: 'beforeSubmitDone',
176
176
  uniqueKey: 'userBeforeSubmitDone'
177
- },
178
- onChange: {
179
- name: 'onChange',
180
- uniqueKey: 'userChange'
181
177
  }
182
178
  };
183
179
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -187,7 +183,6 @@ export var COMPONENT_CLOSE_BLOCK_ID = 'asm-component-close-block';
187
183
  export var COMPONENT_RETENTION_ID = 'ams-component-retention';
188
184
  export var MOCKUP_ID = 'ams-component-mockup';
189
185
  export var LOADING_ID = 'ams-component-loading';
190
- export var POPUPLOADING_ID = 'ams-component-popup-loading'; // popup弹窗loading
191
186
  export var LISTENER_PREFIX = '_ams_sdk_component_listener';
192
187
  export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
193
188
  export var INLINE_IMG_CLASSNAME = 'inline-loading';
@@ -3,15 +3,12 @@ import { componentSignEnum, IcreateComponent, IoptionsParams, IpaymentSessionMet
3
3
  import CoreInstance from '../instance/index';
4
4
  export declare const getComponentSign: (params: IpaymentSessionMetaData) => componentSignEnum;
5
5
  export declare const parseSessionData: (sessionData: string) => [IpaymentSessionMetaData, string];
6
- export type IAMSComponentOptions = IoptionsParams & {
7
- appVersion: string;
8
- };
9
6
  export declare class AMSComponent extends CoreInstance {
10
7
  _componentApp: ComponentApp;
11
8
  channelType: componentSignEnum[];
12
9
  productSceneVersion: string;
13
10
  timer: any;
14
- constructor(options: IAMSComponentOptions);
11
+ constructor(options: IoptionsParams);
15
12
  private parameterInitAndCheck;
16
13
  private pluginAppendIframe;
17
14
  private savePreviousChannel;
@@ -34,7 +31,7 @@ export declare class AMSComponent extends CoreInstance {
34
31
  createComponent(params: IcreateComponent): Promise<void>;
35
32
  private createComponentProcess;
36
33
  preloadComponent(channelType: any, productSceneVersion: any): void;
37
- private clearPreloadIframe;
34
+ clearPreloadIframe(isTimeOut?: boolean): void;
38
35
  /**
39
36
  * @description Create and render components in the specified element area
40
37
  * @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.
@@ -17,10 +17,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
17
17
  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; }
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  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); }
20
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
23
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
24
20
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
21
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
26
22
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -40,7 +36,7 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
40
36
  import ComponentApp from "../../plugin/component";
41
37
  import { ExtendPlugin } from "../../plugin/const";
42
38
  import { PaypalBusSubscriber } from "../../plugin/paypal";
43
- import { componentSignEnum, ComponentSignEnumV2, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
39
+ import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
44
40
  import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
45
41
  import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
46
42
  import { getSecurityConfigStorageKey } from "../../util/security";
@@ -57,9 +53,7 @@ export var getComponentSign = function getComponentSign(params) {
57
53
  productScene = _params$paymentSessio3 === void 0 ? '' : _params$paymentSessio3,
58
54
  _params$paymentSessio4 = _params$paymentSessio2.paymentMethodCategoryType,
59
55
  paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
60
- if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType);
61
- if (productScene) return "".concat(productScene);
62
- return componentSignEnum.NONE;
56
+ return productScene && paymentMethodCategoryType ? "".concat(productScene, "_").concat(paymentMethodCategoryType) : componentSignEnum.NONE;
63
57
  };
64
58
  export var parseSessionData = function parseSessionData(sessionData) {
65
59
  try {
@@ -91,7 +85,7 @@ var handleSessionData = function handleSessionData(originSessionData) {
91
85
  resetEasyPaySceneVersion(parseData);
92
86
  return [parseData !== null && parseData !== void 0 ? parseData : {}, sessionData];
93
87
  };
94
- var handleParams = function handleParams(params, _this) {
88
+ var handleParams = function handleParams(params) {
95
89
  var _params = Object.assign({
96
90
  paymentSessionMetaData: {},
97
91
  renderDisplayType: renderDisplayTypeEnum.popup
@@ -101,15 +95,6 @@ var handleParams = function handleParams(params, _this) {
101
95
  parseData = _handleSessionData2[0],
102
96
  sessionData = _handleSessionData2[1];
103
97
  var componentSign = getComponentSign(parseData);
104
- if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === renderDisplayTypeEnum.popup) {
105
- return Promise.reject({
106
- code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
107
- message: "unsupported payment method"
108
- });
109
- }
110
- if (_this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
111
- componentSign = componentSignEnum.ELEMENT_ADDRESS;
112
- }
113
98
  if (componentSign === componentSignEnum.NONE) {
114
99
  // eslint-disable-next-line prefer-promise-reject-errors
115
100
  return Promise.reject({
@@ -133,23 +118,21 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
133
118
  _inherits(AMSComponent, _CoreInstance);
134
119
  var _super = _createSuper(AMSComponent);
135
120
  function AMSComponent(options) {
136
- var _this2;
121
+ var _this;
137
122
  _classCallCheck(this, AMSComponent);
138
- _this2 = _super.call(this, options);
123
+ _this = _super.call(this, options);
139
124
  // Instantiate the plug-in and set render
140
- _defineProperty(_assertThisInitialized(_this2), "channelType", void 0);
141
- _defineProperty(_assertThisInitialized(_this2), "productSceneVersion", void 0);
142
- _defineProperty(_assertThisInitialized(_this2), "timer", void 0);
143
- var ComponentPlugin = new ComponentApp({
144
- appVersion: options.appVersion
145
- });
125
+ _defineProperty(_assertThisInitialized(_this), "channelType", void 0);
126
+ _defineProperty(_assertThisInitialized(_this), "productSceneVersion", void 0);
127
+ _defineProperty(_assertThisInitialized(_this), "timer", void 0);
128
+ var ComponentPlugin = new ComponentApp();
146
129
  ComponentPlugin.setRender(createIframeNode);
147
130
  ComponentPlugin.setPreloadRender(createPreloadIframeNode);
148
131
  // Register Cashier Application Plug in
149
- _this2._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
150
- _this2._componentApp = _this2._getPlugin(COMPONENTPLUGINID);
151
- _this2.registerBusAbility();
152
- return _this2;
132
+ _this._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
133
+ _this._componentApp = _this._getPlugin(COMPONENTPLUGINID);
134
+ _this.registerBusAbility();
135
+ return _this;
153
136
  }
154
137
  _createClass(AMSComponent, [{
155
138
  key: "parameterInitAndCheck",
@@ -163,7 +146,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
163
146
  selector: selector,
164
147
  renderDisplayType: renderDisplayType
165
148
  }, params);
166
- if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS && _params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
149
+ if (_params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
167
150
  return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
168
151
  }
169
152
  if (this.options.networkMode === networkModeEnum.proxy) {
@@ -241,6 +224,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
241
224
  localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
242
225
  }
243
226
  }
227
+
244
228
  /**
245
229
  * 初始化 Bus总线的能力
246
230
  */
@@ -248,12 +232,12 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
248
232
  key: "registerBusAbility",
249
233
  value: function registerBusAbility() {
250
234
  var _this$originOptions,
251
- _this3 = this;
235
+ _this2 = this;
252
236
  BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod, this.logger);
253
237
  BusManager.clear();
254
238
  BusManager.addInterceptor({
255
239
  onPublishException: function onPublishException(message, e) {
256
- _this3.logger.logError({
240
+ _this2.logger.logError({
257
241
  title: 'onBusPublishException'
258
242
  }, _objectSpread(_objectSpread({}, message), {}, {
259
243
  errorMessage: JSON.stringify(e)
@@ -262,12 +246,12 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
262
246
  });
263
247
  // subscribe basic ablility
264
248
  BusManager.subscribe(new SDKCallbackBusSubscriber(function (state) {
265
- var _this3$_componentApp;
266
- (_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);
249
+ var _this2$_componentApp;
250
+ (_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);
267
251
  }));
268
252
  BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) {
269
- var _this3$_componentApp2;
270
- return (_this3$_componentApp2 = _this3._componentApp) === null || _this3$_componentApp2 === void 0 ? void 0 : _this3$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling);
253
+ var _this2$_componentApp2;
254
+ return (_this2$_componentApp2 = _this2._componentApp) === null || _this2$_componentApp2 === void 0 ? void 0 : _this2$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling);
271
255
  }));
272
256
  BusManager.subscribe(new TrackerBusSubscriber(this.logger));
273
257
  // subscribe plugin
@@ -282,7 +266,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
282
266
  }
283
267
  var paymentChannelMatcher = item.paymentChannelMatcher;
284
268
  if (paymentChannelMatcher) {
285
- _this3._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames);
269
+ _this2._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames);
286
270
  }
287
271
  var sessionMatcher = item.sessionMatcher;
288
272
  if (sessionMatcher) {
@@ -290,18 +274,19 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
290
274
  if (sessionMatcher.paymentMethodTypes) {
291
275
  sessionMatcher.paymentMethodTypes.forEach(function (paymentMethodType) {
292
276
  var subPluginKey = pluginKey + paymentMethodType;
293
- _this3._registerPlugin(subPluginKey, item.busActionNames);
277
+ _this2._registerPlugin(subPluginKey, item.busActionNames);
294
278
  });
295
279
  } else {
296
- _this3._registerPlugin(pluginKey, item.busActionNames);
280
+ _this2._registerPlugin(pluginKey, item.busActionNames);
297
281
  }
298
282
  }
299
283
  var optInit = item === null || item === void 0 || (_item$busActionNames = item.busActionNames) === null || _item$busActionNames === void 0 ? void 0 : _item$busActionNames.optional_init;
300
284
  if (optInit) {
301
- BusManager.publish(new BusMessage(optInit, JSON.stringify(_this3.originOptions)));
285
+ BusManager.publish(new BusMessage(optInit, JSON.stringify(_this2.originOptions)));
302
286
  }
303
287
  });
304
288
  }
289
+
305
290
  /**
306
291
  * To determine whether the corresponding payment method is available,
307
292
  * only the channel described in the document will be called, and it will be returned as available by default
@@ -312,14 +297,14 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
312
297
  }, {
313
298
  key: "canMakePayments",
314
299
  value: function canMakePayments(paymentMethod, subPaymentMethod) {
315
- var _this4 = this;
300
+ var _this3 = this;
316
301
  // 判断支付方式是否可用
317
302
  return new Promise(function (resolve) {
318
- var _this4$_getPlugin;
303
+ var _this3$_getPlugin;
319
304
  if (!paymentMethod) {
320
305
  return resolve(true);
321
306
  }
322
- var actionName = (_this4$_getPlugin = _this4._getPlugin(paymentMethod)) === null || _this4$_getPlugin === void 0 ? void 0 : _this4$_getPlugin.canMakePayments;
307
+ var actionName = (_this3$_getPlugin = _this3._getPlugin(paymentMethod)) === null || _this3$_getPlugin === void 0 ? void 0 : _this3$_getPlugin.canMakePayments;
323
308
  if (actionName && BusManager.isSubscribed(actionName)) {
324
309
  BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
325
310
  paymentMethod: paymentMethod,
@@ -329,7 +314,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
329
314
  }).then(function (message) {
330
315
  resolve(message.getJSONObject());
331
316
  }).catch(function (e) {
332
- _this4.logger.logInfo({
317
+ _this3.logger.logInfo({
333
318
  title: 'canMakePayments_error'
334
319
  }, {
335
320
  params: JSON.stringify(e)
@@ -341,6 +326,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
341
326
  }
342
327
  });
343
328
  }
329
+
344
330
  /**
345
331
  * @description Create component application
346
332
  * @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
@@ -348,26 +334,26 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
348
334
  }, {
349
335
  key: "createComponent",
350
336
  value: function createComponent(params) {
351
- var _this5 = this;
337
+ var _this4 = this;
352
338
  this.clearPreloadIframe();
353
339
  this.logger.setComponentStartTime(Date.now());
354
340
  return this.parameterInitAndCheck({
355
341
  params: params,
356
342
  renderDisplayType: renderDisplayTypeEnum.popup
357
343
  }).then(function (_params) {
358
- return handleParams(_params, _this5);
344
+ return handleParams(_params);
359
345
  }).catch(function (error) {
360
- _this5.logger.logError({
346
+ _this4.logger.logError({
361
347
  title: 'sdk_error_parameter'
362
348
  }, {
363
349
  params: JSON.stringify(params)
364
350
  }).send();
365
- _this5._eventCenter.emit(EVENT.error.name, error);
351
+ _this4._eventCenter.emit(EVENT.error.name, error);
366
352
  return Promise.reject(error);
367
353
  }).then(function (appendParams) {
368
354
  var iframeNodesParams = appendParams.iframeNodesParams;
369
- _this5.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
370
- return _this5.createComponentProcess(appendParams);
355
+ _this4.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
356
+ return _this4.createComponentProcess(appendParams);
371
357
  });
372
358
  }
373
359
  }, {
@@ -391,7 +377,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
391
377
  }, {
392
378
  key: "preloadComponent",
393
379
  value: function preloadComponent(channelType, productSceneVersion) {
394
- var _this6 = this;
380
+ var _this5 = this;
395
381
  this.channelType = channelType;
396
382
  this.productSceneVersion = productSceneVersion;
397
383
  var MAX_CLEAR_TIME = 10000;
@@ -407,7 +393,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
407
393
  });
408
394
  }
409
395
  this.timer = setTimeout(function () {
410
- _this6.clearPreloadIframe(true);
396
+ _this5.clearPreloadIframe(true);
411
397
  }, MAX_CLEAR_TIME);
412
398
  }
413
399
  }, {
@@ -439,7 +425,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
439
425
  }, {
440
426
  key: "mountComponent",
441
427
  value: function mountComponent(params, selector) {
442
- var _this7 = this;
428
+ var _this6 = this;
443
429
  this.clearPreloadIframe();
444
430
  this.logger.setComponentStartTime(Date.now());
445
431
  return this.parameterInitAndCheck({
@@ -447,19 +433,19 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
447
433
  renderDisplayType: renderDisplayTypeEnum.inline,
448
434
  selector: selector
449
435
  }).then(function (_params) {
450
- return handleParams(_params, _this7);
436
+ return handleParams(_params);
451
437
  }).catch(function (error) {
452
- _this7.logger.logError({
438
+ _this6.logger.logError({
453
439
  title: 'sdk_error_parameter'
454
440
  }, {
455
441
  params: JSON.stringify(params)
456
442
  }).send();
457
- _this7._eventCenter.emit(EVENT.error.name, error);
443
+ _this6._eventCenter.emit(EVENT.error.name, error);
458
444
  return Promise.reject(error);
459
445
  }).then(function (appendParams) {
460
446
  var iframeNodesParams = appendParams.iframeNodesParams;
461
- _this7.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
462
- return _this7.mountComponentProcess(appendParams);
447
+ _this6.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
448
+ return _this6.mountComponentProcess(appendParams);
463
449
  });
464
450
  }
465
451
  }, {
@@ -477,11 +463,10 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
477
463
  return Promise.resolve();
478
464
  }
479
465
  var iframeNodesParams = appendParams.iframeNodesParams;
480
- if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS) {
481
- this.savePreviousChannel(iframeNodesParams);
482
- }
466
+ this.savePreviousChannel(iframeNodesParams);
483
467
  return this.pluginAppendIframe(appendParams);
484
468
  }
469
+
485
470
  /**
486
471
  * @description Execute payment submission process
487
472
  * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
@@ -490,30 +475,30 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
490
475
  }, {
491
476
  key: "submit",
492
477
  value: function submit(data) {
493
- var _this8 = this;
478
+ var _this7 = this;
494
479
  return new Promise(function (resolve, reject) {
495
480
  try {
496
- var _this8$getBusActionNa;
481
+ var _this7$getBusActionNa;
497
482
  var eventCallbackId = uuid();
498
- _this8.logger.logInfo({
483
+ _this7.logger.logInfo({
499
484
  title: 'sdk_event_apiSubmit'
500
485
  });
501
- var actionName = (_this8$getBusActionNa = _this8.getBusActionNames()) === null || _this8$getBusActionNa === void 0 ? void 0 : _this8$getBusActionNa.submit;
486
+ var actionName = (_this7$getBusActionNa = _this7.getBusActionNames()) === null || _this7$getBusActionNa === void 0 ? void 0 : _this7$getBusActionNa.submit;
502
487
  if (actionName && BusManager.isSubscribed(actionName)) {
503
488
  // 执行出错了,在通用拦截器返回
504
489
  BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
505
- appendParams: _this8._appendParams,
506
- options: _this8.originOptions,
490
+ appendParams: _this7._appendParams,
491
+ options: _this7.originOptions,
507
492
  data: data
508
493
  }))).then(function (busMessage) {
509
494
  resolve(busMessage === null || busMessage === void 0 ? void 0 : busMessage.getJSONObject());
510
495
  });
511
496
  } else {
512
497
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
513
- _this8._eventCenter.once(eventCallbackId, function (_data) {
498
+ _this7._eventCenter.once(eventCallbackId, function (_data) {
514
499
  resolve(_data);
515
500
  });
516
- _this8._componentApp.dispatchToApp({
501
+ _this7._componentApp.dispatchToApp({
517
502
  context: {
518
503
  event: 'submitPay',
519
504
  eventCallbackId: eventCallbackId,
@@ -320,7 +320,7 @@ var AMSSDK = /*#__PURE__*/function () {
320
320
  this._overrideSubscription(EVENT.close.name, options.onClose, EVENT.close.uniqueKey);
321
321
  }
322
322
  if (options !== null && options !== void 0 && options.onBeforeSubmit) {
323
- if (typeof (options === null || options === void 0 ? void 0 : options.onBeforeSubmit) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
323
+ if (getType(options.onBeforeSubmit) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
324
324
  this._overrideSubscription(EVENT.beforeSubmit.name, /*#__PURE__*/function () {
325
325
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
326
326
  var eventCallbackId, res;
@@ -369,11 +369,6 @@ var AMSSDK = /*#__PURE__*/function () {
369
369
  };
370
370
  }(), EVENT.beforeSubmit.uniqueKey);
371
371
  }
372
- /** 地址监听 */
373
- if (options !== null && options !== void 0 && options.onChange) {
374
- if (getType(options.onChange) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
375
- this._overrideSubscription(EVENT.onChange.name, options.onChange, EVENT.onChange.uniqueKey);
376
- }
377
372
  }
378
373
  /**
379
374
  * @description Register plug-in
@@ -484,9 +479,6 @@ var AMSSDK = /*#__PURE__*/function () {
484
479
  }
485
480
  actionNames = this._getPlugin(pluginKey);
486
481
  }
487
- if (this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
488
- actionNames = this._getPlugin(productSceneEnum.ELEMENT_ADDRESS);
489
- }
490
482
  return actionNames;
491
483
  }
492
484
  }]);
package/esm/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+ * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
+ * 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.
7
+ */
1
8
  import { AMSComponent } from './core/component/index';
2
- import { AddressComponent } from './core/component/address';
3
- import { IoptionsParams, componentSignEnum, IoptionsAddressParams } from './types';
9
+ import { componentSignEnum, IoptionsParams } from './types';
4
10
  export { AMSCheckoutPage } from './core/component/ckp';
5
11
  export * from './types';
6
12
  export declare class AMSCheckout extends AMSComponent {
@@ -21,10 +27,4 @@ export declare class AMSCashierPayment extends AMSCheckout {
21
27
  export declare class AMSVaulting extends AMSCheckout {
22
28
  constructor(options: IoptionsParams);
23
29
  }
24
- export declare class AntomElement extends AMSCheckout {
25
- constructor(options: IoptionsParams);
26
- }
27
- export declare class AddressElement extends AddressComponent {
28
- constructor(options: IoptionsAddressParams);
29
- }
30
30
  export default AMSCheckout;
package/esm/index.js CHANGED
@@ -1,7 +1,4 @@
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
- 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; }
5
2
  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
3
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
@@ -21,11 +18,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
21
18
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
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
- import { AMSAutoDebitAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSEasyPayAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion, ADDRESSElementAppVersion } from "./config/index";
25
21
  import { AMSComponent } from "./core/component/index";
26
- import { AddressComponent } from "./core/component/address";
27
- import { componentSignEnum, productSceneEnum } from "./types";
28
- import { Logger, LogConfig } from "./util/logger";
22
+ import { componentSignEnum } from "./types";
23
+ import { productSceneEnum } from "./types/index";
24
+ import { LogConfig, Logger } from "./util/logger";
29
25
  var logger = new Logger(LogConfig, true);
30
26
  export { AMSCheckoutPage } from "./core/component/ckp";
31
27
  export * from "./types";
@@ -36,9 +32,7 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
36
32
  var _this;
37
33
  var productSceneVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1.0';
38
34
  _classCallCheck(this, AMSCheckout);
39
- _this = _super.call(this, _objectSpread({
40
- appVersion: AMSCheckoutAppVersion
41
- }, _options));
35
+ _this = _super.call(this, _options);
42
36
  _this.preloadComponent(channelType, productSceneVersion);
43
37
  return _this;
44
38
  }
@@ -50,8 +44,7 @@ export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
50
44
  function AMSAutoDebit(options) {
51
45
  _classCallCheck(this, AMSAutoDebit);
52
46
  var _options = Object.assign({}, options, {
53
- product: productSceneEnum.AUTO_DEBIT,
54
- appVersion: AMSAutoDebitAppVersion
47
+ product: productSceneEnum.AUTO_DEBIT
55
48
  });
56
49
  return _super2.call(this, _options, [componentSignEnum.AUTO_DEBIT_WALLET]);
57
50
  }
@@ -75,8 +68,7 @@ export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout3) {
75
68
  function AMSEasyPay(options) {
76
69
  _classCallCheck(this, AMSEasyPay);
77
70
  var _options = Object.assign({}, options, {
78
- product: productSceneEnum.EASY_PAY,
79
- appVersion: AMSEasyPayAppVersion
71
+ product: productSceneEnum.EASY_PAY
80
72
  });
81
73
  var currentProductSceneVersion = '1.0';
82
74
  try {
@@ -107,8 +99,7 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout4) {
107
99
  function AMSCashierPayment(options) {
108
100
  _classCallCheck(this, AMSCashierPayment);
109
101
  var _options = Object.assign({}, options, {
110
- product: productSceneEnum.CASHIER_PAYMENT,
111
- appVersion: AMSCashierPaymentAppVersion
102
+ product: productSceneEnum.CASHIER_PAYMENT
112
103
  });
113
104
  var currentChannelType;
114
105
  try {
@@ -139,37 +130,10 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout5) {
139
130
  function AMSVaulting(options) {
140
131
  _classCallCheck(this, AMSVaulting);
141
132
  var _options = Object.assign({}, options, {
142
- product: productSceneEnum.VAULTING,
143
- appVersion: AMSVaultingAppVersion
133
+ product: productSceneEnum.VAULTING
144
134
  });
145
135
  return _super6.call(this, _options, [componentSignEnum.CASHIER_PAYMENT_CARD]);
146
136
  }
147
137
  return _createClass(AMSVaulting);
148
138
  }(AMSCheckout);
149
- export var AntomElement = /*#__PURE__*/function (_AMSCheckout6) {
150
- _inherits(AntomElement, _AMSCheckout6);
151
- var _super7 = _createSuper(AntomElement);
152
- function AntomElement(options) {
153
- _classCallCheck(this, AntomElement);
154
- var _options = Object.assign({}, options, {
155
- product: productSceneEnum.ELEMENT_PAYMENT,
156
- appVersion: AMSPaymentElementAppVersion
157
- });
158
- return _super7.call(this, _options, [componentSignEnum.ELEMENT_PAYMENT]);
159
- }
160
- return _createClass(AntomElement);
161
- }(AMSCheckout);
162
- export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
163
- _inherits(AddressElement, _AddressComponent);
164
- var _super8 = _createSuper(AddressElement);
165
- function AddressElement(options) {
166
- _classCallCheck(this, AddressElement);
167
- var _options = Object.assign({}, options, {
168
- product: productSceneEnum.ELEMENT_ADDRESS,
169
- appVersion: ADDRESSElementAppVersion
170
- });
171
- return _super8.call(this, _options);
172
- }
173
- return _createClass(AddressElement);
174
- }(AddressComponent);
175
139
  export default AMSCheckout;
@@ -84,7 +84,7 @@ var ApplePayComponent = /*#__PURE__*/function () {
84
84
  }, {
85
85
  biz: 'sdk',
86
86
  type: 'funnel',
87
- success: eventCodeEnum.SDK_PAYMENT_SUCCESSFUL === (state === null || state === void 0 ? void 0 : state.code),
87
+ success: eventCodeEnum.SDK_PAYMENT_FAIL === (state === null || state === void 0 ? void 0 : state.code),
88
88
  code: state === null || state === void 0 ? void 0 : state.code,
89
89
  errorCode: state === null || state === void 0 || (_state$result = state.result) === null || _state$result === void 0 ? void 0 : _state$result.errorCode,
90
90
  errorMessage: state === null || state === void 0 || (_state$result2 = state.result) === null || _state$result2 === void 0 ? void 0 : _state$result2.errorMessage,
@@ -16,13 +16,13 @@ export declare const getIframeUrl: (iframeParams: {
16
16
  productSceneVersion: string;
17
17
  environment: string;
18
18
  appVersion: string;
19
- extendInfo?: string;
20
- locale?: string;
19
+ extendInfo: string;
20
+ locale: string;
21
21
  instanceId: string;
22
22
  renderDisplayType: renderDisplayTypeEnum;
23
23
  isPreload?: string;
24
24
  hostSign?: string;
25
- mid?: string;
25
+ mid: string;
26
26
  }) => {
27
27
  path: string;
28
28
  locationSearch: string;