@blocklet/launcher-workflow 2.4.9 → 2.5.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.
@@ -32,19 +32,19 @@ export default function Allocate({
32
32
  // 基础步骤时间
33
33
  const steps = [{
34
34
  message: t('launch.waiting.starting'),
35
- time: 1
35
+ time: 2
36
36
  }, {
37
37
  message: t('launch.waiting.securing'),
38
- time: 1
38
+ time: 2
39
39
  }, {
40
40
  message: t('launch.waiting.prepare'),
41
- time: 1
41
+ time: 5
42
42
  }, {
43
43
  message: t('launch.waiting.waiting'),
44
- time: 1
44
+ time: 10.5
45
45
  }, {
46
46
  message: t('launch.waiting.done'),
47
- time: 1
47
+ time: 0.5
48
48
  }];
49
49
 
50
50
  // 计算总时间
@@ -106,13 +106,11 @@ export default function Allocate({
106
106
  } else if (launchSession.status >= LAUNCH_STATUS.allocated) {
107
107
  navigate(`/install/${sessionId}${window.location.search || ''}`);
108
108
  } else {
109
- await Promise.all([api.post('/serverless/allocate', {
109
+ await api.post('/serverless/allocate', {
110
110
  launchId: sessionId
111
- }), new Promise(resolve => {
112
- timersRef.current.raceTimer = setTimeout(() => {
113
- resolve();
114
- }, estimatedTime * 1000);
115
- })]);
111
+ }, {
112
+ timeout: (estimatedTime + 30) * 1000
113
+ });
116
114
  setState({
117
115
  allocating: false,
118
116
  allocated: true
@@ -1,6 +1,7 @@
1
1
  import { Box } from '@mui/material';
2
2
  import PropTypes from 'prop-types';
3
- import React from 'react';
3
+ import React, { useEffect } from 'react';
4
+ import { useSearchParams } from 'react-router-dom';
4
5
  import Spinner from '@mui/material/CircularProgress';
5
6
 
6
7
  /**
@@ -13,6 +14,17 @@ export default function BaseServerlessLayout({
13
14
  children,
14
15
  isLoading = false
15
16
  }) {
17
+ const [searchParams, setSearchParams] = useSearchParams();
18
+
19
+ // 删除 URL 中的 sessionId 参数
20
+ useEffect(() => {
21
+ if (searchParams.has('sessionId')) {
22
+ searchParams.delete('sessionId');
23
+ setSearchParams(searchParams, {
24
+ replace: true
25
+ });
26
+ }
27
+ }, [searchParams, setSearchParams]);
16
28
  return /*#__PURE__*/_jsx(Box, {
17
29
  sx: {
18
30
  display: 'flex',
@@ -59,10 +59,14 @@ function LoadingDisplayLayout({
59
59
  messageLoop: false,
60
60
  size: 200
61
61
  })
62
+ }), /*#__PURE__*/_jsx(ActionCardBox, {
63
+ tipFlag: tipFlag || currentAction,
64
+ children: currentAction
62
65
  }), /*#__PURE__*/_jsxs(Box, {
63
66
  sx: {
64
67
  position: 'relative',
65
- width: '100%'
68
+ width: '100%',
69
+ mt: 2
66
70
  },
67
71
  children: [/*#__PURE__*/_jsx(Box, {
68
72
  sx: {
@@ -93,9 +97,6 @@ function LoadingDisplayLayout({
93
97
  children: elapsedTime
94
98
  })]
95
99
  })]
96
- }), /*#__PURE__*/_jsx(ActionCardBox, {
97
- tipFlag: tipFlag || currentAction,
98
- children: currentAction
99
100
  }), /*#__PURE__*/_jsx(ProductIntroCarousel, {
100
101
  tips: tips
101
102
  }, locale), /*#__PURE__*/_jsx(ErrorDisplay, {
@@ -114,13 +114,11 @@ export default function StartApp({
114
114
  return null;
115
115
  }
116
116
  };
117
- const getUrls = useCallback(async blocklet => {
117
+ const getUrls = useCallback(async (blocklet, launch) => {
118
+ const launchSession = launch || state.launchSession;
118
119
  let {
119
120
  urls
120
121
  } = state;
121
- const {
122
- launchSession
123
- } = state;
124
122
  if (urls.length === 0) {
125
123
  urls = getBlockletUrls({
126
124
  blocklet: blocklet || launchSession?.blocklet || {}
@@ -279,7 +277,7 @@ export default function StartApp({
279
277
  blockletStatus,
280
278
  metadata
281
279
  } = launchSession;
282
- const urls = await getUrls(blocklet);
280
+ const urls = await getUrls(blocklet, launchSession);
283
281
  launchSession.urls = urls;
284
282
  [launchSession.appUrl] = urls;
285
283
  setState({
@@ -46,19 +46,19 @@ function Allocate(_ref) {
46
46
  // 基础步骤时间
47
47
  const steps = [{
48
48
  message: t('launch.waiting.starting'),
49
- time: 1
49
+ time: 2
50
50
  }, {
51
51
  message: t('launch.waiting.securing'),
52
- time: 1
52
+ time: 2
53
53
  }, {
54
54
  message: t('launch.waiting.prepare'),
55
- time: 1
55
+ time: 5
56
56
  }, {
57
57
  message: t('launch.waiting.waiting'),
58
- time: 1
58
+ time: 10.5
59
59
  }, {
60
60
  message: t('launch.waiting.done'),
61
- time: 1
61
+ time: 0.5
62
62
  }];
63
63
 
64
64
  // 计算总时间
@@ -122,13 +122,11 @@ function Allocate(_ref) {
122
122
  } else if (launchSession.status >= _constant.LAUNCH_STATUS.allocated) {
123
123
  navigate("/install/".concat(sessionId).concat(window.location.search || ''));
124
124
  } else {
125
- await Promise.all([api.post('/serverless/allocate', {
125
+ await api.post('/serverless/allocate', {
126
126
  launchId: sessionId
127
- }), new Promise(resolve => {
128
- timersRef.current.raceTimer = setTimeout(() => {
129
- resolve();
130
- }, estimatedTime * 1000);
131
- })]);
127
+ }, {
128
+ timeout: (estimatedTime + 30) * 1000
129
+ });
132
130
  setState({
133
131
  allocating: false,
134
132
  allocated: true
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = BaseServerlessLayout;
7
7
  var _material = require("@mui/material");
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _react = _interopRequireDefault(require("react"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactRouterDom = require("react-router-dom");
10
11
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
15
  /**
14
16
  * 无服务器启动流程的基础布局组件
@@ -19,6 +21,17 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
19
21
  children,
20
22
  isLoading = false
21
23
  } = _ref;
24
+ const [searchParams, setSearchParams] = (0, _reactRouterDom.useSearchParams)();
25
+
26
+ // 删除 URL 中的 sessionId 参数
27
+ (0, _react.useEffect)(() => {
28
+ if (searchParams.has('sessionId')) {
29
+ searchParams.delete('sessionId');
30
+ setSearchParams(searchParams, {
31
+ replace: true
32
+ });
33
+ }
34
+ }, [searchParams, setSearchParams]);
22
35
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
23
36
  sx: {
24
37
  display: 'flex',
@@ -68,10 +68,14 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
68
68
  messageLoop: false,
69
69
  size: 200
70
70
  })
71
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commonComponents.ActionCardBox, {
72
+ tipFlag: tipFlag || currentAction,
73
+ children: currentAction
71
74
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
72
75
  sx: {
73
76
  position: 'relative',
74
- width: '100%'
77
+ width: '100%',
78
+ mt: 2
75
79
  },
76
80
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
77
81
  sx: {
@@ -102,9 +106,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
102
106
  children: elapsedTime
103
107
  })]
104
108
  })]
105
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commonComponents.ActionCardBox, {
106
- tipFlag: tipFlag || currentAction,
107
- children: currentAction
108
109
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commonComponents.ProductIntroCarousel, {
109
110
  tips: tips
110
111
  }, locale), /*#__PURE__*/(0, _jsxRuntime.jsx)(_commonComponents.ErrorDisplay, {
@@ -131,13 +131,11 @@ function StartApp(_ref) {
131
131
  return null;
132
132
  }
133
133
  };
134
- const getUrls = (0, _react.useCallback)(async blocklet => {
134
+ const getUrls = (0, _react.useCallback)(async (blocklet, launch) => {
135
+ const launchSession = launch || state.launchSession;
135
136
  let {
136
137
  urls
137
138
  } = state;
138
- const {
139
- launchSession
140
- } = state;
141
139
  if (urls.length === 0) {
142
140
  var _launchSession$appInf;
143
141
  urls = (0, _util.getBlockletUrls)({
@@ -293,7 +291,7 @@ function StartApp(_ref) {
293
291
  blockletStatus,
294
292
  metadata
295
293
  } = launchSession;
296
- const urls = await getUrls(blocklet);
294
+ const urls = await getUrls(blocklet, launchSession);
297
295
  launchSession.urls = urls;
298
296
  [launchSession.appUrl] = urls;
299
297
  setState({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "2.4.9",
3
+ "version": "2.5.0",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -49,8 +49,8 @@
49
49
  "@arcblock/react-hooks": "^3.0.27",
50
50
  "@arcblock/ux": "^3.0.27",
51
51
  "@blocklet/launcher-layout": "^3.0.27",
52
- "@blocklet/launcher-util": "2.4.9",
53
- "@blocklet/launcher-ux": "2.4.9",
52
+ "@blocklet/launcher-util": "2.5.0",
53
+ "@blocklet/launcher-ux": "2.5.0",
54
54
  "@blocklet/payment": "^1.14.8",
55
55
  "@blocklet/payment-react": "^1.19.5",
56
56
  "@emotion/react": "^11.14.0",
@@ -109,5 +109,5 @@
109
109
  "require": "./lib/locales/index.js"
110
110
  }
111
111
  },
112
- "gitHead": "c96a73602a1dc1742293261a48f60858ab2b3b38"
112
+ "gitHead": "26f2003250845078af921c3125ccd67f3d85137f"
113
113
  }