@alipay/ams-checkout 0.0.1694486521-dev.1 → 0.0.1695278363-dev.0

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.
@@ -12,8 +12,8 @@ var _queryParse = queryParse(),
12
12
  groupId = _queryParse.groupId,
13
13
  host = _queryParse.requestHost;
14
14
  export var requestHost = {
15
- local: 'http://imgs-6517.sggz00b.dev.alipay.net/mgw.htm',
16
- dev: host || 'http://imgs-6517.sggz00b.dev.alipay.net/mgw.htm',
15
+ local: 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
16
+ dev: host || 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
17
17
  sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
18
18
  pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
19
19
  prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
@@ -22,7 +22,7 @@ export var requestHost = {
22
22
  export var clientId = '5J5Y8X4E2Y25GR00690';
23
23
  export var tntInstId = 'ALIPW3SG';
24
24
  export var appId = 'ANTOM_PAYMENT_WEB';
25
- export var sofaId = groupId || 'GROUP_20230913102142';
25
+ export var sofaId = groupId || 'GROUP_20230523202227';
26
26
  export var hostSignMap = function hostSignMap(hostSign, env) {
27
27
  var map = {
28
28
  SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
@@ -1,3 +1,10 @@
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 ComponentApp from '../../plugin/component';
2
9
  import { IcreateComponent, IoptionsParams, Iselector } from '../../types';
3
10
  import CoreInstance from '../instance/index';
@@ -8,17 +15,17 @@ export declare class AMSComponent extends CoreInstance {
8
15
  private pluginAppendIframe;
9
16
  /**
10
17
  * @description Create component application
11
- * @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.
18
+ * @param params - The data source created by the component, necessary paymentSessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
12
19
  */
13
20
  createComponent(params: IcreateComponent): Promise<void>;
14
21
  /**
15
22
  * @description Create and render components in the specified element area
16
- * @param params - The data source created by the component, necessary sessionData, necessary element selector IDs, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
23
+ * @param params - The data source created by the component, necessary paymentSessionData, necessary element selector IDs, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
17
24
  */
18
25
  mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
19
26
  /**
20
27
  * @description Execute payment submission process
21
28
  * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
22
29
  */
23
- submit(): Promise<unknown>;
30
+ submit(): void;
24
31
  }
@@ -25,7 +25,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
25
  * 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
26
26
  * 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.
27
27
  */
28
- import { v4 as uuid } from 'uuid';
28
+
29
29
  import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
30
30
  import ComponentApp from "../../plugin/component";
31
31
  import { componentSignEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
@@ -41,12 +41,12 @@ var getComponentSign = function getComponentSign(params) {
41
41
  paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
42
42
  return productScene && paymentMethodCategoryType ? "".concat(productScene, "_").concat(paymentMethodCategoryType) : componentSignEnum.NONE;
43
43
  };
44
- var parseSessionData = function parseSessionData(sessionData) {
44
+ var parsePaymentSessionData = function parsePaymentSessionData(paymentSessionData) {
45
45
  try {
46
- return [JSON.parse(atob(sessionData.split('&&')[3])), sessionData.split('&&').slice(0, 3).join('&&')];
46
+ return [JSON.parse(atob(paymentSessionData.split('&&')[3])), paymentSessionData.split('&&').slice(0, 3).join('&&')];
47
47
  } catch (error) {
48
- console.error('Parsing sessionData is abnormal and may affect the payment link. Please ensure to use the new version of SDK.');
49
- return [{}, sessionData];
48
+ console.error('Parsing paymentSessionData is abnormal and may affect the payment link. Please ensure to use the new version of SDK.');
49
+ return [{}, paymentSessionData];
50
50
  }
51
51
  };
52
52
 
@@ -59,23 +59,23 @@ var resetEasyPaySceneVersion = function resetEasyPaySceneVersion(parseData) {
59
59
  }
60
60
  }
61
61
  };
62
- var handleSessionData = function handleSessionData(originSessionData) {
63
- var _parseSessionData = parseSessionData(originSessionData),
64
- _parseSessionData2 = _slicedToArray(_parseSessionData, 2),
65
- parseData = _parseSessionData2[0],
66
- sessionData = _parseSessionData2[1];
62
+ var handlePaymentSessionData = function handlePaymentSessionData(originPaymentSessionData) {
63
+ var _parsePaymentSessionD = parsePaymentSessionData(originPaymentSessionData),
64
+ _parsePaymentSessionD2 = _slicedToArray(_parsePaymentSessionD, 2),
65
+ parseData = _parsePaymentSessionD2[0],
66
+ paymentSessionData = _parsePaymentSessionD2[1];
67
67
  resetEasyPaySceneVersion(parseData);
68
- return [parseData, sessionData];
68
+ return [parseData, paymentSessionData];
69
69
  };
70
70
  var handleParams = function handleParams(params) {
71
71
  var _params = Object.assign({
72
72
  paymentSessionMetaData: {},
73
73
  renderDisplayType: renderDisplayTypeEnum.popup
74
74
  }, params);
75
- var _handleSessionData = handleSessionData(_params.sessionData),
76
- _handleSessionData2 = _slicedToArray(_handleSessionData, 2),
77
- parseData = _handleSessionData2[0],
78
- sessionData = _handleSessionData2[1];
75
+ var _handlePaymentSession = handlePaymentSessionData(_params.paymentSessionData),
76
+ _handlePaymentSession2 = _slicedToArray(_handlePaymentSession, 2),
77
+ parseData = _handlePaymentSession2[0],
78
+ paymentSessionData = _handlePaymentSession2[1];
79
79
  var componentSign = getComponentSign(parseData);
80
80
  if (componentSign === componentSignEnum.NONE) {
81
81
  // eslint-disable-next-line prefer-promise-reject-errors
@@ -84,7 +84,7 @@ var handleParams = function handleParams(params) {
84
84
  message: "Abnormal response data, interface failure, or unsupported payment method"
85
85
  });
86
86
  }
87
- _params.sessionData = sessionData;
87
+ _params.paymentSessionData = paymentSessionData;
88
88
  _params.paymentSessionMetaData = parseData;
89
89
  return Promise.resolve({
90
90
  iframeNodesParams: _params,
@@ -119,7 +119,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
119
119
  selector: selector,
120
120
  renderDisplayType: renderDisplayType
121
121
  }, params);
122
- if (_params && !_params.sessionData) {
122
+ if (_params && !_params.paymentSessionData) {
123
123
  return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
124
124
  }
125
125
  if (this.options.networkMode === networkModeEnum.proxy) {
@@ -140,7 +140,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
140
140
 
141
141
  /**
142
142
  * @description Create component application
143
- * @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.
143
+ * @param params - The data source created by the component, necessary paymentSessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
144
144
  */
145
145
  }, {
146
146
  key: "createComponent",
@@ -160,7 +160,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
160
160
  }
161
161
  /**
162
162
  * @description Create and render components in the specified element area
163
- * @param params - The data source created by the component, necessary sessionData, necessary element selector IDs, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
163
+ * @param params - The data source created by the component, necessary paymentSessionData, necessary element selector IDs, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
164
164
  */
165
165
  }, {
166
166
  key: "mountComponent",
@@ -186,25 +186,16 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
186
186
  }, {
187
187
  key: "submit",
188
188
  value: function submit() {
189
- var _this4 = this;
190
- return new Promise(function (resolve, reject) {
191
- try {
192
- var eventCallbackId = uuid();
193
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
194
- _this4._eventCenter.once(eventCallbackId, function (_data) {
195
- resolve(_data);
196
- });
197
- _this4._componentApp.dispatchToApp({
198
- context: {
199
- event: 'submitPay',
200
- eventCallbackId: eventCallbackId,
201
- data: {}
202
- }
203
- });
204
- } catch (error) {
205
- reject(error);
206
- }
207
- });
189
+ try {
190
+ this._componentApp.dispatchToApp({
191
+ context: {
192
+ event: 'submitPay',
193
+ data: {}
194
+ }
195
+ });
196
+ } catch (error) {
197
+ console.error(error);
198
+ }
208
199
  }
209
200
  }]);
210
201
  return AMSComponent;
@@ -1,3 +1,10 @@
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 { IcreatePaymentParams, IoptionsParams } from '../../types';
2
9
  export declare const mixinDropInConstructor: (options: IoptionsParams, context: any) => void;
3
10
  /**
@@ -8,7 +8,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
8
8
  * 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
9
9
  * 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.
10
10
  */
11
- /* eslint-disable @typescript-eslint/no-explicit-any */
11
+
12
12
  import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
13
13
  import CheckoutApp from "../../plugin/drop-in";
14
14
  import { messageName, networkModeEnum } from "../../types";
@@ -49,8 +49,8 @@ export var createPayment = function createPayment(params) {
49
49
  export var confirmPayment = function confirmPayment(result) {
50
50
  var _this2 = this;
51
51
  return new Promise(function (resolve, reject) {
52
- _this2.eventCenter.once('onRedirect', function (payload) {
53
- _this2._redirect(payload).then(function () {
52
+ _this2.eventCenter.once('onRedirect', function (playload) {
53
+ _this2._redirect(playload).then(function () {
54
54
  resolve();
55
55
  }).catch(function (err) {
56
56
  reject(err);
@@ -73,21 +73,21 @@ export var confirmPayment = function confirmPayment(result) {
73
73
  */
74
74
  export var _subscribeFromCheckoutPlugin = function _subscribeFromCheckoutPlugin() {
75
75
  var _this3 = this;
76
- var eventKeyMap = new Map([[EVENT.error.name, function (payload) {
77
- _this3.eventCenter.emit(EVENT.error.name, payload.context.data);
78
- }], [EVENT.ready.name, function (payload) {
79
- _this3.eventCenter.emit(EVENT.ready.name, payload.context.data);
80
- }], [EVENT.redirect.name, function (payload) {
81
- _this3.eventCenter.emit(EVENT.redirect.name, payload.context.data);
82
- }], [EVENT.paymentMethodSelected.name, function (payload) {
83
- _this3.checkoutState.paymentMethodType = payload.context.data.paymentMethodType;
76
+ var eventKeyMap = new Map([[EVENT.error.name, function (playload) {
77
+ _this3.eventCenter.emit(EVENT.error.name, playload.context.data);
78
+ }], [EVENT.ready.name, function (playload) {
79
+ _this3.eventCenter.emit(EVENT.ready.name, playload.context.data);
80
+ }], [EVENT.redirect.name, function (playload) {
81
+ _this3.eventCenter.emit(EVENT.redirect.name, playload.context.data);
82
+ }], [EVENT.paymentMethodSelected.name, function (playload) {
83
+ _this3.checkoutState.paymentMethodType = playload.context.data.paymentMethodType;
84
84
  _this3.eventCenter.emit(EVENT.paymentMethodSelected.name, {
85
- paymentMethodType: payload.context.data.paymentMethodType
85
+ paymentMethodType: playload.context.data.paymentMethodType
86
86
  });
87
- }], [EVENT.sizeChanged.name, function (payload) {
88
- _this3.eventCenter.emit(EVENT.sizeChanged.name, payload.context.data);
89
- }], [EVENT.log.name, function (payload) {
90
- _this3.eventCenter.emit(EVENT.log.name, payload.context.data);
87
+ }], [EVENT.sizeChanged.name, function (playload) {
88
+ _this3.eventCenter.emit(EVENT.sizeChanged.name, playload.context.data);
89
+ }], [EVENT.log.name, function (playload) {
90
+ _this3.eventCenter.emit(EVENT.log.name, playload.context.data);
91
91
  }]]);
92
92
  var _iterator = _createForOfIteratorHelper(eventKeyMap.keys()),
93
93
  _step;
@@ -15,7 +15,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
15
15
  * 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
16
16
  * 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.
17
17
  */
18
- /* eslint-disable @typescript-eslint/no-explicit-any */
19
18
  import { v4 as uuid } from 'uuid';
20
19
  import { ERRORMESSAGE, EVENT } from "../../constant";
21
20
  import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, terminalTypeEnum } from "../../types/index";
@@ -1,5 +1,4 @@
1
1
  import { componentSignEnum, Ianalytics } from '../../types';
2
- import { renderDisplayTypeEnum } from '../../types/index';
3
2
  export declare const getAppPath: (environment: string | undefined, appVersion: string, componentSign: componentSignEnum, productSceneVersion: string, extendInfo: string) => any;
4
3
  export declare const getAppDomain: (domainParams: {
5
4
  environment: string;
@@ -17,7 +16,6 @@ export declare const getIframeUrl: (iframeParams: {
17
16
  extendInfo: string;
18
17
  locale: string;
19
18
  instanceId: string;
20
- renderDisplayType: renderDisplayTypeEnum;
21
19
  }) => string;
22
20
  /**
23
21
  * @description Create iframe
@@ -22,7 +22,7 @@ var getAppVersion = function getAppVersion(_extendInfo) {
22
22
  };
23
23
  var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
24
24
  var _signSupportMap;
25
- var signSupportMap = (_signSupportMap = {}, _defineProperty(_signSupportMap, componentSignEnum.NONE, ['']), _defineProperty(_signSupportMap, componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), _defineProperty(_signSupportMap, componentSignEnum.VAULTING_CARD, ['1.0']), _signSupportMap);
25
+ var signSupportMap = (_signSupportMap = {}, _defineProperty(_signSupportMap, componentSignEnum.NONE, ['']), _defineProperty(_signSupportMap, componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), _signSupportMap);
26
26
  var supportProductSceneVersion = signSupportMap[componentSign];
27
27
  // 从左到右,从旧到新
28
28
  var isSupport = supportProductSceneVersion.find(function (it) {
@@ -69,8 +69,7 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
69
69
  appVersion = iframeParams.appVersion,
70
70
  extendInfo = iframeParams.extendInfo,
71
71
  locale = iframeParams.locale,
72
- instanceId = iframeParams.instanceId,
73
- renderDisplayType = iframeParams.renderDisplayType;
72
+ instanceId = iframeParams.instanceId;
74
73
  var path = getAppPath(environment, appVersion, componentSign, productSceneVersion, extendInfo || '');
75
74
  var initialScale = 1;
76
75
  var scale = getViewPort('initial-scale') || initialScale;
@@ -81,10 +80,8 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
81
80
  requestHost = _queryParse$requestHo === void 0 ? '' : _queryParse$requestHo,
82
81
  _queryParse$groupId = _queryParse.groupId,
83
82
  groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
84
- LOCAL_MOCK = _queryParse.LOCAL_MOCK,
85
- _displayType = _queryParse._displayType;
83
+ LOCAL_MOCK = _queryParse.LOCAL_MOCK;
86
84
  var urlParams = Object.assign({}, {
87
- displayType: renderDisplayType,
88
85
  locale: locale,
89
86
  scale: scale,
90
87
  instanceId: instanceId,
@@ -97,7 +94,6 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
97
94
  if (groupId) urlParams.groupId = groupId;
98
95
  if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
99
96
  if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
100
- if (_displayType) urlParams.displayType = _displayType;
101
97
  var locationSearch = serialize(urlParams);
102
98
  return "".concat(path, "?").concat(locationSearch);
103
99
  };
@@ -113,8 +113,6 @@ export var addPopupLoading = function addPopupLoading() {
113
113
  var body = document.getElementsByTagName('body')[0];
114
114
  body === null || body === void 0 ? void 0 : body.appendChild(loading);
115
115
  };
116
-
117
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
116
  export var handleDeclareInfo = function handleDeclareInfo(_ref) {
119
117
  var _ref$closeDialogData = _ref.closeDialogData,
120
118
  closeDialogData = _ref$closeDialogData === void 0 ? {} : _ref$closeDialogData;
@@ -1,5 +1,5 @@
1
1
  import type AMSCheckout from '../../core/instance';
2
- import type { eventPayload, eventPayloadContext, IappendIframeNodesParams, Iselector } from '../../types';
2
+ import type { eventPlayload, IappendIframeNodesParams, Iselector } from '../../types';
3
3
  import { componentSignEnum, platformEnum, renderDisplayTypeEnum } from '../../types';
4
4
  type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;
5
5
  export default class ComponentApp {
@@ -7,7 +7,7 @@ export default class ComponentApp {
7
7
  AMSSDK: AMSCheckout;
8
8
  platform: platformEnum;
9
9
  _performanceData: any[];
10
- _loadAppPromiseResolve: ((value: boolean) => void) | null;
10
+ _loadAppPromiseResolve: ((value: Boolean) => void) | null;
11
11
  _isInitComponent: boolean;
12
12
  private appDomain;
13
13
  private createIframeNode;
@@ -58,7 +58,7 @@ export default class ComponentApp {
58
58
  /**
59
59
  * @description Processing messages from iframe
60
60
  */
61
- _handleAppMessage(data: eventPayload): void;
61
+ _handleAppMessage(data: eventPlayload): void;
62
62
  private handleSizeChanged;
63
63
  private handleRedirect;
64
64
  private handleDeclareInfo;
@@ -66,12 +66,15 @@ export default class ComponentApp {
66
66
  /**
67
67
  * @description Send message to SDK
68
68
  */
69
- dispatchToSDK(event: string, data: any, eventCallbackId?: string): void;
69
+ dispatchToSDK(event: string, data: any): void;
70
70
  /**
71
71
  * @description Send message to iframe
72
72
  */
73
73
  dispatchToApp(payload: {
74
- context: eventPayloadContext;
74
+ context: {
75
+ event: string;
76
+ data: any;
77
+ };
75
78
  }): any;
76
79
  /**
77
80
  * @description Subscribe to messages from SDK
@@ -15,7 +15,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
15
15
  * 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.
16
16
  */
17
17
  /* eslint-disable no-console */
18
- /* eslint-disable @typescript-eslint/no-explicit-any */
19
18
  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 } from "../../constant";
20
19
  import { queryPaymentInfo } from "../../service";
21
20
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum } from "../../types";
@@ -45,7 +44,7 @@ var ComponentApp = /*#__PURE__*/function () {
45
44
  _defineProperty(this, "_componentSign", componentSignEnum.NONE);
46
45
  _defineProperty(this, "_clickEventName", void 0);
47
46
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
48
- this._appVersion = '1.5.5';
47
+ this._appVersion = '1.5.2';
49
48
  this._isInitComponent = false;
50
49
  this._selector = "#".concat(COMPONENT_SECTION_ID);
51
50
  this.createIframeNode = function () {
@@ -182,13 +181,13 @@ var ComponentApp = /*#__PURE__*/function () {
182
181
  this._actionQueryPromise = new Promise(function (resolve, reject) {
183
182
  var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3;
184
183
  var params = {
185
- paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.sessionData) || '',
184
+ paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.paymentSessionData) || '',
186
185
  paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 ? void 0 : (_this3$_renderParams3 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.paymentSessionConfig
187
186
  };
188
187
  /**
189
188
  * @description card
190
189
  */
191
- if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign || componentSignEnum.VAULTING_CARD === _this3._componentSign) {
190
+ if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign) {
192
191
  params.paymentMethodType = 'CARD';
193
192
  }
194
193
  /**
@@ -324,7 +323,6 @@ var ComponentApp = /*#__PURE__*/function () {
324
323
  });
325
324
  this.app = createIframe(this.AMSSDK.options.mode, this.platform);
326
325
  this.app.src = getIframeUrl({
327
- renderDisplayType: renderParams.renderDisplayType,
328
326
  componentSign: this._componentSign,
329
327
  analytics: this.AMSSDK.options.analytics,
330
328
  productSceneVersion: productSceneVersion,
@@ -457,7 +455,7 @@ var ComponentApp = /*#__PURE__*/function () {
457
455
  }
458
456
 
459
457
  // The plug-in communicates with the sdk after processing
460
- this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
458
+ this.dispatchToSDK(data.context.event, data.context.data);
461
459
  }
462
460
  }, {
463
461
  key: "handleSizeChanged",
@@ -587,9 +585,8 @@ var ComponentApp = /*#__PURE__*/function () {
587
585
  */
588
586
  }, {
589
587
  key: "dispatchToSDK",
590
- value: function dispatchToSDK(event, data, eventCallbackId) {
588
+ value: function dispatchToSDK(event, data) {
591
589
  this.AMSSDK._eventCenter.emit(event, data);
592
- if (eventCallbackId) this.AMSSDK._eventCenter.emit(eventCallbackId, data);
593
590
  }
594
591
 
595
592
  /**
@@ -658,7 +655,7 @@ var ComponentApp = /*#__PURE__*/function () {
658
655
  data: {
659
656
  queryResult: res,
660
657
  sessionResult: (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData,
661
- paymentSessionData: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.sessionData,
658
+ paymentSessionData: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData,
662
659
  heightOfVisible: Math.max(innerHeight, window.innerHeight),
663
660
  renderDisplayType: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.renderDisplayType,
664
661
  appearance: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.appearance,
@@ -1,5 +1,5 @@
1
1
  import type AMSCheckout from '../../core/instance';
2
- import type { IcreatePaymentParams, eventPayload } from '../../types';
2
+ import type { IcreatePaymentParams, eventPlayload } from '../../types';
3
3
  export default class CheckoutApp {
4
4
  app: any;
5
5
  paymentMethodsResult: any;
@@ -47,15 +47,15 @@ export default class CheckoutApp {
47
47
  /**
48
48
  * @description Processing messages from iframe
49
49
  */
50
- _handleAppMessage(data: eventPayload): void;
50
+ _handleAppMessage(data: eventPlayload): void;
51
51
  /**
52
52
  * @description Send message to SDK
53
53
  */
54
- _dispatchToSDK(data: eventPayload): void;
54
+ _dispatchToSDK(data: eventPlayload): void;
55
55
  /**
56
56
  * @description Send message to iframe
57
57
  */
58
- _dispatchToApp(data: eventPayload): void;
58
+ _dispatchToApp(data: eventPlayload): void;
59
59
  /**
60
60
  * @description Subscribe to messages from SDK
61
61
  */
@@ -67,5 +67,5 @@ export default class CheckoutApp {
67
67
  /**
68
68
  * @description Send the post submission processing event, and the cashier applies the consumption result
69
69
  */
70
- _handleRequestPayment(data: eventPayload): void;
70
+ _handleRequestPayment(data: eventPlayload): void;
71
71
  }
@@ -11,7 +11,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
11
11
  * 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
12
12
  * 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.
13
13
  */
14
- /* eslint-disable @typescript-eslint/no-explicit-any */
15
14
  import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
16
15
  import { messageName } from "../../types";
17
16
  import { getOrigin, getType, getViewPort, isDom, isJsonString, serialize } from "../../util";
@@ -1,3 +1,10 @@
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 { IrequestConfig } from '../types';
2
9
  /**
3
10
  *
@@ -14,7 +14,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
14
14
  * 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
15
15
  * 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.
16
16
  */
17
- /* eslint-disable @typescript-eslint/no-explicit-any */
17
+
18
18
  import { sdkVersion } from "../config/index";
19
19
  import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
20
20
  import { errorEnum } from "../types";
@@ -121,6 +121,8 @@ function _request() {
121
121
  case 21:
122
122
  _context.prev = 21;
123
123
  _context.t0 = _context["catch"](6);
124
+ // eslint-disable-next-line no-console
125
+ console.log('request error', _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message);
124
126
  _error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
125
127
  success: false,
126
128
  errorCode: errorEnum.SYSTEM,
@@ -133,7 +135,7 @@ function _request() {
133
135
  errorCode: errorCode,
134
136
  errorMessage: ''
135
137
  }));
136
- case 27:
138
+ case 28:
137
139
  case "end":
138
140
  return _context.stop();
139
141
  }
@@ -8,8 +8,6 @@
8
8
 
9
9
  import { errorEnum } from "../types";
10
10
  import { get } from "../util/get";
11
-
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
11
  export var safeJson = function safeJson(data, obj) {
14
12
  try {
15
13
  return JSON.parse(data) || obj;
@@ -19,7 +17,6 @@ export var safeJson = function safeJson(data, obj) {
19
17
  };
20
18
 
21
19
  // 判断header 中的resultStatus
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
20
  export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
24
21
  var resultStatus = get(headers, 'Result-Status') || get(headers, 'result-status', '');
25
22
  // 请求静态数据情况
@@ -30,7 +30,7 @@ export declare enum renderDisplayTypeEnum {
30
30
  }
31
31
  export interface IcreatePaymentParams {
32
32
  paymentMethodsResult?: any;
33
- sessionData?: string;
33
+ paymentSessionData?: string;
34
34
  selector: Iselector;
35
35
  appearance?: {
36
36
  displayType?: checkoutDisplayEnum;
@@ -42,14 +42,12 @@ export declare enum componentSignEnum {
42
42
  'CASHIER_PAYMENT_CARD' = "CASHIER_PAYMENT_CARD",
43
43
  'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
44
44
  'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
45
- 'NONE' = "NONE",
46
- 'VAULTING_CARD' = "VAULTING_CARD"
45
+ 'NONE' = "NONE"
47
46
  }
48
47
  export declare enum productSceneEnum {
49
48
  'EASY_PAY' = "EASY_PAY",
50
49
  'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
51
- 'AUTO_DEBIT' = "AUTO_DEBIT",
52
- 'VAULTING' = "VAULTING"
50
+ 'AUTO_DEBIT' = "AUTO_DEBIT"
53
51
  }
54
52
  export declare enum paymentMethodCategoryTypeEnum {
55
53
  'CARD' = "CARD",
@@ -57,7 +55,7 @@ export declare enum paymentMethodCategoryTypeEnum {
57
55
  'BANK' = "BANK"
58
56
  }
59
57
  export interface IcreateComponent {
60
- sessionData: string;
58
+ paymentSessionData: string;
61
59
  appearance?: Record<string, any>;
62
60
  }
63
61
  export interface IappendIframeNodesParams extends IcreateComponent {
@@ -160,17 +158,15 @@ export declare enum messageName {
160
158
  APP_TO_SDK = "APP_TO_SDK",
161
159
  APP_TO_APP = "APP_TO_APP"
162
160
  }
163
- export interface eventPayload {
161
+ export interface eventPlayload {
164
162
  name: messageName;
165
163
  mode?: string;
166
164
  appId?: string;
167
165
  instanceId: string;
168
- context: eventPayloadContext;
169
- }
170
- export interface eventPayloadContext {
171
- event: string;
172
- data: any;
173
- eventCallbackId?: string;
166
+ context: {
167
+ event: string;
168
+ data: any;
169
+ };
174
170
  }
175
171
  export interface AMSCheckoutOptions {
176
172
  env: Ienv;
@@ -5,7 +5,7 @@
5
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
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
7
  */
8
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
+
9
9
  /**
10
10
  * SDK options
11
11
  */
@@ -21,14 +21,12 @@ export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
21
21
  componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
22
22
  componentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
23
23
  componentSignEnum["NONE"] = "NONE";
24
- componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
25
24
  return componentSignEnum;
26
25
  }({});
27
26
  export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
28
27
  productSceneEnum["EASY_PAY"] = "EASY_PAY";
29
28
  productSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
30
29
  productSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
31
- productSceneEnum["VAULTING"] = "VAULTING";
32
30
  return productSceneEnum;
33
31
  }({});
34
32
  export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
@@ -1,10 +1,3 @@
1
- /**
2
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
- * 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:
4
- * 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
5
- * 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.
6
- */
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
1
  import { getType } from '.';
9
2
  import { ERRORMESSAGE, EVENT } from "../constant";
10
3
  import { messageName, renderDisplayTypeEnum } from "../types";