slice-machine-ui 2.17.2-beta.3 → 2.17.3-alpha.dani-git-integration.1
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/Dspi7FlwsRsCyYdANJ8OZ/_buildManifest.js +1 -0
- package/out/_next/static/chunks/248-6f20227ad4764216.js +1 -0
- package/out/_next/static/chunks/34-6c3125e6f01c62c7.js +1 -0
- package/out/_next/static/chunks/489-eaa4848c00e8986b.js +1 -0
- package/out/_next/static/chunks/pages/{_app-33d293c68b7c0a17.js → _app-e874a85ca6fd4980.js} +1 -1
- package/out/_next/static/chunks/pages/changelog-98836c22c6a40c5d.js +1 -0
- package/out/_next/static/chunks/pages/changes-db800bf4a08faa31.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-a408f5a660e096a6.js → [customTypeId]-041985d94bb9649f.js} +1 -1
- package/out/_next/static/chunks/pages/labs-ad7f36c6f544c1a8.js +1 -0
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-f5e851ebe35049a8.js → [pageTypeId]-338f685c0723043b.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-0bc862dd7bd99611.js +1 -0
- package/out/_next/static/chunks/pages/slices-6dbc3df2c4ef058a.js +1 -0
- 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/src/components/FieldSet/FieldSet.stories.tsx +5 -27
- package/src/features/changes/PushChangesButton.tsx +4 -67
- package/src/features/environments/actions/getActiveEnvironment.ts +20 -5
- package/src/features/navigation/Navigation.tsx +3 -17
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +2 -10
- package/src/legacy/components/AppLayout/index.tsx +34 -2
- package/src/legacy/components/Navigation/Environment.tsx +11 -3
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +19 -24
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +1 -6
- package/out/_next/static/8xVz5YQwOY20VZPYTBtRF/_buildManifest.js +0 -1
- package/out/_next/static/chunks/248-03446cd9e9f13730.js +0 -1
- package/out/_next/static/chunks/34-e684c5fd75cc9dd0.js +0 -1
- package/out/_next/static/chunks/882-151468121d542ed6.js +0 -1
- package/out/_next/static/chunks/pages/changelog-063c5e11dfc8fd55.js +0 -1
- package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +0 -1
- package/out/_next/static/chunks/pages/labs-9630bfb1005be02b.js +0 -1
- package/out/_next/static/chunks/pages/settings-01f4aeb9112a1f87.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-bd5e45632c419567.js +0 -1
- package/out/_next/static/chunks/pages/slices-4a60cd5f2c71327e.js +0 -1
- package/out/_next/static/css/e5f781f20e24a5ea.css +0 -1
- package/out/settings.html +0 -1
- package/out/videoHighlights.png +0 -0
- package/public/videoHighlights.png +0 -0
- package/src/features/settings/SettingsPage.tsx +0 -50
- package/src/features/settings/git/ConnectGitRepository.tsx +0 -112
- package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +0 -33
- package/src/features/settings/git/GitOwnerSelect.tsx +0 -71
- package/src/features/settings/git/GitProvider.ts +0 -40
- package/src/features/settings/git/GitProviderConnectButtons.tsx +0 -63
- package/src/features/settings/git/GitRepositoriesList.tsx +0 -76
- package/src/features/settings/git/GitRepositoriesSearch.tsx +0 -69
- package/src/features/settings/git/GitRepositoryConnectDialog.tsx +0 -97
- package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +0 -62
- package/src/features/settings/git/useGitIntegrationExperiment.ts +0 -8
- package/src/features/settings/git/useGitOwners.ts +0 -12
- package/src/features/settings/git/useGitRepos.ts +0 -24
- package/src/features/settings/git/useLinkedGitRepos.ts +0 -41
- package/src/features/settings/git/useWriteAPIToken.ts +0 -23
- package/src/icons/BitbucketIcon.tsx +0 -19
- package/src/icons/GitHubIcon.tsx +0 -17
- package/src/icons/GitLabIcon.tsx +0 -19
- package/src/icons/SettingsIcon.tsx +0 -19
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/sliceTemplatesComingSoon.ts +0 -30
- package/src/pages/settings.tsx +0 -1
- /package/out/_next/static/{8xVz5YQwOY20VZPYTBtRF → Dspi7FlwsRsCyYdANJ8OZ}/_ssgManifest.js +0 -0
|
@@ -1,83 +1,20 @@
|
|
|
1
|
-
import { Button
|
|
1
|
+
import { Button } from "@prismicio/editor-ui";
|
|
2
2
|
import {
|
|
3
3
|
type ComponentPropsWithoutRef,
|
|
4
4
|
type ElementRef,
|
|
5
|
-
type FC,
|
|
6
5
|
forwardRef,
|
|
7
|
-
type ReactNode,
|
|
8
|
-
Suspense,
|
|
9
6
|
} from "react";
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
import { gitProviderToConfig } from "@/features/settings/git/GitProvider";
|
|
13
|
-
import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
|
|
14
|
-
import { useLinkedGitRepos } from "@/features/settings/git/useLinkedGitRepos";
|
|
15
|
-
|
|
16
|
-
type PushChangesButtonProps = Required<BarePushChangesButtonProps>;
|
|
17
|
-
|
|
18
|
-
export const PushChangesButton: FC<PushChangesButtonProps> = (props) => (
|
|
19
|
-
<ErrorBoundary renderError={renderError}>
|
|
20
|
-
<Suspense fallback={<PushChangesButtonSkeleton />}>
|
|
21
|
-
<PushChangesButtonUsingGitIntegrationExperiment {...props} />
|
|
22
|
-
</Suspense>
|
|
23
|
-
</ErrorBoundary>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const PushChangesButtonUsingGitIntegrationExperiment: FC<
|
|
27
|
-
PushChangesButtonProps
|
|
28
|
-
> = (props) => {
|
|
29
|
-
const gitIntegrationExperiment = useGitIntegrationExperiment();
|
|
30
|
-
return gitIntegrationExperiment.eligible ? (
|
|
31
|
-
<PushChangesButtonUsingLinkedGitRepos {...props} />
|
|
32
|
-
) : (
|
|
33
|
-
<BarePushChangesButton {...props} />
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const PushChangesButtonUsingLinkedGitRepos: FC<PushChangesButtonProps> = (
|
|
38
|
-
props,
|
|
39
|
-
) => {
|
|
40
|
-
const { linkedGitRepos } = useLinkedGitRepos();
|
|
41
|
-
if (linkedGitRepos.length > 0) {
|
|
42
|
-
const providerConfig = gitProviderToConfig[linkedGitRepos[0].provider];
|
|
43
|
-
return (
|
|
44
|
-
<Tooltip
|
|
45
|
-
content={`This project uses the Git workflow. Update Prismic by pushing your changes to ${providerConfig.name}.`}
|
|
46
|
-
side="bottom"
|
|
47
|
-
>
|
|
48
|
-
<BarePushChangesButton disabled />
|
|
49
|
-
</Tooltip>
|
|
50
|
-
);
|
|
51
|
-
} else {
|
|
52
|
-
return <BarePushChangesButton {...props} />;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
type BarePushChangesButtonProps = Pick<
|
|
8
|
+
type PushChangesButtonProps = Pick<
|
|
57
9
|
ComponentPropsWithoutRef<typeof Button>,
|
|
58
10
|
"disabled" | "loading" | "onClick"
|
|
59
11
|
>;
|
|
60
12
|
|
|
61
|
-
const
|
|
13
|
+
export const PushChangesButton = forwardRef<
|
|
62
14
|
ElementRef<typeof Button>,
|
|
63
|
-
|
|
15
|
+
PushChangesButtonProps
|
|
64
16
|
>((props, ref) => (
|
|
65
17
|
<Button {...props} ref={ref} startIcon="upload">
|
|
66
18
|
Push
|
|
67
19
|
</Button>
|
|
68
20
|
));
|
|
69
|
-
|
|
70
|
-
function renderError(): ReactNode {
|
|
71
|
-
return (
|
|
72
|
-
<Tooltip
|
|
73
|
-
content="An error occurred while fetching the list of connected Git repositories."
|
|
74
|
-
side="bottom"
|
|
75
|
-
>
|
|
76
|
-
<BarePushChangesButton disabled />
|
|
77
|
-
</Tooltip>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const PushChangesButtonSkeleton: FC = () => (
|
|
82
|
-
<Skeleton height={32} width={71.32} />
|
|
83
|
-
);
|
|
@@ -5,6 +5,10 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import { managerClient } from "@/managerClient";
|
|
7
7
|
|
|
8
|
+
type GetActiveEnvironmentArgs = {
|
|
9
|
+
retried?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
8
12
|
type GetActiveEnvironmentReturnType =
|
|
9
13
|
| {
|
|
10
14
|
activeEnvironment: Environment;
|
|
@@ -15,18 +19,29 @@ type GetActiveEnvironmentReturnType =
|
|
|
15
19
|
error: unknown;
|
|
16
20
|
};
|
|
17
21
|
|
|
18
|
-
export async function getActiveEnvironment(
|
|
22
|
+
export async function getActiveEnvironment(
|
|
23
|
+
args?: GetActiveEnvironmentArgs,
|
|
24
|
+
): Promise<GetActiveEnvironmentReturnType> {
|
|
25
|
+
const { retried = false } = args ?? {};
|
|
26
|
+
|
|
19
27
|
try {
|
|
20
|
-
const
|
|
28
|
+
const activeEnvironmentResult =
|
|
21
29
|
await managerClient.project.fetchActiveEnvironment();
|
|
22
30
|
|
|
23
|
-
|
|
31
|
+
if (activeEnvironmentResult.type === "error") {
|
|
32
|
+
const errorInstance = new Error(activeEnvironmentResult.error.message);
|
|
33
|
+
errorInstance.name = activeEnvironmentResult.error.name;
|
|
34
|
+
throw errorInstance;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return { activeEnvironment: activeEnvironmentResult.activeEnvironment };
|
|
24
38
|
} catch (error) {
|
|
25
|
-
if (isInvalidActiveEnvironmentError(error)) {
|
|
39
|
+
if (isInvalidActiveEnvironmentError(error) && !retried) {
|
|
26
40
|
// Reset to the production environment.
|
|
27
41
|
await managerClient.project.updateEnvironment({ environment: undefined });
|
|
28
42
|
|
|
29
|
-
|
|
43
|
+
// Call recursively with isRetry=true to prevent infinite loop if it fails again and again.
|
|
44
|
+
return await getActiveEnvironment({ retried: true });
|
|
30
45
|
}
|
|
31
46
|
|
|
32
47
|
return { error };
|
|
@@ -8,13 +8,11 @@ import { CUSTOM_TYPES_CONFIG } from "@/features/customTypes/customTypesConfig";
|
|
|
8
8
|
import { CUSTOM_TYPES_MESSAGES } from "@/features/customTypes/customTypesMessages";
|
|
9
9
|
import { RepositoryInfo } from "@/features/navigation/RepositoryInfo";
|
|
10
10
|
import { OnboardingGuide } from "@/features/onboarding";
|
|
11
|
-
import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
|
|
12
11
|
import { useAdapterName } from "@/hooks/useAdapterName";
|
|
13
12
|
import { useMarketingContent } from "@/hooks/useMarketingContent";
|
|
14
13
|
import { FolderIcon } from "@/icons/FolderIcon";
|
|
15
14
|
import { LightningIcon } from "@/icons/Lightning";
|
|
16
15
|
import { MenuBookIcon } from "@/icons/MenuBookIcon";
|
|
17
|
-
import { SettingsIcon } from "@/icons/SettingsIcon";
|
|
18
16
|
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
|
|
19
17
|
|
|
20
18
|
import { ChangesItem } from "../../legacy/components/Navigation/ChangesItem";
|
|
@@ -27,7 +25,6 @@ import { UpdateInfo } from "./UpdateInfo";
|
|
|
27
25
|
export function Navigation() {
|
|
28
26
|
const router = useRouter();
|
|
29
27
|
|
|
30
|
-
const gitIntegrationExperiment = useGitIntegrationExperiment();
|
|
31
28
|
const { documentationLink } = useMarketingContent();
|
|
32
29
|
const sectionsNamingExperiment = useSectionsNamingExperiment();
|
|
33
30
|
const adapter = useAdapterName();
|
|
@@ -60,11 +57,9 @@ export function Navigation() {
|
|
|
60
57
|
minWidth={0}
|
|
61
58
|
>
|
|
62
59
|
<Box flexDirection="column" gap={16}>
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
</Suspense>
|
|
67
|
-
</ErrorBoundary>
|
|
60
|
+
<Suspense fallback={<Skeleton height={40} />}>
|
|
61
|
+
<Environment />
|
|
62
|
+
</Suspense>
|
|
68
63
|
|
|
69
64
|
<Separator style="dashed" />
|
|
70
65
|
|
|
@@ -117,15 +112,6 @@ export function Navigation() {
|
|
|
117
112
|
}}
|
|
118
113
|
/>
|
|
119
114
|
|
|
120
|
-
{gitIntegrationExperiment.eligible && (
|
|
121
|
-
<NavigationItem
|
|
122
|
-
title="Settings"
|
|
123
|
-
href="/settings"
|
|
124
|
-
Icon={SettingsIcon}
|
|
125
|
-
active={router.asPath.startsWith("/settings")}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
|
|
129
115
|
<NavigationItem
|
|
130
116
|
title="Changelog"
|
|
131
117
|
href="/changelog"
|
|
@@ -27,7 +27,6 @@ import { AddPhotoAlternateIcon } from "@/icons/AddPhotoAlternateIcon";
|
|
|
27
27
|
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
28
28
|
|
|
29
29
|
type SharedSliceCardProps = {
|
|
30
|
-
isComingSoon?: boolean;
|
|
31
30
|
isDeleted?: boolean;
|
|
32
31
|
onUpdateScreenshot?: () => void;
|
|
33
32
|
slice: ComponentUI;
|
|
@@ -36,7 +35,7 @@ type SharedSliceCardProps = {
|
|
|
36
35
|
} & (
|
|
37
36
|
| /*
|
|
38
37
|
* Props for rendering a `Card` with a Next.js `Link` component (or with a
|
|
39
|
-
* non-interactive element if
|
|
38
|
+
* non-interactive element if `isDeleted` is true).
|
|
40
39
|
*/
|
|
41
40
|
{
|
|
42
41
|
mode: "navigation";
|
|
@@ -66,7 +65,6 @@ type Action =
|
|
|
66
65
|
export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
|
|
67
66
|
const {
|
|
68
67
|
action,
|
|
69
|
-
isComingSoon = false,
|
|
70
68
|
isDeleted = false,
|
|
71
69
|
onUpdateScreenshot,
|
|
72
70
|
selected = false,
|
|
@@ -79,7 +77,7 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
|
|
|
79
77
|
if (!variation) return null;
|
|
80
78
|
const src = getScreenshotUrl(slice, variation);
|
|
81
79
|
|
|
82
|
-
const disabled =
|
|
80
|
+
const disabled = isDeleted;
|
|
83
81
|
const canUpdateScreenshot = !disabled && !!onUpdateScreenshot;
|
|
84
82
|
const disableOverlay = variant === "outlined";
|
|
85
83
|
const hasVariationId = variationId !== undefined;
|
|
@@ -224,12 +222,6 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
|
|
|
224
222
|
: `${slice.model.variations.length} variation${
|
|
225
223
|
slice.model.variations.length > 1 ? "s" : ""
|
|
226
224
|
}`}
|
|
227
|
-
{isComingSoon ? (
|
|
228
|
-
<Text color="purple11" component="span" variant="small">
|
|
229
|
-
{" "}
|
|
230
|
-
• (coming soon)
|
|
231
|
-
</Text>
|
|
232
|
-
) : undefined}
|
|
233
225
|
</>
|
|
234
226
|
}
|
|
235
227
|
title={hasVariationId ? variation.name : slice.model.name}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BlankSlate,
|
|
3
|
+
BlankSlateDescription,
|
|
4
|
+
BlankSlateIcon,
|
|
5
|
+
BlankSlateTitle,
|
|
6
|
+
Box,
|
|
7
|
+
Button,
|
|
8
|
+
ButtonGroup,
|
|
9
|
+
} from "@prismicio/editor-ui";
|
|
2
10
|
import { useRouter } from "next/router";
|
|
3
11
|
import { FC, PropsWithChildren, Suspense } from "react";
|
|
4
12
|
|
|
@@ -18,7 +26,31 @@ export const AppLayout: FC<PropsWithChildren> = ({
|
|
|
18
26
|
...otherProps
|
|
19
27
|
}) => {
|
|
20
28
|
return (
|
|
21
|
-
<ErrorBoundary
|
|
29
|
+
<ErrorBoundary
|
|
30
|
+
renderError={(error) => {
|
|
31
|
+
return (
|
|
32
|
+
<Box
|
|
33
|
+
position="absolute"
|
|
34
|
+
top={64}
|
|
35
|
+
width="100%"
|
|
36
|
+
justifyContent="center"
|
|
37
|
+
flexDirection="column"
|
|
38
|
+
>
|
|
39
|
+
<BlankSlate>
|
|
40
|
+
<BlankSlateIcon
|
|
41
|
+
lineColor="tomato11"
|
|
42
|
+
backgroundColor="tomato3"
|
|
43
|
+
name="alert"
|
|
44
|
+
/>
|
|
45
|
+
<BlankSlateTitle>Failed to load Slice Machine</BlankSlateTitle>
|
|
46
|
+
<BlankSlateDescription>
|
|
47
|
+
{JSON.stringify(error)}
|
|
48
|
+
</BlankSlateDescription>
|
|
49
|
+
</BlankSlate>
|
|
50
|
+
</Box>
|
|
51
|
+
);
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
22
54
|
<Suspense>
|
|
23
55
|
<PageLayoutWithActiveEnvironment {...otherProps}>
|
|
24
56
|
<PageLayoutPane>
|
|
@@ -21,7 +21,8 @@ import { SideNavEnvironmentSelector } from "./SideNavEnvironmentSelector/SideNav
|
|
|
21
21
|
|
|
22
22
|
export function Environment() {
|
|
23
23
|
const { environments, error: useEnvironmentsError } = useEnvironments();
|
|
24
|
-
const { activeEnvironment } =
|
|
24
|
+
const { activeEnvironment, error: activeEnvironmentError } =
|
|
25
|
+
useActiveEnvironment();
|
|
25
26
|
const { refreshState, openLoginModal } = useSliceMachineActions();
|
|
26
27
|
const { syncChanges } = useAutoSync();
|
|
27
28
|
const isOnline = useNetwork();
|
|
@@ -82,7 +83,10 @@ export function Environment() {
|
|
|
82
83
|
return <SideNavEnvironmentSelector variant="offline" />;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
if (
|
|
86
|
+
if (
|
|
87
|
+
useEnvironmentsError === undefined &&
|
|
88
|
+
activeEnvironmentError === undefined
|
|
89
|
+
) {
|
|
86
90
|
return (
|
|
87
91
|
<SideNavEnvironmentSelector
|
|
88
92
|
environments={environments}
|
|
@@ -110,5 +114,9 @@ export function Environment() {
|
|
|
110
114
|
);
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
if (useEnvironmentsError !== undefined) {
|
|
118
|
+
throw useEnvironmentsError;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
throw activeEnvironmentError;
|
|
114
122
|
}
|
|
@@ -14,7 +14,6 @@ import { managerClient } from "@/managerClient";
|
|
|
14
14
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
15
15
|
import { pluralize } from "@/utils/textConversion";
|
|
16
16
|
|
|
17
|
-
import { sliceTemplatesComingSoon } from "./sliceTemplatesComingSoon";
|
|
18
17
|
import UpdateSliceZoneModalList from "./UpdateSliceZoneModalList";
|
|
19
18
|
|
|
20
19
|
interface UpdateSliceModalProps {
|
|
@@ -101,29 +100,25 @@ export const SlicesTemplatesModal: FC<UpdateSliceModalProps> = ({
|
|
|
101
100
|
{({ values }) => (
|
|
102
101
|
<UpdateSliceZoneModalList
|
|
103
102
|
values={values}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}),
|
|
124
|
-
),
|
|
125
|
-
...sliceTemplatesComingSoon,
|
|
126
|
-
]}
|
|
103
|
+
availableSlices={availableSlicesTemplates.map(
|
|
104
|
+
(slice): ComponentUI => ({
|
|
105
|
+
extension: "",
|
|
106
|
+
fileName: "",
|
|
107
|
+
from: "",
|
|
108
|
+
href: "",
|
|
109
|
+
pathToSlice: "",
|
|
110
|
+
model: Slices.toSM(slice.model),
|
|
111
|
+
screenshots: Object.entries(slice.screenshots).reduce(
|
|
112
|
+
(acc, curr) => ({
|
|
113
|
+
...acc,
|
|
114
|
+
[curr[0]]: {
|
|
115
|
+
url: curr[1],
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
118
|
+
{},
|
|
119
|
+
),
|
|
120
|
+
}),
|
|
121
|
+
)}
|
|
127
122
|
/>
|
|
128
123
|
)}
|
|
129
124
|
</ModalFormCard>
|
|
@@ -9,8 +9,7 @@ import { SliceZoneFormValues } from "./UpdateSliceZoneModal";
|
|
|
9
9
|
const UpdateSliceZoneModalList: React.FC<{
|
|
10
10
|
availableSlices: ReadonlyArray<ComponentUI>;
|
|
11
11
|
values: SliceZoneFormValues;
|
|
12
|
-
|
|
13
|
-
}> = ({ availableSlices, values, placeholderSlices }) => (
|
|
12
|
+
}> = ({ availableSlices, values }) => (
|
|
14
13
|
<FieldArray
|
|
15
14
|
name="sliceKeys"
|
|
16
15
|
render={(arrayHelpers) => (
|
|
@@ -19,14 +18,10 @@ const UpdateSliceZoneModalList: React.FC<{
|
|
|
19
18
|
elems={availableSlices}
|
|
20
19
|
defineElementKey={(slice) => `${slice.from}-${slice.model.name}`}
|
|
21
20
|
renderElem={(slice) => {
|
|
22
|
-
const isComingSoon =
|
|
23
|
-
placeholderSlices?.some((s) => s.model.id === slice.model.id) ??
|
|
24
|
-
false;
|
|
25
21
|
const isInSliceZone = values.sliceKeys.includes(slice.model.id);
|
|
26
22
|
return (
|
|
27
23
|
<SharedSliceCard
|
|
28
24
|
action={{ type: "checkbox" }}
|
|
29
|
-
isComingSoon={isComingSoon}
|
|
30
25
|
mode="selection"
|
|
31
26
|
onSelectedChange={(selected) => {
|
|
32
27
|
if (selected) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,c,e,a,t,i,b,n,u,d,f,h,l,k,j,p,g,o,r,m){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,a,p,g,"static/chunks/pages/index-0d8cb369de720a35.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,t,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-063c5e11dfc8fd55.js"],"/changes":[c,i,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-fa4f2563cb5fd014.js",e,n,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-564336edb0ed18b0.js"],"/custom-types":[s,a,p,g,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,u,d,f,h,s,t,b,l,o,e,a,k,j,r,m,"static/chunks/pages/custom-types/[customTypeId]-a408f5a660e096a6.js"],"/labs":["static/chunks/pages/labs-9630bfb1005be02b.js"],"/page-types/[pageTypeId]":[c,u,d,f,h,s,t,b,l,o,e,a,k,j,r,m,"static/chunks/pages/page-types/[pageTypeId]-f5e851ebe35049a8.js"],"/settings":[s,"static/css/e5f781f20e24a5ea.css","static/chunks/pages/settings-01f4aeb9112a1f87.js"],"/slices":[c,i,s,b,e,n,j,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-4a60cd5f2c71327e.js"],"/slices/[lib]/[sliceName]/[variation]":[c,i,u,d,f,h,s,t,b,l,e,k,n,"static/css/cdee5b195444f185.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-bd5e45632c419567.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[i,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/157-54b8336d20b41933.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5008e29008aa04f4.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/397-e6c340070a3bcb41.js","static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/34-e684c5fd75cc9dd0.js","static/chunks/647-7b9b5aa9468f9e4b.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/44-a2056f993381ad0f.js","static/chunks/658-8231c0b729e0124a.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/349-7118116b93278f73.js","static/chunks/630-29c729ad2a291ef6.js","static/chunks/268-6a9214b97195af9c.js","static/chunks/248-03446cd9e9f13730.js","static/css/4e475d945cf8a890.css","static/chunks/385-b949173dfa03dd3e.js","static/chunks/882-151468121d542ed6.js","static/css/56f2a6684a524374.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return i},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return o},_T:function(){return u}});var l=n(52322),r=n(56803),a=n(6277),s=n(83478),c=n.n(s);let i=e=>{let{backgroundImage:t,style:n,...r}=e,s=void 0!==t;return(0,l.jsx)("article",{...r,className:(0,a.W)(c().root,{[c().withBackground]:s}),style:{backgroundImage:s?"url(".concat(t,")"):void 0,...n}})},o=e=>(0,l.jsx)("div",{...e,className:c().image}),d=e=>(0,l.jsx)("div",{...e,className:c().content}),u=e=>(0,l.jsx)(r.bL,{...e,variant:"h3"}),h=e=>(0,l.jsx)(r.bL,{...e,color:"grey11"}),x=e=>(0,l.jsx)("div",{...e,className:c().actions,color:"grey"})},38241:function(e,t,n){"use strict";n.d(t,{F:function(){return O}});var l=n(52322),r=n(56803),a=n(97729),s=n.n(a),c=n(2784),i=n(43388),o=n(17378),d=n(98564),u=n(51384),h=n(5632),x=n(56580),m=n(75289),p=n(77630),j=n(88932),g=n(94160),b=n(39204);async function f(e){let{id:t,label:n,repeatable:l,format:r,onSuccess:a}=e,s=d.$[r],c=(0,p.Ue)({id:t,label:n,repeatable:l,format:r});try{let{errors:e}=await (0,g.KA)({customType:c});if(e.length>0)throw e;g.Xe.track({event:"custom-type:created",id:c.id,name:n,format:r,type:l?"repeatable":"single",origin:"table"}),await a(c),j.Am.success((0,b.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")}))}catch(t){let e="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved");console.error(e,t),j.Am.error(e)}}var v=n(59294),_=n(98250),S=n(68968),y=n(59532),C=n(7974),k=n(358),w=n(78254),L=n(54597),I=n(46999),R=n(63397);let B=e=>{let{selected:t,...n}=e;return(0,l.jsx)(m.kC,{sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:t?e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}:"none","&:hover":{boxShadow:e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}}},...n})},N=e=>{let{format:t}=e,[n,,r]=(0,R.U$)("repeatable"),a=d.$[t];return(0,l.jsxs)(m.xu,{mb:2,children:[(0,l.jsxs)(B,{selected:n.value,onClick:()=>r.setValue(!0),children:[(0,l.jsx)(m.Y8,{checked:n.value,onChange:()=>{},"data-testid":"repeatable-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Reusable type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,l.jsxs)(B,{selected:!n.value,onClick:()=>r.setValue(!1),children:[(0,l.jsx)(m.Y8,{checked:!n.value,onChange:()=>{},"data-testid":"single-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Single type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=e=>{let{format:t,isCreating:n,isOpen:r,origin:a="table",onCreateChange:s,onOpenChange:i}=e,{createCustomTypeSuccess:o}=(0,L.Z)(),{completeStep:u}=(0,_.k)(),{customTypeIds:j,customTypeLabels:g}=(0,x.v9)(e=>({customTypeIds:(0,w.W6)(e),customTypeLabels:(0,w.YS)(e)})),b=d.$[t],[R,B]=(0,c.useState)(!0),{syncChanges:z}=(0,S.g)(),E=(0,h.useRouter)(),T=async e=>{let{id:n,label:l,repeatable:r}=e;s(!0),await f({format:t,id:n,label:l,origin:a,repeatable:r,onSuccess:async e=>{o(e);let t=(0,p.y6)(e),l=v.cd[t];B(!0),await E.push({pathname:l.getBuilderPagePathname(n)}),z(),"page"===t&&u("createPageType")}}),s(!1),i(!1)},G=(e,t,n)=>{n(R?{...t,label:e.target.value,id:(0,k.lV)(e.target.value)}:{...t,label:e.target.value})},D=(e,t)=>{t("id",e.target.value),B(!1)};return(0,l.jsx)(y.Z,{testId:"create-ct-modal",isOpen:r,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:()=>{i(!1),B(!0)},onSubmit:e=>{T(e)},isLoading:n,initialValues:{repeatable:!0,id:"",label:""},validate:e=>{let{id:t,label:n}=e,l={};return n&&n.length||(l.label="Cannot be empty."),!l.label&&g.includes(n)&&(l.label="".concat(b.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(n.toLowerCase())&&(l.label='Name "'.concat(n,'" is reserved for Slice Machine use.')),t&&t.length||(l.id="ID cannot be empty."),["update","insert"].includes(t.toLowerCase())&&(l.id='Id "'.concat(t,'" is reserved for Slice Machine use.')),l.id||!t||C.xo.exec(t)||(l.id="Invalid id: No special characters allowed."),!l.id&&t&&j.map(e=>e.toLowerCase()).includes(t)&&(l.id='ID "'.concat(t,'" exists already.')),Object.keys(l).length>0?l:void 0},content:{title:"Create a new ".concat(b.name({start:!1,plural:!1}))},children:e=>{let{errors:n,setValues:r,setFieldValue:a,values:s,touched:c}=e;return(0,l.jsxs)(m.xu,{children:[(0,l.jsx)(N,{format:t}),(0,l.jsx)(I.W,{name:"label",label:"".concat(b.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(b.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:e=>G(e,s,r)}),(0,l.jsx)(I.W,{name:"id",testId:"ct-id-input",label:"".concat(b.name({start:!0,plural:!1})," ID"),placeholder:b.inputPlaceholder,error:c.id?n.id:void 0,onChange:e=>D(e,a)})]})}})};var E=n(72641);let T=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,l.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}),G=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]});var D=n(60867),P=n(50477),W=n(94840),A=n(16442);let $=e=>{let{format:t,isCreatingCustomType:n,openCreateCustomTypeModal:a}=e,s=(0,h.useRouter)(),{customTypes:i,updateCustomTypes:o}=(0,P.xU)(t),u=i.sort((e,t)=>e.id.localeCompare(t.id)),m=v.cd[t],p=d.$[t];return(!function(e,t,n){let{storeCustomTypes:l}=(0,x.v9)(e=>({storeCustomTypes:(0,w.Ch)(e).filter(A.TG)}));(0,c.useEffect)(()=>{let r=l.filter(e=>{let{local:n}=e;return n.format===t});(r.length!==e.length||r.some(t=>{let n=e.find(e=>e.id===t.local.id);return!n||JSON.stringify(W.Dc.fromSM(t.local))!==JSON.stringify(n)}))&&n(r.map(e=>{let{local:t}=e;return W.Dc.fromSM(t)}))},[t,n,e,l])}(i,t,o),0===u.length)?(0,l.jsxs)(E.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:r.t.space[72]},children:[(0,l.jsx)(E.u2,{children:(0,l.jsx)(r.a_,{src:m.blankSlateImage,sizing:"cover"})}),(0,l.jsxs)(E.T9,{children:[(0,l.jsx)(E._T,{children:p.name({start:!0,plural:!0})}),(0,l.jsx)(E.nf,{children:p.blankSlateDescription}),(0,l.jsx)(E.Qj,{children:(0,l.jsx)(r.E,{onClick:a,loading:n,children:"Create"})})]})]}):(0,l.jsx)("div",{children:(0,l.jsxs)(r.bE,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,l.jsx)(r.bH,{children:(0,l.jsxs)(r.bI,{children:[(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.aX,{name:"notes",size:"medium"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Label"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"API ID"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Limit"})}),(0,l.jsx)(r.bG,{})]})}),(0,l.jsx)(r.bF,{children:u.map(e=>{let{repeatable:n,label:a,id:c}=e;return(0,l.jsxs)(r.bI,{onClick:()=>{s.push(v.cd[t].getBuilderPagePathname(c))},children:[(0,l.jsx)(r.bG,{children:n?(0,l.jsx)(T,{width:r.t.space[20]}):(0,l.jsx)(G,{width:r.t.space[20]})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{variant:"bold",noWrap:!0,children:a})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:c})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(D._,{isChangesLocal:!1,format:t,customType:e})})]},c)})})]})})},O=e=>{let{format:t}=e,n=d.$[t],[a,h]=(0,c.useState)(!1),[x,m]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsxs)("title",{children:[n.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,l.jsx)(o.S,{renderError:()=>(0,l.jsx)(u.LN,{children:(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,l.jsx)(r.ax,{title:"Request failed",description:"An error occurred while fetching your ".concat(n.name({start:!1,plural:!0}),".")})})})}),children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.bg,{})})]}),children:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{"data-testid":"create-ct",loading:a,onClick:()=>{m(!0)},startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsxs)(r.D,{flexDirection:"column",children:[(0,l.jsx)($,{format:t,isCreatingCustomType:a,openCreateCustomTypeModal:()=>{m(!0)}}),(0,l.jsx)(z,{format:t,isCreating:a,isOpen:x,onCreateChange:h,onOpenChange:m})]})})]})})})]})}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return o},W:function(){return i}});var l=n(52322),r=n(2784),a=n(75289);let s=e=>{let{bg:t,background:n,sx:r,withRadius:s,radius:c,children:i}=e;return(0,l.jsx)(a.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,...r},children:i})},c=(0,r.createContext)("6px"),i=()=>(0,r.useContext)(c),o=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:i=null,borderFooter:o=!1,radius:d="6px",bodySx:u={},footerSx:h={},sx:x=null,bg:m,background:p,children:j,...g}=e;return(0,l.jsx)(c.Provider,{value:d,children:(0,l.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...x},...g,children:[t||null,n||null,(0,l.jsxs)(s,{bg:m,background:p,sx:u,withRadius:!i,children:[r?(0,l.jsx)(r,{}):null,j||null]}),i?(0,l.jsx)(s,{bg:m,background:p,sx:{...o?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...h},radius:d,withRadius:!0,children:"object"==typeof i?i:(0,l.jsx)(i,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return c},lS:function(){return l},nG:function(){return r},pq:function(){return i},rd:function(){return s},xo:function(){return a}});let l=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",i="slice-machine-simulator"},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[34],{62434:function(e,t,n){"use strict";n.d(t,{Zb:function(){return c},T$:function(){return m},eW:function(){return _},ZB:function(){return u},Lm:function(){return h}});var o=n(52322),r=n(50002),a=n(56803),i=n(6277),l=n(2784),d=n(67968),s=n.n(d);let c=e=>{let{checked:t=!1,size:n="medium",variant:a="solid",interactive:d,disabled:c,onClick:u,href:m,component:_="a",replace:h,...C}=e,p={...C,className:(0,i.W)(s().root,s()["size-".concat(n)],s()[a],{[s().interactive]:e.interactive}),"data-state":!0===t?"checked":void 0,"data-disabled":!0===e.disabled?"":void 0};return!0===e.interactive&&void 0===e.href?(0,o.jsx)("div",{...p,onClick:t=>{if(!0===e.disabled||void 0===e.onClick)return;let n=t.target;(0,r.JY)(n)===t.currentTarget&&e.onClick(t)},tabIndex:!0===e.disabled?void 0:0}):!0===e.interactive?(0,l.createElement)(_,{...p,href:e.href,onClick:e=>{let t=e.target;(0,r.JY)(t)!==e.currentTarget&&e.preventDefault()},..."a"===_?{}:{replace:e.replace}}):(0,o.jsx)("div",{...p})},u=e=>{let{className:t,component:n="img",overlay:r,...a}=e;return(0,o.jsxs)("div",{className:s().media,children:[(0,l.createElement)(n,{...a,className:(0,i.W)(s()["mediaComponent-".concat(n)],t)}),r?(0,o.jsx)("div",{className:s().mediaOverlay,children:r}):void 0]})},m=e=>(0,o.jsx)("div",{...e,className:s().actions}),_=e=>{let{action:t,loading:n=!1,startIcon:r,subtitle:i,title:l,error:d=!1,...c}=e,u=d?"tomato11":"grey11";return(0,o.jsxs)("div",{...c,className:s().footer,children:[(r||n)&&(0,o.jsxs)("div",{className:s().startIconBox,children:[n&&(0,o.jsx)(a.bg,{color:"grey11"}),!n&&r&&(0,o.jsx)(a.aX,{name:r,size:"small",color:u})]}),(0,o.jsxs)("div",{className:s().footerTexts,children:[(0,o.jsx)(a.bL,{component:"span",noWrap:!0,variant:"bold",children:l}),(0,o.jsx)(a.bL,{color:u,component:"span",noWrap:!0,variant:"small",children:i})]}),t]})},h=e=>{let{children:t,...n}=e;return(0,o.jsx)("div",{...n,className:s().status,children:(0,o.jsx)(a.bL,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:t})})}},99195:function(e,t,n){"use strict";n.d(t,{O:function(){return l}});var o=n(52322),r=n(56803),a=n(56448),i=n(93671);let l=e=>{let{badgeColor:t,badgeTitle:n,tooltipContent:l}=function(e){let t=d[e.modelType];switch(e.modelStatus){case a.GJ.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(t," exists only locally. Upon sync, it will be pushed to your remote repository.")};case a.GJ.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(t," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case a.GJ.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(t," is in sync with the remote repository.")};case a.GJ.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(t," has been deleted locally.")};case a.GJ.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===i.t.UNAUTHORIZED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};if(e.authStatus===i.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);return(0,o.jsx)(r.c3,{content:l,side:"bottom",children:(0,o.jsx)(r.m,{color:t,title:n})})},d={CustomType:"type",Slice:"slice"}},51507:function(e,t,n){"use strict";n.d(t,{b:function(){return C}});var o=n(52322),r=n(56803),a=n(39097),i=n.n(a),l=n(62434),d=n(63908),s=n(99195),c=n(27763);let u=e=>(0,o.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,o.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"})}),m=e=>({hash:e.hash}),_=e=>e?Object.entries(e).reduce((e,t)=>{let[n,o]=t;return o.hash?{...e,[n]:{...o,...m(o)}}:e},{}):{},h={build:e=>({...e,screenshots:_(e.screenshots)}),variation(e,t){if(e.model.variations.length)return t?e.model.variations.find(e=>e.id===t):e.model.variations[0]}},C=e=>{let t;let{action:n,isComingSoon:a=!1,isDeleted:m=!1,onUpdateScreenshot:_,selected:C=!1,slice:v,variant:b,variationId:f}=e,g=h.variation(v,f);if(!g)return null;let j=(0,d.d7)(v,g),y=a||m,k=!y&&!!_,S="outlined"===b,T=void 0!==f;return t="selection"===e.mode?{disabled:y,interactive:!0,onClick:()=>{e.onSelectedChange(!C)}}:y?{interactive:!1}:{component:i(),href:c.Y.getBuilderPagePathname({libraryName:v.href,sliceName:v.model.name,variationId:g.id}),interactive:!0,replace:e.replace},(0,o.jsxs)(l.Zb,{"aria-label":"".concat(v.model.name," ").concat(g.name," slice card"),checked:C,"data-testid":"shared-slice-card",...t,..."outlined"===b?{size:"small",variant:"outlined"}:{},children:[void 0!==j?(0,o.jsx)(l.ZB,{alt:"Preview image",overlay:k&&!S?(0,o.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,o.jsx)(p,{onClick:_})}):void 0,src:j}):(0,o.jsx)(l.ZB,{component:"div",children:(0,o.jsxs)(r.D,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,o.jsx)(r.bL,{color:"grey11",component:"span",children:"No screenshot available"}),k&&!S?(0,o.jsx)(p,{onClick:_}):void 0]})}),(0,o.jsx)(l.eW,{action:"checkbox"===n.type&&"selection"===e.mode?(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,o.jsx)(r.U,{checked:C,disabled:y,onCheckedChange:e.onSelectedChange})}):"menu"===n.type?(0,o.jsxs)(r.ar,{modal:!0,children:[(0,o.jsx)(r.av,{disabled:y,children:(0,o.jsx)(r.aZ,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,o.jsxs)(r.as,{align:"end","data-testid":"slice-action-icon-dropdown",children:[k&&S?(0,o.jsx)(r.at,{onSelect:_,startIcon:(0,o.jsx)(u,{}),children:"Update screenshot"}):void 0,(0,o.jsx)(r.at,{onSelect:n.onRename,startIcon:(0,o.jsx)(r.aX,{name:"edit"}),children:"Rename"}),!0===n.removeDisabled&&T?(0,o.jsx)(r.c3,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,o.jsx)(x,{disabled:!0,onSelect:n.onRemove})}):(0,o.jsx)(x,{disabled:!0===n.removeDisabled,onSelect:n.onRemove})]})]}):"remove"===n.type?(0,o.jsx)(r.aZ,{icon:"close",onClick:()=>!y&&n.onRemove(),hiddenLabel:"Remove slice"}):"status"===n.type?(0,o.jsx)(s.O,{authStatus:n.authStatus,isOnline:n.isOnline,modelStatus:n.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,o.jsxs)(o.Fragment,{children:[T?g.id:"".concat(v.model.variations.length," variation").concat(v.model.variations.length>1?"s":""),a?(0,o.jsxs)(r.bL,{color:"purple11",component:"span",variant:"small",children:[" ","• (coming soon)"]}):void 0]}),title:T?g.name:v.model.name}),k&&!T&&(0,d.cx)(v)>0?(0,o.jsx)(l.Lm,{children:"Missing screenshot"}):void 0]})},p=e=>(0,o.jsx)(r.E,{onClick:e.onClick,renderStartIcon:()=>(0,o.jsx)(u,{color:r.t.color.grey11}),color:"grey",children:"Update screenshot"}),x=e=>(0,o.jsx)(r.at,{...e,color:"tomato",startIcon:(0,o.jsx)(r.aX,{name:"delete"}),children:"Delete"})},27763:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});let o={getBuilderPagePathname:e=>"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},W:function(){return d}});var o=n(52322),r=n(2784),a=n(75289);let i=e=>{let{bg:t,background:n,sx:r,withRadius:i,radius:l,children:d}=e;return(0,o.jsx)(a.xu,{sx:{p:4,bg:t||n,...i?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,...r},children:d})},l=(0,r.createContext)("6px"),d=()=>(0,r.useContext)(l),s=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:d=null,borderFooter:s=!1,radius:c="6px",bodySx:u={},footerSx:m={},sx:_=null,bg:h,background:C,children:p,...x}=e;return(0,o.jsx)(l.Provider,{value:c,children:(0,o.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:c,..._},...x,children:[t||null,n||null,(0,o.jsxs)(i,{bg:h,background:C,sx:u,withRadius:!d,children:[r?(0,o.jsx)(r,{}):null,p||null]}),d?(0,o.jsx)(i,{bg:h,background:C,sx:{...s?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...m},radius:c,withRadius:!0,children:"object"==typeof d?d:(0,o.jsx)(d,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return l},lS:function(){return o},nG:function(){return r},pq:function(){return d},rd:function(){return i},xo:function(){return a}});let o=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,i="placeholders/What_are_Slices_mrvome",l="SM_HELP_VIDEOS/mock_data",d="slice-machine-simulator"},67968:function(e){e.exports={flex:"Card_flex__opby1",grid:"Card_grid__VAvIS",column:"Card_column__W4ACG Card_flex__opby1",root:"Card_root__YVuvU Card_column__W4ACG Card_flex__opby1","size-small":"Card_size-small__aIlxd","size-medium":"Card_size-medium__xegz0",solid:"Card_solid__GNGar",outlined:"Card_outlined__W_dxI",interactive:"Card_interactive__rXw5L",media:"Card_media__l0kHL Card_column__W4ACG Card_flex__opby1","mediaComponent-div":"Card_mediaComponent-div__Y2_PZ Card_grid__VAvIS","mediaComponent-img":"Card_mediaComponent-img__ezOTu",mediaOverlay:"Card_mediaOverlay__Aa__Q Card_grid__VAvIS",nonMedia:"Card_nonMedia__Fv3Mz Card_flex__opby1",actions:"Card_actions__XdhOt Card_nonMedia__Fv3Mz Card_flex__opby1",footer:"Card_footer__U0HS1 Card_nonMedia__Fv3Mz Card_flex__opby1",footerTexts:"Card_footerTexts__rTXup Card_column__W4ACG Card_flex__opby1",status:"Card_status__PNN2a Card_column__W4ACG Card_flex__opby1",startIconBox:"Card_startIconBox__1_L4u"}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[882],{60882:function(e,t,l){"use strict";l.d(t,{H:function(){return e8}});var n=l(52322),a=l(56803),i=l(97729),o=l.n(i),r=l(5632),s=l(2784),c=l(56580),d=l(43388),u=l(77630),m=l(23094),h=l(59294),p=l(51384),x=l(74217),v=l(94160),b=l(68968),y=l(23710),f=l(54597),g=l(98564);let j=(0,s.createContext)(void 0);function S(e){let{children:t,initialCustomType:l}=e,[a,i]=(0,s.useState)(l),o=(0,u.y6)(a),r=g.$[o],{actionQueueStatus:c,setNextAction:d}=(0,y.c)({errorMessage:r.autoSaveFailed}),{refreshState:m}=(0,f.Z)(),h=(0,x.R9)(m),{syncChanges:p}=(0,b.g)(),S=(0,s.useCallback)(e=>{let{customType:t,onSaveCallback:l,updateMeta:n}=e;i(t),d(async()=>{let{errors:e}=await (0,v.KA)({customType:t,updateMeta:n});if(e.length>0)throw e;h(await (0,v.y0)()),p(),null==l||l()})},[d,h,p]),I=(0,s.useMemo)(()=>({actionQueueStatus:c,customType:a,setCustomType:S}),[c,a,S]);return(0,n.jsx)(j.Provider,{value:I,children:"function"==typeof t?t(I):t})}function I(){let e=(0,s.useContext)(j);if(!e)throw Error("CustomTypeProvider not found");return e}var C=l(30195);function T(){var e;let[t,l]=(0,s.useState)(!1),{customType:i,setCustomType:o}=I(),[r,c]=null!==(e=(0,u.j5)(i))&&void 0!==e?e:[],d=c?(0,u.N3)(c):"",[m,h]=(0,s.useState)(null!=d?d:""),[p,v]=(0,s.useState)();(0,x.pQ)(t,()=>{t||(h(null!=d?d:""),v(void 0))});let b=(0,s.useCallback)(()=>(0,n.jsx)(a.aX,{name:c?"language":"add",size:"small",color:"grey11"}),[c]);return(0,n.jsxs)(a.ae,{open:t,onOpenChange:l,size:"small",trigger:(0,n.jsx)(a.E,{color:"grey",textColor:"placeholder",textWeight:"normal",renderStartIcon:b,sx:{marginInline:"auto"},children:c?d:"Add an UID"}),children:[(0,n.jsx)(a.al,{title:"Edit the UID label"}),(0,n.jsx)(a.aj,{children:(0,n.jsxs)(a.aJ,{onSubmit:function(){p||(o({customType:c?(0,u.eK)(m,i):(0,u.H8)(m,i)}),l(!1))},children:[(0,n.jsx)(a.D,{flexDirection:"column",padding:16,gap:4,children:(0,n.jsx)(a.aM,{type:"text",label:"Label *",placeholder:"UID",value:m,onValueChange:function(e){h(e),v(function(e){let t=D.safeParse(e,{errorMap:k});if(t.error)return t.error.errors[0].message}(e))},error:p,description:"A label for the UID"})}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",disabled:!!p,children:"Save"})]})]})})]})}let D=C.z.string().max(35).min(1),k=e=>{switch(e.code){case C.z.ZodIssueCode.too_big:return{message:"The label can't be longer than ".concat(e.maximum," characters")};case C.z.ZodIssueCode.too_small:return{message:"This field is required"};default:return{message:"Invalid value"}}};var w=l(94840),_=l(59532),L=l(63397),A=l(75289);let E=e=>{let{name:t,label:l,placeholder:a,error:i,...o}=e;return(0,n.jsxs)(A.xu,{mb:3,children:[(0,n.jsx)(A.__,{htmlFor:t,mb:2,children:l}),(0,n.jsx)(L.gN,{name:t,type:"text",placeholder:a,as:A.II,autoComplete:"off",...o}),i?(0,n.jsx)(A.xv,{sx:{color:"error",mt:1},children:i}):null]})};var N=e=>{let{isOpen:t,onSubmit:l,close:a,tabIds:i}=e;return(0,n.jsx)(_.Z,{isOpen:t,widthInPx:"530px",formId:"create-tab",close:a,onSubmit:e=>{l(e),a()},initialValues:{id:""},validate:e=>{let{id:t}=e;return t?i.includes(t.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Add Tab"},children:e=>{let{errors:t}=e;return(0,n.jsx)(E,{name:"id",label:"New Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id})}})},M=e=>{let{isOpen:t,onSubmit:l,close:a}=e;return(0,n.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:a,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),a()},initialValues:{},content:{title:"Remove Tab"},children:()=>(0,n.jsxs)(A.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(A.X6,{as:"h4",children:"Remove this tab?"}),(0,n.jsx)(A.xv,{as:"p",color:"textClear",sx:{mt:2},children:"This action cannot be undone."}),(0,n.jsx)(A.zx,{type:"button",variant:"buttons.actionDelete",sx:{mt:3},onClick:()=>{l({}),a()},children:"Yes, remove tab"})]})})},z=e=>{let{isOpen:t,onSubmit:l,close:a,tabIds:i,initialTabKey:o}=e;return(0,n.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:a,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),a()},initialValues:{id:o},validate:e=>{let{id:t}=e;return t?i.includes(t.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Rename Tab"},children:e=>{let{errors:t,values:i,setFieldValue:o,isValid:r}=e;return(0,n.jsxs)(A.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(E,{name:"id",label:"Rename Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id,onBlur:e=>{i.id!==e.target.value&&o("id",e.target.value.trim())},onChange:e=>{o("id",e.target.value)}}),(0,n.jsx)(A.zx,{type:"button",sx:{mt:3,width:"100%"},disabled:!r,onClick:()=>{i.id&&i.id.length&&l({id:i.id.trim()}),a()},children:"Save"})]})}})},Z=l(28316),O=l(88932),P=l(35289),F=l(17378),K=l(45440),B=l(16086),R=l(358),U=l(5495),V=l(39302),X=l(3285),G=l(40141),H=l(65077),Y=l(22654),q=l(63470),Q=l(91589),W=l(27213),$=l(31860);let J=e=>{let{openCreateSliceModal:t,openCreateSliceFromImageModal:l,openUpdateSliceZoneModal:i,openSlicesTemplatesModal:o,projectHasAvailableSlices:r,isSlicesTemplatesSupported:s}=e,c=(0,Y.l)(),d=(0,q.k)(),u=(0,W.F)({menuType:"ActionList",sectionsNamingExperiment:d});return(0,n.jsxs)(a.s,{"data-testid":"slice-zone-blank-slate",sx:{width:648},children:[(0,n.jsx)(a.x,{lineColor:"purple9",backgroundColor:"purple5",name:"add",size:"large"}),(0,n.jsxs)(a.z,{size:"big",children:["Add ",(0,$._)(d.value)]}),(0,n.jsxs)(a.w,{children:[(0,$._)((0,$.f)(d.value))," are website sections that you can reuse on different pages with different content. Each on different pages with different content. Each"," ",d.value," has its own component in your code."]}),(0,n.jsx)(a.v,{children:(0,n.jsxs)(a.A,{children:[c.eligible&&(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromImage.BackgroundIcon,onClick:l,description:u.fromImage.description,children:u.fromImage.title}),(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromScratch.BackgroundIcon,onClick:t,description:u.fromScratch.description,children:u.fromScratch.title}),s&&(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromTemplate.BackgroundIcon,onClick:o,description:u.fromTemplate.description,children:u.fromTemplate.title}),r&&(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromExisting.BackgroundIcon,onClick:i,description:u.fromExisting.description,children:u.fromExisting.title})]})})]})};var ee=l(98250);function et(e){let{customType:t,tabId:l,slices:n}=e,a={...t};return n.forEach(e=>{a={...a,tabs:a.tabs.map(t=>t.key===l&&t.sliceZone?{...t,sliceZone:{key:t.sliceZone.key,value:[{key:e.id,value:e},...t.sliceZone.value]}}:t)}}),v.Xe.track({event:"custom-type:slice-zone-updated",customTypeId:t.id}),a}var el=l(18566),en=l(80148);async function ea(){try{let{templates:e,errors:t}=await en.managerClient.sliceTemplateLibrary.readLibrary({});if(t.length>0)throw t;return e.map(e=>({model:e.model,screenshots:Object.fromEntries(Object.entries(e.screenshots).map(e=>{let[t,l]=e;return[t,URL.createObjectURL(l)]}))}))}catch(e){return[]}}var ei=l(6256),eo=l(39204),er=l(7723),es=l(33986),ec=l(30527),ed=l(55862);let eu=e=>{let{deleteSliceZone:t,closeDeleteSliceZoneModal:l}=e;return(0,n.jsx)(ed.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:l,children:(0,n.jsx)(ec.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none",overflow:"hidden"},borderFooter:!0,Header:(0,n.jsxs)(A.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,n.jsx)(A.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Do you really want to delete Slice Zone?"}),(0,n.jsx)(A.x8,{type:"button",onClick:l})]}),Footer:()=>(0,n.jsxs)(A.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,n.jsx)(es.z,{label:"Cancel",variant:"secondary",onClick:l,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,n.jsx)(es.z,{label:"Delete",variant:"danger",onClick:t,sx:{minHeight:39,minWidth:78}})]}),children:(0,n.jsx)(A.nv,{children:"You're about to delete Slice Zone."})})})};var em=l(43776),eh=l(62434),ep=l(63908),ex=l(63019),ev=l(65375),eb=l.n(ev);let ey=e=>{var t;let{isOpen:l,close:i,onSubmit:o,isLoading:r,slice:d,libraries:u}=e,{remoteSlices:m}=(0,c.v9)(e=>({remoteSlices:(0,er.sT)(e)})),h={from:null===(t=u[0])||void 0===t?void 0:t.name,sliceName:(0,R.MP)(d.key)},[p,v]=(0,s.useState)(h),[b,y]=(0,s.useState)();function f(e){v(e),y((0,ex.h)(e,u,m))}return(0,x.pQ)(l,()=>{l||(v(h),y(void 0))}),(0,n.jsxs)(a.ae,{open:l,onOpenChange:e=>!e&&i(),size:{width:448,height:"auto"},children:[(0,n.jsx)(a.al,{title:"Upgrade slice"}),(0,n.jsx)(a.aj,{children:(0,n.jsx)(a.aJ,{onSubmit:function(){b&&Object.keys(b).length>0||o({libraryID:p.from,sliceID:p.sliceName})},children:(0,n.jsxs)(a.D,{flexDirection:"column",children:[(0,n.jsxs)(a.bn,{className:eb().scrollArea,children:[(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"This will create a new slice with the same fields. The new slice will replace the legacy slice in all of your types, and the existing slice content will be re-mapped to the new slice."}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"This will not migrate your component. You will need to do that manually."}),(0,n.jsxs)(a.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)(a.aM,{label:"Slice name *",placeholder:"Pascalised Slice API ID (e.g. ".concat((0,R.MP)(d.key),")"),error:null==b?void 0:b.sliceName,value:p.sliceName,onValueChange:e=>f({...p,sliceName:e.slice(0,30)}),"data-testid":"slice-name-input"}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"A display name for the slice"})]}),(0,n.jsxs)(a.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)("label",{className:eb().label,children:(0,n.jsx)(a.bL,{variant:"bold",children:"Slice library *"})}),(0,n.jsx)(a.bq,{size:"medium",color:"grey",startIcon:"folder",flexContent:!0,value:p.from,onValueChange:e=>{e&&f({...p,from:e})},children:u.map(e=>(0,n.jsx)(a.bt,{value:e.name,children:e.name},e.name))}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"The library where we'll store your slice"})]})]}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",loading:r,disabled:b&&Object.keys(b).length>0,children:"Upgrade"})]})]})})})]})};var ef=l(96009),eg=l.n(ef);let ej=e=>{var t,l;let{isOpen:i,close:o,onSubmit:r,isLoading:c,slice:d,sliceName:u,libraries:m,localSharedSlices:h}=e,p={libraryID:null===(t=h[0])||void 0===t?void 0:t.from,sliceID:null===(l=h[0])||void 0===l?void 0:l.model.id,variationID:eg()(d.key),variationName:u},[v,b]=(0,s.useState)(!0),[y,f]=(0,s.useState)(p),[g,j]=(0,s.useState)({});function S(e){f(e),j(eS(e,m))}return(0,x.pQ)(i,()=>{i||(f(p),j({}))}),(0,n.jsxs)(a.ae,{open:i,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(a.al,{title:"Convert to slice variation"}),(0,n.jsx)(a.aj,{children:(0,n.jsx)(a.aJ,{onSubmit:function(){Object.keys(g).length>0||r(y)},children:(0,n.jsxs)(a.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(a.bn,{className:eb().scrollArea,children:[(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"If you have multiple slices that are similar, you can combine them as variations of the same slice."}),(0,n.jsxs)(a.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:eb().label,children:[(0,n.jsx)(a.bL,{variant:"bold",children:"Target slice *"}),"string"==typeof g.libraryID?(0,n.jsx)(a.bL,{variant:"small",color:"tomato10",children:g.libraryID}):null,"string"==typeof g.sliceID?(0,n.jsx)(a.bL,{variant:"small",color:"tomato10",children:g.sliceID}):null]}),(0,n.jsx)(a.bq,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:"".concat(y.libraryID,"::").concat(y.sliceID),onValueChange:e=>{if(e){let[t,l]=e.split("::");S({...y,libraryID:t,sliceID:l})}},children:h.map(e=>(0,n.jsxs)(a.bt,{value:"".concat(e.from,"::").concat(e.model.id),children:[e.from," ",">"," ",e.model.name," (",e.model.id,")"]},"".concat(e.from,"::").concat(e.model.id)))}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"Choose the slice to which you would like to add this variation."})]}),(0,n.jsx)(a.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(a.aM,{label:"Variation name *",placeholder:u,error:g.variationName,value:y.variationName,onValueChange:e=>{let t={...y,variationName:e.slice(0,30)};v&&(t.variationID=eg()(t.variationName)),S(t)},"data-testid":"variation-name-input"})}),(0,n.jsx)(a.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(a.aM,{label:"ID *",placeholder:eg()(d.key),error:g.variationID,value:y.variationID,onValueChange:e=>{b(!1),S({...y,variationID:e.slice(0,30)})},"data-testid":"variation-id-input"})})]}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",loading:c,disabled:Object.keys(g).length>0,children:"Convert"})]})]})})})]})},eS=(e,t)=>{let l={};e.libraryID||(l.libraryID="Cannot be empty.");let n=t.find(t=>t.path===e.libraryID);l.libraryID||n||(l.libraryID="Does not exist."),e.sliceID||(l.sliceID="Cannot be empty.");let a=null==n?void 0:n.components.find(t=>t.model.id===e.sliceID);if(l.sliceID||a||(l.sliceID="Does not exist."),e.variationName||(l.variationName="Cannot be empty."),e.variationID){var i;(null!==(i=null==a?void 0:a.model.variations.map(e=>e.id))&&void 0!==i?i:[]).includes(e.variationID)&&(l.variationID="Slice variation ID is already taken.")}else l.variationID="Cannot be empty.";return l},eI=e=>{var t,l;let{isOpen:i,close:o,onSubmit:r,isLoading:c,identicalSlices:d}=e,u=null!==(l=null===(t=d[0])||void 0===t?void 0:t.path)&&void 0!==l?l:"",[m,h]=(0,s.useState)(u),[p,v]=(0,s.useState)();return(0,x.pQ)(i,()=>{i||(h(u),v(void 0))}),(0,n.jsxs)(a.ae,{open:i,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(a.al,{title:"Merge with an existing slice"}),(0,n.jsx)(a.aj,{children:(0,n.jsx)(a.aJ,{onSubmit:function(){if(p)return;let[e,t,l]=m.split("::");r({libraryID:e,sliceID:t,variationID:l})},children:(0,n.jsxs)(a.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(a.bn,{className:eb().scrollArea,children:[(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"If you have multiple identical slices, you can merge them. All of your content will be remapped to the target slice."}),(0,n.jsxs)(a.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:eb().label,children:[(0,n.jsx)(a.bL,{variant:"bold",children:"Target slice*"}),"string"==typeof p?(0,n.jsx)(a.bL,{variant:"small",color:"tomato10",children:p}):null]}),(0,n.jsx)(a.bq,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:m,onValueChange:function(e){h(e),e||v("Cannot be empty.")},children:d.map(e=>(0,n.jsx)(a.bt,{value:e.path,children:e.path.split("::").join(" > ")},e.path))}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"Choose a slice that you would like to merge this into."})]})]}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",loading:c,disabled:!!p,children:"Merge"})]})]})})})]})},eC=e=>{var t;let{slice:l,path:i}=e,{refreshState:o}=(0,f.Z)(),[r,d]=(0,s.useState)(!1),[u,m]=(0,s.useState)(),{setCustomType:h}=I(),{libraries:p}=(0,c.v9)(e=>({libraries:(0,er.Sd)(e)})),x="Slice"===l.value.type&&null!==(t=l.value.fieldset)&&void 0!==t?t:l.key,b=p.filter(e=>e.isLocal),y=b.map(e=>e.components).flat(),g=eT(l,x,y),j=async e=>{var t,n,a;if(!u)return;d(!0),v.Xe.track({event:"legacy-slice:converted",id:e.sliceID,variation:null!==(t=e.variationID)&&void 0!==t?t:"default",library:e.libraryID,conversionType:u});let{errors:r}=await en.managerClient.slices.convertLegacySliceToSharedSlice({model:l.value,src:{...i,sliceID:l.key},dest:{libraryID:e.libraryID,sliceID:e.sliceID,variationName:null!==(n=e.variationName)&&void 0!==n?n:"Default",variationID:null!==(a=e.variationID)&&void 0!==a?a:"default"}});if(r.length)throw console.error("Could not convert slice `".concat(x,"`"),r),O.Am.error("Could not convert slice `".concat(x,"`")),r;let{model:s,errors:c}=await en.managerClient.customTypes.readCustomType({id:i.customTypeID});if(c.length||!s){console.error("Could not refresh custom type view `".concat(i.customTypeID,"`"),c),O.Am.error("Could not refresh custom type view `".concat(i.customTypeID,"`"));return}switch(o(await (0,v.y0)()),d(!1),m(void 0),u){case"as_new_slice":O.Am.success("".concat(x," has been upgraded to a new slice ").concat(e.libraryID," > ").concat(e.sliceID));break;case"as_new_variation":O.Am.success("".concat(x," has been converted as a variation of ").concat(e.libraryID," > ").concat(e.sliceID));break;default:O.Am.success("".concat(x," has been merged with ").concat(e.libraryID," > ").concat(e.sliceID))}h({customType:s})},S={path:i,slice:l,sliceName:x,libraries:b,localSharedSlices:y,identicalSlices:g,close:()=>m(void 0),onSubmit:j,isLoading:r};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.ar,{children:[(0,n.jsx)(a.av,{children:(0,n.jsx)(a.E,{"data-testid":"convert-legacy-slice",startIcon:"refresh",endIcon:"arrowDropDown",size:"medium",color:"grey",children:"Migrate legacy slice"})}),(0,n.jsxs)(a.as,{align:"start",children:[(0,n.jsx)(a.at,{startIcon:(0,n.jsx)(a.aX,{name:"folder",size:"large"}),description:"Use it with new types",onSelect:()=>m("as_new_slice"),children:"Upgrade slice"}),(0,n.jsx)(a.at,{startIcon:(0,n.jsx)(a.aX,{name:"viewDay",size:"large"}),description:"Add it to another slice",onSelect:()=>m("as_new_variation"),disabled:!y.length,children:"Convert to slice variation"}),(0,n.jsx)(a.at,{startIcon:(0,n.jsx)(a.aX,{name:"driveFileMove",size:"large"}),description:"Combine identical slices",onSelect:()=>m("merge_with_identical"),disabled:!g.length,children:"Merge with another slice"})]})]}),(0,n.jsx)(ey,{...S,isOpen:"as_new_slice"===u}),(0,n.jsx)(ej,{...S,isOpen:"as_new_variation"===u}),(0,n.jsx)(eI,{...S,isOpen:"merge_with_identical"===u})]})},eT=(e,t,l)=>(0,s.useMemo)(()=>{let n=[],a=(0,ep.ux)(e.value,t);for(let e of l)for(let t of e.model.variations){let l=(0,ep.ux)(t,e.model.name);a.primary===l.primary&&a.items===l.items&&n.push({libraryID:e.from,sliceID:e.model.id,variationID:t.id,path:"".concat(e.from,"::").concat(e.model.id,"::").concat(t.id)})}return n},[e,t,l]),eD=e=>{let{slice:t,path:l}=e,[i]=(0,em.E)("legacySliceUpgrader"),o=i.enabled?"This Slice was created with the Legacy Builder. It needs to be converted first to be used within Slice Machine.":"This Slice was created with the Legacy Builder, and is incompatible with Slice Machine. You cannot edit, push, or delete it in Slice Machine. In order to proceed, manually remove the Slice from your type model. Then create a new Slice with the same fields using Slice Machine.";return(0,n.jsxs)(eh.Zb,{children:[(0,n.jsx)(eh.ZB,{component:"div",children:(0,n.jsx)(a.D,{alignItems:"center",justifyContent:"center",children:(0,n.jsx)(a.bL,{color:"grey11",component:"span",children:"No screenshot available"})})}),(0,n.jsxs)(eh.T$,{children:[(0,n.jsx)(a.c3,{content:o,side:"bottom",children:(0,n.jsx)(a.m,{color:"purple",title:"Legacy Slice"})}),i.enabled?(0,n.jsx)(eC,{slice:t,path:l}):null]}),(0,n.jsx)(eh.eW,{subtitle:"1 variation",title:(0,ep.Dj)(t.value)})]})};var ek=l(51507),ew=l(21151);let e_=e=>{let{slices:t,format:l,path:a,onRemoveSharedSlice:i}=e,o=t.some(e=>"SharedSlice"!==e.type),r=g.$[l],[c]=(0,em.E)("legacySliceUpgrader");return(0,s.useEffect)(()=>{o&&(c.enabled?O.Am.info("This ".concat(r.name({start:!1,plural:!1})," contains legacy slices that can be upgraded.")):O.Am.warning("This ".concat(r.name({start:!1,plural:!1})," contains slices that are incompatible.")))},[o]),(0,n.jsx)(ew.Z,{elems:t,defineElementKey:e=>"SharedSlice"!==e.type?e.payload.key:e.payload.model.name,renderElem:e=>{if("SharedSlice"!==e.type){let t=e.payload;return(0,n.jsx)(eD,{slice:t,path:a})}{let t=e.payload;return(0,n.jsx)(ek.b,{action:{type:"remove",onRemove:()=>{i(t.model.id)}},mode:"navigation",slice:t,variant:"solid"})}},sx:{padding:"16px"}})};async function eL(e){try{let{templateIDs:t,localLibrariesNames:l,location:n,onSuccess:a}=e,{data:i,errors:o}=await en.managerClient.sliceTemplateLibrary.createSlices({templateIDs:t});if(o.length>0||void 0===i)throw o;i.sliceIDs.forEach((e,a)=>{v.Xe.track({event:"slice:created",id:e,name:e,library:l[0],location:n,mode:"template",sliceTemplate:t[a]})}),await a(i.sliceIDs)}catch(t){let e="Internal Error: Slice(s) not created";console.error(e,t),O.Am.error(e)}}var eA=l(26109);let eE=[{extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:{id:"video_highlights",name:"VideoHighlights",type:"SharedSlice",variations:[{description:"",docURL:"",id:"default",name:"Default",version:"sktwi1xtmkfgx8626"}]},screenshots:{default:{url:"/videoHighlights.png"}}}];var eN=e=>{let{availableSlices:t,values:l,placeholderSlices:a}=e;return(0,n.jsx)(L.F2,{name:"sliceKeys",render:e=>(0,n.jsx)(ew.Z,{gridTemplateMinPx:"200px",elems:t,defineElementKey:e=>"".concat(e.from,"-").concat(e.model.name),renderElem:t=>{var i;let o=null!==(i=null==a?void 0:a.some(e=>e.model.id===t.model.id))&&void 0!==i&&i,r=l.sliceKeys.includes(t.model.id);return(0,n.jsx)(ek.b,{action:{type:"checkbox"},isComingSoon:o,mode:"selection",onSelectedChange:n=>{n?e.push(t.model.id):e.remove(l.sliceKeys.indexOf(t.model.id))},selected:r,slice:t,variant:"outlined"})}})})};let eM=e=>{let{formId:t,close:l,onSuccess:a,availableSlicesTemplates:i,localLibraries:o,location:r}=e,{createSliceSuccess:s}=(0,f.Z)(),c=(0,q.k)();return(0,n.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;eL({templateIDs:t,localLibrariesNames:o.map(e=>e.name),location:r,onSuccess:async e=>{s((await (0,v.y0)()).libraries),a(await Promise.all(e.map(async e=>(await en.managerClient.slices.readSlice({libraryID:o[0].name,sliceID:e})).model).filter(e=>void 0!==e)))}})},initialValues:{sliceKeys:[]},content:{title:"Use template ".concat((0,$._)(c.value))},validate:e=>{if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one template to add"}},actionMessage:e=>{let{errors:t}=e;return void 0!==t.sliceKeys?(0,n.jsx)(A.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(eN,{values:t,placeholderSlices:eE,availableSlices:[...i.map(e=>({extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:eA.id.toSM(e.model),screenshots:Object.entries(e.screenshots).reduce((e,t)=>({...e,[t[0]]:{url:t[1]}}),{})})),...eE]})}})};var ez=e=>{let{formId:t,close:l,onSubmit:a,availableSlices:i}=e,o=(0,q.k)();return(0,n.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;a(t.map(e=>{var t;return null===(t=i.find(t=>t.model.id===e))||void 0===t?void 0:t.model}).filter(e=>void 0!==e))},initialValues:{sliceKeys:[]},content:{title:"Select existing ".concat((0,$._)(o.value))},testId:"update-slices-modal",validate:e=>{if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one slice to add"}},actionMessage:e=>{let{errors:t}=e;return void 0!==t.sliceKeys?(0,n.jsx)(A.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(eN,{values:t,availableSlices:i})}})};let eZ=(e,t)=>{let l=(t||[]).reduce((e,t)=>[...e,...t.components],[]),{slicesInSliceZone:n,notFound:a}=e.value.reduce((e,t)=>{let{key:n,value:a}=t;if("SharedSlice"===a.type){let t=l.find(e=>e.model.id===n);return t?{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"SharedSlice",payload:t}]}:{...e,notFound:[...e.notFound,{key:n}]}}return{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"Slice",payload:{key:n,value:a}}]}},{slicesInSliceZone:[],notFound:[]});return{availableSlices:l,slicesInSliceZone:n,notFound:a}};var eO=e=>{var t;let{customType:l,onCreateSliceZone:i,onDeleteSliceZone:o,onRemoveSharedSlice:r,sliceZone:d,tabId:u}=e,m=(0,Y.l)(),h=(0,el.QT)(ea,[]),[p,x]=(0,s.useState)(!1),[b,y]=(0,s.useState)(!1),[g,j]=(0,s.useState)(!1),[S,C]=(0,s.useState)(!1),{remoteSlices:T,libraries:D}=(0,c.v9)(e=>({remoteSlices:(0,er.sT)(e),libraries:(0,er.Sd)(e),slices:(0,er.xC)(e)})),{setCustomType:k}=I(),{completeStep:_}=(0,ee.k)(),{openLoginModal:L}=(0,f.Z)(),A=(0,q.k)(),E=(0,W.F)({menuType:"Dropdown",sectionsNamingExperiment:A}),N=D.filter(e=>e.isLocal),{availableSlices:M,slicesInSliceZone:z,notFound:Z}=(0,s.useMemo)(()=>d?eZ(d,D):{availableSlices:[],slicesInSliceZone:[],notFound:[]},[d,D]),[F,K]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(null==Z?void 0:Z.length)&&Z.forEach(e=>{let{key:t}=e;r(t)})},[Z]);let B=z.filter(e=>"SharedSlice"===e.type).map(e=>e.payload),R=M.filter(e=>!B.some(t=>t.model.id===e.model.id)),U=()=>{y(!0)},V=()=>{j(!0)},X=async()=>{await en.managerClient.user.checkIsLoggedIn()?C(!0):L()},G=()=>{x(!0),v.Xe.track({event:"custom-type:open-add-from-templates",customTypeId:l.id,customTypeFormat:l.format})},es=()=>{y(!1)},ec=()=>{j(!1)},ed=()=>{C(!1)},em=()=>{x(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P.Bu,{actions:d?(0,n.jsxs)(a.ar,{children:[(0,n.jsx)(a.av,{children:(0,n.jsx)(a.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,n.jsxs)(a.as,{align:"end",children:[m.eligible&&(0,n.jsx)(a.at,{renderStartIcon:()=>E.fromImage.BackgroundIcon,onSelect:()=>void X(),description:E.fromImage.description,children:E.fromImage.title}),(0,n.jsx)(a.at,{renderStartIcon:()=>E.fromScratch.BackgroundIcon,onSelect:V,description:E.fromScratch.description,children:E.fromScratch.title}),h.length>0?(0,n.jsx)(a.at,{onSelect:G,renderStartIcon:()=>E.fromTemplate.BackgroundIcon,description:E.fromTemplate.description,children:E.fromTemplate.title}):void 0,R.length>0?(0,n.jsx)(a.at,{onSelect:U,renderStartIcon:()=>E.fromExisting.BackgroundIcon,description:E.fromExisting.description,children:E.fromExisting.title}):void 0]})]}):void 0,toggle:"page"!==l.format||"Main"!==u?(0,n.jsx)(a.bC,{checked:!!d,onCheckedChange:e=>{e?i():K(!0)},size:"small","data-testid":"slice-zone-switch"}):void 0,children:(0,$._)((0,$.f)(A.value))}),d?z.length>0?(0,n.jsx)(H.xR,{children:(0,n.jsx)(e_,{slices:z,format:l.format,path:{customTypeID:l.id,tabID:u,sliceZoneID:null!==(t=null==d?void 0:d.key)&&void 0!==t?t:""},onRemoveSharedSlice:r})}):(0,n.jsx)(a.D,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"center",padding:{block:32},children:(0,n.jsx)(J,{openUpdateSliceZoneModal:U,openCreateSliceModal:V,openCreateSliceFromImageModal:()=>void X(),openSlicesTemplatesModal:G,projectHasAvailableSlices:R.length>0,isSlicesTemplatesSupported:h.length>0})}):void 0,b&&(0,n.jsx)(ez,{formId:"tab-slicezone-form-".concat(u),availableSlices:R,onSubmit:e=>{let t=et({customType:l,tabId:u,slices:e});k({customType:w.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success("Slice(s) added to slice zone")}}),_("createSlice"),es()},close:es}),p&&(0,n.jsx)(eM,{formId:"tab-slicezone-form-".concat(u),availableSlicesTemplates:h,localLibraries:N,location:"".concat(l.format,"_type"),onSuccess:e=>{let t=et({customType:l,tabId:u,slices:e});k({customType:w.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success((0,n.jsx)(eo.GX,{message:"".concat((0,$.f)(A.value)," template(s) added to ").concat(A.value," zone and created at: "),path:"".concat(N[0].name,"/")}))}}),_("createSlice"),em()},close:em}),F&&(0,n.jsx)(eu,{closeDeleteSliceZoneModal:()=>{K(!1)},deleteSliceZone:()=>{o(),K(!1)}}),(null==N?void 0:N.length)!==0&&g&&(0,n.jsx)(ei.c,{onSuccess:e=>{let t=et({customType:l,tabId:u,slices:[e]});k({customType:w.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success((0,n.jsx)(eo.GX,{message:"New ".concat(A.value," added to ").concat(A.value," zone and created at: "),path:"".concat(N[0].name,"/")}))}}),ec()},localLibraries:N,location:"".concat(l.format,"_type"),remoteSlices:T,onClose:ec}),(0,n.jsx)(Q.S,{open:S,location:"".concat(l.format,"_type"),onSuccess:e=>{let{slices:t,library:a}=e,i=et({customType:l,tabId:u,slices:t.map(e=>e.model)});k({customType:w.Dc.fromSM(i),onSaveCallback:()=>{O.Am.success((0,n.jsx)(eo.GX,{message:"".concat((0,$.f)(A.value),"(s) added to ").concat(A.value," zone and created at: "),path:a}))}}),ed()},onClose:ed})]})};let eP=[K.C.UID,K.C.Image,K.C.Text,K.C.StructuredText,K.C.Link,K.C.Select,K.C.Boolean,K.C.Number,K.C.Color,K.C.Date,K.C.Table,K.C.Embed,K.C.Timestamp,K.C.GeoPoint,K.C.ContentRelationship,K.C.LinkToMedia,K.C.Group,K.C.NestedGroup];var eF=e=>{var t,l,i,o;let{tabId:r}=e,{customType:c,setCustomType:d}=I(),m=w.Dc.toSM(c),h=null===(t=m.tabs.find(e=>e.key===r))||void 0===t?void 0:t.sliceZone,p=null!==(i=null===(l=m.tabs.find(e=>e.key===r))||void 0===l?void 0:l.value)&&void 0!==i?i:[],x="page"===m.format&&m.repeatable?p.filter(e=>"uid"!==e.key):p,v=m.tabs.reduce((e,t)=>[...e,...t.value],[]),b=e=>{var t;let{apiId:l,value:n}=e,a=null===(t=n.config)||void 0===t?void 0:t.label;if((0,B.Ss)(K.C,n.type)||null==a)return;if("Range"===n.type||"IntegrationFields"===n.type||"Separator"===n.type)throw Error("Unsupported Field Type: ".concat(n.type));let i=K.C[n.type];try{i.schema.validateSync(n,{stripUnknown:!1})}catch(e){throw Error('Add field: Model is invalid for field "'.concat(n.type,'".'))}let o=w.L$.fromSM(n);d({customType:(0,u.xS)({customType:c,newField:o,newFieldId:l,sectionId:r}),onSaveCallback:()=>{O.Am.success("".concat("Group"===n.type?"Group":"Field"," added"))}}),(0,U.V)({id:l,field:o})},y=e=>{let{apiId:t,newKey:l,value:n,inGroupFieldAction:a,updateMeta:i}=e;if((0,B.Ss)(K.C,n.type))return;let o=w.L$.fromSM(n);d({customType:(0,u.L4)({customType:c,previousFieldId:t,newFieldId:l,newField:o,sectionId:r}),onSaveCallback:()=>{"add"===a&&O.Am.success("Field added")},updateMeta:i}),a||(0,V.Z)({previousId:t,id:l,field:o})};return(0,n.jsx)(F.S,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(a.D,{padding:32,children:(0,n.jsx)(a.bg,{})}),children:(0,n.jsxs)(P.aV,{border:!1,style:{flexGrow:1},children:[(0,n.jsx)(G.Z,{zoneType:"customType",zoneTypeFormat:null!==(o=c.format)&&void 0!==o?o:"custom",tabId:r,title:"Static zone",dataTip:"",fields:x,poolOfFieldsToCheck:v,showHints:!0,EditModal:X.Z,widgetsArray:eP,onDeleteItem:e=>{d({customType:(0,u.AK)({customType:c,fieldId:e,sectionId:r})})},onSave:e=>""===e.apiId?b({...e,apiId:e.newKey}):y(e),onDragEnd:e=>{if((0,B.uS)(e))return;let{source:t,destination:l}=e;if(!l)return;let n=(0,u.gR)({customType:c,sourceIndex:t.index,destinationIndex:l.index,sectionId:r});(0,Z.flushSync)(()=>d({customType:n}))},renderHintBase:e=>{let{item:t}=e;return"data".concat((0,R.Ti)(t.key))},renderFieldAccessor:e=>"data".concat((0,R.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:c.repeatable}),(0,n.jsx)(eO,{customType:m,tabId:r,sliceZone:h,onRemoveSharedSlice:e=>{d({customType:(0,u.EN)({customType:c,sectionId:r,sliceId:e})})},onCreateSliceZone:()=>{d({customType:(0,u.Tr)(c,r)})},onDeleteSliceZone:()=>{d({customType:(0,u.E3)(c,r)})}})]})})})};let eK=()=>{var e,t,l;let{customType:i,setCustomType:o}=I(),r=w.Dc.toSM(i),[c,d]=(0,s.useState)(null===(e=r.tabs[0])||void 0===e?void 0:e.key),[m,h]=(0,s.useState)(),p=(null===(l=r.tabs.find(e=>e.key===c))||void 0===l?void 0:null===(t=l.sliceZone)||void 0===t?void 0:t.value.length)===0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.c9,{sx:p?{flexGrow:1}:void 0,children:["page"===i.format?(0,n.jsx)(a.ca,{title:i.repeatable?(0,n.jsx)(T,{}):void 0}):void 0,(0,n.jsxs)(a.cb,{onValueChange:d,value:c,children:[(0,n.jsx)(a.cd,{onAddNewTab:()=>{h({type:"CREATE_CUSTOM_TYPE_TAB"})},children:r.tabs.map(e=>(0,n.jsx)(a.ce,{menu:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.at,{onSelect:()=>{h({type:"UPDATE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(a.aX,{name:"edit"}),children:"Rename"}),(0,n.jsx)(a.at,{color:"tomato",disabled:function(e){if(r.tabs.length<=1)return!0;let t=r.tabs.find(e=>e.value.find(e=>"uid"===e.key));return"page"===i.format&&i.repeatable&&(null==t?void 0:t.key)===e}(e.key),onSelect:()=>{h({type:"DELETE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(a.aX,{name:"delete"}),children:"Remove"})]}),value:e.key,children:e.key},e.key))}),r.tabs.map(e=>(0,n.jsx)(a.cc,{value:e.key,children:(0,n.jsx)(eF,{tabId:e.key})},e.key))]})]}),(null==m?void 0:m.type)==="CREATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(N,{close:()=>{h(void 0)},isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,u.vB)(i,t)}),d(t)},tabIds:r.tabs.map(e=>e.key.toLowerCase())}):void 0,(null==m?void 0:m.type)==="UPDATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(z,{close:()=>{h(void 0)},initialTabKey:m.tabKey,isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,u.HO)(i,m.tabKey,t)}),c===m.tabKey&&d(t)},tabIds:r.tabs.filter(e=>e.key!==m.tabKey).map(e=>e.key.toLowerCase())}):void 0,(null==m?void 0:m.type)==="DELETE_CUSTOM_TYPE_TAB"?(0,n.jsx)(M,{close:()=>{h(void 0)},isOpen:!0,onSubmit:()=>{if(o({customType:(0,u.F$)(i,m.tabKey)}),c===m.tabKey){var e;let t=null===(e=r.tabs.find(e=>e.key!==m.tabKey))||void 0===e?void 0:e.key;void 0!==t&&d(t)}}}):void 0]})};var eB=l(16442),eR=l(78254),eU=l(60867),eV=l(9975),eX=l(34919),eG=l.n(eX);let eH=e=>{let{tabs:t,...l}=e;return(0,n.jsxs)(eV.fC,{...l,className:eG().root,defaultValue:t[0].label,orientation:"vertical",children:[(0,n.jsx)(eV.aV,{className:eG().list,"aria-label":"content tabs",children:t.map((e,t)=>{let{label:l}=e;return(0,n.jsx)(eV.xz,{className:eG().trigger,value:l,children:(0,n.jsx)(a.bL,{className:eG().triggerText,component:"span",color:"inherit",children:l})},"".concat(l,"-trig").concat(t+1))})}),t.map((e,t)=>{let{label:l,content:i}=e;return(0,n.jsx)(eV.VY,{className:eG().content,value:l,children:(0,n.jsx)(a.bn,{className:eG().scrollArea,children:i})},"".concat(l,"-content").concat(t+1))})]})};var eY=l(25661),eq=l(88241),eQ=l(32554),eW=l(44621),e$=l.n(eW);let eJ=e=>{var t,l;let{inline:i,...o}=e,r=(0,eQ.p)();if(!0===i)return(0,n.jsx)("code",{...o,className:e$().inlineCode});let s=(()=>{var e,t,l,n,a;if((null===(t=o.node)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.meta)!==void 0){let e=null===(n=o.node)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.meta;return{fileName:e.substring(1,e.length-1),language:null===(a=o.className)||void 0===a?void 0:a.split("-")[1]}}return null})(),c=null===(t=/language-(\w+)/.exec(null!==(l=o.className)&&void 0!==l?l:""))||void 0===t?void 0:t[1];return(0,n.jsx)(a.W,{...o,onCopy:()=>{v.Xe.track({event:"page-type:copy-snippet",framework:r})},language:c,code:String(o.children).replace(/\n$/,""),title:null==s?void 0:s.fileName})},e0=e=>{let{markdown:t}=e;return(0,n.jsx)(eY.D,{children:t,linkTarget:"_blank",remarkPlugins:[eq.Z],components:{code:e=>(0,n.jsx)(eJ,{...e}),h1:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h1",variant:"h1"}),h2:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h2",variant:"h2"}),h3:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h3",variant:"h3"}),h4:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h4",variant:"h4"}),h5:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h4",variant:"h4"}),p:e=>(0,n.jsx)(a.bL,{className:e$().section,children:e.children,component:"p",variant:"normal"}),pre:e=>(0,n.jsx)(a.bL,{className:e$().section,children:e.children,component:"pre",variant:"normal"})}})};async function e1(e){let t=JSON.parse(e),{errors:l,documentation:n}=await en.managerClient.documentation.read({kind:t.kind,data:t.data});if(l.length>0)throw l;return n}var e4=l(65480),e3=l.n(e4);let e6=e=>{var t;let{model:l}=e,i=(0,eQ.p)(),o=(t={kind:"PageSnippet",data:{model:l}},(0,el.QT)(e1,[JSON.stringify(t)])),{completeStep:r}=(0,ee.k)();return 0===o.length?null:(0,n.jsxs)(a.ae,{size:"small",trigger:(0,n.jsx)(a.E,{color:"grey",onClick:()=>{r("codePage"),v.Xe.track({event:"page-type:open-snippet",framework:i})},startIcon:"code",children:"Page snippet"}),children:[(0,n.jsx)(a.al,{icon:"code",title:"Page snippet"}),(0,n.jsx)("section",{className:e3().content,children:o.length>1?(0,n.jsx)(eH,{style:{flex:1},tabs:o.map((e,t)=>{let{label:l,content:a}=e;return{label:null!=l?l:"Tab ".concat(t+1),content:(0,n.jsx)(e0,{markdown:a})}})}):(0,n.jsx)(a.bn,{style:{flex:1,padding:16},children:(0,n.jsx)(e0,{markdown:o[0].content})})})]})},e2=e=>{let{model:t}=e;return(0,n.jsx)("div",{children:(0,n.jsx)(F.S,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(a.E,{color:"grey",startIcon:"code",children:"Page snippet"}),children:(0,n.jsx)(e6,{model:t})})})})},e8=()=>{let e=(0,r.useRouter)(),{selectedCustomType:t}=(0,c.v9)(t=>({selectedCustomType:(0,eR.Jk)(t,(0,h.Ag)(e.query))}));return((0,s.useEffect)(()=>{t&&(0,eB.TG)(t)||e.replace("/")},[t,e]),t&&(0,eB.TG)(t))?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o(),{children:(0,n.jsxs)("title",{children:[t.local.label," - Slice Machine"]})}),(0,n.jsx)(e5,{customType:t.local})]}):(0,n.jsx)(p.LN,{})},e5=e=>{let{customType:t}=e;return null===t?(0,n.jsx)(p.LN,{}):(0,n.jsx)(p.LN,{children:(0,n.jsx)(S,{initialCustomType:w.Dc.fromSM(t),children:e=>{var l;let{actionQueueStatus:i,customType:o,setCustomType:r}=e,s=(0,u.y6)(o),c=h.cd[t.format],x=g.$[t.format];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(p.wd,{children:[(0,n.jsx)(p.Xq,{url:c.tablePagePathname}),(0,n.jsxs)(p.Cx,{children:[(0,n.jsx)(d.g,{children:x.name({start:!0,plural:!0})}),(0,n.jsx)(d.g,{active:!0,children:null!==(l=o.label)&&void 0!==l?l:o.id})]}),(0,n.jsxs)(p.K2,{children:[(0,n.jsx)(m.X,{status:i}),"page"===o.format?(0,n.jsx)(e2,{model:o}):void 0,(0,n.jsx)(eU._,{isChangesLocal:!0,format:s,customType:o,setLocalCustomType:r})]})]}),(0,n.jsx)(p.RN,{children:(0,n.jsx)(a.D,{flexDirection:"column",minWidth:0,children:(0,n.jsx)(eK,{})})})]})}})})}},43776:function(e,t,l){"use strict";l.d(t,{E:function(){return a}});var n=l(31470);function a(e){var t,l;let[a,i]=(0,n.f)(),o=async t=>{let l={...a,labs:{...a.labs}};t?l.labs[e]=t:e in l.labs&&delete l.labs[e],0===Object.keys(l.labs).length&&delete l.labs,await i(l)};return[{enabled:null!==(l=null==a?void 0:null===(t=a.labs)||void 0===t?void 0:t[e])&&void 0!==l&&l},o]}},31470:function(e,t,l){"use strict";l.d(t,{f:function(){return i}});var n=l(18566),a=l(80148);function i(){return[(0,n.QT)(o,[]),async e=>{await a.managerClient.project.writeSliceMachineConfig({config:e}),(0,n.VA)(o,[],e)}]}async function o(){return a.managerClient.project.getSliceMachineConfig()}},34919:function(e){e.exports={flex:"ContentTabs_flex__T21Oc",column:"ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",root:"ContentTabs_root__Gn3Zg ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",list:"ContentTabs_list__rAZtl ContentTabs_flex__T21Oc",trigger:"ContentTabs_trigger__cTyPN ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",triggerText:"ContentTabs_triggerText__p_ZBl",content:"ContentTabs_content__H1Stj ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",scrollArea:"ContentTabs_scrollArea__DuDcQ"}},65480:function(e){e.exports={content:"PageSnippetDialog_content__jIN6d"}},44621:function(e){e.exports={section:"MarkdownRenderer_section__uNS1M",inlineCode:"MarkdownRenderer_inlineCode__lmGTi"}},65375:function(e){e.exports={scrollArea:"ConvertLegacySliceButton_scrollArea__xf3vM",label:"ConvertLegacySliceButton_label__BK0Gd"}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[477],{37782:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changelog",function(){return r(93081)}])},38193:function(e,n,r){"use strict";r.d(n,{Z:function(){return l}});var t=r(52322),i=r(61183);r(2784);var s=r(59326),o=r(75289);i.Z.registerLanguage("svelte",e=>({subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"}]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10}]}]}));let a=["javascript","bash","xml","html","json"];var l=e=>{var n;let{children:r,lang:l,sx:c,codeStyle:x,codeClass:d,Header:p}=e,{theme:g}=(0,s.B7)(),u=l?i.Z.highlight(r,{language:"vue"===l?"html":l}).value:i.Z.highlightAuto(r,a).value;return(0,t.jsxs)(o.kC,{as:"pre",sx:c,children:[p?(0,t.jsx)(p,{}):null,(0,t.jsx)("code",{className:"hljs".concat(d?" ".concat(d):""),style:{overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(n=g.colors)||void 0===n?void 0:n.textClear),...x},dangerouslySetInnerHTML:{__html:u}})]})}},93081:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return O}});var t,i,s=r(52322),o=r(97729),a=r.n(o),l=r(56803),c=r(2784),x=r(56580),d=r(65077),p=r(18566),g=r(80148);async function u(){return await g.managerClient.versions.getAllStableSliceMachineVersionsWithKind()}function h(){return(0,p.QT)(u,[])}var v=r(51384),f=r(9149),m=r(75289);async function j(){return await g.managerClient.versions.getLatestNonBreakingSliceMachineVersion()}var b=r(85606),k=r(59082),C=r(12170);let y=e=>{let{type:n,hasUpToDateVersions:r}=e;return(0,s.jsx)(m.xv,{sx:{padding:"0px 4px",borderRadius:"2px",fontSize:"8px",fontWeight:600,lineHeight:"16px",textTransform:"uppercase",...(n===i.Latest||n===i.LatestNonBreaking)&&{bg:"grey02",color:"code.gray"},...n===i.Current&&r&&{bg:"lightGreen",color:"code.green"},...n===i.Current&&!r&&{bg:"lightOrange",color:"code.orange"}},children:n})},S=e=>{let{isSelected:n,onClick:r,versionNumber:t,tags:i,hasUpToDateVersions:o}=e;return(0,s.jsxs)(m.kC,{sx:{p:1,borderRadius:"4px",cursor:"pointer",transition:"200ms all",justifyContent:"space-between",alignItems:"center",...n?{color:"purple",bg:(0,C.DZ)("purple",.95)}:{"&:hover":{bg:"grey01"}}},onClick:r,children:[(0,s.jsx)(m.xv,{children:t}),(0,s.jsx)(m.kC,{sx:{gap:"8px"},children:i.map(e=>(0,s.jsx)(y,{type:e,hasUpToDateVersions:o},e))})]})};(t=i||(i={})).Latest="LATEST",t.LatestNonBreaking="LATEST-NON-BREAKING",t.Current="CURRENT";let T=e=>{var n;let{selectedVersion:r,selectVersion:t}=e,i=h(),{sliceMachineUpdateAvailable:o,adapterUpdateAvailable:a}=(0,k.P)(),c=(0,p.QT)(j,[]),x=(0,b.d)(),d=null===(n=i[0])||void 0===n?void 0:n.version;return(0,s.jsxs)(m.kC,{sx:{minWidth:"228px",borderRight:"1px dashed",borderColor:l.t.color.grey6,flexDirection:"column",paddingRight:"48px"},children:[(0,s.jsxs)(m.kC,{sx:{flexDirection:"column",borderBottom:"1px dashed",borderColor:l.t.color.grey6,paddingBottom:"28px"},children:[(0,s.jsx)(m.xv,{sx:{fontSize:"20px",fontWeight:500,lineHeight:"32px"},children:"Changelog"}),(0,s.jsx)(m.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",marginTop:"28px"},children:"All versions"})]}),(0,s.jsx)(m.kC,{sx:{mt:"24px",flexDirection:"column",gap:"4px",overflow:"auto"},children:i.map((e,n)=>(0,s.jsx)(S,{isSelected:(null==r?void 0:r.version)===e.version,onClick:()=>t(e),versionNumber:e.version,tags:function(e){let n=[];return e===d?n.push("LATEST"):e===c&&n.push("LATEST-NON-BREAKING"),e===x&&n.push("CURRENT"),n}(e.version),hasUpToDateVersions:!o&&!a},"versionBadge-".concat(e.version,"-").concat(n)))})]})};var N=r(951);async function w(e){return await g.managerClient.versions.getSliceMachineReleaseNotesForVersion({version:e})}var E=r(19870);let L=e=>{let{releaseNotes:n}=e;return(0,s.jsx)(m.xv,{sx:{"h1, h2, h3":{fontSize:"16px",fontWeight:600,lineHeight:"20px"},p:{fontSize:"14px",fontWeight:400,lineHeight:"20px"},b:{fontSize:"14px",fontWeight:600,lineHeight:"20px"},code:{color:"code.orange"},li:{listStyleType:"disc",marginLeft:"25px",paddingLeft:"5px"}},dangerouslySetInnerHTML:{__html:E.TU.parse(n)}})};var R=r(32554),_=r(38193);let z=e=>{let{selectedVersion:n,packageManager:r}=e,t=h(),i=(0,R.p)(),{sliceMachineUpdateAvailable:o,adapterUpdateAvailable:a}=(0,k.P)(),l=n.version===t[0].version,c=function(e,n){let r=n.join(" ");switch(e){case"bun":return"bun add --development ".concat(r);case"npm":return"npm install --save-dev ".concat(r);case"pnpm":case"pnpm@6":return"pnpm add --save-dev ".concat(r);case"yarn":case"yarn@berry":return"yarn add --dev ".concat(r)}}(r,function(e){let{sliceMachineVersionToInstall:n,isLatestSliceMachineVersion:r,adapterName:t}=e,i=["slice-machine-ui@".concat(n)];return r&&i.push("".concat(t,"@latest")),i}({sliceMachineVersionToInstall:l?"latest":n.version,isLatestSliceMachineVersion:l,adapterName:i}));return(0,s.jsxs)(s.Fragment,{children:[a&&!o&&l&&(0,s.jsxs)(m.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},children:[(0,s.jsx)(N.CSE,{size:"24px"}),"It looks like you are using an outdated version of the adapter. Run this command to update your adapter:"]}),(0,s.jsxs)(m.kC,{sx:{flexDirection:"column",gap:"16px",padding:"16px",bg:"grey01"},children:[(0,s.jsx)(m.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"20px"},children:"How to install"}),(0,s.jsxs)(m.kC,{sx:{gap:"8px"},children:[(0,s.jsx)(_.Z,{codeStyle:{color:"white",flex:1,padding:"8px"},sx:{flex:1},children:c}),(0,s.jsx)(m.zx,{variant:"secondary",onClick:()=>void navigator.clipboard.writeText(c),children:"Copy"})]})]})]})},H=e=>{let{versionKind:n}=e,r={fontSize:"14px",padding:"2px 4px",borderRadius:"4px",textTransform:"uppercase",..."MAJOR"===n?{color:"purple",bg:(0,C.DZ)("purple",.85)}:{color:"grey05",bg:"grey02"}};return(0,s.jsx)(m.xv,{sx:r,children:n})},B=()=>(0,s.jsxs)(m.kC,{sx:{paddingLeft:"32px"},children:["Could not fetch release notes."," ",(0,s.jsx)("a",{href:"https://github.com/prismicio/slice-machine/releases",target:"_blank",rel:"noopener noreferrer",children:"Find out more on GitHub"})]}),M=e=>{var n;let{selectedVersion:r,packageManager:t}=e,i=(n=r.version,(0,p.QT)(w,[n]));return(0,s.jsxs)(m.kC,{sx:{flexDirection:"column"},children:[(0,s.jsxs)(m.kC,{sx:{padding:"0px 0px 32px 32px",borderBottom:"1px dashed",borderColor:l.t.color.grey6,justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(m.xv,{sx:{fontSize:"24px",fontWeight:600,lineHeight:"32px"},children:"Version ".concat(r.version)}),!!r.kind&&(0,s.jsx)(H,{versionKind:r.kind})]}),(0,s.jsxs)(m.kC,{sx:{flexDirection:"column",padding:"24px 0px 0px 32px",gap:"24px"},children:[(null==i?void 0:i.includes("# Breaking Change"))&&(0,s.jsxs)(m.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},"data-testid":"breaking-changes-warning",children:[(0,s.jsx)(N.CSE,{size:"24px"}),"This update includes breaking changes. To update correctly, follow the steps below."]}),(0,s.jsx)(z,{selectedVersion:r,packageManager:t}),void 0!==i?(0,s.jsx)(L,{releaseNotes:i}):(0,s.jsx)(B,{})]})]})};function A(){let{packageManager:e}=(0,x.v9)(e=>({packageManager:(0,f.Ak)(e)})),n=h(),r=n[0],[t,i]=(0,c.useState)(null!=r?r:void 0);(0,c.useEffect)(()=>{i(r)},[r]);let o=0===n.length||!t;return(0,s.jsx)(v.LN,{children:(0,s.jsx)(v.RN,{children:(0,s.jsxs)(d.xR,{sx:{display:"flex",minWidth:0},children:[(0,s.jsx)(T,{selectedVersion:t,selectVersion:e=>i(e)}),o?(0,s.jsx)(B,{}):(0,s.jsx)(l.ay,{renderError:()=>(0,s.jsx)(B,{}),children:(0,s.jsx)(c.Suspense,{fallback:(0,s.jsx)(l.bg,{}),children:(0,s.jsx)(M,{selectedVersion:t,packageManager:e})})})]})})})}function O(){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a(),{children:(0,s.jsx)("title",{children:"Changelog - Slice Machine"})}),(0,s.jsx)(A,{})]})}}},function(e){e.O(0,[898,183,870,888,774,179],function(){return e(e.s=37782)}),_N_E=e.O()}]);
|