slice-machine-ui 1.19.3-dev-next-release.3 → 1.19.3-dev-environments.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.
- package/components/AppLayout/index.tsx +34 -10
- package/components/Navigation/Environment.tsx +47 -0
- package/components/Navigation/index.css.ts +6 -0
- package/components/Navigation/index.tsx +15 -2
- package/lib/builders/SliceBuilder/Sidebar/{AddVariationModal.tsx → VariationModal.tsx} +3 -3
- package/lib/builders/SliceBuilder/Sidebar/index.tsx +13 -52
- package/lib/builders/SliceBuilder/index.tsx +27 -31
- package/out/404.html +1 -1
- package/out/_next/static/{0Lwj5aWsM8JhkX_oWgDHj → SPaOafYlpiOTCKrKML7gk}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/840-5b485c737b24324b.js +1 -0
- package/out/_next/static/chunks/904-e290f0254cc4b5df.js +1 -0
- package/out/_next/static/chunks/{958-c90d60818f1c468a.js → 958-be627006594efb21.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-d42e615a839b8752.js → _app-2af35c541ee1bab0.js} +7 -7
- package/out/_next/static/chunks/pages/{changelog-fa36b9995c26e1d7.js → changelog-4b8369d91d82b28b.js} +1 -1
- package/out/_next/static/chunks/pages/changes-db6e8c6be5ae076e.js +1 -0
- package/out/_next/static/chunks/pages/labs-2922105ab714d32a.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ca780766d02c801b.js +1 -0
- package/out/_next/static/chunks/pages/slices-93b7af2624c85b8e.js +1 -0
- package/out/_next/static/css/{412af4286eb0b283.css → 009bd7f5ac85fc6a.css} +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 +4 -4
- package/pages/slices.tsx +1 -0
- package/src/apiClient.ts +4 -32
- package/src/components/Divider/Divider.css.ts +31 -0
- package/src/components/Divider/Divider.stories.tsx +27 -0
- package/src/components/Divider/Divider.tsx +25 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/PageLayout/PageLayout.css.ts +8 -3
- package/src/components/PageLayout/PageLayout.stories.tsx +10 -1
- package/src/components/PageLayout/PageLayout.tsx +7 -2
- package/src/components/SideNav/SideNav.css.ts +3 -10
- package/src/components/SideNav/SideNav.stories.tsx +29 -2
- package/src/components/SideNav/SideNav.tsx +5 -1
- package/src/components/SideNav/SideNavEnvironmentSelector.css.ts +69 -0
- package/src/components/SideNav/SideNavEnvironmentSelector.tsx +163 -0
- package/src/components/SideNav/index.ts +1 -0
- package/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx +4 -3
- package/src/features/environments/actions/getActiveEnvironmentDomain.ts +11 -0
- package/src/features/environments/actions/getEnvironments.ts +12 -0
- package/src/features/environments/actions/setEnvironment.ts +18 -0
- package/src/features/environments/useActiveEnvironment.ts +38 -0
- package/src/features/environments/useEnvironments.ts +7 -0
- package/src/features/legacyState/actions/getLegacySliceMachineState.ts +53 -0
- package/src/features/legacyState/useLegacySliceMachineState.ts +7 -0
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +4 -3
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +17 -44
- package/src/modules/environment/index.ts +2 -2
- package/src/modules/screenshots/sagas.ts +6 -3
- package/src/modules/selectedSlice/actions.ts +2 -7
- package/src/modules/selectedSlice/reducer.ts +1 -6
- package/src/modules/selectedSlice/sagas.ts +18 -10
- package/src/modules/slices/index.ts +1 -23
- package/src/modules/toaster/utils.tsx +12 -6
- package/src/modules/useSliceMachineActions.ts +3 -9
- package/test/pages/slices.test.tsx +4 -8
- package/test/src/modules/__fixtures__/serverState.ts +2 -0
- package/test/src/modules/selectedSlice/sagas.test.ts +12 -14
- package/test/src/modules/toaster/utils.test.ts +34 -3
- package/components/DeleteVariationModal/index.tsx +0 -83
- package/components/Forms/RenameVariationModal/RenameVariationModal.css.ts +0 -7
- package/components/Forms/RenameVariationModal/RenameVariationModal.tsx +0 -117
- package/components/Forms/RenameVariationModal/index.ts +0 -1
- package/out/_next/static/chunks/840-884e41a48b92e5d3.js +0 -1
- package/out/_next/static/chunks/904-69cc3c4be2bff626.js +0 -1
- package/out/_next/static/chunks/pages/changes-e388be4457a43c3a.js +0 -1
- package/out/_next/static/chunks/pages/labs-ebce03a4e7a95a4e.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-7c811c2c79f01a25.js +0 -1
- package/out/_next/static/chunks/pages/slices-22db04643850c1d8.js +0 -1
- package/src/features/slices/sliceBuilder/actions/deleteVariation.ts +0 -86
- package/src/features/slices/sliceBuilder/actions/renameVariation.ts +0 -80
- /package/out/_next/static/{0Lwj5aWsM8JhkX_oWgDHj → SPaOafYlpiOTCKrKML7gk}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Box, Button, ButtonGroup } from "@prismicio/editor-ui";
|
|
1
|
+
import { Box, Button, ButtonGroup, ErrorBoundary } from "@prismicio/editor-ui";
|
|
2
2
|
import { useRouter } from "next/router";
|
|
3
|
-
import
|
|
3
|
+
import { FC, PropsWithChildren, Suspense } from "react";
|
|
4
|
+
|
|
5
|
+
import { useActiveEnvironment } from "@src/features/environments/useActiveEnvironment";
|
|
4
6
|
|
|
5
7
|
import Navigation from "@components/Navigation";
|
|
6
8
|
import { Breadcrumb, type BreadcrumbProps } from "@src/components/Breadcrumb";
|
|
@@ -14,14 +16,36 @@ import {
|
|
|
14
16
|
export const AppLayout: FC<PropsWithChildren> = ({
|
|
15
17
|
children,
|
|
16
18
|
...otherProps
|
|
17
|
-
}) =>
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
}) => {
|
|
20
|
+
return (
|
|
21
|
+
<ErrorBoundary>
|
|
22
|
+
<Suspense>
|
|
23
|
+
<PageLayoutWithActiveEnvironment {...otherProps}>
|
|
24
|
+
<PageLayoutPane>
|
|
25
|
+
<Navigation />
|
|
26
|
+
</PageLayoutPane>
|
|
27
|
+
{children}
|
|
28
|
+
</PageLayoutWithActiveEnvironment>
|
|
29
|
+
</Suspense>
|
|
30
|
+
</ErrorBoundary>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const PageLayoutWithActiveEnvironment: FC<PropsWithChildren> = ({
|
|
35
|
+
children,
|
|
36
|
+
...otherProps
|
|
37
|
+
}) => {
|
|
38
|
+
const { activeEnvironment } = useActiveEnvironment();
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<PageLayout
|
|
42
|
+
activeEnvironmentKind={activeEnvironment?.kind ?? "prod"}
|
|
43
|
+
{...otherProps}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</PageLayout>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
25
49
|
|
|
26
50
|
export const AppLayoutHeader: FC<PropsWithChildren> = ({
|
|
27
51
|
children,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Environment as EnvironmentType,
|
|
3
|
+
isUnauthenticatedError,
|
|
4
|
+
isUnauthorizedError,
|
|
5
|
+
} from "@slicemachine/manager/client";
|
|
6
|
+
|
|
7
|
+
import { useEnvironments } from "@src/features/environments/useEnvironments";
|
|
8
|
+
import { setEnvironment } from "@src/features/environments/actions/setEnvironment";
|
|
9
|
+
import { useActiveEnvironment } from "@src/features/environments/useActiveEnvironment";
|
|
10
|
+
import { getLegacySliceMachineState } from "@src/features/legacyState/actions/getLegacySliceMachineState";
|
|
11
|
+
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
12
|
+
|
|
13
|
+
import { SideNavEnvironmentSelector } from "@src/components/SideNav";
|
|
14
|
+
|
|
15
|
+
export function Environment() {
|
|
16
|
+
const { environments, error: useEnvironmentsError } = useEnvironments();
|
|
17
|
+
const { activeEnvironment } = useActiveEnvironment();
|
|
18
|
+
const { refreshState, openLoginModal } = useSliceMachineActions();
|
|
19
|
+
|
|
20
|
+
async function onSelect(environment: EnvironmentType) {
|
|
21
|
+
await setEnvironment(environment);
|
|
22
|
+
|
|
23
|
+
const legacySliceMachineState = await getLegacySliceMachineState();
|
|
24
|
+
|
|
25
|
+
refreshState(legacySliceMachineState);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (
|
|
29
|
+
isUnauthenticatedError(useEnvironmentsError) ||
|
|
30
|
+
isUnauthorizedError(useEnvironmentsError)
|
|
31
|
+
) {
|
|
32
|
+
return (
|
|
33
|
+
<SideNavEnvironmentSelector
|
|
34
|
+
variant="unauthorized"
|
|
35
|
+
onLogInClick={() => openLoginModal()}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<SideNavEnvironmentSelector
|
|
42
|
+
environments={environments}
|
|
43
|
+
activeEnvironment={activeEnvironment}
|
|
44
|
+
onSelect={onSelect}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
SideNavSeparator,
|
|
14
14
|
SideNavLink,
|
|
15
15
|
SideNavListItem,
|
|
16
|
-
SideNavLogo,
|
|
17
16
|
SideNavList,
|
|
18
17
|
UpdateInfo,
|
|
19
18
|
RightElement,
|
|
20
19
|
SideNav,
|
|
21
20
|
SideNavRepository,
|
|
22
21
|
} from "@src/components/SideNav/SideNav";
|
|
22
|
+
import { Divider } from "@src/components/Divider";
|
|
23
23
|
import { FolderIcon } from "@src/icons/FolderIcon";
|
|
24
24
|
import { userHasSeenTutorialsToolTip } from "@src/modules/userContext";
|
|
25
25
|
import { SliceMachineStoreType } from "@src/redux/type";
|
|
@@ -31,6 +31,9 @@ import {
|
|
|
31
31
|
} from "@src/modules/environment";
|
|
32
32
|
import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMessages";
|
|
33
33
|
import { ChangesListItem } from "./ChangesListItem";
|
|
34
|
+
import { Environment } from "./Environment";
|
|
35
|
+
|
|
36
|
+
import * as styles from "./index.css";
|
|
34
37
|
|
|
35
38
|
const Navigation: FC = () => {
|
|
36
39
|
const { changelog, repoName, apiEndpoint, hasSeenTutorialsToolTip } =
|
|
@@ -49,7 +52,17 @@ const Navigation: FC = () => {
|
|
|
49
52
|
|
|
50
53
|
return (
|
|
51
54
|
<SideNav>
|
|
52
|
-
<
|
|
55
|
+
<ErrorBoundary>
|
|
56
|
+
<Suspense>
|
|
57
|
+
<Environment />
|
|
58
|
+
</Suspense>
|
|
59
|
+
</ErrorBoundary>
|
|
60
|
+
|
|
61
|
+
<Divider
|
|
62
|
+
variant="edgeFaded"
|
|
63
|
+
color="grey6"
|
|
64
|
+
className={styles.environmentDivider}
|
|
65
|
+
/>
|
|
53
66
|
|
|
54
67
|
<SideNavRepository
|
|
55
68
|
repositoryName={repoName}
|
|
@@ -15,7 +15,7 @@ const Error = ({ msg }: { msg?: string }) => (
|
|
|
15
15
|
{msg || "Error!"}
|
|
16
16
|
</Text>
|
|
17
17
|
);
|
|
18
|
-
const
|
|
18
|
+
const VariationModal: React.FunctionComponent<{
|
|
19
19
|
isOpen: boolean;
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
onClose: () => any;
|
|
@@ -51,7 +51,7 @@ const AddVariationModal: React.FunctionComponent<{
|
|
|
51
51
|
const originError = !(
|
|
52
52
|
origin.value.length && variations.find((v) => v.id === origin.value)
|
|
53
53
|
)
|
|
54
|
-
? { id: "
|
|
54
|
+
? { id: "Yuu must select an existing variation!" }
|
|
55
55
|
: null;
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
57
57
|
const invalidIdError = id &&
|
|
@@ -236,4 +236,4 @@ const AddVariationModal: React.FunctionComponent<{
|
|
|
236
236
|
);
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
export default
|
|
239
|
+
export default VariationModal;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Box, Button } from "@prismicio/editor-ui";
|
|
2
2
|
import { useRouter } from "next/router";
|
|
3
|
-
import { type
|
|
3
|
+
import { type FC, useState } from "react";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import type { SliceBuilderState } from "@builders/SliceBuilder";
|
|
7
|
-
import { DeleteVariationModal } from "@components/DeleteVariationModal";
|
|
8
|
-
import { RenameVariationModal } from "@components/Forms/RenameVariationModal";
|
|
5
|
+
import VariationModal from "@builders/SliceBuilder/Sidebar/VariationModal";
|
|
9
6
|
import ScreenshotChangesModal from "@components/ScreenshotChangesModal";
|
|
10
7
|
import type { ComponentUI } from "@lib/models/common/ComponentUI";
|
|
11
8
|
import type { VariationSM } from "@lib/models/common/Slice";
|
|
@@ -18,43 +15,27 @@ import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
|
18
15
|
type SidebarProps = {
|
|
19
16
|
slice: ComponentUI;
|
|
20
17
|
variation: VariationSM;
|
|
21
|
-
|
|
22
|
-
setSliceBuilderState: Dispatch<SetStateAction<SliceBuilderState>>;
|
|
18
|
+
updateSlice: (slice: ComponentUI) => void;
|
|
23
19
|
};
|
|
24
20
|
|
|
25
|
-
type DialogState =
|
|
26
|
-
| { type: "ADD_VARIATION"; variation?: undefined }
|
|
27
|
-
| { type: "RENAME_VARIATION"; variation: VariationSM }
|
|
28
|
-
| { type: "DELETE_VARIATION"; variation: VariationSM }
|
|
29
|
-
| undefined;
|
|
30
|
-
|
|
31
21
|
export const Sidebar: FC<SidebarProps> = (props) => {
|
|
32
|
-
const { slice, variation,
|
|
22
|
+
const { slice, variation, updateSlice } = props;
|
|
33
23
|
|
|
34
|
-
const
|
|
24
|
+
const router = useRouter();
|
|
35
25
|
|
|
36
26
|
const screenshotChangesModal = useScreenshotChangesModal();
|
|
37
27
|
const { sliceFilterFn, defaultVariationSelector } =
|
|
38
28
|
screenshotChangesModal.modalPayload;
|
|
39
29
|
|
|
40
|
-
const
|
|
41
|
-
const
|
|
30
|
+
const [showVariationModal, setShowVariationModal] = useState(false);
|
|
31
|
+
const { copyVariationSlice } = useSliceMachineActions();
|
|
42
32
|
|
|
43
33
|
return (
|
|
44
34
|
<>
|
|
45
35
|
<Box flexDirection="column" gap={16}>
|
|
46
36
|
{slice.model.variations.map((v) => (
|
|
47
37
|
<SharedSliceCard
|
|
48
|
-
action={{
|
|
49
|
-
type: "menu",
|
|
50
|
-
onRename: () => {
|
|
51
|
-
setDialog({ type: "RENAME_VARIATION", variation: v });
|
|
52
|
-
},
|
|
53
|
-
onRemove: () => {
|
|
54
|
-
setDialog({ type: "DELETE_VARIATION", variation: v });
|
|
55
|
-
},
|
|
56
|
-
removeDisabled: slice.model.variations.length <= 1,
|
|
57
|
-
}}
|
|
38
|
+
action={{ type: "menu" }}
|
|
58
39
|
key={v.id}
|
|
59
40
|
mode="navigation"
|
|
60
41
|
onUpdateScreenshot={() => {
|
|
@@ -75,7 +56,7 @@ export const Sidebar: FC<SidebarProps> = (props) => {
|
|
|
75
56
|
))}
|
|
76
57
|
<Button
|
|
77
58
|
onClick={() => {
|
|
78
|
-
|
|
59
|
+
setShowVariationModal(true);
|
|
79
60
|
}}
|
|
80
61
|
startIcon="add"
|
|
81
62
|
sx={{ bottom: 72, marginInline: 24, position: "sticky" }}
|
|
@@ -88,31 +69,11 @@ export const Sidebar: FC<SidebarProps> = (props) => {
|
|
|
88
69
|
slices={sliceFilterFn([slice])}
|
|
89
70
|
defaultVariationSelector={defaultVariationSelector}
|
|
90
71
|
/>
|
|
91
|
-
<
|
|
92
|
-
isOpen={dialog?.type === "RENAME_VARIATION"}
|
|
93
|
-
onClose={() => {
|
|
94
|
-
setDialog(undefined);
|
|
95
|
-
}}
|
|
96
|
-
slice={slice}
|
|
97
|
-
variation={dialog?.variation}
|
|
98
|
-
sliceBuilderState={sliceBuilderState}
|
|
99
|
-
setSliceBuilderState={setSliceBuilderState}
|
|
100
|
-
/>
|
|
101
|
-
<DeleteVariationModal
|
|
102
|
-
isOpen={dialog?.type === "DELETE_VARIATION"}
|
|
103
|
-
onClose={() => {
|
|
104
|
-
setDialog(undefined);
|
|
105
|
-
}}
|
|
106
|
-
slice={slice}
|
|
107
|
-
variation={dialog?.variation}
|
|
108
|
-
sliceBuilderState={sliceBuilderState}
|
|
109
|
-
setSliceBuilderState={setSliceBuilderState}
|
|
110
|
-
/>
|
|
111
|
-
<AddVariationModal
|
|
72
|
+
<VariationModal
|
|
112
73
|
initialVariation={variation}
|
|
113
|
-
isOpen={
|
|
74
|
+
isOpen={showVariationModal}
|
|
114
75
|
onClose={() => {
|
|
115
|
-
|
|
76
|
+
setShowVariationModal(false);
|
|
116
77
|
}}
|
|
117
78
|
onSubmit={(id, name, copiedVariation) => {
|
|
118
79
|
copyVariationSlice(id, name, copiedVariation);
|
|
@@ -127,7 +88,7 @@ export const Sidebar: FC<SidebarProps> = (props) => {
|
|
|
127
88
|
variations: [...slice.model.variations, newVariation],
|
|
128
89
|
},
|
|
129
90
|
};
|
|
130
|
-
updateSlice(newSlice
|
|
91
|
+
updateSlice(newSlice);
|
|
131
92
|
|
|
132
93
|
const url = SLICES_CONFIG.getBuilderPagePathname({
|
|
133
94
|
libraryName: newSlice.href,
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { Box, Button } from "@prismicio/editor-ui";
|
|
2
|
-
import {
|
|
3
|
-
type Dispatch,
|
|
4
|
-
type FC,
|
|
5
|
-
type SetStateAction,
|
|
6
|
-
useEffect,
|
|
7
|
-
useState,
|
|
8
|
-
} from "react";
|
|
2
|
+
import React, { useState, useEffect } from "react";
|
|
9
3
|
|
|
10
|
-
import {
|
|
11
|
-
type ToastPayload,
|
|
12
|
-
handleRemoteResponse,
|
|
13
|
-
} from "@src/modules/toaster/utils";
|
|
4
|
+
import { handleRemoteResponse } from "@src/modules/toaster/utils";
|
|
14
5
|
|
|
15
6
|
import FieldZones from "./FieldZones";
|
|
16
7
|
import { Sidebar } from "./Sidebar";
|
|
@@ -36,7 +27,10 @@ import { selectIsSimulatorAvailableForFramework } from "@src/modules/environment
|
|
|
36
27
|
import { isSelectedSliceTouched } from "@src/modules/selectedSlice/selectors";
|
|
37
28
|
import { ComponentWithSliceProps } from "@src/layouts/WithSlice";
|
|
38
29
|
|
|
39
|
-
export type SliceBuilderState =
|
|
30
|
+
export type SliceBuilderState = {
|
|
31
|
+
loading: boolean;
|
|
32
|
+
done: boolean;
|
|
33
|
+
};
|
|
40
34
|
|
|
41
35
|
export const initialState: SliceBuilderState = {
|
|
42
36
|
loading: false,
|
|
@@ -44,60 +38,63 @@ export const initialState: SliceBuilderState = {
|
|
|
44
38
|
};
|
|
45
39
|
|
|
46
40
|
const SliceBuilder: ComponentWithSliceProps = ({ slice, variation }) => {
|
|
47
|
-
const { openToaster } = useSliceMachineActions();
|
|
41
|
+
const { openToaster, updateSlice } = useSliceMachineActions();
|
|
48
42
|
const isTouched = useSelector((store: SliceMachineStoreType) =>
|
|
49
43
|
isSelectedSliceTouched(store, slice.from, slice.model.id),
|
|
50
44
|
);
|
|
51
45
|
|
|
52
46
|
// We need to move this state to somewhere global to update the UI if any action from anywhere save or update to the filesystem I'd guess
|
|
53
|
-
const [
|
|
47
|
+
const [data, setData] = useState<SliceBuilderState>(initialState);
|
|
54
48
|
|
|
55
49
|
useEffect(() => {
|
|
56
50
|
if (isTouched) {
|
|
57
|
-
|
|
51
|
+
setData(initialState);
|
|
58
52
|
}
|
|
59
53
|
}, [isTouched]);
|
|
60
54
|
|
|
61
55
|
// activate/deactivate Success message
|
|
62
56
|
useEffect(() => {
|
|
63
|
-
if (
|
|
64
|
-
|
|
57
|
+
if (data.done) {
|
|
58
|
+
// @ts-expect-error TS(2345) FIXME: Argument of type '(content: string | React.ReactNo... Remove this comment to see the full error message
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
60
|
+
handleRemoteResponse(openToaster)(data);
|
|
65
61
|
}
|
|
66
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
-
}, [
|
|
63
|
+
}, [data]);
|
|
68
64
|
|
|
69
65
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
70
66
|
if (!variation) return <AppLayout />;
|
|
71
67
|
else
|
|
72
68
|
return (
|
|
73
69
|
<SliceBuilderForVariation
|
|
74
|
-
|
|
70
|
+
updateSlice={(slice) => {
|
|
71
|
+
updateSlice(slice, setData);
|
|
72
|
+
}}
|
|
75
73
|
slice={slice}
|
|
76
74
|
variation={variation}
|
|
77
75
|
isTouched={isTouched}
|
|
78
|
-
|
|
76
|
+
data={data}
|
|
79
77
|
/>
|
|
80
78
|
);
|
|
81
79
|
};
|
|
82
80
|
|
|
83
81
|
type SliceBuilderForVariationProps = {
|
|
84
|
-
|
|
82
|
+
updateSlice: (slice: ComponentUI) => void;
|
|
85
83
|
slice: ComponentUI;
|
|
86
84
|
variation: VariationSM;
|
|
87
85
|
isTouched: boolean;
|
|
88
|
-
|
|
86
|
+
data: SliceBuilderState;
|
|
89
87
|
};
|
|
90
|
-
const SliceBuilderForVariation: FC<SliceBuilderForVariationProps> = ({
|
|
91
|
-
|
|
88
|
+
const SliceBuilderForVariation: React.FC<SliceBuilderForVariationProps> = ({
|
|
89
|
+
updateSlice,
|
|
92
90
|
slice,
|
|
93
91
|
variation,
|
|
94
92
|
isTouched,
|
|
95
|
-
|
|
93
|
+
data,
|
|
96
94
|
}) => {
|
|
97
95
|
const isSimulatorAvailableForFramework = useSelector(
|
|
98
96
|
selectIsSimulatorAvailableForFramework,
|
|
99
97
|
);
|
|
100
|
-
const { updateSlice } = useSliceMachineActions();
|
|
101
98
|
|
|
102
99
|
return (
|
|
103
100
|
<AppLayout>
|
|
@@ -110,10 +107,10 @@ const SliceBuilderForVariation: FC<SliceBuilderForVariationProps> = ({
|
|
|
110
107
|
isTouched={!!isTouched}
|
|
111
108
|
/>
|
|
112
109
|
<Button
|
|
113
|
-
loading={
|
|
114
|
-
disabled={!isTouched ||
|
|
110
|
+
loading={data.loading}
|
|
111
|
+
disabled={!isTouched || data.loading}
|
|
115
112
|
onClick={() => {
|
|
116
|
-
updateSlice(slice
|
|
113
|
+
updateSlice(slice);
|
|
117
114
|
}}
|
|
118
115
|
data-cy="builder-save-button"
|
|
119
116
|
>
|
|
@@ -131,8 +128,7 @@ const SliceBuilderForVariation: FC<SliceBuilderForVariationProps> = ({
|
|
|
131
128
|
<Sidebar
|
|
132
129
|
slice={slice}
|
|
133
130
|
variation={variation}
|
|
134
|
-
|
|
135
|
-
setSliceBuilderState={setState}
|
|
131
|
+
updateSlice={updateSlice}
|
|
136
132
|
/>
|
|
137
133
|
<FieldZones variation={variation} />
|
|
138
134
|
</Box>
|
package/out/404.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>Slice Machine</title><meta name="next-head-count" content="3"/><link rel="preload" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>Slice Machine</title><meta name="next-head-count" content="3"/><link rel="preload" href="/_next/static/css/009bd7f5ac85fc6a.css" as="style"/><link rel="stylesheet" href="/_next/static/css/009bd7f5ac85fc6a.css" data-n-g=""/><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-2af35c541ee1bab0.js" defer=""></script><script src="/_next/static/chunks/pages/_error-69b4f498bafdd188.js" defer=""></script><script src="/_next/static/SPaOafYlpiOTCKrKML7gk/_buildManifest.js" defer=""></script><script src="/_next/static/SPaOafYlpiOTCKrKML7gk/_ssgManifest.js" defer=""></script></head><body><div id="__next"><style data-emotion="css-global 413pep">html{--theme-ui-colors-text:#25252D;--theme-ui-colors-textClear:#6F6E77;--theme-ui-colors-grayLight:#E8E8ED;--theme-ui-colors-hoverBackground:#f2f2f2;--theme-ui-colors-background:#FFF;--theme-ui-colors-backgroundClear:#FFF;--theme-ui-colors-primary:#5D40F7;--theme-ui-colors-purpleLight:#F6F1FC;--theme-ui-colors-purpleLight01:#6548FF1A;--theme-ui-colors-purple12:#F1EEFE;--theme-ui-colors-purpleStrong:#5842C3;--theme-ui-colors-whiteButtonText:#1A1523;--theme-ui-colors-codeBlockBackground:#32275F;--theme-ui-colors-failedConnectText:#86848D;--theme-ui-colors-changesWarning-background:#FFECC7;--theme-ui-colors-changesWarning-color:#5C0C17;--theme-ui-colors-greyIcon:#6F6E77;--theme-ui-colors-greyIconDisabled:#C9D0D8;--theme-ui-colors-missingScreenshotBanner-color:#5C0C17;--theme-ui-colors-missingScreenshotBanner-bg:#FFECC7;--theme-ui-colors-badge-new-bg:#DBEDDB;--theme-ui-colors-badge-new-color:#05644D;--theme-ui-colors-badge-modified-bg:#FFECC7;--theme-ui-colors-badge-modified-color:#5C0C17;--theme-ui-colors-badge-synced-bg:purple12;--theme-ui-colors-badge-synced-color:#5842C3;--theme-ui-colors-badge-deleted-bg:rgba(203, 36, 49, 0.1);--theme-ui-colors-badge-unknown-bg:#F3F5F7;--theme-ui-colors-badge-unknown-color:#9AA4AF;--theme-ui-colors-codeBlockBorder:#545454;--theme-ui-colors-secondary:#F9FAFB;--theme-ui-colors-danger:#CB2431;--theme-ui-colors-highlight:hsl(10, 40%, 90%);--theme-ui-colors-purple:#5B3DF5;--theme-ui-colors-purple08:#5842C3;--theme-ui-colors-muted:#F9F9FB;--theme-ui-colors-icons:#8091A5;--theme-ui-colors-gray:#F8F9FA;--theme-ui-colors-grey01:#F3F5F7;--theme-ui-colors-grey02:#E6E6EA;--theme-ui-colors-grey03:#F4F2F4;--theme-ui-colors-grey04:#9AA4AF;--theme-ui-colors-grey05:#667587;--theme-ui-colors-grey07:#F9F8F9;--theme-ui-colors-grey10:#86848D;--theme-ui-colors-grey12:#1A1523;--theme-ui-colors-greyTransparent:rgba(37, 37, 45, 0.4);--theme-ui-colors-borders:#E4E2E4;--theme-ui-colors-bordersFocused:#6E56CF;--theme-ui-colors-deep:#0E2150;--theme-ui-colors-deep1:#A0ADE7;--theme-ui-colors-lightGreen:#EBF8F1;--theme-ui-colors-lightOrange:#FDF4EC;--theme-ui-colors-darkOrange:#C17C10;--theme-ui-colors-error:#E55737;--theme-ui-colors-success:#3AB97A;--theme-ui-colors-headSection:#fff;--theme-ui-colors-warning:#E67E22;--theme-ui-colors-warning02:#ED811C;--theme-ui-colors-sidebar:#F1F1F4;--theme-ui-colors-link:#6E56CF;--theme-ui-colors-choggleBox:#5163BA;--theme-ui-colors-darkBorder:#DCDBDD;--theme-ui-colors-code-border:#DFE1E5;--theme-ui-colors-code-blue:#3B41BD;--theme-ui-colors-code-gray:#667587;--theme-ui-colors-code-orange:#EA6D46;--theme-ui-colors-code-green:#3AB97A;color:var(--theme-ui-colors-text);background-color:var(--theme-ui-colors-background);}html.theme-ui-light,.theme-ui-light html{--theme-ui-colors-text:#25252D;--theme-ui-colors-textClear:#6F6E77;--theme-ui-colors-grayLight:#E8E8ED;--theme-ui-colors-hoverBackground:#f2f2f2;--theme-ui-colors-background:#FFF;--theme-ui-colors-backgroundClear:#FFF;--theme-ui-colors-primary:#5D40F7;--theme-ui-colors-purpleLight:#F6F1FC;--theme-ui-colors-purpleLight01:#6548FF1A;--theme-ui-colors-purple12:#F1EEFE;--theme-ui-colors-purpleStrong:#5842C3;--theme-ui-colors-whiteButtonText:#1A1523;--theme-ui-colors-codeBlockBackground:#32275F;--theme-ui-colors-failedConnectText:#86848D;--theme-ui-colors-changesWarning-background:#FFECC7;--theme-ui-colors-changesWarning-color:#5C0C17;--theme-ui-colors-greyIcon:#6F6E77;--theme-ui-colors-greyIconDisabled:#C9D0D8;--theme-ui-colors-missingScreenshotBanner-color:#5C0C17;--theme-ui-colors-missingScreenshotBanner-bg:#FFECC7;--theme-ui-colors-badge-new-bg:#DBEDDB;--theme-ui-colors-badge-new-color:#05644D;--theme-ui-colors-badge-modified-bg:#FFECC7;--theme-ui-colors-badge-modified-color:#5C0C17;--theme-ui-colors-badge-synced-bg:purple12;--theme-ui-colors-badge-synced-color:#5842C3;--theme-ui-colors-badge-deleted-bg:rgba(203, 36, 49, 0.1);--theme-ui-colors-badge-unknown-bg:#F3F5F7;--theme-ui-colors-badge-unknown-color:#9AA4AF;--theme-ui-colors-codeBlockBorder:#545454;--theme-ui-colors-secondary:#F9FAFB;--theme-ui-colors-danger:#CB2431;--theme-ui-colors-highlight:hsl(10, 40%, 90%);--theme-ui-colors-purple:#5B3DF5;--theme-ui-colors-purple08:#5842C3;--theme-ui-colors-muted:#F9F9FB;--theme-ui-colors-icons:#8091A5;--theme-ui-colors-gray:#F8F9FA;--theme-ui-colors-grey01:#F3F5F7;--theme-ui-colors-grey02:#E6E6EA;--theme-ui-colors-grey03:#F4F2F4;--theme-ui-colors-grey04:#9AA4AF;--theme-ui-colors-grey05:#667587;--theme-ui-colors-grey07:#F9F8F9;--theme-ui-colors-grey10:#86848D;--theme-ui-colors-grey12:#1A1523;--theme-ui-colors-greyTransparent:rgba(37, 37, 45, 0.4);--theme-ui-colors-borders:#E4E2E4;--theme-ui-colors-bordersFocused:#6E56CF;--theme-ui-colors-deep:#0E2150;--theme-ui-colors-deep1:#A0ADE7;--theme-ui-colors-lightGreen:#EBF8F1;--theme-ui-colors-lightOrange:#FDF4EC;--theme-ui-colors-darkOrange:#C17C10;--theme-ui-colors-error:#E55737;--theme-ui-colors-success:#3AB97A;--theme-ui-colors-headSection:#fff;--theme-ui-colors-warning:#E67E22;--theme-ui-colors-warning02:#ED811C;--theme-ui-colors-sidebar:#F1F1F4;--theme-ui-colors-link:#6E56CF;--theme-ui-colors-choggleBox:#5163BA;--theme-ui-colors-darkBorder:#DCDBDD;--theme-ui-colors-code-border:#DFE1E5;--theme-ui-colors-code-blue:#3B41BD;--theme-ui-colors-code-gray:#667587;--theme-ui-colors-code-orange:#EA6D46;--theme-ui-colors-code-green:#3AB97A;}html.theme-ui-dark,.theme-ui-dark html{--theme-ui-colors-text:#fff;--theme-ui-colors-textClear:#6E707B;--theme-ui-colors-hoverBackground:#202020;--theme-ui-colors-grey02:#E6E6EA;--theme-ui-colors-background:#202022;--theme-ui-colors-backgroundClear:#28282C;--theme-ui-colors-primary:#4E54D7;--theme-ui-colors-secondary:#28282C;--theme-ui-colors-icons:#5D5D71;--theme-ui-colors-gray:#1D1D1F;--theme-ui-colors-borders:#3A3A46;--theme-ui-colors-deep:#28282C;--theme-ui-colors-headSection:#28282C;--theme-ui-colors-warning:#E67E22;--theme-ui-colors-sidebar:#28282C;--theme-ui-colors-code-border:#5D5D6F;--theme-ui-colors-code-blue:#3B41BD;--theme-ui-colors-code-gray:#667587;--theme-ui-colors-code-orange:#EA6D46;--theme-ui-colors-code-green:#3AB97A;--theme-ui-colors-link:#A9A9C6;--theme-ui-colors-choggleBox:#fff;}</style><style data-emotion="css-global h19pgh">*{box-sizing:border-box;}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",sans-serif;line-height:1.5;font-weight:400;}body{margin:0;}</style><style data-emotion="css yvak7d">.css-yvak7d{box-sizing:border-box;margin:0;min-width:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:calc(100vh - 57px);width:100vw;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}</style><div class="css-yvak7d"><style data-emotion="css uqm8ih">.css-uqm8ih{box-sizing:border-box;margin:0;min-width:0;color:var(--theme-ui-colors-primary);overflow:visible;}</style><svg stroke-width="4" viewBox="0 0 32 32" width="48" height="48" fill="none" stroke="currentColor" role="img" id="spinner" class="css-uqm8ih"><title>Loading</title><circle stroke-width="4" r="12" cx="16" cy="16" fill="none" opacity="0.125"></circle><circle stroke-width="4" r="12" cx="16" cy="16" fill="none" stroke-dasharray="20 110"><animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0 16 16" to="360 16 16" dur="750ms" repeatCount="indefinite"></animateTransform></circle></svg></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"SPaOafYlpiOTCKrKML7gk","runtimeConfig":{"sentryEnvironment":"alpha"},"nextExport":true,"isFallback":false,"gip":true,"appGip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,n,
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,f,n,u){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[c,i,b,"static/chunks/pages/index-941b44c74dd339e4.js"],"/_error":["static/chunks/pages/_error-69b4f498bafdd188.js"],"/changelog":["static/chunks/870-0c7a8a9622de78b7.js","static/chunks/pages/changelog-4b8369d91d82b28b.js"],"/changes":[a,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-38d08f1e885b222d.js",s,e,"static/css/51597cd1f01c4889.css","static/chunks/pages/changes-db6e8c6be5ae076e.js"],"/custom-types":[c,i,b,"static/chunks/pages/custom-types-2f5664d9492b13fb.js"],"/custom-types/[customTypeId]":[f,s,c,t,n,u,"static/chunks/pages/custom-types/[customTypeId]-3a37eb3373bb8823.js"],"/labs":["static/chunks/pages/labs-2922105ab714d32a.js"],"/page-types/[pageTypeId]":[f,s,c,t,n,u,"static/chunks/pages/page-types/[pageTypeId]-733f3890c0466a05.js"],"/slices":[a,s,e,"static/css/867d8d7ab4a75762.css","static/chunks/pages/slices-93b7af2624c85b8e.js"],"/slices/[lib]/[sliceName]/[variation]":[a,s,e,t,"static/css/6e4843007ff41825.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ca780766d02c801b.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[a,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/18539003-371d86ea83e7293b.js","static/chunks/125-f0e2eb84ee39757a.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-79a62d775e64898c.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/958-be627006594efb21.js","static/chunks/550-e72c08c598051224.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/80-821a0b5d4ad61185.js","static/chunks/482-39cef3a713901788.js","static/chunks/840-5b485c737b24324b.js","static/css/16b41648cd1de03b.css","static/chunks/474-2393e400314474be.js","static/chunks/904-e290f0254cc4b5df.js","static/css/3e88bd24e38f18d0.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[840],{80131:function(e,n,t){"use strict";t.d(n,{M:function(){return w}});var r=t(62230),s=t(85244),a=t(52322),l=t(2784),c=t(75289),i=t(56580),d=t(68780),o=t(70041),u=t(17064),h=t(63397),x=t(78656),C=t(98240),f=function(e){var n=e.selected,t=(0,C.Z)(e,["selected"]);return(0,a.jsx)(c.kC,(0,r.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},t))},p=function(e){var n=e.format,t=(0,u.Z)((0,h.U$)("repeatable"),3),r=t[0],s=t[2],l=x.$[n];return(0,a.jsxs)(c.xu,{mb:2,children:[(0,a.jsxs)(f,{selected:r.value,onClick:function(){return s.setValue(!0)},children:[(0,a.jsx)(c.Y8,{checked:r.value,onChange:function(){},"data-cy":"repeatable-type-radio-btn"}),(0,a.jsxs)(c.xu,{sx:{marginLeft:2},children:["Reusable type",(0,a.jsx)(c.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:l.hintRepeatable})]})]}),(0,a.jsxs)(f,{selected:!r.value,onClick:function(){return s.setValue(!1)},children:[(0,a.jsx)(c.Y8,{checked:!r.value,onChange:function(){},"data-cy":"single-type-radio-btn"}),(0,a.jsxs)(c.xu,{sx:{marginLeft:2},children:["Single type",(0,a.jsx)(c.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:l.hintSingle})]})]})]})},m=t(90374),j=t(49471),g=t(77174),v=t(24340),_=t(32665),y=t(3098),b=t(82770),T=t(38876),L=t(75329),w=function(e){var n=e.format,t=e.origin,u=void 0===t?"table":t,h=(0,m.Z)(),C=h.createCustomType,f=h.closeModals,w=(0,i.v9)(function(e){return{customTypeIds:(0,j.W6)(e),customTypeLabels:(0,j.YS)(e),isCreateCustomTypeModalOpen:(0,g.gP)(e,v.q.CREATE_CUSTOM_TYPE),isCreatingCustomType:(0,_.hg)(e,y.z.CREATE_CUSTOM_TYPE)}}),S=w.customTypeIds,k=w.isCreateCustomTypeModalOpen,Z=w.isCreatingCustomType,H=w.customTypeLabels,M=x.$[n],N=(0,l.useState)(!0),E=N[0],I=N[1],R=function(e){var t=e.id,r=e.label,s=e.repeatable,a=r||t;b.Xe.track({event:"custom-type:created",id:t,name:a,format:n,type:s?"repeatable":"single",origin:u}),C(t,a,s,n),f(),I(!0)},V=function(e,n,t){t(E?(0,s.Z)((0,r.Z)({},n),{label:e.target.value,id:(0,T.lV)(e.target.value)}):(0,s.Z)((0,r.Z)({},n),{label:e.target.value}))},z=function(e,n){n("id",e.target.value),I(!1)};return(0,a.jsx)(d.Z,{dataCy:"create-ct-modal",isOpen:k,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){f(),I(!0)},onSubmit:R,isLoading:Z,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,t=e.label,r={};return t&&t.length||(r.label="Cannot be empty."),!r.label&&H.includes(t)&&(r.label="".concat(M.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(r.id="ID cannot be empty."),r.id||!n||L.xo.exec(n)||(r.id="Invalid id: No special characters allowed."),!r.id&&n&&S.map(function(e){return e.toLowerCase()}).includes(n)&&(r.id='ID "'.concat(n,'" exists already.')),Object.keys(r).length>0?r:void 0},content:{title:"Create a new ".concat(M.name({start:!1,plural:!1}))},children:function(e){var t=e.errors,r=e.setValues,s=e.setFieldValue,l=e.values,i=e.touched;return(0,a.jsxs)(c.xu,{children:[(0,a.jsx)(p,{format:n}),(0,a.jsx)(o.W,{name:"label",label:"".concat(M.name({start:!0,plural:!1})," Name"),dataCy:"ct-name-input",placeholder:"A display name for the ".concat(M.name({start:!1,plural:!1})),error:i.label?t.label:void 0,onChange:function(e){return V(e,l,r)}}),(0,a.jsx)(o.W,{name:"id",dataCy:"ct-id-input",label:"".concat(M.name({start:!0,plural:!1})," ID"),placeholder:M.inputPlaceholder,error:i.id?t.id:void 0,onChange:function(e){return z(e,s)}})]})}})}},840:function(e,n,t){"use strict";t.d(n,{F:function(){return D}});var r=t(52322),s=t(2784),a=t(22715),l=t(97729),c=t.n(l),i=t(56580),d=t(5327),o=t(90374),u=t(32665),h=t(3098),x=t(80131),C=t(78656),f=t(5632),p=t(67557),m=t(50002),j=t(6277);t(80207);var g=function(e){var n=e.children;return(0,r.jsx)("div",{className:"_1ecs97de7i _1ecs97de7n _1ecs97d39c _1ecs97d3gp _1ecs97de99 _1ecs97deal _1ecs97deaz _1ecs97de89",children:(0,r.jsx)("table",{className:"gdfsm51 _1ecs97de7i _1ecs97de7n _1ecs97dec6 _1ecs97ded9",children:n})})},v=(0,s.createContext)("body");function _(){return(0,s.useContext)(v)}var y=function(e){var n=e.children;return(0,r.jsx)(v.Provider,{value:"head",children:(0,r.jsx)("thead",{className:"gdfsm52 _1ecs97de7i _1ecs97de7n _1ecs97d18 _1ecs97d8l",children:n})})},b=function(e){var n=e.children;return(0,r.jsx)(v.Provider,{value:"body",children:(0,r.jsx)("tbody",{className:"gdfsm53 _1ecs97de7i _1ecs97de7n",children:n})})},T=function(e){var n,t=e.children,s=e.onClick,a=_();return(0,r.jsx)("tr",{className:(0,j.W)("_1ecs97de7i _1ecs97de7n _1ecs97deff",(n={},(0,p.Z)(n,"_1ecs97decf",!!s),(0,p.Z)(n,"_1ecs97dm _1ecs97d7z _1ecs97d3c _1ecs97dap _1ecs97d2w _1ecs97da9 _1ecs97defi _1ecs97der0 _1ecs97de8v _1ecs97der3","body"===a),n)),onClick:function(e){var n,t=e.target;if(s&&e.currentTarget.contains(t)){var r=(0,m.JY)(t);(null===(n=null==r?void 0:r.contains(e.currentTarget))||void 0===n||n)&&s(e)}},children:t})},L=function(e){var n=e.children,t=_();return(0,r.jsx)("head"===t?"th":"td",{className:"gdfsm55 _1ecs97de7i _1ecs97de7n _1ecs97d39c _1ecs97d3gp _1ecs97deaz _1ecs97de7j _1ecs97d9nq _1ecs97d9v3 _1ecs97decj _1ecs97depd",children:(0,r.jsx)("div",{className:"gdfsm56 _1ecs97de7i _1ecs97de7k",children:n})})},w=function(){return(0,r.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,r.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.0912 12C13.2794 12 11 14.2794 11 17.0912C11 19.903 13.2794 22.1824 16.0912 22.1824C17.9763 22.1824 19.6215 21.1577 20.501 19.6372C20.6563 19.3688 20.7878 19.0849 20.8926 18.7883C20.9846 18.5279 20.8482 18.2422 20.5878 18.1502C20.3275 18.0582 20.0418 18.1947 19.9498 18.455C19.8657 18.693 19.7601 18.9209 19.6354 19.1365C18.9273 20.3606 17.6049 21.1824 16.0912 21.1824C13.8317 21.1824 12 19.3507 12 17.0912C12 14.8317 13.8317 13 16.0912 13C17.4478 13 18.6507 13.66 19.3955 14.6782H17.6216C17.3455 14.6782 17.1216 14.9021 17.1216 15.1782C17.1216 15.4544 17.3455 15.6782 17.6216 15.6782H20.2998C20.576 15.6782 20.7998 15.4544 20.7998 15.1782V12.5C20.7998 12.2239 20.576 12 20.2998 12C20.0237 12 19.7998 12.2239 19.7998 12.5V13.6032C18.8717 12.6167 17.5536 12 16.0912 12Z",fill:"white"})]})},S=function(){return(0,r.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,r.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0869 14.6818L14.6627 12.3787C14.7183 12.1561 14.9183 12 15.1477 12C15.473 12 15.7117 12.3057 15.6328 12.6213L15.1177 14.6818H17.7232L18.299 12.3787C18.3547 12.1561 18.5547 12 18.7841 12C19.1094 12 19.3481 12.3057 19.2692 12.6213L18.754 14.6818H21C21.2761 14.6818 21.5 14.9057 21.5 15.1818C21.5 15.458 21.2761 15.6818 21 15.6818H18.504L17.8449 18.3182H20C20.2761 18.3182 20.5 18.542 20.5 18.8182C20.5 19.0943 20.2761 19.3182 20 19.3182H17.5949L17.0192 21.6213C16.9635 21.8439 16.7635 22 16.5341 22C16.2088 22 15.9701 21.6943 16.049 21.3787L16.5642 19.3182H13.9586L13.3828 21.6213C13.3272 21.8439 13.1272 22 12.8977 22C12.5724 22 12.3338 21.6943 12.4127 21.3787L12.9278 19.3182H11C10.7239 19.3182 10.5 19.0943 10.5 18.8182C10.5 18.542 10.7239 18.3182 11 18.3182H13.1778L13.8369 15.6818H12C11.7239 15.6818 11.5 15.458 11.5 15.1818C11.5 14.9057 11.7239 14.6818 12 14.6818H14.0869ZM16.8142 18.3182L17.4732 15.6818H14.8677L14.2086 18.3182H16.8142Z",fill:"white"})]})},k=t(67445),Z=t(22710),H=t(99267),M=t(17329),N=t(40147),E=t(49471),I=t(7819),R=t(75708);function V(e){return z.apply(this,arguments)}function z(){return(z=(0,Z.Z)(function(e){var n,t,r;return(0,H.__generator)(this,function(s){switch(s.label){case 0:return[4,N.j.customTypes.readAllCustomTypes({format:e})];case 1:if(t=(n=s.sent()).errors,r=n.models,t.length>0)throw t;return[2,r.map(function(e){return e.model})]}})})).apply(this,arguments)}var P=t(2754),O=t(62607),A=function(e){var n,t,l,c,d,u,h=e.format,x=e.isCreatingCustomType,p=(0,o.Z)().openCreateCustomTypeModal,m=(0,f.useRouter)(),j=(t=(0,s.useCallback)(function(e){return(0,M.VA)(V,[h],e)},[h]),{customTypes:(0,M.QT)(V,[h]),updateCustomTypes:t}),v=j.customTypes,_=j.updateCustomTypes,Z=v.sort(function(e,n){return e.id.localeCompare(n.id)}),H=k.cd[h],N=C.$[h];return(u=(0,i.v9)(function(e){return{storeCustomTypes:(0,E.Ch)(e).filter(I.TG)}}).storeCustomTypes,(0,s.useEffect)(function(){var e=u.filter(function(e){return e.local.format===h});(e.length!==v.length||e.some(function(e){var n=v.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(R.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&_(e.map(function(e){var n=e.local;return R.Dc.fromSM(n)}))},[h,_,v,u]),0===Z.length)?(0,r.jsxs)(P.R$,{style:{alignSelf:"center",marginTop:a.TV.size[72]},children:[(0,r.jsx)(P.u2,{children:(0,r.jsx)(a.Ee,{src:H.blankSlateImage,sizing:"cover"})}),(0,r.jsxs)(P.T9,{children:[(0,r.jsx)(P._T,{children:N.name({start:!0,plural:!0})}),(0,r.jsx)(P.nf,{children:N.blankSlateDescription}),(0,r.jsx)(P.Qj,{children:(0,r.jsx)(a.zx,{onClick:p,loading:x,children:"Create"})})]})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(g,{children:[(0,r.jsx)(y,{children:(0,r.jsxs)(T,{children:[(0,r.jsx)(L,{children:(0,r.jsx)(a.I5,{name:"notes",size:"medium"})}),(0,r.jsx)(L,{children:"Label"}),(0,r.jsx)(L,{children:"API ID"}),(0,r.jsx)(L,{children:"Limit"}),(0,r.jsx)(L,{})]})}),(0,r.jsx)(b,{children:Z.map(function(e){var n=e.repeatable,t=e.label,s=e.id;return(0,r.jsxs)(T,{onClick:function(){m.push(k.cd[h].getBuilderPagePathname(s))},children:[(0,r.jsx)(L,{children:n?(0,r.jsx)(w,{}):(0,r.jsx)(S,{})}),(0,r.jsx)(L,{children:t}),(0,r.jsx)(L,{children:s}),(0,r.jsx)(L,{children:n?"Reusable":"Single"}),(0,r.jsx)(L,{children:(0,r.jsx)(O._,{isChangesLocal:!1,format:h,customType:e})})]},s)})})]})})},D=function(e){var n=e.format,t=C.$[n],l=(0,o.Z)().openCreateCustomTypeModal,f=(0,i.v9)(function(e){return{isCreatingCustomType:(0,u.hg)(e,h.z.CREATE_CUSTOM_TYPE)}}).isCreatingCustomType;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c(),{children:(0,r.jsxs)("title",{children:[t.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,r.jsx)(a.SV,{renderError:function(){return(0,r.jsx)(d.LN,{children:(0,r.jsx)(d.RN,{children:(0,r.jsx)(a.xu,{alignItems:"center",justifyContent:"center",children:(0,r.jsx)(a.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(t.name({start:!1,plural:!0}),".")})})})})},children:(0,r.jsx)(s.Suspense,{fallback:(0,r.jsxs)(d.LN,{children:[(0,r.jsxs)(d.wd,{children:[(0,r.jsx)(d.Cx,{folder:t.name({start:!0,plural:!0})}),(0,r.jsx)(d.K2,{children:(0,r.jsx)(a.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,r.jsx)(d.RN,{children:(0,r.jsx)(a._3,{})})]}),children:(0,r.jsxs)(d.LN,{children:[(0,r.jsxs)(d.wd,{children:[(0,r.jsx)(d.Cx,{folder:t.name({start:!0,plural:!0})}),(0,r.jsx)(d.K2,{children:(0,r.jsx)(a.zx,{"data-cy":"create-ct",loading:f,onClick:l,startIcon:"add",children:"Create"})})]}),(0,r.jsx)(d.RN,{children:(0,r.jsxs)(a.xu,{flexDirection:"column",children:[(0,r.jsx)(A,{format:n,isCreatingCustomType:f}),(0,r.jsx)(x.M,{format:n})]})})]})})})]})}},80207:function(){}}]);
|