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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -140,6 +140,15 @@ export declare const EVENT: {
140
140
  dismissLoading: {
141
141
  name: string;
142
142
  };
143
+ popupWindow: {
144
+ name: string;
145
+ };
146
+ closePopup: {
147
+ name: string;
148
+ };
149
+ threedReady: {
150
+ name: string;
151
+ };
143
152
  };
144
153
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
145
154
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -139,6 +139,15 @@ export var EVENT = {
139
139
  },
140
140
  dismissLoading: {
141
141
  name: 'dismissLoading'
142
+ },
143
+ popupWindow: {
144
+ name: 'popupWindow'
145
+ },
146
+ closePopup: {
147
+ name: 'closePopup'
148
+ },
149
+ threedReady: {
150
+ name: 'threedReady'
142
151
  }
143
152
  };
144
153
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -9,6 +9,8 @@ export default class ComponentApp {
9
9
  _performanceData: any[];
10
10
  _loadAppPromiseResolve: ((value: boolean) => void) | null;
11
11
  _isInitComponent: boolean;
12
+ private _threedData?;
13
+ private popupWindow?;
12
14
  private appDomain;
13
15
  private createIframeNode;
14
16
  private _selector;
@@ -51,6 +53,7 @@ export default class ComponentApp {
51
53
  private createApp;
52
54
  private listener;
53
55
  private resizeListener;
56
+ private createPopupWindow;
54
57
  /**
55
58
  * @description Initialize subscription iframe message
56
59
  */
@@ -73,7 +76,7 @@ export default class ComponentApp {
73
76
  */
74
77
  dispatchToApp(payload: {
75
78
  context: eventPayloadContext;
76
- }): any;
79
+ }, element?: any): any;
77
80
  /**
78
81
  * @description Subscribe to messages from SDK
79
82
  */
@@ -16,16 +16,18 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
16
16
  */
17
17
  /* eslint-disable no-console */
18
18
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
+ import APDID from '@alipay/jshield-apdid';
20
+ import { marmptMap } from "../../config/index";
19
21
  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
22
  import { queryPaymentInfo } from "../../service";
21
23
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum } from "../../types";
22
24
  import { getType, isJsonString, isPC, queryParse } from "../../util";
23
25
  import { isLocalMock } from "../../util/mock";
26
+ import { getAppname, getSecurityHost } from "../../util/security";
24
27
  import { createIframe, getAppDomain, getIframeUrl } from "./cashierApp";
25
28
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
26
29
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
27
- import APDID from '@alipay/jshield-apdid';
28
- import { getSecurityHost, getAppname } from "../../util/security";
30
+ import { createModal, insertStyleSheet, destroyModal } from "./popupWindow.style";
29
31
  var _ref = queryParse() || {},
30
32
  preinit = _ref.preinit,
31
33
  rebuild = _ref.rebuild,
@@ -41,6 +43,8 @@ var ComponentApp = /*#__PURE__*/function () {
41
43
  _defineProperty(this, "_performanceData", []);
42
44
  _defineProperty(this, "_loadAppPromiseResolve", null);
43
45
  _defineProperty(this, "_isInitComponent", void 0);
46
+ _defineProperty(this, "_threedData", void 0);
47
+ _defineProperty(this, "popupWindow", void 0);
44
48
  _defineProperty(this, "appDomain", void 0);
45
49
  _defineProperty(this, "createIframeNode", void 0);
46
50
  _defineProperty(this, "_selector", void 0);
@@ -113,7 +117,7 @@ var ComponentApp = /*#__PURE__*/function () {
113
117
  APDID.initToken(appName, {
114
118
  host: h5gateway
115
119
  }, function (success, tokenResult, msg) {
116
- console.log("initToken result tokenResult", JSON.stringify(tokenResult));
120
+ console.log('initToken result tokenResult', JSON.stringify(tokenResult));
117
121
  });
118
122
  }
119
123
 
@@ -145,6 +149,7 @@ var ComponentApp = /*#__PURE__*/function () {
145
149
  if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
146
150
  var container = createInlineBaseElement(this._selector);
147
151
  if (container) this.renderInlineLoading(renderParams, container);
152
+ insertStyleSheet();
148
153
  }
149
154
  if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
150
155
  createBaseElement(this.platform, this.closeBtnFunc.bind(this));
@@ -210,10 +215,11 @@ var ComponentApp = /*#__PURE__*/function () {
210
215
  value: Date.now()
211
216
  });
212
217
  this._actionQueryPromise = new Promise(function (resolve, reject) {
213
- var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3;
218
+ var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3, _this3$_renderParams4;
214
219
  var params = {
215
220
  paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.sessionData) || '',
216
- paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 || (_this3$_renderParams2 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams2 === void 0 ? void 0 : _this3$_renderParams2.paymentSessionConfig
221
+ paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 || (_this3$_renderParams2 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams2 === void 0 ? void 0 : _this3$_renderParams2.paymentSessionConfig,
222
+ notRedirectAfterComplete: ((_this3$_renderParams3 = _this3._renderParams) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.notRedirectAfterComplete) === true
217
223
  };
218
224
  /**
219
225
  * @description card
@@ -223,10 +229,10 @@ var ComponentApp = /*#__PURE__*/function () {
223
229
  }
224
230
  var needDeviceId = false;
225
231
  var waitTime = '3000';
226
- var securityConfig = (_this3$_renderParams3 = _this3._renderParams) === null || _this3$_renderParams3 === void 0 || (_this3$_renderParams3 = _this3$_renderParams3.paymentSessionMetaData) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.securityConfig;
232
+ var securityConfig = (_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 || (_this3$_renderParams4 = _this3$_renderParams4.paymentSessionMetaData) === null || _this3$_renderParams4 === void 0 ? void 0 : _this3$_renderParams4.securityConfig;
227
233
  if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign && securityConfig) {
228
- var _this3$_renderParams4;
229
- var extendInfo = ((_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 || (_this3$_renderParams4 = _this3$_renderParams4.paymentSessionMetaData) === null || _this3$_renderParams4 === void 0 ? void 0 : _this3$_renderParams4.extendInfo) || '';
234
+ var _this3$_renderParams5;
235
+ var extendInfo = ((_this3$_renderParams5 = _this3._renderParams) === null || _this3$_renderParams5 === void 0 || (_this3$_renderParams5 = _this3$_renderParams5.paymentSessionMetaData) === null || _this3$_renderParams5 === void 0 ? void 0 : _this3$_renderParams5.extendInfo) || '';
230
236
  var info = JSON.parse(extendInfo);
231
237
  if ((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false') {
232
238
  needDeviceId = true;
@@ -238,13 +244,13 @@ var ComponentApp = /*#__PURE__*/function () {
238
244
  * @description easyPay
239
245
  */
240
246
  if (componentSignEnum.EASY_PAY_WALLET === _this3._componentSign) {
241
- var _this3$_renderParams5;
247
+ var _this3$_renderParams6;
242
248
  var _ref2 = params.paymentSessionConfig || {},
243
249
  _ref2$productSceneVer = _ref2.productSceneVersion,
244
250
  productSceneVersion = _ref2$productSceneVer === void 0 ? '' : _ref2$productSceneVer,
245
251
  _ref2$productScene = _ref2.productScene,
246
252
  productScene = _ref2$productScene === void 0 ? '' : _ref2$productScene;
247
- var _ref3 = ((_this3$_renderParams5 = _this3._renderParams) === null || _this3$_renderParams5 === void 0 ? void 0 : _this3$_renderParams5.paymentSessionMetaData) || {},
253
+ var _ref3 = ((_this3$_renderParams6 = _this3._renderParams) === null || _this3$_renderParams6 === void 0 ? void 0 : _this3$_renderParams6.paymentSessionMetaData) || {},
248
254
  _ref3$action = _ref3.action,
249
255
  _ref3$action2 = _ref3$action === void 0 ? {} : _ref3$action,
250
256
  _ref3$action2$autoDeb = _ref3$action2.autoDebitWithToken,
@@ -262,8 +268,8 @@ var ComponentApp = /*#__PURE__*/function () {
262
268
  * @description autoDebit
263
269
  */
264
270
  if (componentSignEnum.AUTO_DEBIT_WALLET === _this3._componentSign) {
265
- var _this3$_renderParams6, _action$web, _action$wap;
266
- var action = ((_this3$_renderParams6 = _this3._renderParams) === null || _this3$_renderParams6 === void 0 || (_this3$_renderParams6 = _this3$_renderParams6.paymentSessionMetaData) === null || _this3$_renderParams6 === void 0 ? void 0 : _this3$_renderParams6.action) || {};
271
+ var _this3$_renderParams7, _action$web, _action$wap;
272
+ var action = ((_this3$_renderParams7 = _this3._renderParams) === null || _this3$_renderParams7 === void 0 || (_this3$_renderParams7 = _this3$_renderParams7.paymentSessionMetaData) === null || _this3$_renderParams7 === void 0 ? void 0 : _this3$_renderParams7.action) || {};
267
273
  var signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
268
274
  if (signType === 'SMS') {
269
275
  return resolve({
@@ -301,6 +307,11 @@ var ComponentApp = /*#__PURE__*/function () {
301
307
  resolve(res);
302
308
  }
303
309
  }).catch(function (err) {
310
+ if (componentSignEnum.EASY_PAY_WALLET === _this3._componentSign) {
311
+ return resolve({
312
+ success: false
313
+ });
314
+ }
304
315
  _this3.dispatchToSDK(EVENT.error.name, {
305
316
  code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
306
317
  });
@@ -422,6 +433,19 @@ var ComponentApp = /*#__PURE__*/function () {
422
433
  }
423
434
  });
424
435
  }
436
+ }, {
437
+ key: "createPopupWindow",
438
+ value: function createPopupWindow(data) {
439
+ var _this$_renderParams2;
440
+ this._threedData = data;
441
+ var sessionData = encodeURIComponent((_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.sessionData);
442
+ // const threedPageUrl = `http://192.168.1.5:5173/src/component-app/threedPage/demo.html?scene=threedWrapperPage&sessionData=${sessionData}&instanceId=${this.AMSSDK._instanceId}`
443
+ var threedPageUrl = "".concat(marmptMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&instanceId=").concat(this.AMSSDK._instanceId);
444
+ this.popupWindow = createModal({
445
+ device: this.platform,
446
+ url: threedPageUrl
447
+ });
448
+ }
425
449
 
426
450
  /**
427
451
  * @description Initialize subscription iframe message
@@ -448,10 +472,28 @@ var ComponentApp = /*#__PURE__*/function () {
448
472
  }, {
449
473
  key: "_handleAppMessage",
450
474
  value: function _handleAppMessage(data) {
451
- 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];
475
+ 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];
452
476
  if (!eventKeyMap.includes(data.context.event)) {
453
477
  return;
454
478
  }
479
+ if (data.context.event === EVENT.closePopup.name) {
480
+ destroyModal();
481
+ return;
482
+ }
483
+ if (data.context.event === EVENT.threedReady.name) {
484
+ this.dispatchToApp({
485
+ context: {
486
+ event: 'renderThreedPage',
487
+ data: this._threedData
488
+ }
489
+ }, this.popupWindow);
490
+ return;
491
+ }
492
+ if (data.context.event === EVENT.popupWindow.name) {
493
+ var _data$context;
494
+ this.createPopupWindow((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
495
+ return;
496
+ }
455
497
  if (data.context.event === EVENT.dismissLoading.name) {
456
498
  var _data$context$data;
457
499
  this.dispatchToSDK(EVENT.eventCallback.name, {
@@ -642,12 +684,16 @@ var ComponentApp = /*#__PURE__*/function () {
642
684
  }, {
643
685
  key: "dispatchToApp",
644
686
  value: function dispatchToApp(payload) {
687
+ var element = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
645
688
  var data = Object.assign({}, payload, {
646
689
  name: messageName.SDK_TO_APP,
647
690
  mode: this.AMSSDK.options.mode,
648
691
  appId: COMPONENTPLUGINID,
649
692
  instanceId: this.AMSSDK._instanceId
650
693
  });
694
+ if (element && element.contentWindow) {
695
+ return element.contentWindow.postMessage(JSON.stringify(data), '*');
696
+ }
651
697
  if (this.app && this.app.contentWindow) {
652
698
  return this.app.contentWindow.postMessage(JSON.stringify(data), this.appDomain);
653
699
  }
@@ -676,7 +722,7 @@ var ComponentApp = /*#__PURE__*/function () {
676
722
  key: "sendRenderEvent",
677
723
  value: function () {
678
724
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
679
- var _this$_renderParams2, _this$_renderParams3, _this$_renderParams4, _this$_renderParams5, _this$_renderParams6, res;
725
+ var _this$_renderParams3, _this$_renderParams4, _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, res;
680
726
  return _regeneratorRuntime().wrap(function _callee$(_context) {
681
727
  while (1) switch (_context.prev = _context.next) {
682
728
  case 0:
@@ -700,12 +746,12 @@ var ComponentApp = /*#__PURE__*/function () {
700
746
  event: 'renderComponent',
701
747
  data: {
702
748
  queryResult: res,
703
- sessionResult: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionMetaData,
704
- paymentSessionData: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData,
749
+ sessionResult: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.paymentSessionMetaData,
750
+ paymentSessionData: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.sessionData,
705
751
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
706
- renderDisplayType: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.renderDisplayType,
707
- appearance: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.appearance,
708
- notRedirectAfterComplete: ((_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.notRedirectAfterComplete) === true,
752
+ renderDisplayType: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.renderDisplayType,
753
+ appearance: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.appearance,
754
+ notRedirectAfterComplete: ((_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.notRedirectAfterComplete) === true,
709
755
  envInfo: {
710
756
  screenHeight: screen.height,
711
757
  screenWidth: screen.width
@@ -1 +1,6 @@
1
- export {};
1
+ export declare const insertStyleSheet: () => void;
2
+ export declare const createModal: ({ device, url }: {
3
+ device: any;
4
+ url: any;
5
+ }) => HTMLIFrameElement;
6
+ export declare const destroyModal: () => void;
@@ -1,33 +1,45 @@
1
1
  import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant";
2
2
 
3
3
  // CSS样式字符串
4
- var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n width: 500px;\n height: 300px;\n background-color: #fff;\n border-radius: 5px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n");
4
+ var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n");
5
5
 
6
6
  // 创建和插入样式表
7
- var insertStyleSheet = function insertStyleSheet() {
7
+ export var insertStyleSheet = function insertStyleSheet() {
8
8
  var style = document.createElement('style');
9
9
  style.innerHTML = modalStyles;
10
10
  document.head.appendChild(style);
11
11
  };
12
12
 
13
13
  // 插入弹窗
14
- var createModal = function createModal() {
14
+ export var createModal = function createModal(_ref) {
15
+ var device = _ref.device,
16
+ url = _ref.url;
15
17
  var overlay = document.createElement('div');
16
18
  overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
17
19
  var modal = document.createElement('div');
18
20
  modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
21
+ if (device === 'desktop') {
22
+ modal.style.width = '600px';
23
+ modal.style.height = '464px';
24
+ modal.style.borderRadius = '12px';
25
+ } else {
26
+ modal.style.width = 'calc(100% - 16px)';
27
+ modal.style.height = '80%';
28
+ modal.style.borderRadius = '8px';
29
+ }
19
30
  var iframe = document.createElement('iframe');
20
- iframe.src = 'your-url'; // 替换为实际的 URL 地址
31
+ iframe.src = url; // 替换为实际的 URL 地址
21
32
  iframe.style.border = 'none';
22
33
  iframe.style.width = '100%';
23
34
  iframe.style.height = '100%';
24
35
  modal.appendChild(iframe);
25
36
  document.body.appendChild(overlay);
26
37
  document.body.appendChild(modal);
38
+ return iframe;
27
39
  };
28
40
 
29
41
  // 销毁弹窗
30
- var destroyModal = function destroyModal() {
42
+ export var destroyModal = function destroyModal() {
31
43
  var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
32
44
  var modal = document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal"));
33
45
  overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
@@ -38,7 +50,4 @@ var destroyModal = function destroyModal() {
38
50
  overlay.parentNode.removeChild(overlay);
39
51
  modal.parentNode.removeChild(modal);
40
52
  }, ANIMATION_TIME);
41
- };
42
-
43
- // 在插入弹窗之前先插入样式表
44
- insertStyleSheet();
53
+ };
@@ -256,6 +256,7 @@ export interface CashierSdkActionQueryRequest {
256
256
  paymentSessionData: string;
257
257
  paymentSessionConfig?: IpaymentSessionConfig;
258
258
  paymentMethodType?: string;
259
+ notRedirectAfterComplete?: boolean;
259
260
  extParams?: any;
260
261
  }
261
262
  export interface CashierSdkActionQueryResult {
@@ -285,6 +286,13 @@ export declare enum eventCodeEnum {
285
286
  SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
286
287
  SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
287
288
  }
289
+ export interface ThreedData {
290
+ data: any;
291
+ method: string;
292
+ targetUrl: string;
293
+ pti?: number;
294
+ pt?: number;
295
+ }
288
296
  declare global {
289
297
  interface Window {
290
298
  [key: string]: any;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@alipay/ams-checkout","version":"0.0.1697942541-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":{"@alipay/jshield-apdid":"^2.0.3","@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.1697942541-dev.2","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":{"@alipay/jshield-apdid":"^2.0.3","@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"}}