@alipay/ams-checkout 0.0.1701663818-dev.0 → 0.0.1701850681-dev.4

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.
@@ -140,13 +140,10 @@ export declare const EVENT: {
140
140
  dismissLoading: {
141
141
  name: string;
142
142
  };
143
- popupWindow: {
143
+ startDialog: {
144
144
  name: string;
145
145
  };
146
- closePopup: {
147
- name: string;
148
- };
149
- threedReady: {
146
+ popWindow: {
150
147
  name: string;
151
148
  };
152
149
  getDeviceId: {
@@ -155,6 +152,18 @@ export declare const EVENT: {
155
152
  declareEventCallbackInfo: {
156
153
  name: string;
157
154
  };
155
+ setGlobalData: {
156
+ name: string;
157
+ };
158
+ getGlobalData: {
159
+ name: string;
160
+ };
161
+ sendMuitiAppEventToSdk: {
162
+ name: string;
163
+ };
164
+ receiveMuitiAppFromSdk: {
165
+ name: string;
166
+ };
158
167
  };
159
168
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
160
169
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -140,20 +140,29 @@ export var EVENT = {
140
140
  dismissLoading: {
141
141
  name: 'dismissLoading'
142
142
  },
143
- popupWindow: {
144
- name: 'popupWindow'
143
+ startDialog: {
144
+ name: 'startDialog'
145
145
  },
146
- closePopup: {
147
- name: 'closePopup'
148
- },
149
- threedReady: {
150
- name: 'threedReady'
146
+ popWindow: {
147
+ name: 'popWindow'
151
148
  },
152
149
  getDeviceId: {
153
150
  name: 'getDeviceId'
154
151
  },
155
152
  declareEventCallbackInfo: {
156
153
  name: 'declareEventCallbackInfo'
154
+ },
155
+ setGlobalData: {
156
+ name: 'setGlobalData'
157
+ },
158
+ getGlobalData: {
159
+ name: 'getGlobalData'
160
+ },
161
+ sendMuitiAppEventToSdk: {
162
+ name: 'sendMuitiAppEventToSdk'
163
+ },
164
+ receiveMuitiAppFromSdk: {
165
+ name: 'receiveMuitiAppFromSdk'
157
166
  }
158
167
  };
159
168
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -138,9 +138,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
138
138
  key: "pluginAppendIframe",
139
139
  value: function pluginAppendIframe(appendParams) {
140
140
  try {
141
- this.logger.logInfo({
142
- title: 'sdk_event_createComponent'
143
- }).send();
144
141
  return this._componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams);
145
142
  } catch (error) {
146
143
  return Promise.reject(error);
@@ -163,6 +160,16 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
163
160
  _this2._eventCenter.emit(EVENT.error.name, error);
164
161
  return Promise.reject(error);
165
162
  }).then(function (appendParams) {
163
+ var _appendParams$iframeN, _appendParams$iframeN2;
164
+ // This version, easypay2.0 only supports alipayhk
165
+ var productSceneVersion = appendParams === null || appendParams === void 0 || (_appendParams$iframeN = appendParams.iframeNodesParams) === null || _appendParams$iframeN === void 0 || (_appendParams$iframeN = _appendParams$iframeN.paymentSessionMetaData) === null || _appendParams$iframeN === void 0 || (_appendParams$iframeN = _appendParams$iframeN.paymentSessionConfig) === null || _appendParams$iframeN === void 0 ? void 0 : _appendParams$iframeN.productSceneVersion;
166
+ var paymentMethodType = appendParams === null || appendParams === void 0 || (_appendParams$iframeN2 = appendParams.iframeNodesParams) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentSessionMetaData) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentMethodInfoView) === null || _appendParams$iframeN2 === void 0 ? void 0 : _appendParams$iframeN2.paymentMethodType;
167
+ if ((appendParams === null || appendParams === void 0 ? void 0 : appendParams.componentSign) === componentSignEnum.EASY_PAY_WALLET && productSceneVersion === '2.0' && paymentMethodType !== 'ALIPAY_HK') {
168
+ return Promise.reject({
169
+ code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
170
+ message: "Abnormal response data, interface failure, or unsupported payment method"
171
+ });
172
+ }
166
173
  return _this2.pluginAppendIframe(appendParams);
167
174
  });
168
175
  }
@@ -3,14 +3,14 @@ import type { eventPayload, eventPayloadContext, IappendIframeNodesParams, Isele
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 {
6
- app: any;
6
+ app: null | HTMLIFrameElement;
7
7
  AMSSDK: AMSCheckout;
8
8
  platform: platformEnum;
9
9
  _performanceData: any[];
10
10
  _loadAppPromiseResolve: ((value: boolean) => void) | null;
11
11
  _isInitComponent: boolean;
12
- private _threedData?;
13
- private popupWindow?;
12
+ private _globalData?;
13
+ private popupApp?;
14
14
  private appDomain;
15
15
  private createIframeNode;
16
16
  private _selector;
@@ -44,9 +44,10 @@ export default class ComponentApp {
44
44
  * @description render iframe content
45
45
  */
46
46
  appendIframeNodes(componentSign: componentSignEnum, renderParams: IappendIframeNodesParams): Promise<void>;
47
+ private setParameterDefaultValues;
47
48
  private renderInlineLoading;
48
49
  private renderPopupLoading;
49
- _createLoadAppPromise(): Promise<unknown>;
50
+ _createLoadAppPromise(loadTimeLimit?: number): Promise<unknown>;
50
51
  /**
51
52
  * @description Interface request
52
53
  */
@@ -59,8 +60,9 @@ export default class ComponentApp {
59
60
  private createApp;
60
61
  private listener;
61
62
  private resizeListener;
62
- private createPopupWindow;
63
+ private createDialog;
63
64
  private getDeviceIdAndCallback;
65
+ private returnDataAndCallback;
64
66
  /**
65
67
  * @description Initialize subscription iframe message
66
68
  */
@@ -15,7 +15,7 @@ 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 @typescript-eslint/no-explicit-any */
18
- import { marmotMap } from "../../config/index";
18
+ // import { marmotMap } from '../../config/index';
19
19
  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
20
  import { queryPaymentInfo, submitPayInfo } from "../../service";
21
21
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
@@ -35,8 +35,8 @@ var ComponentApp = /*#__PURE__*/function () {
35
35
  _defineProperty(this, "_performanceData", []);
36
36
  _defineProperty(this, "_loadAppPromiseResolve", null);
37
37
  _defineProperty(this, "_isInitComponent", void 0);
38
- _defineProperty(this, "_threedData", void 0);
39
- _defineProperty(this, "popupWindow", void 0);
38
+ _defineProperty(this, "_globalData", void 0);
39
+ _defineProperty(this, "popupApp", void 0);
40
40
  _defineProperty(this, "appDomain", void 0);
41
41
  _defineProperty(this, "createIframeNode", void 0);
42
42
  _defineProperty(this, "_selector", void 0);
@@ -49,7 +49,7 @@ var ComponentApp = /*#__PURE__*/function () {
49
49
  _defineProperty(this, "_appLocationSearch", void 0);
50
50
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
51
51
  _defineProperty(this, "_multipleCallbackEvents", void 0);
52
- this._appVersion = '1.6.2';
52
+ this._appVersion = '1.7.0';
53
53
  this._isInitComponent = false;
54
54
  this._selector = "#".concat(COMPONENT_SECTION_ID);
55
55
  this.createIframeNode = function () {
@@ -62,6 +62,7 @@ var ComponentApp = /*#__PURE__*/function () {
62
62
  key: 'sdk_init',
63
63
  value: Date.now()
64
64
  });
65
+ this._globalData = new Map();
65
66
  }
66
67
 
67
68
  /**
@@ -227,19 +228,24 @@ var ComponentApp = /*#__PURE__*/function () {
227
228
  }, {
228
229
  key: "appendIframeNodes",
229
230
  value: function appendIframeNodes(componentSign, renderParams) {
230
- var _this3 = this;
231
+ var _renderParams,
232
+ _this3 = this;
231
233
  if (this._isInitComponent) {
232
234
  this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
233
235
  return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
234
236
  }
237
+ renderParams = this.setParameterDefaultValues(componentSign, renderParams);
235
238
  this._isInitComponent = true;
236
239
  this._renderParams = renderParams;
237
240
  this._componentSign = componentSign;
238
- if (renderParams !== null && renderParams !== void 0 && renderParams.selector) this._selector = renderParams.selector;
241
+ if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
239
242
  this._renderDisplayType = renderParams.renderDisplayType;
240
243
  var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
241
- this.initSecurity();
242
244
  this.initLoggerMeta();
245
+ this.AMSSDK.logger.logInfo({
246
+ title: 'sdk_event_createComponent'
247
+ }).send();
248
+ this.initSecurity();
243
249
  this._performanceData.push({
244
250
  key: 'sdk_create_component',
245
251
  value: Date.now()
@@ -270,6 +276,16 @@ var ComponentApp = /*#__PURE__*/function () {
270
276
  return Promise.reject(error);
271
277
  });
272
278
  }
279
+ }, {
280
+ key: "setParameterDefaultValues",
281
+ value: function setParameterDefaultValues(componentSign, renderParams) {
282
+ var newParams = Object.assign({}, renderParams);
283
+ if (componentSign === componentSignEnum.VAULTING_CARD) {
284
+ var _newParams$notRedirec;
285
+ newParams.notRedirectAfterComplete = (_newParams$notRedirec = newParams === null || newParams === void 0 ? void 0 : newParams.notRedirectAfterComplete) !== null && _newParams$notRedirec !== void 0 ? _newParams$notRedirec : true;
286
+ }
287
+ return newParams;
288
+ }
273
289
  }, {
274
290
  key: "renderInlineLoading",
275
291
  value: function renderInlineLoading(renderParams, selector) {
@@ -291,18 +307,15 @@ var ComponentApp = /*#__PURE__*/function () {
291
307
  }
292
308
  }, {
293
309
  key: "_createLoadAppPromise",
294
- value: function _createLoadAppPromise() {
310
+ value: function _createLoadAppPromise(loadTimeLimit) {
295
311
  var _this4 = this;
296
312
  return new Promise(function (resolve, reject) {
297
313
  _this4._loadAppPromiseResolve = resolve;
298
314
  setTimeout(function () {
299
315
  reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
300
- }, LOADTIME_LIMIT);
316
+ }, loadTimeLimit !== null && loadTimeLimit !== void 0 ? loadTimeLimit : LOADTIME_LIMIT);
301
317
  }).catch(function (error) {
302
- _this4.dispatchToSDK(EVENT.error.name, {
303
- code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code,
304
- message: ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT.message
305
- });
318
+ _this4.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
306
319
  _this4.AMSSDK.logger.logError({
307
320
  title: 'sdk_error_web_app_timeout'
308
321
  }).send();
@@ -427,7 +440,7 @@ var ComponentApp = /*#__PURE__*/function () {
427
440
  resolve(res);
428
441
  }
429
442
  }).catch(function (err) {
430
- if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign) {
443
+ if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD].includes(_this5._componentSign)) {
431
444
  return resolve({
432
445
  success: false
433
446
  });
@@ -653,13 +666,12 @@ var ComponentApp = /*#__PURE__*/function () {
653
666
  });
654
667
  }
655
668
  }, {
656
- key: "createPopupWindow",
657
- value: function createPopupWindow(data) {
658
- var _this$_renderParams5;
659
- this._threedData = data;
660
- var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
661
- var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
662
- this.popupWindow = createModal({
669
+ key: "createDialog",
670
+ value: function createDialog(data) {
671
+ var threedPageUrl = data.url.includes('?') ? "".concat(data.url, "&").concat(this._appLocationSearch) : "".concat(data.url, "?").concat(this._appLocationSearch);
672
+ this.popupApp = createModal({
673
+ widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
674
+ heightPadding: data === null || data === void 0 ? void 0 : data.heightPadding,
663
675
  device: this.platform,
664
676
  url: threedPageUrl
665
677
  });
@@ -700,6 +712,35 @@ var ComponentApp = /*#__PURE__*/function () {
700
712
  }
701
713
  return getDeviceIdAndCallback;
702
714
  }()
715
+ }, {
716
+ key: "returnDataAndCallback",
717
+ value: function () {
718
+ var _returnDataAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventContext) {
719
+ var _eventContext$data, targetData;
720
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
721
+ while (1) switch (_context5.prev = _context5.next) {
722
+ case 0:
723
+ if (eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId) {
724
+ targetData = this._globalData.get((_eventContext$data = eventContext.data) === null || _eventContext$data === void 0 ? void 0 : _eventContext$data.dataKey);
725
+ this.dispatchToApp({
726
+ context: {
727
+ event: 'appEventCallback',
728
+ eventCallbackId: eventContext === null || eventContext === void 0 ? void 0 : eventContext.eventCallbackId,
729
+ data: targetData
730
+ }
731
+ });
732
+ }
733
+ case 1:
734
+ case "end":
735
+ return _context5.stop();
736
+ }
737
+ }, _callee5, this);
738
+ }));
739
+ function returnDataAndCallback(_x5) {
740
+ return _returnDataAndCallback.apply(this, arguments);
741
+ }
742
+ return returnDataAndCallback;
743
+ }()
703
744
  /**
704
745
  * @description Initialize subscription iframe message
705
746
  */
@@ -725,7 +766,9 @@ var ComponentApp = /*#__PURE__*/function () {
725
766
  }, {
726
767
  key: "_handleAppMessage",
727
768
  value: function _handleAppMessage(data) {
728
- var eventKeyMap = [EVENT.launch.name, EVENT.redirect.name, EVENT.sizeChanged.name, EVENT.log.name, EVENT.close.name, EVENT.error.name, EVENT.eventCallback.name, EVENT.submitForm.name, EVENT.showCloseButton.name, EVENT.hideCloseButton.name, EVENT.setAllowRetention.name, EVENT.declareCheckoutInfo.name, EVENT.showPopup.name, EVENT.dismissLoading.name, EVENT.popupWindow.name, EVENT.threedReady.name, EVENT.closePopup.name, EVENT.getDeviceId.name, EVENT.declareEventCallbackInfo.name];
769
+ var eventKeyMap = Object.keys(EVENT).map(function (key) {
770
+ return EVENT[key].name;
771
+ });
729
772
  if (!eventKeyMap.includes(data.context.event)) {
730
773
  return;
731
774
  }
@@ -733,29 +776,38 @@ var ComponentApp = /*#__PURE__*/function () {
733
776
  this.getDeviceIdAndCallback(data.context);
734
777
  return;
735
778
  }
736
- if (data.context.event === EVENT.closePopup.name) {
779
+ if (data.context.event === EVENT.popWindow.name) {
737
780
  destroyModal();
738
781
  return;
739
782
  }
740
- if (data.context.event === EVENT.threedReady.name) {
741
- this.dispatchToApp({
742
- context: {
743
- event: 'renderThreedPage',
744
- data: this._threedData
745
- }
746
- }, this.popupWindow);
783
+ if (data.context.event === EVENT.getGlobalData.name) {
784
+ this.returnDataAndCallback(data.context);
785
+ return;
786
+ }
787
+ if (data.context.event === EVENT.setGlobalData.name) {
788
+ var _data$context$data, _data$context$data2;
789
+ this._globalData.set((_data$context$data = data.context.data) === null || _data$context$data === void 0 ? void 0 : _data$context$data.dataKey, (_data$context$data2 = data.context.data) === null || _data$context$data2 === void 0 ? void 0 : _data$context$data2.data);
747
790
  return;
748
791
  }
749
- if (data.context.event === EVENT.popupWindow.name) {
792
+ if (data.context.event === EVENT.startDialog.name) {
750
793
  var _data$context;
751
- this.createPopupWindow((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
794
+ this.createDialog((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
795
+ return;
796
+ }
797
+ if (data.context.event === EVENT.sendMuitiAppEventToSdk.name) {
798
+ this.dispatchToApp({
799
+ context: {
800
+ event: 'receiveMuitiAppFromSdk',
801
+ data: data.context.data
802
+ }
803
+ });
752
804
  return;
753
805
  }
754
806
  if (data.context.event === EVENT.dismissLoading.name) {
755
- var _data$context$data;
807
+ var _data$context$data3;
756
808
  this.dispatchToSDK(EVENT.eventCallback.name, {
757
809
  code: 'SDK_END_OF_LOADING',
758
- message: ((_data$context$data = data.context.data) === null || _data$context$data === void 0 ? void 0 : _data$context$data.message) || ''
810
+ message: ((_data$context$data3 = data.context.data) === null || _data$context$data3 === void 0 ? void 0 : _data$context$data3.message) || ''
759
811
  });
760
812
  return;
761
813
  }
@@ -764,6 +816,9 @@ var ComponentApp = /*#__PURE__*/function () {
764
816
  key: 'sdk_onLaunch',
765
817
  value: Date.now()
766
818
  });
819
+ this.AMSSDK.logger.logInfo({
820
+ title: 'sdk_event_webAppOnLaunch'
821
+ }).send();
767
822
  this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
768
823
  this.sendRenderEvent();
769
824
  return;
@@ -814,8 +869,8 @@ var ComponentApp = /*#__PURE__*/function () {
814
869
  }, {
815
870
  key: "handleSizeChanged",
816
871
  value: function handleSizeChanged(data) {
817
- var _data$context$data2;
818
- if (((_data$context$data2 = data.context.data) === null || _data$context$data2 === void 0 ? void 0 : _data$context$data2.height) <= 1) return;
872
+ var _data$context$data4;
873
+ if (((_data$context$data4 = data.context.data) === null || _data$context$data4 === void 0 ? void 0 : _data$context$data4.height) <= 1) return;
819
874
  var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
820
875
  cashier.style.height = "".concat(data.context.data.height, "px");
821
876
  if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
@@ -1004,8 +1059,11 @@ var ComponentApp = /*#__PURE__*/function () {
1004
1059
  if (targetElement && targetElement.contentWindow) {
1005
1060
  return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
1006
1061
  }
1007
- if (this.app && this.app.contentWindow) {
1008
- return this.app.contentWindow.postMessage(JSON.stringify(data), this.appDomain);
1062
+ if (this.app || this.popupApp) {
1063
+ var _this$app, _this$app2, _this$popupApp, _this$popupApp2;
1064
+ (this === null || this === void 0 || (_this$app = this.app) === null || _this$app === void 0 ? void 0 : _this$app.contentWindow) && (this === null || this === void 0 || (_this$app2 = this.app) === null || _this$app2 === void 0 ? void 0 : _this$app2.contentWindow.postMessage(JSON.stringify(data), this.appDomain));
1065
+ (this === null || this === void 0 || (_this$popupApp = this.popupApp) === null || _this$popupApp === void 0 ? void 0 : _this$popupApp.contentWindow) && (this === null || this === void 0 || (_this$popupApp2 = this.popupApp) === null || _this$popupApp2 === void 0 ? void 0 : _this$popupApp2.contentWindow.postMessage(JSON.stringify(data), '*'));
1066
+ return;
1009
1067
  }
1010
1068
  throw new Error(ERRORMESSAGE.SDK_SUBMIT_ERROR.message);
1011
1069
  }
@@ -1031,26 +1089,26 @@ var ComponentApp = /*#__PURE__*/function () {
1031
1089
  }, {
1032
1090
  key: "sendRenderEvent",
1033
1091
  value: function () {
1034
- var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
1035
- var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
1036
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1037
- while (1) switch (_context5.prev = _context5.next) {
1092
+ var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
1093
+ var _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, res, submitRes;
1094
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1095
+ while (1) switch (_context6.prev = _context6.next) {
1038
1096
  case 0:
1039
- _context5.prev = 0;
1097
+ _context6.prev = 0;
1040
1098
  if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
1041
- _context5.next = 3;
1099
+ _context6.next = 3;
1042
1100
  break;
1043
1101
  }
1044
- return _context5.abrupt("return");
1102
+ return _context6.abrupt("return");
1045
1103
  case 3:
1046
- _context5.next = 5;
1104
+ _context6.next = 5;
1047
1105
  return this._actionQueryPromise;
1048
1106
  case 5:
1049
- res = _context5.sent;
1050
- _context5.next = 8;
1107
+ res = _context6.sent;
1108
+ _context6.next = 8;
1051
1109
  return this._actionSubmitPromise;
1052
1110
  case 8:
1053
- submitRes = _context5.sent;
1111
+ submitRes = _context6.sent;
1054
1112
  this._performanceData.push({
1055
1113
  key: 'sdk_render_component',
1056
1114
  value: Date.now()
@@ -1061,12 +1119,12 @@ var ComponentApp = /*#__PURE__*/function () {
1061
1119
  data: {
1062
1120
  queryResult: res,
1063
1121
  submitResult: submitRes,
1064
- sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
1065
- paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
1122
+ sessionResult: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.paymentSessionMetaData,
1123
+ paymentSessionData: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.sessionData,
1066
1124
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
1067
- renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
1068
- appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
1069
- notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
1125
+ renderDisplayType: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.renderDisplayType,
1126
+ appearance: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.appearance,
1127
+ notRedirectAfterComplete: ((_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.notRedirectAfterComplete) === true,
1070
1128
  envInfo: {
1071
1129
  screenHeight: screen.height,
1072
1130
  screenWidth: screen.width
@@ -1083,16 +1141,16 @@ var ComponentApp = /*#__PURE__*/function () {
1083
1141
  }
1084
1142
  });
1085
1143
  // eslint-disable-next-line no-empty
1086
- _context5.next = 16;
1144
+ _context6.next = 16;
1087
1145
  break;
1088
1146
  case 14:
1089
- _context5.prev = 14;
1090
- _context5.t0 = _context5["catch"](0);
1147
+ _context6.prev = 14;
1148
+ _context6.t0 = _context6["catch"](0);
1091
1149
  case 16:
1092
1150
  case "end":
1093
- return _context5.stop();
1151
+ return _context6.stop();
1094
1152
  }
1095
- }, _callee5, this, [[0, 14]]);
1153
+ }, _callee6, this, [[0, 14]]);
1096
1154
  }));
1097
1155
  function sendRenderEvent() {
1098
1156
  return _sendRenderEvent.apply(this, arguments);
@@ -1,6 +1,8 @@
1
1
  export declare const insertStyleSheet: () => void;
2
- export declare const createModal: ({ device, url }: {
2
+ export declare const createModal: ({ device, url, widthPadding, heightPadding }: {
3
3
  device: any;
4
4
  url: any;
5
+ widthPadding: any;
6
+ heightPadding: any;
5
7
  }) => HTMLIFrameElement;
6
8
  export declare const destroyModal: () => void;
@@ -13,7 +13,9 @@ export var insertStyleSheet = function insertStyleSheet() {
13
13
  // 插入弹窗
14
14
  export var createModal = function createModal(_ref) {
15
15
  var device = _ref.device,
16
- url = _ref.url;
16
+ url = _ref.url,
17
+ widthPadding = _ref.widthPadding,
18
+ heightPadding = _ref.heightPadding;
17
19
  var overlay = document.createElement('div');
18
20
  overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
19
21
  var modal = document.createElement('div');
@@ -23,8 +25,8 @@ export var createModal = function createModal(_ref) {
23
25
  modal.style.height = '464px';
24
26
  modal.style.borderRadius = '12px';
25
27
  } else {
26
- modal.style.width = 'calc(100% - 16px)';
27
- modal.style.height = '80%';
28
+ modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
29
+ modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
28
30
  modal.style.borderRadius = '8px';
29
31
  }
30
32
  var iframe = document.createElement('iframe');
@@ -357,13 +357,6 @@ export declare enum eventCodeEnum {
357
357
  SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
358
358
  SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
359
359
  }
360
- export interface ThreedData {
361
- data: any;
362
- method: string;
363
- targetUrl: string;
364
- pti?: number;
365
- pt?: number;
366
- }
367
360
  export declare enum RedirectType {
368
361
  ApplinkUrl = "ApplinkUrl",
369
362
  SchemeUrl = "SchemeUrl",
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@alipay/ams-checkout","version":"0.0.1701663818-dev.0","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
1
+ {"name":"@alipay/ams-checkout","version":"0.0.1701850681-dev.4","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}