slice-machine-ui 2.17.3-beta.10 → 2.17.3-beta.11
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.
- package/out/404.html +1 -1
- package/out/_next/static/{Ahdv3H07Mjm1YmGHQ2jWC → Mn1b3xEWEJNa-mSgCSYLq}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/{248-a2a655660e3f09b0.js → 248-bdbfde18c5a04eae.js} +1 -1
- package/out/_next/static/chunks/{489-feb8133b2c5a7773.js → 489-6edb99e269996dd1.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-f232ce46126995c7.js → _app-76c43bdc0320687e.js} +3 -3
- package/out/_next/static/chunks/pages/{changelog-3663cafded70979e.js → changelog-21b960abba5abf71.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-dda121066bd037bc.js → changes-bdfa50eadb1e5a42.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-a7ead234825f32c0.js → labs-d79597003a1ff74e.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-29476d3554e484bb.js → [variation]-98f85d5fb8d5c704.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-742b0e644563ac91.js → slices-046e5e978ffc3a42.js} +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/src/apiClient.ts +1 -1
- package/src/features/auth/LogoutButton.tsx +37 -0
- package/src/features/environments/actions/getActiveEnvironment.ts +2 -8
- package/src/features/environments/useActiveEnvironment.ts +8 -1
- package/src/features/environments/useEnvironments.ts +8 -1
- package/src/legacy/components/LoginModal/index.tsx +11 -3
- package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx +3 -0
- /package/out/_next/static/{Ahdv3H07Mjm1YmGHQ2jWC → Mn1b3xEWEJNa-mSgCSYLq}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/303dad78be1eb854.css" as="style"/><link rel="stylesheet" href="/_next/static/css/303dad78be1eb854.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e0c07a2fe4908d81.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/303dad78be1eb854.css" as="style"/><link rel="stylesheet" href="/_next/static/css/303dad78be1eb854.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e0c07a2fe4908d81.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-76c43bdc0320687e.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/72585f70-28b4d7d5384b3703.js" defer=""></script><script src="/_next/static/chunks/157-54b8336d20b41933.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D/simulator-b127d948a17968d3.js" defer=""></script><script src="/_next/static/Mn1b3xEWEJNa-mSgCSYLq/_buildManifest.js" defer=""></script><script src="/_next/static/Mn1b3xEWEJNa-mSgCSYLq/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]/simulator","query":{},"buildId":"Mn1b3xEWEJNa-mSgCSYLq","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/303dad78be1eb854.css" as="style"/><link rel="stylesheet" href="/_next/static/css/303dad78be1eb854.css" data-n-g=""/><link rel="preload" href="/_next/static/css/cdee5b195444f185.css" as="style"/><link rel="stylesheet" href="/_next/static/css/cdee5b195444f185.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e0c07a2fe4908d81.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/303dad78be1eb854.css" as="style"/><link rel="stylesheet" href="/_next/static/css/303dad78be1eb854.css" data-n-g=""/><link rel="preload" href="/_next/static/css/cdee5b195444f185.css" as="style"/><link rel="stylesheet" href="/_next/static/css/cdee5b195444f185.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e0c07a2fe4908d81.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-76c43bdc0320687e.js" defer=""></script><script src="/_next/static/chunks/59b4e022-ef680789f7cc9b11.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/f36c6662-1f3a854183168b10.js" defer=""></script><script src="/_next/static/chunks/4c744e84-480e426e4b1cfef3.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-09fb3b997ad1eb70.js" defer=""></script><script src="/_next/static/chunks/397-e6c340070a3bcb41.js" defer=""></script><script src="/_next/static/chunks/183-4ea255b867ff171b.js" defer=""></script><script src="/_next/static/chunks/50-586dc7ab5e584e76.js" defer=""></script><script src="/_next/static/chunks/349-7118116b93278f73.js" defer=""></script><script src="/_next/static/chunks/34-8d9d9b2944824750.js" defer=""></script><script src="/_next/static/chunks/630-bb6e3db525588f16.js" defer=""></script><script src="/_next/static/chunks/658-8231c0b729e0124a.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D-98f85d5fb8d5c704.js" defer=""></script><script src="/_next/static/Mn1b3xEWEJNa-mSgCSYLq/_buildManifest.js" defer=""></script><script src="/_next/static/Mn1b3xEWEJNa-mSgCSYLq/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]","query":{},"buildId":"Mn1b3xEWEJNa-mSgCSYLq","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
package/out/slices.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/303dad78be1eb854.css" as="style"/><link rel="stylesheet" href="/_next/static/css/303dad78be1eb854.css" data-n-g=""/><link rel="preload" href="/_next/static/css/efa5152b7c0f35c0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/efa5152b7c0f35c0.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e0c07a2fe4908d81.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/303dad78be1eb854.css" as="style"/><link rel="stylesheet" href="/_next/static/css/303dad78be1eb854.css" data-n-g=""/><link rel="preload" href="/_next/static/css/efa5152b7c0f35c0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/efa5152b7c0f35c0.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e0c07a2fe4908d81.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-76c43bdc0320687e.js" defer=""></script><script src="/_next/static/chunks/59b4e022-ef680789f7cc9b11.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/397-e6c340070a3bcb41.js" defer=""></script><script src="/_next/static/chunks/50-586dc7ab5e584e76.js" defer=""></script><script src="/_next/static/chunks/34-8d9d9b2944824750.js" defer=""></script><script src="/_next/static/chunks/658-8231c0b729e0124a.js" defer=""></script><script src="/_next/static/chunks/907-445266211c48b1a5.js" defer=""></script><script src="/_next/static/chunks/pages/slices-046e5e978ffc3a42.js" defer=""></script><script src="/_next/static/Mn1b3xEWEJNa-mSgCSYLq/_buildManifest.js" defer=""></script><script src="/_next/static/Mn1b3xEWEJNa-mSgCSYLq/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices","query":{},"buildId":"Mn1b3xEWEJNa-mSgCSYLq","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slice-machine-ui",
|
|
3
|
-
"version": "2.17.3-beta.
|
|
3
|
+
"version": "2.17.3-beta.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A visual builder for your Slice Models with all the tools you need to generate data models and mock CMS content locally.",
|
|
6
6
|
"repository": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"start-slicemachine": "./bin/start-slicemachine.cjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@slicemachine/manager": "0.25.2-beta.
|
|
39
|
-
"start-slicemachine": "0.12.60-beta.
|
|
38
|
+
"@slicemachine/manager": "0.25.2-beta.15",
|
|
39
|
+
"start-slicemachine": "0.12.60-beta.15"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@emotion/react": "11.11.1",
|
package/src/apiClient.ts
CHANGED
|
@@ -163,7 +163,7 @@ export const pushChanges: SliceMachineManagerClient["prismicRepository"]["pushCh
|
|
|
163
163
|
|
|
164
164
|
/** Auth Routes * */
|
|
165
165
|
|
|
166
|
-
export const
|
|
166
|
+
export const clearAuth = async (): Promise<void> => {
|
|
167
167
|
return await managerClient.user.logout();
|
|
168
168
|
};
|
|
169
169
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IconButton, Tooltip } from "@prismicio/editor-ui";
|
|
2
|
+
import * as Sentry from "@sentry/nextjs";
|
|
3
|
+
import { toast } from "react-toastify";
|
|
4
|
+
|
|
5
|
+
import { clearAuth as managerLogout, getState } from "@/apiClient";
|
|
6
|
+
import { invalidateActiveEnvironmentData } from "@/features/environments/useActiveEnvironment";
|
|
7
|
+
import { invalidateEnvironmentsData } from "@/features/environments/useEnvironments";
|
|
8
|
+
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
9
|
+
|
|
10
|
+
export function LogoutButton() {
|
|
11
|
+
const { refreshState } = useSliceMachineActions();
|
|
12
|
+
|
|
13
|
+
async function onClick() {
|
|
14
|
+
await managerLogout();
|
|
15
|
+
|
|
16
|
+
const serverState = await getState();
|
|
17
|
+
refreshState(serverState);
|
|
18
|
+
|
|
19
|
+
Sentry.setUser({ id: serverState.env.shortId });
|
|
20
|
+
|
|
21
|
+
// refresh queries to update the UI
|
|
22
|
+
invalidateEnvironmentsData();
|
|
23
|
+
invalidateActiveEnvironmentData();
|
|
24
|
+
|
|
25
|
+
toast.success("Logged out");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Tooltip content="Log out" side="right">
|
|
30
|
+
<IconButton
|
|
31
|
+
icon="logout"
|
|
32
|
+
onClick={() => void onClick()}
|
|
33
|
+
hiddenLabel="Log out"
|
|
34
|
+
/>
|
|
35
|
+
</Tooltip>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -5,10 +5,6 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import { managerClient } from "@/managerClient";
|
|
7
7
|
|
|
8
|
-
type GetActiveEnvironmentArgs = {
|
|
9
|
-
retried?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
8
|
type GetActiveEnvironmentReturnType =
|
|
13
9
|
| {
|
|
14
10
|
activeEnvironment: Environment;
|
|
@@ -20,10 +16,8 @@ type GetActiveEnvironmentReturnType =
|
|
|
20
16
|
};
|
|
21
17
|
|
|
22
18
|
export async function getActiveEnvironment(
|
|
23
|
-
|
|
19
|
+
retried = false,
|
|
24
20
|
): Promise<GetActiveEnvironmentReturnType> {
|
|
25
|
-
const { retried = false } = args ?? {};
|
|
26
|
-
|
|
27
21
|
try {
|
|
28
22
|
const activeEnvironmentResult =
|
|
29
23
|
await managerClient.project.fetchActiveEnvironment();
|
|
@@ -41,7 +35,7 @@ export async function getActiveEnvironment(
|
|
|
41
35
|
await managerClient.project.updateEnvironment({ environment: undefined });
|
|
42
36
|
|
|
43
37
|
// Call recursively with isRetry=true to prevent infinite loop if it fails again and again.
|
|
44
|
-
return await getActiveEnvironment(
|
|
38
|
+
return await getActiveEnvironment(true);
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
return { error };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
invalidateFetcherData,
|
|
3
|
+
useRequest,
|
|
4
|
+
} from "@prismicio/editor-support/Suspense";
|
|
2
5
|
|
|
3
6
|
import { getActiveEnvironment } from "./actions/getActiveEnvironment";
|
|
4
7
|
|
|
8
|
+
export function invalidateActiveEnvironmentData() {
|
|
9
|
+
invalidateFetcherData(getActiveEnvironment);
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
export function useActiveEnvironment() {
|
|
6
13
|
return useRequest(getActiveEnvironment, []);
|
|
7
14
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
invalidateFetcherData,
|
|
3
|
+
useRequest,
|
|
4
|
+
} from "@prismicio/editor-support/Suspense";
|
|
2
5
|
|
|
3
6
|
import { getEnvironments } from "./actions/getEnvironments";
|
|
4
7
|
|
|
8
|
+
export function invalidateEnvironmentsData() {
|
|
9
|
+
invalidateFetcherData(getEnvironments);
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
export function useEnvironments() {
|
|
6
13
|
return useRequest(getEnvironments, []);
|
|
7
14
|
}
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
Text,
|
|
14
14
|
} from "theme-ui";
|
|
15
15
|
|
|
16
|
-
import { checkAuthStatus,
|
|
16
|
+
import { checkAuthStatus, clearAuth, getState } from "@/apiClient";
|
|
17
17
|
import { getActiveEnvironment } from "@/features/environments/actions/getActiveEnvironment";
|
|
18
|
+
import { invalidateActiveEnvironmentData } from "@/features/environments/useActiveEnvironment";
|
|
19
|
+
import { invalidateEnvironmentsData } from "@/features/environments/useEnvironments";
|
|
18
20
|
import { useAutoSync } from "@/features/sync/AutoSyncProvider";
|
|
19
21
|
import { getUnSyncedChanges } from "@/features/sync/getUnSyncChanges";
|
|
20
22
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
@@ -50,7 +52,7 @@ const LoginModal: React.FunctionComponent = () => {
|
|
|
50
52
|
}),
|
|
51
53
|
);
|
|
52
54
|
const { syncChanges } = useAutoSync();
|
|
53
|
-
const { closeModals, startLoadingLogin, stopLoadingLogin } =
|
|
55
|
+
const { closeModals, startLoadingLogin, stopLoadingLogin, refreshState } =
|
|
54
56
|
useSliceMachineActions();
|
|
55
57
|
|
|
56
58
|
const prismicBase = preferWroomBase(env.manifest.apiEndpoint);
|
|
@@ -64,7 +66,7 @@ const LoginModal: React.FunctionComponent = () => {
|
|
|
64
66
|
|
|
65
67
|
try {
|
|
66
68
|
startLoadingLogin();
|
|
67
|
-
await
|
|
69
|
+
await clearAuth();
|
|
68
70
|
window.open(loginRedirectUrl, "_blank");
|
|
69
71
|
await startPolling<CheckAuthStatusResponse, ValidAuthStatus>(
|
|
70
72
|
checkAuthStatus,
|
|
@@ -76,11 +78,17 @@ const LoginModal: React.FunctionComponent = () => {
|
|
|
76
78
|
60,
|
|
77
79
|
);
|
|
78
80
|
|
|
81
|
+
// refresh queries to update the UI
|
|
82
|
+
invalidateEnvironmentsData();
|
|
83
|
+
invalidateActiveEnvironmentData();
|
|
84
|
+
|
|
79
85
|
toast.success("Logged in");
|
|
80
86
|
stopLoadingLogin();
|
|
81
87
|
closeModals();
|
|
82
88
|
|
|
83
89
|
const serverState = await getState();
|
|
90
|
+
refreshState(serverState);
|
|
91
|
+
|
|
84
92
|
const slices = normalizeFrontendSlices(
|
|
85
93
|
serverState.libraries,
|
|
86
94
|
serverState.remoteSlices,
|
package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import type { Environment } from "@slicemachine/manager/client";
|
|
|
18
18
|
import { clsx } from "clsx";
|
|
19
19
|
import type { FC, ReactNode } from "react";
|
|
20
20
|
|
|
21
|
+
import { LogoutButton } from "@/features/auth/LogoutButton";
|
|
21
22
|
import { LoginIcon } from "@/icons/LoginIcon";
|
|
22
23
|
import { LogoIcon } from "@/icons/LogoIcon";
|
|
23
24
|
|
|
@@ -138,6 +139,8 @@ export const SideNavEnvironmentSelector: FC<SideNavEnvironmentSelectorProps> = (
|
|
|
138
139
|
}
|
|
139
140
|
/>
|
|
140
141
|
) : undefined}
|
|
142
|
+
|
|
143
|
+
{variant === "default" && <LogoutButton />}
|
|
141
144
|
</Box>
|
|
142
145
|
</>
|
|
143
146
|
)}
|
|
File without changes
|