@blocklet/launcher-workflow 2.3.80 → 2.3.81

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.
@@ -31,7 +31,7 @@ export default function InProgressSession() {
31
31
  data
32
32
  } = await api.get(joinURL(routerPrefix, '/launches/in-progress'));
33
33
  if (data.launch) {
34
- if (localStorage.getItem(IGNORE_LAUNCH_SESSION_KEY) === data.launch._id) {
34
+ if (localStorage.getItem(IGNORE_LAUNCH_SESSION_KEY) === data.launch.id) {
35
35
  return null;
36
36
  }
37
37
  setOpen(true);
@@ -47,7 +47,7 @@ export default function InProgressSession() {
47
47
  }
48
48
  const handleClose = () => {
49
49
  setOpen(false);
50
- localStorage.setItem(IGNORE_LAUNCH_SESSION_KEY, state.value._id);
50
+ localStorage.setItem(IGNORE_LAUNCH_SESSION_KEY, state.value.id);
51
51
  };
52
52
  let continueBaseURL = '';
53
53
  try {
@@ -2,6 +2,7 @@ import AnimationWaiter from '@arcblock/ux/lib/AnimationWaiter';
2
2
  import Button from '@arcblock/ux/lib/Button';
3
3
  import Toast from '@arcblock/ux/lib/Toast';
4
4
  import { INSTANCE_STATUS } from '@blocklet/launcher-util/es/constant';
5
+ import { LAUNCH_STATUS } from '@blocklet/launcher-util/lib/constant';
5
6
  import styled from '@emotion/styled';
6
7
  import Spinner from '@mui/material/CircularProgress';
7
8
  import { useSetState } from 'ahooks';
@@ -58,7 +59,7 @@ export default function LaunchDedicated({
58
59
  const handleInstance = instance => {
59
60
  if (instance.status >= INSTANCE_STATUS.running) {
60
61
  const url = getLaunchBlockletUrl({
61
- serverUrl: instance.adminURL,
62
+ serverUrl: instance.appInfo?.adminURL || instance.appUrl,
62
63
  blockletMetaUrl,
63
64
  locale,
64
65
  chainHost: window.blocklet?.CHAIN_HOST,
@@ -84,6 +85,15 @@ export default function LaunchDedicated({
84
85
  setLaunchState({
85
86
  status: STATUS.launching
86
87
  });
88
+ const {
89
+ data: {
90
+ launch: launchSession
91
+ }
92
+ } = await api.get(`/launches/${sessionId}`);
93
+ if (launchSession.status >= LAUNCH_STATUS.installed) {
94
+ handleInstance(launchSession.instance);
95
+ return;
96
+ }
87
97
  const {
88
98
  data: {
89
99
  instance
@@ -96,7 +106,7 @@ export default function LaunchDedicated({
96
106
  }
97
107
  });
98
108
  setLaunchState({
99
- instanceId: instance._id
109
+ instanceId: instance.id
100
110
  });
101
111
  handleInstance(instance);
102
112
  } catch (err) {
@@ -107,6 +117,9 @@ export default function LaunchDedicated({
107
117
  } else {
108
118
  Toast.error(errDesc);
109
119
  }
120
+ setLaunchState({
121
+ status: STATUS.error
122
+ });
110
123
  }
111
124
  };
112
125
  const getInstanceStatus = async () => {
@@ -235,6 +248,7 @@ const WaiterContainer = styled.div`
235
248
  const Content = styled.div`
236
249
  margin: auto;
237
250
  height: 100%;
251
+ overflow: hidden;
238
252
 
239
253
  .link {
240
254
  color: ${props => props.theme.palette.primary.main};
@@ -32,11 +32,11 @@ export default function LaunchServerless({
32
32
  });
33
33
  setTimeout(() => {
34
34
  window.location = getLaunchBlockletUrl({
35
- serverUrl: instance.adminURL,
35
+ serverUrl: instance.serverUrl,
36
36
  blockletMetaUrl: searchParams.get('blocklet_meta_url'),
37
37
  locale,
38
38
  launchType: 'serverless',
39
- nftId: instance.nftId,
39
+ nftDid: instance.nftDid,
40
40
  sessionId,
41
41
  chainHost: window.blocklet?.CHAIN_HOST,
42
42
  from: searchParams.get('from')
package/es/paid.js CHANGED
@@ -38,7 +38,7 @@ export default function PurchaseSuccess() {
38
38
  if (data?.status >= LAUNCH_STATUS.nftMinted) {
39
39
  params.set('launchType', data.type);
40
40
  navigate({
41
- pathname: joinURL(routerPrefix, `/launch/${data._id}`),
41
+ pathname: joinURL(routerPrefix, `/launch/${data.id}`),
42
42
  search: params.toString()
43
43
  });
44
44
  }
package/es/prepare.js CHANGED
@@ -145,18 +145,18 @@ function Content({
145
145
  }
146
146
  }, [productTypes, defaultProductTypeName, params, setParams, setState]);
147
147
  const getPurchaseNewLink = useCallback(() => {
148
- window.location = launchState?.value?.launch?.app?.appURL;
148
+ window.location = launchState?.value?.launch?.app?.appUrl;
149
149
  const urlObj = new URL(window.location.href);
150
150
  urlObj.searchParams.delete('sessionId');
151
151
  return urlObj.href;
152
- }, [launchState?.value?.launch?.app?.appURL]);
152
+ }, [launchState?.value?.launch?.app?.appUrl]);
153
153
  useEffect(() => {
154
154
  const tmpLaunch = launchState.value?.launch;
155
155
  if (!tmpLaunch) {
156
156
  return;
157
157
  }
158
- if (tmpLaunch._id !== params.get('sessionId')) {
159
- params.set('sessionId', tmpLaunch._id);
158
+ if (tmpLaunch.id !== params.get('sessionId')) {
159
+ params.set('sessionId', tmpLaunch.id);
160
160
  setParams(params, {
161
161
  replace: true
162
162
  });
@@ -172,7 +172,7 @@ function Content({
172
172
  return t('common.serviceError');
173
173
  }
174
174
  const handlePaid = () => {
175
- navigate(`/paid?&sessionId=${launch._id}&blocklet_meta_url=${launch.blockletMetaUrl}&from=${from}`);
175
+ navigate(`/paid?&sessionId=${launch.id}&blocklet_meta_url=${launch.blockletMetaUrl}&from=${from}`);
176
176
  };
177
177
  const handleChangeProductType = (_, typeName) => {
178
178
  if (!typeName) {
@@ -215,7 +215,7 @@ function Content({
215
215
  window.location = getPurchaseNewLink();
216
216
  },
217
217
  onConfirm: () => {
218
- window.location = getBlockletAdminURL(launch?.app?.appURL);
218
+ window.location = getBlockletAdminURL(launch?.app?.appUrl);
219
219
  }
220
220
  });
221
221
  }
@@ -338,7 +338,7 @@ function Content({
338
338
  id: window.blocklet?.preferences?.dedicatedPricingTableId,
339
339
  mode: "inline",
340
340
  extraParams: {
341
- 'metadata.session_id': launch._id,
341
+ 'metadata.session_id': launch.id,
342
342
  'subscription_data.days_until_due': 0,
343
343
  'subscription_data.days_until_cancel': window.blocklet?.preferences?.daysUntilCancel || 30
344
344
  },
package/es/util.js CHANGED
@@ -15,7 +15,7 @@ export const getLaunchBlockletUrl = ({
15
15
  blockletMetaUrl,
16
16
  locale,
17
17
  launchType,
18
- nftId,
18
+ nftDid,
19
19
  sessionId,
20
20
  chainHost,
21
21
  from
@@ -34,8 +34,8 @@ export const getLaunchBlockletUrl = ({
34
34
  if (locale) {
35
35
  result += `&locale=${locale}`;
36
36
  }
37
- if (nftId) {
38
- result += `&nftId=${nftId}`;
37
+ if (nftDid) {
38
+ result += `&nftId=${nftDid}`;
39
39
  }
40
40
  if (sessionId) {
41
41
  result += `&launcherSessionId=${sessionId}`;
@@ -38,7 +38,7 @@ function InProgressSession() {
38
38
  data
39
39
  } = await api.get((0, _urlJoin.default)(routerPrefix, '/launches/in-progress'));
40
40
  if (data.launch) {
41
- if (localStorage.getItem(IGNORE_LAUNCH_SESSION_KEY) === data.launch._id) {
41
+ if (localStorage.getItem(IGNORE_LAUNCH_SESSION_KEY) === data.launch.id) {
42
42
  return null;
43
43
  }
44
44
  setOpen(true);
@@ -54,7 +54,7 @@ function InProgressSession() {
54
54
  }
55
55
  const handleClose = () => {
56
56
  setOpen(false);
57
- localStorage.setItem(IGNORE_LAUNCH_SESSION_KEY, state.value._id);
57
+ localStorage.setItem(IGNORE_LAUNCH_SESSION_KEY, state.value.id);
58
58
  };
59
59
  let continueBaseURL = '';
60
60
  try {
@@ -8,6 +8,7 @@ var _AnimationWaiter = _interopRequireDefault(require("@arcblock/ux/lib/Animatio
8
8
  var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
9
9
  var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
10
10
  var _constant = require("@blocklet/launcher-util/es/constant");
11
+ var _constant2 = require("@blocklet/launcher-util/lib/constant");
11
12
  var _styled = _interopRequireDefault(require("@emotion/styled"));
12
13
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
13
14
  var _ahooks = require("ahooks");
@@ -67,9 +68,9 @@ function LaunchDedicated(_ref) {
67
68
  }
68
69
  const handleInstance = instance => {
69
70
  if (instance.status >= _constant.INSTANCE_STATUS.running) {
70
- var _window$blocklet;
71
+ var _instance$appInfo, _window$blocklet;
71
72
  const url = (0, _util.getLaunchBlockletUrl)({
72
- serverUrl: instance.adminURL,
73
+ serverUrl: ((_instance$appInfo = instance.appInfo) === null || _instance$appInfo === void 0 ? void 0 : _instance$appInfo.adminURL) || instance.appUrl,
73
74
  blockletMetaUrl,
74
75
  locale,
75
76
  chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST,
@@ -95,6 +96,15 @@ function LaunchDedicated(_ref) {
95
96
  setLaunchState({
96
97
  status: STATUS.launching
97
98
  });
99
+ const {
100
+ data: {
101
+ launch: launchSession
102
+ }
103
+ } = await api.get("/launches/".concat(sessionId));
104
+ if (launchSession.status >= _constant2.LAUNCH_STATUS.installed) {
105
+ handleInstance(launchSession.instance);
106
+ return;
107
+ }
98
108
  const {
99
109
  data: {
100
110
  instance
@@ -107,7 +117,7 @@ function LaunchDedicated(_ref) {
107
117
  }
108
118
  });
109
119
  setLaunchState({
110
- instanceId: instance._id
120
+ instanceId: instance.id
111
121
  });
112
122
  handleInstance(instance);
113
123
  } catch (err) {
@@ -118,6 +128,9 @@ function LaunchDedicated(_ref) {
118
128
  } else {
119
129
  _Toast.default.error(errDesc);
120
130
  }
131
+ setLaunchState({
132
+ status: STATUS.error
133
+ });
121
134
  }
122
135
  };
123
136
  const getInstanceStatus = async () => {
@@ -235,7 +248,7 @@ function LaunchDedicated(_ref) {
235
248
  }
236
249
  const LinkEle = _styled.default.a(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 36px;\n color: ", ";\n"])), props => props.theme.palette.primary.main);
237
250
  const WaiterContainer = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: #1dc1c7;\n"])));
238
- const Content = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: auto;\n height: 100%;\n\n .link {\n color: ", ";\n }\n\n .link:hover {\n text-decoration: underline !important;\n }\n\n .status {\n color: ", ";\n display: flex;\n flex-direction: column;\n align-items: center;\n\n .status-spinner {\n color: inherit !important;\n }\n\n .status-text {\n display: inline-block;\n padding: 0 20px;\n max-width: 420px;\n margin-top: 24px;\n text-align: center;\n }\n }\n\n .button {\n min-width: 150px;\n margin-bottom: 100px;\n }\n .center {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n }\n .launch-page-header {\n transition: all ease 0.3s;\n }\n"])), props => props.theme.palette.primary.main, props => props.theme.palette.primary.main);
251
+ const Content = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: auto;\n height: 100%;\n overflow: hidden;\n\n .link {\n color: ", ";\n }\n\n .link:hover {\n text-decoration: underline !important;\n }\n\n .status {\n color: ", ";\n display: flex;\n flex-direction: column;\n align-items: center;\n\n .status-spinner {\n color: inherit !important;\n }\n\n .status-text {\n display: inline-block;\n padding: 0 20px;\n max-width: 420px;\n margin-top: 24px;\n text-align: center;\n }\n }\n\n .button {\n min-width: 150px;\n margin-bottom: 100px;\n }\n .center {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n }\n .launch-page-header {\n transition: all ease 0.3s;\n }\n"])), props => props.theme.palette.primary.main, props => props.theme.palette.primary.main);
239
252
  LaunchDedicated.propTypes = {
240
253
  sessionId: _propTypes.default.string.isRequired,
241
254
  type: _propTypes.default.oneOf(['launch', 'start'])
@@ -43,11 +43,11 @@ function LaunchServerless(_ref) {
43
43
  setTimeout(() => {
44
44
  var _window$blocklet;
45
45
  window.location = (0, _util.getLaunchBlockletUrl)({
46
- serverUrl: instance.adminURL,
46
+ serverUrl: instance.serverUrl,
47
47
  blockletMetaUrl: searchParams.get('blocklet_meta_url'),
48
48
  locale,
49
49
  launchType: 'serverless',
50
- nftId: instance.nftId,
50
+ nftDid: instance.nftDid,
51
51
  sessionId,
52
52
  chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST,
53
53
  from: searchParams.get('from')
package/lib/paid.js CHANGED
@@ -48,7 +48,7 @@ function PurchaseSuccess() {
48
48
  if ((data === null || data === void 0 ? void 0 : data.status) >= _constant.LAUNCH_STATUS.nftMinted) {
49
49
  params.set('launchType', data.type);
50
50
  navigate({
51
- pathname: (0, _urlJoin.default)(routerPrefix, "/launch/".concat(data._id)),
51
+ pathname: (0, _urlJoin.default)(routerPrefix, "/launch/".concat(data.id)),
52
52
  search: params.toString()
53
53
  });
54
54
  }
package/lib/prepare.js CHANGED
@@ -156,19 +156,19 @@ function Content(_ref) {
156
156
  }, [productTypes, defaultProductTypeName, params, setParams, setState]);
157
157
  const getPurchaseNewLink = (0, _react.useCallback)(() => {
158
158
  var _launchState$value2;
159
- window.location = launchState === null || launchState === void 0 || (_launchState$value2 = launchState.value) === null || _launchState$value2 === void 0 || (_launchState$value2 = _launchState$value2.launch) === null || _launchState$value2 === void 0 || (_launchState$value2 = _launchState$value2.app) === null || _launchState$value2 === void 0 ? void 0 : _launchState$value2.appURL;
159
+ window.location = launchState === null || launchState === void 0 || (_launchState$value2 = launchState.value) === null || _launchState$value2 === void 0 || (_launchState$value2 = _launchState$value2.launch) === null || _launchState$value2 === void 0 || (_launchState$value2 = _launchState$value2.app) === null || _launchState$value2 === void 0 ? void 0 : _launchState$value2.appUrl;
160
160
  const urlObj = new URL(window.location.href);
161
161
  urlObj.searchParams.delete('sessionId');
162
162
  return urlObj.href;
163
- }, [launchState === null || launchState === void 0 || (_launchState$value3 = launchState.value) === null || _launchState$value3 === void 0 || (_launchState$value3 = _launchState$value3.launch) === null || _launchState$value3 === void 0 || (_launchState$value3 = _launchState$value3.app) === null || _launchState$value3 === void 0 ? void 0 : _launchState$value3.appURL]);
163
+ }, [launchState === null || launchState === void 0 || (_launchState$value3 = launchState.value) === null || _launchState$value3 === void 0 || (_launchState$value3 = _launchState$value3.launch) === null || _launchState$value3 === void 0 || (_launchState$value3 = _launchState$value3.app) === null || _launchState$value3 === void 0 ? void 0 : _launchState$value3.appUrl]);
164
164
  (0, _react.useEffect)(() => {
165
165
  var _launchState$value4;
166
166
  const tmpLaunch = (_launchState$value4 = launchState.value) === null || _launchState$value4 === void 0 ? void 0 : _launchState$value4.launch;
167
167
  if (!tmpLaunch) {
168
168
  return;
169
169
  }
170
- if (tmpLaunch._id !== params.get('sessionId')) {
171
- params.set('sessionId', tmpLaunch._id);
170
+ if (tmpLaunch.id !== params.get('sessionId')) {
171
+ params.set('sessionId', tmpLaunch.id);
172
172
  setParams(params, {
173
173
  replace: true
174
174
  });
@@ -184,7 +184,7 @@ function Content(_ref) {
184
184
  return t('common.serviceError');
185
185
  }
186
186
  const handlePaid = () => {
187
- navigate("/paid?&sessionId=".concat(launch._id, "&blocklet_meta_url=").concat(launch.blockletMetaUrl, "&from=").concat(from));
187
+ navigate("/paid?&sessionId=".concat(launch.id, "&blocklet_meta_url=").concat(launch.blockletMetaUrl, "&from=").concat(from));
188
188
  };
189
189
  const handleChangeProductType = (_, typeName) => {
190
190
  if (!typeName) {
@@ -228,7 +228,7 @@ function Content(_ref) {
228
228
  },
229
229
  onConfirm: () => {
230
230
  var _launch$app;
231
- window.location = (0, _util.getBlockletAdminURL)(launch === null || launch === void 0 || (_launch$app = launch.app) === null || _launch$app === void 0 ? void 0 : _launch$app.appURL);
231
+ window.location = (0, _util.getBlockletAdminURL)(launch === null || launch === void 0 || (_launch$app = launch.app) === null || _launch$app === void 0 ? void 0 : _launch$app.appUrl);
232
232
  }
233
233
  });
234
234
  }
@@ -353,7 +353,7 @@ function Content(_ref) {
353
353
  id: (_window$blocklet4 = window.blocklet) === null || _window$blocklet4 === void 0 || (_window$blocklet4 = _window$blocklet4.preferences) === null || _window$blocklet4 === void 0 ? void 0 : _window$blocklet4.dedicatedPricingTableId,
354
354
  mode: "inline",
355
355
  extraParams: {
356
- 'metadata.session_id': launch._id,
356
+ 'metadata.session_id': launch.id,
357
357
  'subscription_data.days_until_due': 0,
358
358
  'subscription_data.days_until_cancel': ((_window$blocklet5 = window.blocklet) === null || _window$blocklet5 === void 0 || (_window$blocklet5 = _window$blocklet5.preferences) === null || _window$blocklet5 === void 0 ? void 0 : _window$blocklet5.daysUntilCancel) || 30
359
359
  },
package/lib/util.js CHANGED
@@ -25,7 +25,7 @@ const getLaunchBlockletUrl = _ref => {
25
25
  blockletMetaUrl,
26
26
  locale,
27
27
  launchType,
28
- nftId,
28
+ nftDid,
29
29
  sessionId,
30
30
  chainHost,
31
31
  from
@@ -44,8 +44,8 @@ const getLaunchBlockletUrl = _ref => {
44
44
  if (locale) {
45
45
  result += "&locale=".concat(locale);
46
46
  }
47
- if (nftId) {
48
- result += "&nftId=".concat(nftId);
47
+ if (nftDid) {
48
+ result += "&nftId=".concat(nftDid);
49
49
  }
50
50
  if (sessionId) {
51
51
  result += "&launcherSessionId=".concat(sessionId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "2.3.80",
3
+ "version": "2.3.81",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,8 +47,8 @@
47
47
  "@arcblock/react-hooks": "^2.10.81",
48
48
  "@arcblock/ux": "^2.10.81",
49
49
  "@blocklet/launcher-layout": "^2.10.81",
50
- "@blocklet/launcher-util": "2.3.80",
51
- "@blocklet/launcher-ux": "2.3.80",
50
+ "@blocklet/launcher-util": "2.3.81",
51
+ "@blocklet/launcher-ux": "2.3.81",
52
52
  "@blocklet/payment": "^1.14.8",
53
53
  "@blocklet/payment-react": "^1.16.10",
54
54
  "@emotion/react": "^11.13.5",
@@ -105,5 +105,5 @@
105
105
  "require": "./lib/locales/index.js"
106
106
  }
107
107
  },
108
- "gitHead": "b47a4f9834cbc3a0c6c18b622d107e8b9153faae"
108
+ "gitHead": "8ecafb12bc2f29364cd0488a7f3c5b6ccb4d212c"
109
109
  }