@blocklet/launcher-workflow 2.5.5 → 2.5.6

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.
@@ -4,17 +4,19 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy';
4
4
  import DashboardIcon from '@mui/icons-material/Dashboard';
5
5
  import OpenInNewIcon from '@mui/icons-material/OpenInNew';
6
6
  import TaskAltIcon from '@mui/icons-material/TaskAlt';
7
- import { alpha, Box, Button, CircularProgress, Typography, useTheme } from '@mui/material';
7
+ import InfoIcon from '@mui/icons-material/Info';
8
+ import { alpha, Box, Button, CircularProgress, Typography, useTheme, Alert } from '@mui/material';
8
9
  import Chip from '@mui/material/Chip';
9
10
  import IconButton from '@mui/material/IconButton';
10
11
  import { useSetState } from 'ahooks';
11
12
  import PropTypes from 'prop-types';
12
13
  import React, { useEffect, useMemo } from 'react';
13
- import { joinURL } from 'ufo';
14
+ import { joinURL, withQuery } from 'ufo';
14
15
  import { useLocaleContext } from '../../../contexts/locale';
15
16
  import useRequest from '../../../contexts/request';
16
17
  import useSerialPolling from '../../../hooks/use-serial-polling';
17
18
  import { checkBlockletAccessible, checkUrlAccessible } from '../../../util';
19
+ import { useSessionContext } from '../../../contexts/session';
18
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
21
  export default function AppSuccessDisplay({
20
22
  accessibleUrl,
@@ -25,11 +27,15 @@ export default function AppSuccessDisplay({
25
27
  }) {
26
28
  const theme = useTheme();
27
29
  const {
28
- t
30
+ t,
31
+ locale
29
32
  } = useLocaleContext();
30
33
  const {
31
34
  api
32
35
  } = useRequest();
36
+ const {
37
+ session
38
+ } = useSessionContext();
33
39
  const [state, setState] = useSetState({
34
40
  accessibleUrls: [accessibleUrl],
35
41
  checkingBlockletStatus: true,
@@ -335,6 +341,39 @@ export default function AppSuccessDisplay({
335
341
  })]
336
342
  }, url))]
337
343
  })]
344
+ }), session.user?.email && /*#__PURE__*/_jsxs(Alert, {
345
+ icon: /*#__PURE__*/_jsx(InfoIcon, {
346
+ fontSize: "inherit"
347
+ }),
348
+ severity: "info",
349
+ sx: {
350
+ mb: 3
351
+ },
352
+ children: [/*#__PURE__*/_jsxs(Typography, {
353
+ variant: "body1",
354
+ sx: {
355
+ mb: 1,
356
+ textAlign: 'left'
357
+ },
358
+ children: [/*#__PURE__*/_jsx("strong", {
359
+ children: t('startApp.ownerAccount')
360
+ }), /*#__PURE__*/_jsx(Box, {
361
+ component: "span",
362
+ sx: {
363
+ color: 'primary.main',
364
+ fontWeight: '500',
365
+ backgroundColor: alpha(theme.palette.primary.main, 0.05),
366
+ px: 1,
367
+ py: 0.25,
368
+ borderRadius: 0.5
369
+ },
370
+ children: session.user.email
371
+ })]
372
+ }), /*#__PURE__*/_jsx(Typography, {
373
+ variant: "body2",
374
+ color: "text.secondary",
375
+ children: t('startApp.ownerAccountDescription')
376
+ })]
338
377
  }), /*#__PURE__*/_jsxs(Box, {
339
378
  display: "flex",
340
379
  flexDirection: "column",
@@ -359,7 +398,13 @@ export default function AppSuccessDisplay({
359
398
  minWidth: 220
360
399
  },
361
400
  color: "primary",
362
- onClick: () => window.open(joinURL(getBaseURL(), `/api/launches/${sessionId}/redirect/dashboard?appUrl=${appUrl}&appDid=${blockletInfo.appPid}&ownerDid=${blockletInfo.ownerDid}`), '_blank'),
401
+ onClick: () => window.open(withQuery(joinURL(getBaseURL(), `/api/launches/${sessionId}/redirect/dashboard`), {
402
+ appUrl,
403
+ appDid: blockletInfo.appPid,
404
+ ownerDid: blockletInfo.ownerDid,
405
+ locale,
406
+ theme: theme.palette.mode
407
+ }), '_blank'),
363
408
  startIcon: /*#__PURE__*/_jsx(DashboardIcon, {
364
409
  sx: {
365
410
  fontSize: 24,
@@ -381,7 +426,13 @@ export default function AppSuccessDisplay({
381
426
  color: theme.palette.text.secondary
382
427
  }
383
428
  },
384
- onClick: () => started && window.open(joinURL(getBaseURL(), `/api/launches/${sessionId}/redirect/app?appUrl=${appUrl}&appDid=${blockletInfo.appPid}&ownerDid=${blockletInfo.ownerDid}`), '_blank'),
429
+ onClick: () => started && window.open(withQuery(joinURL(getBaseURL(), `/api/launches/${sessionId}/redirect/app`), {
430
+ appUrl,
431
+ appDid: blockletInfo.appPid,
432
+ ownerDid: blockletInfo.ownerDid,
433
+ locale,
434
+ theme: theme.palette.mode
435
+ }), '_blank'),
385
436
  startIcon: started ? /*#__PURE__*/_jsx(OpenInNewIcon, {
386
437
  sx: {
387
438
  fontSize: 24,
package/es/locales/en.js CHANGED
@@ -127,7 +127,9 @@ export default {
127
127
  error: {
128
128
  expired: 'Blocklet has expired or terminated, please purchase a new one',
129
129
  noAppUrl: 'No accessible URL found, please contact the administrator'
130
- }
130
+ },
131
+ ownerAccount: 'Owner Account:',
132
+ ownerAccountDescription: 'This account will be used to log in and manage your Blocklet application.'
131
133
  },
132
134
  loading: {
133
135
  completed: 'completed',
package/es/locales/zh.js CHANGED
@@ -126,7 +126,9 @@ export default {
126
126
  error: {
127
127
  expired: 'Blocklet 已过期或已终止,请重新购买',
128
128
  noAppUrl: '没有发现 Blocklet 的访问地址,请联系管理员'
129
- }
129
+ },
130
+ ownerAccount: 'Owner 账户:',
131
+ ownerAccountDescription: '此账户将用于登录和管理您的 Blocklet 应用。'
130
132
  },
131
133
  loading: {
132
134
  completed: '完成',
@@ -10,6 +10,7 @@ var _ContentCopy = _interopRequireDefault(require("@mui/icons-material/ContentCo
10
10
  var _Dashboard = _interopRequireDefault(require("@mui/icons-material/Dashboard"));
11
11
  var _OpenInNew = _interopRequireDefault(require("@mui/icons-material/OpenInNew"));
12
12
  var _TaskAlt = _interopRequireDefault(require("@mui/icons-material/TaskAlt"));
13
+ var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
13
14
  var _material = require("@mui/material");
14
15
  var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
15
16
  var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
@@ -21,6 +22,7 @@ var _locale = require("../../../contexts/locale");
21
22
  var _request = _interopRequireDefault(require("../../../contexts/request"));
22
23
  var _useSerialPolling = _interopRequireDefault(require("../../../hooks/use-serial-polling"));
23
24
  var _util2 = require("../../../util");
25
+ var _session = require("../../../contexts/session");
24
26
  var _jsxRuntime = require("react/jsx-runtime");
25
27
  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); }
26
28
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -30,7 +32,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
30
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
31
33
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
34
  function AppSuccessDisplay(_ref) {
33
- var _launchSession$appInf, _launchSession$blockl, _launchSession$appInf2, _launchSession$metada, _state$blockletInfo;
35
+ var _launchSession$appInf, _launchSession$blockl, _launchSession$appInf2, _launchSession$metada, _state$blockletInfo, _session$user;
34
36
  let {
35
37
  accessibleUrl,
36
38
  sessionId,
@@ -40,11 +42,15 @@ function AppSuccessDisplay(_ref) {
40
42
  } = _ref;
41
43
  const theme = (0, _material.useTheme)();
42
44
  const {
43
- t
45
+ t,
46
+ locale
44
47
  } = (0, _locale.useLocaleContext)();
45
48
  const {
46
49
  api
47
50
  } = (0, _request.default)();
51
+ const {
52
+ session
53
+ } = (0, _session.useSessionContext)();
48
54
  const [state, setState] = (0, _ahooks.useSetState)({
49
55
  accessibleUrls: [accessibleUrl],
50
56
  checkingBlockletStatus: true,
@@ -346,6 +352,39 @@ function AppSuccessDisplay(_ref) {
346
352
  })]
347
353
  }, url))]
348
354
  })]
355
+ }), ((_session$user = session.user) === null || _session$user === void 0 ? void 0 : _session$user.email) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Alert, {
356
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Info.default, {
357
+ fontSize: "inherit"
358
+ }),
359
+ severity: "info",
360
+ sx: {
361
+ mb: 3
362
+ },
363
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
364
+ variant: "body1",
365
+ sx: {
366
+ mb: 1,
367
+ textAlign: 'left'
368
+ },
369
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
370
+ children: t('startApp.ownerAccount')
371
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
372
+ component: "span",
373
+ sx: {
374
+ color: 'primary.main',
375
+ fontWeight: '500',
376
+ backgroundColor: (0, _material.alpha)(theme.palette.primary.main, 0.05),
377
+ px: 1,
378
+ py: 0.25,
379
+ borderRadius: 0.5
380
+ },
381
+ children: session.user.email
382
+ })]
383
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
384
+ variant: "body2",
385
+ color: "text.secondary",
386
+ children: t('startApp.ownerAccountDescription')
387
+ })]
349
388
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
350
389
  display: "flex",
351
390
  flexDirection: "column",
@@ -370,7 +409,13 @@ function AppSuccessDisplay(_ref) {
370
409
  minWidth: 220
371
410
  },
372
411
  color: "primary",
373
- onClick: () => window.open((0, _ufo.joinURL)((0, _util.getBaseURL)(), "/api/launches/".concat(sessionId, "/redirect/dashboard?appUrl=").concat(appUrl, "&appDid=").concat(blockletInfo.appPid, "&ownerDid=").concat(blockletInfo.ownerDid)), '_blank'),
412
+ onClick: () => window.open((0, _ufo.withQuery)((0, _ufo.joinURL)((0, _util.getBaseURL)(), "/api/launches/".concat(sessionId, "/redirect/dashboard")), {
413
+ appUrl,
414
+ appDid: blockletInfo.appPid,
415
+ ownerDid: blockletInfo.ownerDid,
416
+ locale,
417
+ theme: theme.palette.mode
418
+ }), '_blank'),
374
419
  startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dashboard.default, {
375
420
  sx: {
376
421
  fontSize: 24,
@@ -392,7 +437,13 @@ function AppSuccessDisplay(_ref) {
392
437
  color: theme.palette.text.secondary
393
438
  }
394
439
  },
395
- onClick: () => started && window.open((0, _ufo.joinURL)((0, _util.getBaseURL)(), "/api/launches/".concat(sessionId, "/redirect/app?appUrl=").concat(appUrl, "&appDid=").concat(blockletInfo.appPid, "&ownerDid=").concat(blockletInfo.ownerDid)), '_blank'),
440
+ onClick: () => started && window.open((0, _ufo.withQuery)((0, _ufo.joinURL)((0, _util.getBaseURL)(), "/api/launches/".concat(sessionId, "/redirect/app")), {
441
+ appUrl,
442
+ appDid: blockletInfo.appPid,
443
+ ownerDid: blockletInfo.ownerDid,
444
+ locale,
445
+ theme: theme.palette.mode
446
+ }), '_blank'),
396
447
  startIcon: started ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_OpenInNew.default, {
397
448
  sx: {
398
449
  fontSize: 24,
package/lib/locales/en.js CHANGED
@@ -133,7 +133,9 @@ var _default = exports.default = {
133
133
  error: {
134
134
  expired: 'Blocklet has expired or terminated, please purchase a new one',
135
135
  noAppUrl: 'No accessible URL found, please contact the administrator'
136
- }
136
+ },
137
+ ownerAccount: 'Owner Account:',
138
+ ownerAccountDescription: 'This account will be used to log in and manage your Blocklet application.'
137
139
  },
138
140
  loading: {
139
141
  completed: 'completed',
package/lib/locales/zh.js CHANGED
@@ -132,7 +132,9 @@ var _default = exports.default = {
132
132
  error: {
133
133
  expired: 'Blocklet 已过期或已终止,请重新购买',
134
134
  noAppUrl: '没有发现 Blocklet 的访问地址,请联系管理员'
135
- }
135
+ },
136
+ ownerAccount: 'Owner 账户:',
137
+ ownerAccountDescription: '此账户将用于登录和管理您的 Blocklet 应用。'
136
138
  },
137
139
  loading: {
138
140
  completed: '完成',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "2.5.5",
3
+ "version": "2.5.6",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -43,16 +43,16 @@
43
43
  "dependencies": {
44
44
  "@abtnode/constant": "^1.16.46",
45
45
  "@abtnode/util": "^1.16.46",
46
- "@arcblock/did-connect": "^3.0.36",
47
- "@arcblock/icons": "^3.0.36",
48
- "@arcblock/license": "^3.0.36",
49
- "@arcblock/react-hooks": "^3.0.36",
50
- "@arcblock/ux": "^3.0.36",
51
- "@blocklet/launcher-layout": "^3.0.36",
52
- "@blocklet/launcher-util": "2.5.5",
53
- "@blocklet/launcher-ux": "2.5.5",
46
+ "@arcblock/did-connect": "^3.0.37",
47
+ "@arcblock/icons": "^3.0.37",
48
+ "@arcblock/license": "^3.0.37",
49
+ "@arcblock/react-hooks": "^3.0.37",
50
+ "@arcblock/ux": "^3.0.37",
51
+ "@blocklet/launcher-layout": "^3.0.37",
52
+ "@blocklet/launcher-util": "2.5.6",
53
+ "@blocklet/launcher-ux": "2.5.6",
54
54
  "@blocklet/payment": "^1.14.8",
55
- "@blocklet/payment-react": "^1.19.9",
55
+ "@blocklet/payment-react": "^1.19.10",
56
56
  "@emotion/react": "^11.14.0",
57
57
  "@emotion/styled": "^11.14.1",
58
58
  "@mui/icons-material": "^7.2.0",
@@ -109,5 +109,5 @@
109
109
  "require": "./lib/locales/index.js"
110
110
  }
111
111
  },
112
- "gitHead": "411bbc64f4c08af3aa8b29b125ebfc4430e5cc00"
112
+ "gitHead": "5026dbb0d285ba0818cce2c18a211f44a96327f5"
113
113
  }