slice-machine-ui 1.23.1-beta.2 → 1.23.1-beta.3
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/components/CustomTypeTable/changesPage.tsx +1 -0
- package/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx +11 -23
- package/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx +11 -23
- package/components/DeleteDocumentsDrawer/index.tsx +0 -1
- package/components/SliceMachineDrawer/index.tsx +4 -6
- package/out/404.html +1 -1
- package/out/_next/static/{8aiH3LjdI_Vj38RRmPnNx → c66ozmNEqPsp5qxNPQX7V}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/25-37d6fa7f064be04b.js +1 -0
- package/out/_next/static/chunks/{727-15cf3f2fea9a37e5.js → 727-2016e98f80ea6a62.js} +1 -1
- package/out/_next/static/chunks/{904-ccd8ca3368ce29fc.js → 904-4c4d0a2183ae9a27.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-46cdcb7304fa805f.js → _app-d528dd2b96dccb97.js} +2 -2
- package/out/_next/static/chunks/pages/{changelog-68d115a14f1423d7.js → changelog-afd18276fe018b24.js} +1 -1
- package/out/_next/static/chunks/pages/changes-898f58035cfafe03.js +1 -0
- package/out/_next/static/chunks/pages/{labs-526bb7d60a1b90f4.js → labs-ee206005948f8e87.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-73dd999915509965.js → [variation]-b2a9d773ce5d7739.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-7b09cb5130c63bb3.js → slices-e9c70c082ca3e3f9.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/pages/changes.tsx +67 -28
- package/src/features/changes/actions/pushChanges.ts +66 -0
- package/src/{modules/pushChangesSaga → features/changes/actions}/trackPushChangesSuccess.ts +16 -12
- package/src/modules/loading/types.ts +0 -1
- package/src/modules/modal/types.ts +0 -3
- package/src/modules/useSliceMachineActions.ts +3 -18
- package/src/modules/userContext/index.ts +6 -3
- package/src/redux/reducer.ts +0 -2
- package/src/redux/saga.ts +0 -2
- package/src/redux/type.ts +0 -2
- package/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx +0 -92
- package/lib/models/common/TransactionalPush.ts +0 -10
- package/out/_next/static/chunks/25-8fedd33ad9b6de5b.js +0 -1
- package/out/_next/static/chunks/pages/changes-6a24f50da1a00688.js +0 -1
- package/src/modules/pushChangesSaga/index.ts +0 -191
- package/test/src/modules/pushChangesSaga.test.ts +0 -261
- /package/out/_next/static/{8aiH3LjdI_Vj38RRmPnNx → c66ozmNEqPsp5qxNPQX7V}/_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/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/b22c0750c14cc089.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b22c0750c14cc089.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.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/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/b22c0750c14cc089.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b22c0750c14cc089.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-d528dd2b96dccb97.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js" defer=""></script><script src="/_next/static/chunks/4c744e84-e3161d754618373f.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js" defer=""></script><script src="/_next/static/chunks/183-4feb6bb3eddbc768.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/543-f8766685f7f451e2.js" defer=""></script><script src="/_next/static/chunks/696-b12edad30a3617e5.js" defer=""></script><script src="/_next/static/chunks/25-37d6fa7f064be04b.js" defer=""></script><script src="/_next/static/chunks/318-541db69860d31138.js" defer=""></script><script src="/_next/static/chunks/286-ed90373e9a469944.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D-b2a9d773ce5d7739.js" defer=""></script><script src="/_next/static/c66ozmNEqPsp5qxNPQX7V/_buildManifest.js" defer=""></script><script src="/_next/static/c66ozmNEqPsp5qxNPQX7V/_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":"c66ozmNEqPsp5qxNPQX7V","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/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/f8eb526e10bc2441.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f8eb526e10bc2441.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.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/200244e3e0463c39.css" as="style"/><link rel="stylesheet" href="/_next/static/css/200244e3e0463c39.css" data-n-g=""/><link rel="preload" href="/_next/static/css/f8eb526e10bc2441.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f8eb526e10bc2441.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-d528dd2b96dccb97.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/25-37d6fa7f064be04b.js" defer=""></script><script src="/_next/static/chunks/286-ed90373e9a469944.js" defer=""></script><script src="/_next/static/chunks/pages/slices-e9c70c082ca3e3f9.js" defer=""></script><script src="/_next/static/c66ozmNEqPsp5qxNPQX7V/_buildManifest.js" defer=""></script><script src="/_next/static/c66ozmNEqPsp5qxNPQX7V/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices","query":{},"buildId":"c66ozmNEqPsp5qxNPQX7V","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": "1.23.1-beta.
|
|
3
|
+
"version": "1.23.1-beta.3",
|
|
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": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@radix-ui/react-visually-hidden": "1.0.3",
|
|
39
|
-
"@slicemachine/manager": "0.17.8-beta.
|
|
40
|
-
"start-slicemachine": "0.12.14-beta.
|
|
39
|
+
"@slicemachine/manager": "0.17.8-beta.3",
|
|
40
|
+
"start-slicemachine": "0.12.14-beta.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@emotion/react": "11.11.1",
|
package/pages/changes.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Button } from "@prismicio/editor-ui";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useMemo, useState } from "react";
|
|
3
|
+
import { toast } from "react-toastify";
|
|
3
4
|
import Head from "next/head";
|
|
4
5
|
import { BaseStyles } from "theme-ui";
|
|
5
|
-
import { useSelector } from "react-redux";
|
|
6
|
-
import { SliceMachineStoreType } from "../src/redux/type";
|
|
7
6
|
import {
|
|
8
7
|
AppLayout,
|
|
9
8
|
AppLayoutActions,
|
|
@@ -18,19 +17,19 @@ import { NoChangesBlankSlate } from "@src/features/changes/BlankSlates";
|
|
|
18
17
|
|
|
19
18
|
import { AuthStatus } from "@src/modules/userContext/types";
|
|
20
19
|
import { unSyncStatuses, useUnSyncChanges } from "@src/hooks/useUnSyncChanges";
|
|
21
|
-
import { isLoading } from "@src/modules/loading";
|
|
22
|
-
import { LoadingKeysEnum } from "@src/modules/loading/types";
|
|
23
20
|
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
24
21
|
import {
|
|
25
22
|
SoftDeleteDocumentsDrawer,
|
|
26
23
|
HardDeleteDocumentsDrawer,
|
|
27
|
-
ReferencesErrorDrawer,
|
|
28
24
|
} from "@components/DeleteDocumentsDrawer";
|
|
29
25
|
import { hasLocal } from "@lib/models/common/ModelData";
|
|
30
26
|
import {
|
|
31
27
|
ChangedCustomType,
|
|
32
28
|
ChangedSlice,
|
|
33
29
|
} from "@lib/models/common/ModelStatus";
|
|
30
|
+
import { PushChangesLimit } from "@slicemachine/manager";
|
|
31
|
+
import { pushChanges } from "@src/features/changes/actions/pushChanges";
|
|
32
|
+
import { getState } from "@src/apiClient";
|
|
34
33
|
|
|
35
34
|
const Changes: React.FunctionComponent = () => {
|
|
36
35
|
const {
|
|
@@ -59,28 +58,57 @@ const Changes: React.FunctionComponent = () => {
|
|
|
59
58
|
return { changedSlices, changedCustomTypes };
|
|
60
59
|
}, [unSyncedSlices, unSyncedCustomTypes, modelsStatuses]);
|
|
61
60
|
|
|
62
|
-
const {
|
|
61
|
+
const { pushChangesSuccess, refreshState } = useSliceMachineActions();
|
|
62
|
+
const [isSyncing, setIsSyncing] = useState(false);
|
|
63
|
+
const [openModalData, setOpenModalData] = useState<
|
|
64
|
+
PushChangesLimit | undefined
|
|
65
|
+
>(undefined);
|
|
63
66
|
|
|
64
|
-
const
|
|
65
|
-
isSyncing: isLoading(store, LoadingKeysEnum.CHANGES_PUSH),
|
|
66
|
-
}));
|
|
67
|
+
const numberOfChanges = unSyncedSlices.length + unSyncedCustomTypes.length;
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// Do not remote the eslint disable, fixing the eslint warning creates a bug that prevent from opening all modals
|
|
73
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
|
-
}, []);
|
|
69
|
+
const onPush = async (confirmDeleteDocuments: boolean) => {
|
|
70
|
+
try {
|
|
71
|
+
setIsSyncing(true);
|
|
72
|
+
setOpenModalData(undefined);
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
const limit = await pushChanges({
|
|
75
|
+
confirmDeleteDocuments,
|
|
76
|
+
changedSlices,
|
|
77
|
+
changedCustomTypes,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (limit !== undefined) {
|
|
81
|
+
setOpenModalData(limit);
|
|
82
|
+
} else {
|
|
83
|
+
// TODO(DT-1737): Remove the use of global getState
|
|
84
|
+
const serverState = await getState();
|
|
85
|
+
refreshState({
|
|
86
|
+
env: serverState.env,
|
|
87
|
+
remoteCustomTypes: serverState.remoteCustomTypes,
|
|
88
|
+
customTypes: serverState.customTypes,
|
|
89
|
+
libraries: serverState.libraries,
|
|
90
|
+
remoteSlices: serverState.remoteSlices,
|
|
91
|
+
clientError: serverState.clientError,
|
|
92
|
+
});
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
})
|
|
94
|
+
// Update last sync value in local storage
|
|
95
|
+
pushChangesSuccess();
|
|
96
|
+
|
|
97
|
+
toast.success("All slices and types have been pushed");
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error(
|
|
101
|
+
"Something went wrong when manually pushing your changes",
|
|
102
|
+
error,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
toast.error(
|
|
106
|
+
"Something went wrong when pushing your changes. Check your terminal logs.",
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
setIsSyncing(false);
|
|
111
|
+
};
|
|
84
112
|
|
|
85
113
|
const PageContent = useMemo(() => {
|
|
86
114
|
if (!isOnline) {
|
|
@@ -123,7 +151,7 @@ const Changes: React.FunctionComponent = () => {
|
|
|
123
151
|
<AppLayoutBreadcrumb folder="Changes" />
|
|
124
152
|
<AppLayoutActions>
|
|
125
153
|
<Button
|
|
126
|
-
onClick={() => onPush(false)} // not deleting documents by default
|
|
154
|
+
onClick={() => void onPush(false)} // not deleting documents by default
|
|
127
155
|
loading={isSyncing}
|
|
128
156
|
disabled={
|
|
129
157
|
numberOfChanges === 0 ||
|
|
@@ -141,9 +169,20 @@ const Changes: React.FunctionComponent = () => {
|
|
|
141
169
|
<AppLayoutContent>
|
|
142
170
|
<BaseStyles sx={{ display: "flex", flexDirection: "column" }}>
|
|
143
171
|
{PageContent}
|
|
144
|
-
<SoftDeleteDocumentsDrawer
|
|
145
|
-
|
|
146
|
-
|
|
172
|
+
<SoftDeleteDocumentsDrawer
|
|
173
|
+
pushChanges={(confirmDeleteDocuments) =>
|
|
174
|
+
void onPush(confirmDeleteDocuments)
|
|
175
|
+
}
|
|
176
|
+
modalData={openModalData}
|
|
177
|
+
onClose={() => setOpenModalData(undefined)}
|
|
178
|
+
/>
|
|
179
|
+
<HardDeleteDocumentsDrawer
|
|
180
|
+
pushChanges={(confirmDeleteDocuments) =>
|
|
181
|
+
void onPush(confirmDeleteDocuments)
|
|
182
|
+
}
|
|
183
|
+
modalData={openModalData}
|
|
184
|
+
onClose={() => setOpenModalData(undefined)}
|
|
185
|
+
/>
|
|
147
186
|
</BaseStyles>
|
|
148
187
|
</AppLayoutContent>
|
|
149
188
|
</AppLayout>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { pushChanges as pushChangesCall, telemetry } from "@src/apiClient";
|
|
2
|
+
import {
|
|
3
|
+
ChangedCustomType,
|
|
4
|
+
ChangedSlice,
|
|
5
|
+
} from "@lib/models/common/ModelStatus";
|
|
6
|
+
import { PushChangesLimit } from "@slicemachine/manager";
|
|
7
|
+
|
|
8
|
+
import { trackPushChangesSuccess } from "./trackPushChangesSuccess";
|
|
9
|
+
|
|
10
|
+
type PushChangesArgs = {
|
|
11
|
+
changedSlices: ReadonlyArray<ChangedSlice>;
|
|
12
|
+
changedCustomTypes: ReadonlyArray<ChangedCustomType>;
|
|
13
|
+
confirmDeleteDocuments?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export async function pushChanges(
|
|
17
|
+
args: PushChangesArgs,
|
|
18
|
+
): Promise<PushChangesLimit | undefined> {
|
|
19
|
+
const {
|
|
20
|
+
changedSlices,
|
|
21
|
+
changedCustomTypes,
|
|
22
|
+
confirmDeleteDocuments = false,
|
|
23
|
+
} = args;
|
|
24
|
+
|
|
25
|
+
const startTime = Date.now();
|
|
26
|
+
const sliceChanges = changedSlices.map((sliceChange) => ({
|
|
27
|
+
id: sliceChange.slice.model.id,
|
|
28
|
+
type: "Slice" as const,
|
|
29
|
+
libraryID: sliceChange.slice.from,
|
|
30
|
+
status: sliceChange.status,
|
|
31
|
+
}));
|
|
32
|
+
const customTypeChanges = changedCustomTypes.map((customTypeChange) => ({
|
|
33
|
+
id: customTypeChange.customType.id,
|
|
34
|
+
type: "CustomType" as const,
|
|
35
|
+
status: customTypeChange.status,
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
// Creating a new payload with the correct format
|
|
39
|
+
const pushPayload = {
|
|
40
|
+
confirmDeleteDocuments,
|
|
41
|
+
changes: [...sliceChanges, ...customTypeChanges],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const response = await pushChangesCall(pushPayload);
|
|
45
|
+
|
|
46
|
+
if (response) {
|
|
47
|
+
// Tracking when a limit has been reached
|
|
48
|
+
void telemetry.track({
|
|
49
|
+
event: "changes:limit-reach",
|
|
50
|
+
limitType: response.type,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return response;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
trackPushChangesSuccess({
|
|
57
|
+
changedCustomTypes,
|
|
58
|
+
changedSlices,
|
|
59
|
+
// Currently, we only pass confirmDeleteDocuments when the user
|
|
60
|
+
// has confirmed the deletion of documents
|
|
61
|
+
hasDeletedDocuments: confirmDeleteDocuments,
|
|
62
|
+
startTime,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ChangedCustomType,
|
|
3
|
+
ChangedSlice,
|
|
4
|
+
ModelStatus,
|
|
5
|
+
} from "@lib/models/common/ModelStatus";
|
|
2
6
|
import { telemetry } from "@src/apiClient";
|
|
3
7
|
import { countMissingScreenshots } from "@src/domain/slice";
|
|
4
|
-
import { ModelStatus } from "@lib/models/common/ModelStatus";
|
|
5
8
|
|
|
6
|
-
type
|
|
9
|
+
type TrackPushChangesSuccessArgs = {
|
|
10
|
+
changedSlices: ReadonlyArray<ChangedSlice>;
|
|
11
|
+
changedCustomTypes: ReadonlyArray<ChangedCustomType>;
|
|
12
|
+
hasDeletedDocuments: boolean;
|
|
13
|
+
startTime: number;
|
|
14
|
+
};
|
|
7
15
|
|
|
8
|
-
export function trackPushChangesSuccess(
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
confirmDeleteDocuments,
|
|
12
|
-
changedCustomTypes,
|
|
13
|
-
changedSlices,
|
|
14
|
-
} = params;
|
|
16
|
+
export function trackPushChangesSuccess(args: TrackPushChangesSuccessArgs) {
|
|
17
|
+
const { startTime, hasDeletedDocuments, changedCustomTypes, changedSlices } =
|
|
18
|
+
args;
|
|
15
19
|
|
|
16
20
|
const customTypesStats = changedCustomTypes.reduce<{
|
|
17
21
|
customTypesCreated: number;
|
|
@@ -80,14 +84,14 @@ export function trackPushChangesSuccess(params: trackingParameters) {
|
|
|
80
84
|
);
|
|
81
85
|
const duration = Date.now() - startTime;
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
void telemetry.track({
|
|
84
88
|
event: "changes:pushed",
|
|
85
89
|
...customTypesStats,
|
|
86
90
|
...slicesStats,
|
|
87
91
|
total: total,
|
|
88
92
|
missingScreenshots,
|
|
89
93
|
duration: duration,
|
|
90
|
-
hasDeletedDocuments
|
|
94
|
+
hasDeletedDocuments,
|
|
91
95
|
_includeEnvironmentKind: true,
|
|
92
96
|
});
|
|
93
97
|
}
|
|
@@ -10,7 +10,6 @@ export enum LoadingKeysEnum {
|
|
|
10
10
|
RENAME_SLICE = "RENAME_SLICE",
|
|
11
11
|
GENERATE_SLICE_CUSTOM_SCREENSHOT = "GENERATE_SLICE_CUSTOM_SCREENSHOT",
|
|
12
12
|
SAVE_SLICE = "SAVE_SLICE",
|
|
13
|
-
CHANGES_PUSH = "CHANGES_PUSH",
|
|
14
13
|
DELETE_SLICE = "DELETE_SLICE",
|
|
15
14
|
SIMULATOR_SAVE_MOCK = "SIMULATOR_SAVE_MOCK",
|
|
16
15
|
CHANGELOG = "CHANGELOG",
|
|
@@ -5,9 +5,6 @@ export enum ModalKeysEnum {
|
|
|
5
5
|
SCREENSHOT_PREVIEW = "SCREENSHOT_PREVIEW",
|
|
6
6
|
SCREENSHOTS = "SCREENSHOTS",
|
|
7
7
|
DELETE_SLICE = "DELETE_SLICE",
|
|
8
|
-
SOFT_DELETE_DOCUMENTS_DRAWER = "SOFT_DELETE_DOCUMENTS_DRAWER",
|
|
9
|
-
HARD_DELETE_DOCUMENTS_DRAWER = "HARD_DELETE_DOCUMENTS_DRAWER",
|
|
10
|
-
REFERENCES_MISSING_DRAWER = "REFERENCES_MISSING_DRAWER",
|
|
11
8
|
SIMULATOR_SETUP = "SIMULATOR_SETUP",
|
|
12
9
|
}
|
|
13
10
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
hasSeenTutorialsToolTipCreator,
|
|
11
11
|
hasSeenSimulatorToolTipCreator,
|
|
12
12
|
hasSeenChangesToolTipCreator,
|
|
13
|
+
changesPushSuccessCreator,
|
|
13
14
|
} from "./userContext";
|
|
14
15
|
import { getChangelogCreator, refreshStateCreator } from "./environment";
|
|
15
16
|
import {
|
|
@@ -35,7 +36,6 @@ import { GenericToastTypes, openToasterCreator } from "./toaster";
|
|
|
35
36
|
import { CustomTypes } from "@lib/models/common/CustomType";
|
|
36
37
|
import { CustomType } from "@prismicio/types-internal/lib/customtypes";
|
|
37
38
|
import { ComponentUI, ScreenshotUI } from "../../lib/models/common/ComponentUI";
|
|
38
|
-
import { ChangesPushSagaPayload, changesPushCreator } from "./pushChangesSaga";
|
|
39
39
|
import { saveSliceMockCreator } from "./simulator";
|
|
40
40
|
import { SaveSliceMockRequest } from "@src/apiClient";
|
|
41
41
|
import { CustomTypeFormat } from "@slicemachine/manager";
|
|
@@ -70,18 +70,6 @@ const useSliceMachineActions = () => {
|
|
|
70
70
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.SCREENSHOT_PREVIEW }));
|
|
71
71
|
const openDeleteSliceModal = () =>
|
|
72
72
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.DELETE_SLICE }));
|
|
73
|
-
const openDeleteDocumentsDrawer = () =>
|
|
74
|
-
dispatch(
|
|
75
|
-
modalOpenCreator({
|
|
76
|
-
modalKey: ModalKeysEnum.SOFT_DELETE_DOCUMENTS_DRAWER,
|
|
77
|
-
}),
|
|
78
|
-
);
|
|
79
|
-
const openDeleteDocumentsDrawerOverLimit = () =>
|
|
80
|
-
dispatch(
|
|
81
|
-
modalOpenCreator({
|
|
82
|
-
modalKey: ModalKeysEnum.HARD_DELETE_DOCUMENTS_DRAWER,
|
|
83
|
-
}),
|
|
84
|
-
);
|
|
85
73
|
const openSimulatorSetupModal = () =>
|
|
86
74
|
dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.SIMULATOR_SETUP }));
|
|
87
75
|
|
|
@@ -203,8 +191,7 @@ const useSliceMachineActions = () => {
|
|
|
203
191
|
}),
|
|
204
192
|
);
|
|
205
193
|
|
|
206
|
-
const
|
|
207
|
-
dispatch(changesPushCreator.request(payload));
|
|
194
|
+
const pushChangesSuccess = () => dispatch(changesPushSuccessCreator());
|
|
208
195
|
|
|
209
196
|
// Toaster store
|
|
210
197
|
const openToaster = (
|
|
@@ -238,8 +225,6 @@ const useSliceMachineActions = () => {
|
|
|
238
225
|
checkSimulatorSetup,
|
|
239
226
|
connectToSimulatorFailure,
|
|
240
227
|
connectToSimulatorSuccess,
|
|
241
|
-
openDeleteDocumentsDrawer,
|
|
242
|
-
openDeleteDocumentsDrawerOverLimit,
|
|
243
228
|
connectToSimulatorIframe,
|
|
244
229
|
refreshState,
|
|
245
230
|
openScreenshotsModal,
|
|
@@ -270,9 +255,9 @@ const useSliceMachineActions = () => {
|
|
|
270
255
|
openRenameSliceModal,
|
|
271
256
|
closeModals,
|
|
272
257
|
openToaster,
|
|
273
|
-
pushChanges,
|
|
274
258
|
saveSliceMock,
|
|
275
259
|
getChangelog,
|
|
260
|
+
pushChangesSuccess,
|
|
276
261
|
};
|
|
277
262
|
};
|
|
278
263
|
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from "@src/modules/userContext/types";
|
|
10
10
|
import { refreshStateCreator } from "../environment";
|
|
11
11
|
import ErrorWithStatus from "@lib/models/common/ErrorWithStatus";
|
|
12
|
-
import { changesPushCreator } from "../pushChangesSaga";
|
|
13
12
|
|
|
14
13
|
// NOTE: Be careful every key written in this store is persisted in the localstorage
|
|
15
14
|
|
|
@@ -54,6 +53,10 @@ export const hasSeenChangesToolTipCreator = createAction(
|
|
|
54
53
|
"USER_CONTEXT/VIEW_CHANGES_TOOL_TIP",
|
|
55
54
|
)();
|
|
56
55
|
|
|
56
|
+
export const changesPushSuccessCreator = createAction(
|
|
57
|
+
"USER_CONTEXT/CHANGES_PUSH_SUCCESS",
|
|
58
|
+
)();
|
|
59
|
+
|
|
57
60
|
type userContextActions = ActionType<
|
|
58
61
|
| typeof sendAReviewCreator
|
|
59
62
|
| typeof skipReviewCreator
|
|
@@ -62,7 +65,7 @@ type userContextActions = ActionType<
|
|
|
62
65
|
| typeof hasSeenSimulatorToolTipCreator
|
|
63
66
|
| typeof hasSeenChangesToolTipCreator
|
|
64
67
|
| typeof refreshStateCreator
|
|
65
|
-
| typeof
|
|
68
|
+
| typeof changesPushSuccessCreator
|
|
66
69
|
>;
|
|
67
70
|
|
|
68
71
|
// Selectors
|
|
@@ -137,7 +140,7 @@ export const userContextReducer: Reducer<
|
|
|
137
140
|
authStatus: getAuthStatus(action.payload.clientError),
|
|
138
141
|
};
|
|
139
142
|
}
|
|
140
|
-
case getType(
|
|
143
|
+
case getType(changesPushSuccessCreator): {
|
|
141
144
|
return {
|
|
142
145
|
...state,
|
|
143
146
|
lastSyncChange: Date.now(),
|
package/src/redux/reducer.ts
CHANGED
|
@@ -12,7 +12,6 @@ import { simulatorReducer } from "@src/modules/simulator";
|
|
|
12
12
|
import { availableCustomTypesReducer } from "@src/modules/availableCustomTypes";
|
|
13
13
|
import { slicesReducer } from "@src/modules/slices";
|
|
14
14
|
import { routerReducer } from "connected-next-router";
|
|
15
|
-
import { pushChangesReducer } from "@src/modules/pushChangesSaga";
|
|
16
15
|
|
|
17
16
|
/** Creates the main reducer */
|
|
18
17
|
const createReducer = (): Reducer =>
|
|
@@ -25,7 +24,6 @@ const createReducer = (): Reducer =>
|
|
|
25
24
|
availableCustomTypes: availableCustomTypesReducer,
|
|
26
25
|
slices: slicesReducer,
|
|
27
26
|
router: routerReducer,
|
|
28
|
-
pushChanges: pushChangesReducer,
|
|
29
27
|
});
|
|
30
28
|
|
|
31
29
|
export default createReducer;
|
package/src/redux/saga.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { watchSimulatorSagas } from "@src/modules/simulator";
|
|
|
4
4
|
import { watchAvailableCustomTypesSagas } from "@src/modules/availableCustomTypes";
|
|
5
5
|
import { watchSliceSagas } from "@src/modules/slices";
|
|
6
6
|
import { watchToasterSagas } from "@src/modules/toaster";
|
|
7
|
-
import { watchChangesPushSagas } from "@src/modules/pushChangesSaga";
|
|
8
7
|
import { watchChangelogSagas } from "@src/modules/environment";
|
|
9
8
|
|
|
10
9
|
// Single entry point to start all Sagas at once
|
|
@@ -13,6 +12,5 @@ export default function* rootSaga() {
|
|
|
13
12
|
yield fork(watchAvailableCustomTypesSagas);
|
|
14
13
|
yield fork(watchSliceSagas);
|
|
15
14
|
yield fork(watchToasterSagas);
|
|
16
|
-
yield fork(watchChangesPushSagas);
|
|
17
15
|
yield fork(watchChangelogSagas);
|
|
18
16
|
}
|
package/src/redux/type.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { SimulatorStoreType } from "@src/modules/simulator/types";
|
|
|
6
6
|
import { AvailableCustomTypesStoreType } from "@src/modules/availableCustomTypes/types";
|
|
7
7
|
import { SlicesStoreType } from "@src/modules/slices/types";
|
|
8
8
|
import { RouterState } from "connected-next-router/types";
|
|
9
|
-
import { PushChangesStoreType } from "@src/modules/pushChangesSaga";
|
|
10
9
|
|
|
11
10
|
export type SliceMachineStoreType = {
|
|
12
11
|
modal: ModalStoreType;
|
|
@@ -17,5 +16,4 @@ export type SliceMachineStoreType = {
|
|
|
17
16
|
availableCustomTypes: AvailableCustomTypesStoreType;
|
|
18
17
|
slices: SlicesStoreType;
|
|
19
18
|
router: RouterState;
|
|
20
|
-
pushChanges: PushChangesStoreType;
|
|
21
19
|
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Text } from "theme-ui";
|
|
3
|
-
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
4
|
-
import { Button } from "@components/Button";
|
|
5
|
-
import { useSelector } from "react-redux";
|
|
6
|
-
import { SliceMachineStoreType } from "@src/redux/type";
|
|
7
|
-
import { ModalKeysEnum } from "@src/modules/modal/types";
|
|
8
|
-
import { isModalOpen } from "@src/modules/modal";
|
|
9
|
-
import { getModelId, hasLocal } from "@lib/models/common/ModelData";
|
|
10
|
-
import { CustomTypesReferencesCard } from "./AssociatedDocumentsCard";
|
|
11
|
-
import { ToasterType } from "@src/modules/toaster";
|
|
12
|
-
import { selectAllCustomTypes } from "@src/modules/availableCustomTypes";
|
|
13
|
-
import { SliceMachineDrawerUI } from "@components/SliceMachineDrawer";
|
|
14
|
-
|
|
15
|
-
export const ReferencesErrorDrawer: React.FunctionComponent<{
|
|
16
|
-
pushChanges: (confirmDeleteDocuments: boolean) => void;
|
|
17
|
-
}> = ({ pushChanges }) => {
|
|
18
|
-
const { isOpen, modalData, localCustomTypes } = useSelector(
|
|
19
|
-
(store: SliceMachineStoreType) => ({
|
|
20
|
-
isOpen: isModalOpen(store, ModalKeysEnum.REFERENCES_MISSING_DRAWER),
|
|
21
|
-
localCustomTypes: selectAllCustomTypes(store).filter(hasLocal),
|
|
22
|
-
modalData: store.pushChanges,
|
|
23
|
-
}),
|
|
24
|
-
);
|
|
25
|
-
const { closeModals, openToaster } = useSliceMachineActions();
|
|
26
|
-
|
|
27
|
-
if (!isOpen) return null;
|
|
28
|
-
|
|
29
|
-
if (modalData?.details === undefined) {
|
|
30
|
-
openToaster("No change data", ToasterType.ERROR);
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const hasMoreThanOne = modalData?.details.customTypes.length > 1;
|
|
35
|
-
|
|
36
|
-
const associatedDocumentsCards = modalData.details.customTypes.map(
|
|
37
|
-
(customTypeDetail) => {
|
|
38
|
-
const customType = localCustomTypes.find(
|
|
39
|
-
(customType) => getModelId(customType) === customTypeDetail.id,
|
|
40
|
-
);
|
|
41
|
-
if (customType === undefined) return null;
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<CustomTypesReferencesCard
|
|
45
|
-
format={customType.local.format}
|
|
46
|
-
id={customType.local.id}
|
|
47
|
-
name={customType.local.label ?? customType.local.id}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<SliceMachineDrawerUI
|
|
55
|
-
isOpen={isOpen}
|
|
56
|
-
title={"Missing Slices"}
|
|
57
|
-
footer={
|
|
58
|
-
<>
|
|
59
|
-
<Button
|
|
60
|
-
label="Try again"
|
|
61
|
-
variant="primary"
|
|
62
|
-
onClick={() => {
|
|
63
|
-
closeModals();
|
|
64
|
-
pushChanges(false);
|
|
65
|
-
}}
|
|
66
|
-
sx={{
|
|
67
|
-
fontWeight: "bold",
|
|
68
|
-
color: "white",
|
|
69
|
-
borderRadius: 6,
|
|
70
|
-
width: "100%",
|
|
71
|
-
}}
|
|
72
|
-
/>
|
|
73
|
-
</>
|
|
74
|
-
}
|
|
75
|
-
explanations={
|
|
76
|
-
<>
|
|
77
|
-
<Text sx={{ fontWeight: "bold", mb: 1, lineHeight: "24px" }}>
|
|
78
|
-
You have{hasMoreThanOne ? "" : " a"} type
|
|
79
|
-
{hasMoreThanOne ? "s" : ""} that reference{" "}
|
|
80
|
-
{hasMoreThanOne ? "" : "s"} one or more missing Slices
|
|
81
|
-
</Text>
|
|
82
|
-
<Text sx={{ mb: 24 }}>
|
|
83
|
-
Before pushing, remove references to any missing Slices by opening{" "}
|
|
84
|
-
the affected type{hasMoreThanOne ? "s" : ""} and clicking the{" "}
|
|
85
|
-
<b>Save</b> button.
|
|
86
|
-
</Text>
|
|
87
|
-
{associatedDocumentsCards}
|
|
88
|
-
</>
|
|
89
|
-
}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25],{54132:function(e,n,t){"use strict";t.d(n,{Z:function(){return a}});var o=t(62230),r=t(85244),i=t(98240),c=t(52322);t(2784);var d=t(75289),s=function(e){var n=e.bg,t=e.background,r=e.sx,i=e.withRadius,s=e.radius,a=e.children;return(0,c.jsx)(d.xu,{sx:(0,o.Z)({p:4,bg:n||t},i?{borderBottomLeftRadius:s,borderBottomRightRadius:s}:null,r),children:a})},a=function(e){var n=e.Header,t=void 0===n?null:n,a=e.SubHeader,l=void 0===a?null:a,u=e.Body,h=void 0===u?null:u,v=e.Footer,m=void 0===v?null:v,f=e.borderFooter,b=e.radius,_=void 0===b?"6px":b,p=e.bodySx,x=e.footerSx,g=e.sx,C=e.bg,j=e.background,Z=e.children,k=(0,i.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,c.jsxs)(d.Zb,(0,r.Z)((0,o.Z)({sx:(0,o.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:_},void 0===g?null:g)},k),{children:[t?(0,c.jsx)(t,{radius:_}):null,l?(0,c.jsx)(l,{radius:_}):null,(0,c.jsxs)(s,{bg:C,background:j,sx:void 0===p?{}:p,withRadius:!m,children:[h?(0,c.jsx)(h,{}):null,Z||null]}),m?(0,c.jsx)(s,{bg:C,background:j,sx:(0,o.Z)({},void 0!==f&&f?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===x?{}:x),radius:_,withRadius:!0,children:"object"==typeof m?m:(0,c.jsx)(m,{})}):null]}))}},75329:function(e,n,t){"use strict";t.d(n,{Sn:function(){return d},lS:function(){return o},nG:function(){return r},pq:function(){return s},rd:function(){return c},xo:function(){return i}});var o=["components"],r=["png","jpg","jpeg"],i=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,c="placeholders/What_are_Slices_mrvome",d="SM_HELP_VIDEOS/mock_data",s="slice-machine-simulator"},24804:function(e,n,t){"use strict";t.d(n,{Zb:function(){return b},T$:function(){return p},eW:function(){return x},ZB:function(){return _},Lm:function(){return g}});var o=t(67557),r=t(62230),i=t(85244),c=t(98240),d=t(52322),s=t(50002),a=t(22715),l=t(6277),u=t(2784);t(71457);var h={solid:"_1ecs97d3c _1ecs97dap _1ecs97d4pk _1ecs97d4wx",outlined:"_1ecs97d2i _1ecs97d9v _1ecs97dw _1ecs97d89 _1ecs97d2w _1ecs97da9 _1ecs97d4oq _1ecs97d4w3 _1ecs97d4oc _1ecs97d4vp"},v={div:"_1ecs97dez0 _1ecs97dez3 _1ecs97dezd",img:"kedahr9 _1ecs97df77 _1ecs97dezn"},m={small:"kedahr2",medium:"kedahr3"},f={solid:"kedahr4 _1ecs97d1u _1ecs97d97 _1ecs97d4pe _1ecs97d4wr",outlined:"kedahr5 _1ecs97d18 _1ecs97d8l _1ecs97d4o6 _1ecs97d4vj"},b=function(e){var n,t=e.checked,a=e.size,v=e.variant,b=void 0===v?"solid":v,_=(e.interactive,e.disabled,e.onClick,e.href,e.component),p=void 0===_?"a":_,x=(e.replace,(0,c.Z)(e,["checked","size","variant","interactive","disabled","onClick","href","component","replace"])),g=(0,i.Z)((0,r.Z)({},x),{className:(0,l.W)("_1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dez1 _1ecs97dezr _1ecs97dezv",m[void 0===a?"medium":a],f[b],(n={},(0,o.Z)(n,"kedahr6",e.interactive),(0,o.Z)(n,h[b],e.interactive),n)),"data-state":!0===(void 0!==t&&t)?"checked":void 0});return!0===e.interactive&&void 0===e.href?(0,d.jsx)("div",(0,i.Z)((0,r.Z)({},g),{"data-disabled":!0===e.disabled?"":void 0,onClick:function(n){if(!0!==e.disabled&&void 0!==e.onClick){var t=n.target;(0,s.JY)(t)===n.currentTarget&&e.onClick(n)}},tabIndex:!0===e.disabled?void 0:0})):!0===e.interactive?(0,u.createElement)(p,(0,r.Z)((0,i.Z)((0,r.Z)({},g),{href:e.href,onClick:function(e){var n=e.target;(0,s.JY)(n)!==e.currentTarget&&e.preventDefault()}}),"a"===p?{}:{replace:e.replace})):(0,d.jsx)("div",(0,r.Z)({},g))},_=function(e){var n=e.className,t=e.component,o=void 0===t?"img":t,s=e.overlay,a=(0,c.Z)(e,["className","component","overlay"]);return(0,d.jsxs)("div",{className:"kedahr7 _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97deze _1ecs97dezd _1ecs97df7d _1ecs97dezv",children:[(0,u.createElement)(o,(0,i.Z)((0,r.Z)({},a),{className:(0,l.W)(v[o],n)})),Boolean(s)?(0,d.jsx)("div",{className:"kedahra _1ecs97dez0 _1ecs97dez3 _1ecs97df9d _1ecs97dezt _1ecs97df0i",children:s}):void 0]})},p=function(e){return(0,d.jsx)("div",(0,i.Z)((0,r.Z)({},e),{className:"kedahrc kedahrb _1ecs97dez0 _1ecs97dez2 _1ecs97dez8 _1ecs97dez1 _1ecs97dezc _1ecs97df71 _1ecs97dezi"}))},x=function(e){var n=e.action,t=e.subtitle,o=e.title,s=(0,c.Z)(e,["action","subtitle","title"]);return(0,d.jsxs)("div",(0,i.Z)((0,r.Z)({},s),{className:"kedahrd kedahrb _1ecs97dez0 _1ecs97dez2 _1ecs97dez8 _1ecs97dez1 _1ecs97dezc _1ecs97df92 _1ecs97df73",children:[(0,d.jsxs)("div",{className:"kedahre _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97deze _1ecs97dezd _1ecs97df51",children:[(0,d.jsx)(a.xv,{component:"span",noWrap:!0,variant:"bold",children:o}),(0,d.jsx)(a.xv,{color:"grey11",component:"span",noWrap:!0,variant:"small",children:t})]}),n]}))},g=function(e){var n=e.children,t=(0,c.Z)(e,["children"]);return(0,d.jsx)("div",(0,i.Z)((0,r.Z)({},t),{className:"kedahrf _1ecs97dez0 _1ecs97dez2 _1ecs97dezb _1ecs97df6v _1ecs97dfb5 _1ecs97dezh _1ecs97dfhi _1ecs97dezt",children:(0,d.jsx)(a.xv,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:n})}))}},34728:function(e,n,t){"use strict";t.d(n,{O:function(){return d}});var o=t(52322),r=t(22715),i=t(32681),c=t(79096),d=function(e){var n=function(e){var n=s[e.modelType];switch(e.modelStatus){case i.G.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(n," exists only locally. Upon sync, it will be pushed to your remote repository.")};case i.G.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(n," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case i.G.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(n," is in sync with the remote repository.")};case i.G.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(n," has been deleted locally.")};case i.G.Unknown:if(!e.isOnline)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (no internet connection)."};if(e.authStatus===c.t.UNAUTHORIZED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};if(e.authStatus===c.t.FORBIDDEN)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (you don't have access to the repository)."};default:return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (unknown error)."}}}(e),t=n.badgeColor,d=n.badgeTitle,a=n.tooltipContent;return(0,o.jsx)(r.u,{content:a,side:"bottom",children:(0,o.jsx)(r.Ct,{color:t,title:d})})},s={CustomType:"type",Slice:"slice"}},71749:function(e,n,t){"use strict";t.d(n,{b:function(){return _}});var o=t(62230),r=t(85244),i=t(52322),c=t(22715),d=t(39097),s=t.n(d),a=t(67557),l=t(17064),u={build:function(e){var n;return(0,r.Z)((0,o.Z)({},e),{screenshots:(n=e.screenshots)?Object.entries(n).reduce(function(e,n){var t,i=(0,l.Z)(n,2),c=i[0],d=i[1];return d.hash?(0,r.Z)((0,o.Z)({},e),(0,a.Z)({},c,(0,o.Z)({},d,{hash:d.hash}))):e},{}):{}})},variation:function(e,n){if(e.model.variations.length)return n?e.model.variations.find(function(e){return e.id===n}):e.model.variations[0]}},h=t(24804),v=t(5479),m=t(34728),f=t(49451),b=function(e){return(0,i.jsx)("svg",(0,r.Z)((0,o.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V12.4413C20 12.4512 19.9997 12.461 19.9991 12.4707C20.0072 12.6083 19.9586 12.7485 19.8536 12.8536C19.6583 13.0488 19.3417 13.0488 19.1464 12.8536L16.3536 10.0607C16.1583 9.8654 15.8417 9.8654 15.6464 10.0607L11.8536 13.8536C11.6583 14.0488 11.3417 14.0488 11.1464 13.8536L9.35355 12.0607C9.15829 11.8654 8.84171 11.8654 8.64645 12.0607L5 15.7071V18.5C5 18.7761 5.22386 19 5.5 19H12.5C12.7761 19 13 19.2239 13 19.5C13 19.7761 12.7761 20 12.5 20H5.5C4.67157 20 4 19.3284 4 18.5V15.5003V15.4997V5.5ZM11.5 12.7929L14.9393 9.35355C15.5251 8.76777 16.4749 8.76777 17.0607 9.35355L19 11.2929V5.5C19 5.22386 18.7761 5 18.5 5H5.5C5.22386 5 5 5.22386 5 5.5V14.2929L7.93934 11.3536C8.52513 10.7678 9.47487 10.7678 10.0607 11.3536L11.5 12.7929ZM16.5 13C16.7761 13 17 13.2239 17 13.5V16H19.5C19.7761 16 20 16.2239 20 16.5C20 16.7761 19.7761 17 19.5 17H17V19.5C17 19.7761 16.7761 20 16.5 20C16.2239 20 16 19.7761 16 19.5V17H13.5C13.2239 17 13 16.7761 13 16.5C13 16.2239 13.2239 16 13.5 16H16V13.5C16 13.2239 16.2239 13 16.5 13Z",fill:"currentColor"})}))},_=function(e){var n,t=e.action,d=e.isComingSoon,a=void 0!==d&&d,l=e.isDeleted,_=e.onUpdateScreenshot,g=e.selected,C=void 0!==g&&g,j=e.slice,Z=e.variant,k=e.variationId,y=u.variation(j,k);if(!y)return null;var z=(0,v.d7)(j,y),S=a||void 0!==l&&l,w=!S&&!!_,T="outlined"===Z,N=void 0!==k;return n="selection"===e.mode?{disabled:S,interactive:!0,onClick:function(){e.onSelectedChange(!C)}}:S?{interactive:!1}:{component:s(),href:f.Y.getBuilderPagePathname({libraryName:j.href,sliceName:j.model.name,variationId:y.id}),interactive:!0,replace:e.replace},(0,i.jsxs)(h.Zb,(0,r.Z)((0,o.Z)({"aria-label":"".concat(j.model.name," ").concat(y.name," slice card"),checked:C,"data-cy":"shared-slice-card","data-testid":"shared-slice-card"},n,"outlined"===Z?{size:"small",variant:"outlined"}:{}),{children:[void 0!==z?(0,i.jsx)(h.ZB,{alt:"Preview image",overlay:w&&!T?(0,i.jsx)(c.xu,{alignItems:"center",justifyContent:"center",children:(0,i.jsx)(p,{onClick:_})}):void 0,src:z}):(0,i.jsx)(h.ZB,{component:"div",children:(0,i.jsxs)(c.xu,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,i.jsx)(c.xv,{color:"grey11",component:"span",children:"No screenshot available"}),w&&!T?(0,i.jsx)(p,{onClick:_}):void 0]})}),(0,i.jsx)(h.eW,{action:"checkbox"===t.type&&"selection"===e.mode?(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:(0,i.jsx)(c.XZ,{checked:C,disabled:S,onCheckedChange:e.onSelectedChange})}):"menu"===t.type?(0,i.jsxs)(c.h_,{modal:!0,children:[(0,i.jsx)(c.$F,{disabled:S,children:(0,i.jsx)(c.hU,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,i.jsxs)(c.AW,{align:"end","data-cy":"slice-action-icon-dropdown",children:[w&&T?(0,i.jsx)(c.Xi,{onSelect:_,startIcon:(0,i.jsx)(b,{}),children:"Update screenshot"}):void 0,(0,i.jsx)(c.Xi,{onSelect:t.onRename,startIcon:(0,i.jsx)(c.I5,{name:"edit"}),children:"Rename"}),!0===t.removeDisabled&&N?(0,i.jsx)(c.u,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,i.jsx)(x,{disabled:!0,onSelect:t.onRemove})}):(0,i.jsx)(x,{disabled:!0===t.removeDisabled,onSelect:t.onRemove})]})]}):"remove"===t.type?(0,i.jsx)(c.hU,{icon:"close",onClick:function(){return!S&&t.onRemove()},hiddenLabel:"Remove slice"}):"status"===t.type?(0,i.jsx)(m.O,{authStatus:t.authStatus,isOnline:t.isOnline,modelStatus:t.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,i.jsxs)(i.Fragment,{children:[N?y.id:"".concat(j.model.variations.length," variation").concat(j.model.variations.length>1?"s":""),a?(0,i.jsxs)(c.xv,{color:"purple11",component:"span",variant:"small",children:[" ","• (coming soon)"]}):void 0]}),title:N?y.name:j.model.name}),w&&!N&&(0,v.cx)(j)>0?(0,i.jsx)(h.Lm,{children:"Missing screenshot"}):void 0]}))},p=function(e){return(0,i.jsx)(c.zx,{onClick:e.onClick,renderStartIcon:function(){return(0,i.jsx)(b,{color:c.TV.color.greyLight11})},color:"grey",children:"Update screenshot"})},x=function(e){return(0,i.jsx)(c.Xi,(0,r.Z)((0,o.Z)({},e),{color:"tomato",startIcon:(0,i.jsx)(c.I5,{name:"delete"}),children:"Delete"}))}},49451:function(e,n,t){"use strict";t.d(n,{Y:function(){return o}});var o={getBuilderPagePathname:function(e){return"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}}},71457:function(){}}]);
|