slice-machine-ui 2.2.2-beta.9 → 2.3.0

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.
Files changed (63) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/chunks/{18539003-e38c98b473d02623.js → 18539003-afe9213a677bd9f0.js} +3 -3
  3. package/out/_next/static/chunks/212-b6a2b8d9d16ef3c5.js +1 -0
  4. package/out/_next/static/chunks/{210-565d01ee9777d1a1.js → 326-2d6d04d623de16c6.js} +2 -2
  5. package/out/_next/static/chunks/448-ae7b5e576a84b47d.js +1 -0
  6. package/out/_next/static/chunks/465-d5dd75edd8e6bb65.js +1 -0
  7. package/out/_next/static/chunks/574-a23212bd78e563de.js +1 -0
  8. package/out/_next/static/chunks/{756-0b198fb40a3e6ae2.js → 695-bfe7255199983590.js} +6 -4
  9. package/out/_next/static/chunks/816-17afd84d2642f4c4.js +1 -0
  10. package/out/_next/static/chunks/pages/_app-07a2573662865a6b.js +547 -0
  11. package/out/_next/static/chunks/pages/changelog-1d15a7ef498f499a.js +1 -0
  12. package/out/_next/static/chunks/pages/changes-0af2a1a5244418f9.js +1 -0
  13. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-a6ff1618238b3510.js → [customTypeId]-b714ad9814898d23.js} +1 -1
  14. package/out/_next/static/chunks/pages/index-2610e550d79c5bb1.js +1 -0
  15. package/out/_next/static/chunks/pages/labs-240ba57bfdabe998.js +1 -0
  16. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-c300f963db847451.js → [pageTypeId]-aa881786f6e5aee2.js} +1 -1
  17. package/out/_next/static/chunks/pages/settings-039476a9a63d25a1.js +1 -0
  18. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-cfc19e3e799745bb.js +1 -0
  19. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-58e6cb0f278ea03c.js +1 -0
  20. package/out/_next/static/chunks/pages/slices-9894ce968d74baf6.js +1 -0
  21. package/out/_next/static/css/447984631bacb88c.css +1 -0
  22. package/out/_next/static/yi8ItcVBmEtxCSvLChc0b/_buildManifest.js +1 -0
  23. package/out/changelog.html +1 -1
  24. package/out/changes.html +1 -1
  25. package/out/custom-types/[customTypeId].html +1 -1
  26. package/out/custom-types.html +1 -1
  27. package/out/index.html +1 -1
  28. package/out/labs.html +1 -1
  29. package/out/page-types/[pageTypeId].html +1 -1
  30. package/out/settings.html +1 -1
  31. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  32. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  33. package/out/slices.html +1 -1
  34. package/package.json +9 -9
  35. package/src/features/builder/AddFieldDropdown.tsx +3 -0
  36. package/src/features/onboarding/OnboardingGuide.tsx +45 -0
  37. package/src/features/onboarding/OnboardingProgressStepper.tsx +71 -0
  38. package/src/features/onboarding/OnboardingProvider.tsx +82 -0
  39. package/src/features/onboarding/OnboardingStepDialog/OnboardingStepDialog.tsx +46 -0
  40. package/src/features/onboarding/OnboardingStepDialog/OnboardingStepDialogContent.tsx +38 -0
  41. package/src/features/onboarding/OnboardingStepDialog/index.ts +1 -0
  42. package/src/features/onboarding/content.tsx +99 -0
  43. package/src/features/onboarding/types.ts +32 -0
  44. package/src/features/onboarding/useOnboardingExperiment.ts +6 -0
  45. package/src/hooks/usePersistedState.ts +20 -3
  46. package/src/legacy/components/Navigation/index.tsx +2 -0
  47. package/out/_next/static/chunks/212-58a99ab312f8a03b.js +0 -1
  48. package/out/_next/static/chunks/448-a070e845a4500277.js +0 -1
  49. package/out/_next/static/chunks/465-695ac5fedef986eb.js +0 -1
  50. package/out/_next/static/chunks/574-a391e2fe8084b1c3.js +0 -1
  51. package/out/_next/static/chunks/816-96fc9a79308019c7.js +0 -1
  52. package/out/_next/static/chunks/pages/_app-6fdb10a504e07048.js +0 -544
  53. package/out/_next/static/chunks/pages/changelog-f0cd26a9ae095e9e.js +0 -1
  54. package/out/_next/static/chunks/pages/changes-1a57f90433a0b5e2.js +0 -1
  55. package/out/_next/static/chunks/pages/index-a0530bd55c7e1872.js +0 -1
  56. package/out/_next/static/chunks/pages/labs-7b0abeef69494aec.js +0 -1
  57. package/out/_next/static/chunks/pages/settings-f82286dde10f624c.js +0 -1
  58. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-453f946e8879c829.js +0 -1
  59. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-7009aed51761c5eb.js +0 -1
  60. package/out/_next/static/chunks/pages/slices-7411822d74f1f6c1.js +0 -1
  61. package/out/_next/static/css/82c8c4f05b25d3af.css +0 -1
  62. package/out/_next/static/uy_u3vlXV2zWs0MNOVlac/_buildManifest.js +0 -1
  63. /package/out/_next/static/{uy_u3vlXV2zWs0MNOVlac → yi8ItcVBmEtxCSvLChc0b}/_ssgManifest.js +0 -0
@@ -0,0 +1,45 @@
1
+ import { Card, CardContent, Text } from "@prismicio/editor-ui";
2
+
3
+ import { OnboardingProgressStepper } from "@/features/onboarding/OnboardingProgressStepper";
4
+ import {
5
+ OnboardingProvider,
6
+ useOnboardingContext,
7
+ } from "@/features/onboarding/OnboardingProvider";
8
+ import { useOnboardingExperiment } from "@/features/onboarding/useOnboardingExperiment";
9
+
10
+ const OnboardingGuideContent = () => {
11
+ const { steps, completedStepCount, isComplete } = useOnboardingContext();
12
+
13
+ if (isComplete) return null;
14
+
15
+ return (
16
+ <Card color="grey2" variant="outlined" paddingBlock={16}>
17
+ <CardContent>
18
+ <div>
19
+ <Text variant="bold" color="grey12">
20
+ Welcome
21
+ </Text>
22
+ <Text color="grey11" variant="small">
23
+ Get started in {steps.length} steps
24
+ </Text>
25
+ </div>
26
+ <Text color="grey11" variant="small" align="end">
27
+ {completedStepCount}/{steps.length}
28
+ </Text>
29
+ <OnboardingProgressStepper />
30
+ </CardContent>
31
+ </Card>
32
+ );
33
+ };
34
+
35
+ export const OnboardingGuide = () => {
36
+ const { eligible } = useOnboardingExperiment();
37
+
38
+ if (!eligible) return null;
39
+
40
+ return (
41
+ <OnboardingProvider>
42
+ <OnboardingGuideContent />
43
+ </OnboardingProvider>
44
+ );
45
+ };
@@ -0,0 +1,71 @@
1
+ import {
2
+ Button,
3
+ DropdownMenu,
4
+ DropdownMenuContent,
5
+ DropdownMenuItem,
6
+ DropdownMenuLabel,
7
+ DropdownMenuTrigger,
8
+ Icon,
9
+ } from "@prismicio/editor-ui";
10
+ import { useState } from "react";
11
+
12
+ import { useOnboardingContext } from "@/features/onboarding/OnboardingProvider";
13
+ import { OnboardingStepDialog } from "@/features/onboarding/OnboardingStepDialog";
14
+ import type { OnboardingStep } from "@/features/onboarding/types";
15
+
16
+ const EndCtaIcon = () => <Icon name="playCircle" size="small" color="grey11" />;
17
+
18
+ export const OnboardingProgressStepper = () => {
19
+ const { completedStepCount, steps, isStepComplete } = useOnboardingContext();
20
+
21
+ const [isDialogOpen, setDialogOpen] = useState(false);
22
+ const [activeStep, setActiveStep] = useState(steps[0]);
23
+
24
+ const showStep = (step: OnboardingStep) => {
25
+ setActiveStep(step);
26
+ setDialogOpen(true);
27
+ };
28
+
29
+ return (
30
+ <>
31
+ <OnboardingStepDialog
32
+ step={activeStep}
33
+ isOpen={isDialogOpen}
34
+ onClose={() => setDialogOpen(false)}
35
+ />
36
+ <DropdownMenu>
37
+ <DropdownMenuTrigger>
38
+ <Button
39
+ color="grey"
40
+ sx={{ width: "100%" }}
41
+ renderEndIcon={EndCtaIcon}
42
+ >
43
+ {completedStepCount > 0 ? "Continue" : "Start"}
44
+ </Button>
45
+ </DropdownMenuTrigger>
46
+ <DropdownMenuContent align="start">
47
+ <DropdownMenuLabel>Progress</DropdownMenuLabel>
48
+ {steps.map((step) => {
49
+ const isCompleted = isStepComplete(step.id);
50
+
51
+ return (
52
+ <DropdownMenuItem
53
+ key={step.id}
54
+ onSelect={() => showStep(step)}
55
+ startIcon={
56
+ <Icon
57
+ color={isCompleted ? "green10" : "currentColor"}
58
+ name={isCompleted ? "checkBox" : "checkBoxOutlinedBlank"}
59
+ />
60
+ }
61
+ description={step.description}
62
+ >
63
+ {step.title}
64
+ </DropdownMenuItem>
65
+ );
66
+ })}
67
+ </DropdownMenuContent>
68
+ </DropdownMenu>
69
+ </>
70
+ );
71
+ };
@@ -0,0 +1,82 @@
1
+ import { createContext, ReactNode, useContext } from "react";
2
+
3
+ import { onboardingSteps as steps } from "@/features/onboarding/content";
4
+ import {
5
+ type OnboardingStep,
6
+ type OnboardingStepStatuses,
7
+ onboardingStepStatusesSchema,
8
+ type OnboardingStepType,
9
+ } from "@/features/onboarding/types";
10
+ import { usePersistedState } from "@/hooks/usePersistedState";
11
+
12
+ type OnboardingContext = {
13
+ steps: OnboardingStep[];
14
+ completedStepCount: number;
15
+ toggleStepComplete: (step: OnboardingStepType) => void;
16
+ getStepIndex: (stepId: OnboardingStepType) => number;
17
+ isStepComplete: (stepId: OnboardingStepType) => boolean;
18
+ isComplete: boolean;
19
+ };
20
+
21
+ export const OnboardingContext = createContext<OnboardingContext | undefined>(
22
+ undefined,
23
+ );
24
+
25
+ const getInitialState = (): OnboardingStepStatuses => {
26
+ // if the old guide was dismissed, all steps start as complete
27
+ const wasOldGuideDismissed =
28
+ localStorage.getItem("slice-machine_isInAppGuideOpen") === "false";
29
+
30
+ return Object.fromEntries(
31
+ steps.map((step) => [step.id, wasOldGuideDismissed]),
32
+ ) as OnboardingStepStatuses;
33
+ };
34
+
35
+ export const OnboardingProvider = ({ children }: { children: ReactNode }) => {
36
+ const [stepStatus, setStepStatus] = usePersistedState(
37
+ "onboardingSteps",
38
+ getInitialState(),
39
+ { schema: onboardingStepStatusesSchema },
40
+ );
41
+
42
+ const toggleStepComplete = (step: OnboardingStepType) => {
43
+ setStepStatus((current) => ({ ...current, [step]: !current[step] }));
44
+ };
45
+
46
+ const getStepIndex = (stepId: OnboardingStepType) => {
47
+ return steps.findIndex(({ id }) => id === stepId);
48
+ };
49
+
50
+ const isStepComplete = (stepId: OnboardingStepType) => {
51
+ return stepStatus[stepId] ?? false;
52
+ };
53
+
54
+ const completedStepCount = Object.values(stepStatus).filter(Boolean).length;
55
+
56
+ return (
57
+ <OnboardingContext.Provider
58
+ value={{
59
+ steps,
60
+ toggleStepComplete,
61
+ isStepComplete,
62
+ getStepIndex,
63
+ completedStepCount,
64
+ isComplete: completedStepCount === steps.length,
65
+ }}
66
+ >
67
+ {children}
68
+ </OnboardingContext.Provider>
69
+ );
70
+ };
71
+
72
+ export const useOnboardingContext = () => {
73
+ const context = useContext(OnboardingContext);
74
+
75
+ if (context == null) {
76
+ throw new Error(
77
+ "useOnboardingContext must be used within an OnboardingProvider",
78
+ );
79
+ }
80
+
81
+ return context;
82
+ };
@@ -0,0 +1,46 @@
1
+ import {
2
+ Dialog,
3
+ DialogActions,
4
+ DialogContent,
5
+ DialogHeader,
6
+ } from "@prismicio/editor-ui";
7
+
8
+ import { useOnboardingContext } from "@/features/onboarding/OnboardingProvider";
9
+ import { OnboardingStepDialogContent } from "@/features/onboarding/OnboardingStepDialog/OnboardingStepDialogContent";
10
+ import type { OnboardingStep } from "@/features/onboarding/types";
11
+
12
+ type OnboardingStepDialogProps = {
13
+ step: OnboardingStep;
14
+ isOpen: boolean;
15
+ onClose: () => void;
16
+ };
17
+
18
+ export const OnboardingStepDialog = ({
19
+ step,
20
+ isOpen,
21
+ onClose,
22
+ }: OnboardingStepDialogProps) => {
23
+ const { toggleStepComplete, isStepComplete } = useOnboardingContext();
24
+
25
+ const markAsDone = () => {
26
+ if (!isOpen) return;
27
+ toggleStepComplete(step.id);
28
+ onClose();
29
+ };
30
+
31
+ return (
32
+ <Dialog open={isOpen} onOpenChange={onClose}>
33
+ <DialogHeader title="Learn" />
34
+ <DialogContent>
35
+ <OnboardingStepDialogContent step={step} />
36
+ <DialogActions
37
+ ok={{
38
+ text: isStepComplete(step.id) ? "Undo step" : "Mark as done",
39
+ onClick: markAsDone,
40
+ }}
41
+ cancel={{ text: "Close" }}
42
+ />
43
+ </DialogContent>
44
+ </Dialog>
45
+ );
46
+ };
@@ -0,0 +1,38 @@
1
+ import { Box, ScrollArea, Text, Video } from "@prismicio/editor-ui";
2
+
3
+ import { getOnboardingStepsContent } from "@/features/onboarding/content";
4
+ import { useOnboardingContext } from "@/features/onboarding/OnboardingProvider";
5
+ import { OnboardingStep } from "@/features/onboarding/types";
6
+ import { useRepositoryInformation } from "@/hooks/useRepositoryInformation";
7
+
8
+ type OnboardingStepDialogContentProps = {
9
+ step: OnboardingStep;
10
+ };
11
+
12
+ export const OnboardingStepDialogContent = ({
13
+ step,
14
+ }: OnboardingStepDialogContentProps) => {
15
+ const { getStepIndex } = useOnboardingContext();
16
+ const { repositoryUrl } = useRepositoryInformation();
17
+
18
+ const {
19
+ content: Content,
20
+ videoUrl,
21
+ title = step.title,
22
+ } = getOnboardingStepsContent({ repositoryUrl })[step.id];
23
+
24
+ return (
25
+ <ScrollArea>
26
+ <Box as="article" flexDirection="column" padding={16} gap={16}>
27
+ <section>
28
+ <Text sx={{ marginBottom: 4 }} color="purple9" variant="bold">
29
+ Step {getStepIndex(step.id) + 1}
30
+ </Text>
31
+ <Text variant="h3">{title}</Text>
32
+ <Content />
33
+ </section>
34
+ <Video src={videoUrl} sizing="contain" autoPlay loop />
35
+ </Box>
36
+ </ScrollArea>
37
+ );
38
+ };
@@ -0,0 +1 @@
1
+ export { OnboardingStepDialog } from "./OnboardingStepDialog";
@@ -0,0 +1,99 @@
1
+ import { Text } from "@prismicio/editor-ui";
2
+
3
+ import type {
4
+ OnboardingStep,
5
+ OnboardingStepContentDefinition,
6
+ OnboardingStepType,
7
+ } from "@/features/onboarding/types";
8
+
9
+ export const onboardingSteps: OnboardingStep[] = [
10
+ {
11
+ id: "addSlice",
12
+ title: "Add Slices",
13
+ description: "Add slices to your page type.",
14
+ },
15
+ {
16
+ id: "codePage",
17
+ title: "Code your page",
18
+ description: "Build your page's structure",
19
+ },
20
+ {
21
+ id: "pushModels",
22
+ title: "Push Your Page",
23
+ description: "Push to your Page Builder.",
24
+ },
25
+ {
26
+ id: "createContent",
27
+ title: "Create content",
28
+ description: "Create engaging content.",
29
+ },
30
+ {
31
+ id: "renderPage",
32
+ title: "Render your page",
33
+ description: "Render your page on localhost.",
34
+ },
35
+ ];
36
+
37
+ type GetOnboardingStepsContentProps = {
38
+ repositoryUrl: string;
39
+ };
40
+
41
+ export const getOnboardingStepsContent = ({
42
+ repositoryUrl,
43
+ }: GetOnboardingStepsContentProps): Record<
44
+ OnboardingStepType,
45
+ OnboardingStepContentDefinition
46
+ > => ({
47
+ addSlice: {
48
+ videoUrl:
49
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/ADD_SLICE.mp4",
50
+ content: () => (
51
+ <Text>Use slice templates and add them to your page type.</Text>
52
+ ),
53
+ },
54
+ codePage: {
55
+ videoUrl:
56
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/CODE_SNIP.mp4",
57
+ content: () => (
58
+ <Text>
59
+ If you don't already have a page component, copy-paste the page snippets
60
+ provided in your page type to create one.
61
+ </Text>
62
+ ),
63
+ },
64
+ pushModels: {
65
+ videoUrl:
66
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/PUSH.mp4",
67
+ content: () => (
68
+ <Text>
69
+ You have just created some models, but you can't use them yet. First,
70
+ you must push them to the Page Builder. The Page Builder is where you
71
+ create content. Go head — push your models.
72
+ </Text>
73
+ ),
74
+ },
75
+ createContent: {
76
+ videoUrl:
77
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/PREVIEW.mp4",
78
+ content: () => (
79
+ <Text>
80
+ Open your{" "}
81
+ <Text href={repositoryUrl} underline>
82
+ Page Builder
83
+ </Text>
84
+ , create a page, add slices, save, and publish. Then, come back here.
85
+ </Text>
86
+ ),
87
+ },
88
+ renderPage: {
89
+ videoUrl:
90
+ "https://res.cloudinary.com/dmtf1daqp/video/upload/v1700213517/IN-APP-GUIDE-SM/WRITE.mp4",
91
+ content: () => (
92
+ <Text>
93
+ To render the page, run your project in your terminal and visit the page
94
+ on localhost (e.g.{" "}
95
+ <Text component="code">localhost:3000/example-page</Text>).
96
+ </Text>
97
+ ),
98
+ },
99
+ });
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+
3
+ export const onboardingStepStatusesSchema = z.object({
4
+ addSlice: z.boolean(),
5
+ codePage: z.boolean(),
6
+ pushModels: z.boolean(),
7
+ createContent: z.boolean(),
8
+ renderPage: z.boolean(),
9
+ });
10
+
11
+ export type OnboardingStepStatuses = z.infer<
12
+ typeof onboardingStepStatusesSchema
13
+ >;
14
+
15
+ export type OnboardingStepType = keyof OnboardingStepStatuses;
16
+
17
+ export type OnboardingStep = {
18
+ id: OnboardingStepType;
19
+ title: string;
20
+ description: string;
21
+ };
22
+
23
+ export type OnboardingStepContentDefinition = {
24
+ title?: string;
25
+ content: () => JSX.Element;
26
+ videoUrl: string;
27
+ };
28
+
29
+ export type OnboardingStepContent = Record<
30
+ OnboardingStepType,
31
+ OnboardingStepContentDefinition
32
+ >;
@@ -0,0 +1,6 @@
1
+ import { useExperimentVariant } from "@/hooks/useExperimentVariant";
2
+
3
+ export const useOnboardingExperiment = () => {
4
+ const variant = useExperimentVariant("slice-machine-onboarding");
5
+ return { eligible: variant?.value === "on" };
6
+ };
@@ -1,20 +1,37 @@
1
1
  import { Dispatch, SetStateAction, useEffect, useState } from "react";
2
+ import { ZodType, ZodTypeDef } from "zod";
2
3
 
3
4
  type PersistedState<T> = [T, Dispatch<SetStateAction<T>>];
4
5
 
5
6
  const SLICE_MACHINE_STORAGE_PREFIX = "slice-machine";
6
7
 
8
+ type UsePersistedStateOptions<T> = {
9
+ schema?: ZodType<T, ZodTypeDef, unknown>;
10
+ };
11
+
12
+ export function usePersistedState<T>(
13
+ key: string,
14
+ ): PersistedState<T | undefined>;
7
15
  export function usePersistedState<T>(
8
16
  key: string,
9
17
  defaultValue: T,
10
- ): PersistedState<T> {
18
+ options?: UsePersistedStateOptions<T>,
19
+ ): PersistedState<T>;
20
+ export function usePersistedState<T>(
21
+ key: string,
22
+ defaultValue?: T,
23
+ options?: UsePersistedStateOptions<T>,
24
+ ): PersistedState<T | undefined> {
25
+ const { schema } = options ?? {};
11
26
  const computedKey = `${SLICE_MACHINE_STORAGE_PREFIX}_${key}`;
12
27
 
13
- const [value, setValue] = useState<T>(() => {
28
+ const [value, setValue] = useState<T | undefined>(() => {
14
29
  try {
15
30
  const value = localStorage.getItem(computedKey);
16
31
 
17
- return value !== null ? (JSON.parse(value) as T) : defaultValue;
32
+ if (value == null) return defaultValue;
33
+ if (!schema) return JSON.parse(value) as T;
34
+ return schema.parse(JSON.parse(value));
18
35
  } catch (error) {
19
36
  console.warn(`Error reading localStorage key “${computedKey}”:`, error);
20
37
 
@@ -17,6 +17,7 @@ import { ErrorBoundary } from "@/ErrorBoundary";
17
17
  import { CUSTOM_TYPES_CONFIG } from "@/features/customTypes/customTypesConfig";
18
18
  import { CUSTOM_TYPES_MESSAGES } from "@/features/customTypes/customTypesMessages";
19
19
  import { MasterSliceLibraryPreviewModal } from "@/features/masterSliceLibrary/SliceLibraryPreviewModal";
20
+ import { OnboardingGuide } from "@/features/onboarding/OnboardingGuide";
20
21
  import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
21
22
  import { useMarketingContent } from "@/hooks/useMarketingContent";
22
23
  import { useRepositoryInformation } from "@/hooks/useRepositoryInformation";
@@ -123,6 +124,7 @@ const Navigation: FC = () => {
123
124
  </ErrorBoundary>
124
125
 
125
126
  <SideNavList position="bottom">
127
+ <OnboardingGuide />
126
128
  {masterSliceLibrary !== undefined && (
127
129
  <SideNavListItem>
128
130
  <MasterSliceLibraryPreviewModal
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[212],{9502:function(e,n,t){"use strict";t.d(n,{R$:function(){return f},Qj:function(){return v},T9:function(){return m},nf:function(){return h},u2:function(){return p},_T:function(){return y}});var r=t(67557),o=t(62230),i=t(85244),s=t(98240),a=t(52322),c=t(7729),l=t(6277),u=t(98484),d=t.n(u),f=function(e){var n=e.backgroundImage,t=e.style,c=(0,s.Z)(e,["backgroundImage","style"]),u=void 0!==n;return(0,a.jsx)("article",(0,i.Z)((0,o.Z)({},c),{className:(0,l.W)(d().root,(0,r.Z)({},d().withBackground,u)),style:(0,o.Z)({backgroundImage:u?"url(".concat(n,")"):void 0},t)}))},p=function(e){return(0,a.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:d().image}))},m=function(e){return(0,a.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:d().content}))},y=function(e){return(0,a.jsx)(c.xv,(0,i.Z)((0,o.Z)({},e),{className:d().title}))},h=function(e){return(0,a.jsx)(c.xv,(0,i.Z)((0,o.Z)({},e),{className:d().desc,color:"grey11"}))},v=function(e){return(0,a.jsx)("div",(0,i.Z)((0,o.Z)({},e),{className:d().actions,color:"grey"}))}},65563:function(e,n,t){"use strict";t.d(n,{AK:function(){return Z},E3:function(){return m},EN:function(){return y},F$:function(){return x},HO:function(){return g},L4:function(){return j},Tr:function(){return p},Ue:function(){return _},gR:function(){return S},mf:function(){return h},vB:function(){return v},xS:function(){return b},y6:function(){return l}});var r=t(67557),o=t(62230),i=t(85244),s=t(17064),a=t(98863),c=t(88866);function l(e){var n;return null!==(n=e.format)&&void 0!==n?n:"custom"}function u(e){return Object.entries(e.json)}function d(e,n){return e.json[n]}function f(e,n){var t=d(e,n);if(void 0!==t)return Object.entries(t).find(function(e){var n=(0,s.Z)(e,2);return(n[0],n[1]).type===c.SlicesFieldType})}function p(e,n){if(t=e,d=f(t,a=n),(p=(0,s.Z)(null!=d?d:[],2))[0],null!==(l=null==(m=p[1])?void 0:m.config)&&void 0!==l?l:void 0)return e;var t,a,l,d,p,m,y=function(e,n){var t,r=u(e),o=r.findIndex(function(e){return(0,s.Z)(e,1)[0]===n}),i=r.flatMap(function(e){var n=(0,s.Z)(e,2),t=(n[0],n[1]);return Object.keys(t).filter(function(e){return t[e].type===c.SlicesFieldType})}),a=o;do t="slices".concat(0!==a?a.toString():""),a++;while(i.includes(t));return t}(e,n);return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,(0,i.Z)((0,o.Z)({},e.json[n]),(0,r.Z)({},y,{type:c.SlicesFieldType,fieldset:"Slice Zone"}))))})}function m(e,n){var t=d(e,n);if(void 0===t)return e;var s=Object.keys(t).find(function(e){return t[e].type===c.SlicesFieldType});if(void 0===s)return e;var l=(0,a.ud)(t,s);return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,l))})}function y(e){var n,t,s=e.customType,l=e.sectionId,u=e.sliceId,f=d(s,l);if(void 0===f)return s;var p=Object.keys(f).find(function(e){return f[e].type===c.SlicesFieldType});if(void 0===p)return s;var m=f[p];if(m.type!==c.SlicesFieldType)return s;var y=(0,a.ud)(null!==(t=null===(n=m.config)||void 0===n?void 0:n.choices)&&void 0!==t?t:{},u);return(0,i.Z)((0,o.Z)({},s),{json:(0,i.Z)((0,o.Z)({},s.json),(0,r.Z)({},l,(0,i.Z)((0,o.Z)({},f),(0,r.Z)({},p,(0,i.Z)((0,o.Z)({},m),{config:(0,i.Z)((0,o.Z)({},m.config),{choices:y})})))))})}function h(e){var n,t=(0,i.Z)((0,o.Z)({},e),{format:"page"}),r=u(e)[0];if(r){var a=(0,s.Z)(r,1)[0];t=p(t,a)}return t}function v(e,n){return(0,i.Z)((0,o.Z)({},e),{json:(0,i.Z)((0,o.Z)({},e.json),(0,r.Z)({},n,{}))})}function x(e,n){var t=(0,a.ud)(e.json,n);return(0,i.Z)((0,o.Z)({},e),{json:t})}function g(e,n,t){if(n===t)return e;var r=Object.keys(e.json).reduce(function(r,o){return o===n?r[t]=e.json[o]:r[o]=e.json[o],r},{});return(0,i.Z)((0,o.Z)({},e),{json:r})}function b(e){var n=e.customType,t=e.sectionId,a=e.newField,l=e.newFieldId,u=n.json[t],d=f(n,t),p=Object.fromEntries(Object.entries(u).filter(function(e){var n=(0,s.Z)(e,2);return(n[0],n[1]).type!==c.SlicesFieldType})),m=(0,i.Z)((0,o.Z)({},p),(0,r.Z)({},l,a));if(void 0!==d){var y=(0,s.Z)(d,2),h=y[0],v=y[1];m[h]=v}return I({customType:n,sectionId:t,updatedSection:m})}function Z(e){var n=e.customType,t=e.sectionId,r=e.fieldId,o=(0,a.ud)(n.json[t],r);return I({customType:n,sectionId:t,updatedSection:o})}function j(e){var n,t,r,o,i,a=e.customType,c=e.sectionId,l=e.previousFieldId,u=e.newFieldId,d=e.newField,f=(n={fields:a.json[c],previousFieldId:l,newFieldId:u,newField:d},t=n.fields,r=n.previousFieldId,o=n.newFieldId,i=n.newField,Object.entries(t).reduce(function(e,n){var t=(0,s.Z)(n,2),a=t[0],c=t[1];return a===r?e[o]=i:a!==o&&(e[a]=c),e},{}));return I({customType:a,sectionId:c,updatedSection:f})}function S(e){var n,t,r,o,i,a,l,u=e.customType,d=e.sectionId,p=e.sourceIndex,m=e.destinationIndex,y=u.json[d],h=f(u,d),v=(n={fields:Object.fromEntries(Object.entries(y).filter(function(e){var n=(0,s.Z)(e,2);return(n[0],n[1]).type!==c.SlicesFieldType})),sourceIndex:p,destinationIndex:m},t=n.fields,r=n.sourceIndex,o=n.destinationIndex,i=Object.entries(t),a=(0,s.Z)(i.splice(r,1),1)[0],i.splice(o,0,a),Object.fromEntries(i));if(void 0!==h){var x=(0,s.Z)(h,2),g=x[0],b=x[1];v[g]=b}return I({customType:u,sectionId:d,updatedSection:v})}function I(e){var n=e.customType,t=e.sectionId,s=e.updatedSection;return(0,i.Z)((0,o.Z)({},n),{json:(0,i.Z)((0,o.Z)({},n.json),(0,r.Z)({},t,s))})}function _(e){var n,t,r=e.id,i=e.label,s=e.repeatable,a=e.format,c=(n=s,t=a,!1===n&&"page"===t?(0,o.Z)({},C,F):!1===n?T:"page"===t?(0,o.Z)({},w,F):k);return{format:a,id:r,json:c,label:i,repeatable:s,status:!0}}var T={Main:{}},C={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},k={Main:{uid:{config:{label:"UID"},type:"UID"}}},w={Main:(0,o.Z)({},k.Main,C.Main)},F={"SEO & Metadata":{meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"},meta_description:{config:{label:"Meta Description",placeholder:"A brief summary of the page"},type:"Text"},meta_image:{config:{constraint:{height:1260,width:2400},label:"Meta Image",thumbnails:[]},type:"Image"}}}},56471:function(e,n,t){"use strict";t.d(n,{_:function(){return N}});var r=t(22710),o=t(99267),i=t(52322),s=t(7729),a=t(5632),c=t(2784),l=t(65186),u=t(59326),d=t(75289),f=t(88932),p=t(7604),m=t(64837);function y(){return(y=(0,r.Z)(function(e){var n,t,r,i,s,a;return(0,o.__generator)(this,function(o){switch(o.label){case 0:n=e.customType,t=e.onSuccess,r=m.$[n.format],o.label=1;case 1:return o.trys.push([1,3,,4]),[4,p.j.customTypes.deleteCustomType({id:n.id})];case 2:if((i=o.sent().errors).length>0)throw i;return t(),f.Am.success("".concat(r.name({start:!0,plural:!1})," deleted")),[3,4];case 3:return s=o.sent(),a="Internal Error: ".concat(r.name({start:!0,plural:!1})," could not be deleted"),console.error(a,s),f.Am.error(a),[3,4];case 4:return[2]}})})).apply(this,arguments)}var h=t(61107),v=t(2978),x=t(28199),g=t(7342),b=function(e){var n,t=e.customType,s=e.format,a=e.onClose,f=e.onDeleteCustomTypeSuccess,p=m.$[s],b=(0,c.useState)(!1),Z=b[0],j=b[1],S=(0,g.Z)().deleteCustomTypeSuccess,I=(n=(0,r.Z)(function(){return(0,o.__generator)(this,function(e){switch(e.label){case 0:return j(!0),[4,function(e){return y.apply(this,arguments)}({customType:t,onSuccess:function(){return S(t.id)}})];case 1:return e.sent(),f(),[2]}})}),function(){return n.apply(this,arguments)}),_=(0,u.B7)().theme;return(0,i.jsx)(x.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:function(){return a()},children:(0,i.jsx)(v.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:function(){var e;return(0,i.jsxs)(d.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,i.jsxs)(d.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(l.$vK,{size:20,color:null===(e=_.colors)||void 0===e?void 0:e.greyIcon}),(0,i.jsxs)(d.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:["Delete"," ",p.name({start:!1,plural:!1})]})]}),(0,i.jsx)(d.x8,{type:"button",onClick:function(){return a()}})]})},Footer:function(){return(0,i.jsxs)(d.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(h.z,{label:"Cancel",variant:"secondary",onClick:function(){return a()},sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),void 0!==t&&(0,i.jsx)(h.z,{label:"Delete",variant:"danger",isLoading:Z,onClick:function(){I()},sx:{minHeight:39,minWidth:78}})]})},children:(0,i.jsxs)("div",{children:["This action will immediately make the following change:",(0,i.jsx)("ul",{children:(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(d.xv,{sx:{fontWeight:"bold"},children:["customtypes/",null==t?void 0:t.id,"/"]})," ","directory."]})}),"The next time you push your changes to Prismic, the following change will happen:",(0,i.jsx)("ul",{children:(0,i.jsxs)("li",{children:["Remove the"," ",p.name({start:!1,plural:!1})," and any associated Documents from your repository."]})})]})})})},Z=t(62230),j=t(85244),S=t(56580);function I(){return(I=(0,r.Z)(function(e){var n,t,r,i,s,a,c,l;return(0,o.__generator)(this,function(o){switch(o.label){case 0:n=e.model,t=e.newLabel,r=e.onSuccess,i=m.$[n.format],o.label=1;case 1:return o.trys.push([1,3,,4]),s=(0,j.Z)((0,Z.Z)({},n),{label:t}),[4,p.j.customTypes.renameCustomType({model:s})];case 2:if((a=o.sent().errors).length>0)throw a;return r(s),f.Am.success("".concat(i.name({start:!0,plural:!1})," renamed")),[3,4];case 3:return c=o.sent(),l="Internal Error: ".concat(i.name({start:!0,plural:!1})," could not be renamed"),console.error(l,c),f.Am.error(l),[3,4];case 4:return[2]}})})).apply(this,arguments)}var _=t(35393),T=t(7781),C=t(4995),k=t(44570),w=function(e){var n,t,s,a=e.isChangesLocal,l=e.customType,u=e.format,f=e.onClose,p=e.setLocalCustomType,y=null!==(n=null==l?void 0:l.label)&&void 0!==n?n:"",h=null!==(t=null==l?void 0:l.id)&&void 0!==t?t:"",v=(0,g.Z)().renameCustomTypeSuccess,x=(0,_.g)().syncChanges,b=(0,c.useState)(!1),w=b[0],F=b[1],O=(s=(0,r.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:if(F(!0),!(a&&p))return[3,1];return p((0,j.Z)((0,Z.Z)({},l),{label:e.customTypeName})),[3,3];case 1:return[4,function(e){return I.apply(this,arguments)}({model:l,newLabel:e.customTypeName,onSuccess:function(e){v(e),x()}})];case 2:n.sent(),n.label=3;case 3:return F(!1),f(),[2]}})}),function(e){return s.apply(this,arguments)}),B=(0,S.v9)(function(e){return{customTypeLabels:(0,T.YS)(e)}}).customTypeLabels,L=m.$[u];return(0,i.jsx)(C.Z,{isOpen:!0,testId:"rename-custom-type-modal",widthInPx:"530px",formId:"rename-custom-type-modal-".concat(h),buttonLabel:"Rename",close:f,onSubmit:function(e){O(e)},initialValues:{customTypeName:y},isLoading:w,content:{title:"Rename a ".concat(L.name({start:!1,plural:!1}))},validate:function(e){var n=e.customTypeName,t={};return n&&n.length||(t.customTypeName="Cannot be empty."),void 0!=t.customTypeName&&B.includes(n)&&y!==n&&(t.customTypeName="".concat(L.name({start:!0,plural:!1})," name is already taken.")),Object.keys(t).length>0?t:void 0},children:function(e){var n=e.errors;return(0,i.jsx)(d.xu,{children:(0,i.jsx)(k.W,{name:"customTypeName",label:"".concat(L.name({start:!0,plural:!1})," Name"),placeholder:"A display name for the ".concat(L.name({start:!1,plural:!1})),error:n.customTypeName,testId:"custom-type-name-input"})})}})},F=t(12189),O=t(65563);function B(){return(B=(0,r.Z)(function(e,n){var t,r,i,s,a;return(0,o.__generator)(this,function(o){switch(o.label){case 0:t=m.$[e.format],o.label=1;case 1:return o.trys.push([1,3,,4]),r=(0,O.mf)(e),[4,(0,F.KA)(r)];case 2:if((i=o.sent().errors).length>0)throw i;return n(r),f.Am.success("".concat(t.name({start:!0,plural:!1})," converted to page type")),[3,4];case 3:return s=o.sent(),a="Internal Error: ".concat(t.name({start:!0,plural:!1})," not converted to page type"),console.error(a,s),f.Am.error(a),[3,4];case 4:return[2]}})})).apply(this,arguments)}var L=t(99526),N=function(e){var n,t=e.format,l=e.customType,u=e.isChangesLocal,d=e.setLocalCustomType,f=(0,a.useRouter)(),p=(0,g.Z)().saveCustomTypeSuccess,m=(0,c.useState)(!1),y=m[0],h=m[1],v=(0,c.useState)(!1),x=v[0],Z=v[1],j=(0,c.useState)(!1),S=j[0],I=j[1],_=(n=(0,r.Z)(function(){var e,n;return(0,o.__generator)(this,function(t){switch(t.label){case 0:return I(!0),[4,function(e,n){return B.apply(this,arguments)}(l,p)];case 1:return t.sent(),e=L.cd.custom.getBuilderPagePathname(l.id),f.asPath===e&&(n=L.cd.page.getBuilderPagePathname(l.id),f.replace(n)),I(!1),[2]}})}),function(){return n.apply(this,arguments)}),T=function(){var e,n=L.cd[null!==(e=l.format)&&void 0!==e?e:"custom"].tablePagePathname;f.asPath!==n?f.replace(n):h(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.h_,{modal:!0,children:[(0,i.jsx)(s.$F,{disabled:S,children:(0,i.jsx)(s.hU,{color:"grey","data-testid":"editDropdown",hiddenLabel:"Custom type actions",icon:"moreVert",loading:S,variant:"solid"})}),(0,i.jsxs)(s.AW,{align:"end",children:[(0,i.jsx)(s.Xi,{startIcon:(0,i.jsx)(s.I5,{name:"edit"}),onSelect:function(){Z(!0)},children:"Rename"}),"custom"===t&&!u&&(0,i.jsx)(s.Xi,{startIcon:(0,i.jsx)(s.I5,{name:"driveFileMove"}),onSelect:function(){_()},children:"Convert to page type"}),(0,i.jsx)(s.Xi,{color:"tomato",startIcon:(0,i.jsx)(s.I5,{name:"delete"}),onSelect:function(){h(!0)},children:"Remove"})]})]}),y?(0,i.jsx)(b,{format:t,customType:l,onClose:function(){return h(!1)},onDeleteCustomTypeSuccess:T}):null,x?(0,i.jsx)(w,{format:t,customType:l,isChangesLocal:u,onClose:function(){return Z(!1)},setLocalCustomType:d}):null]})}},61107:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),o=t(85244),i=t(98240),s=t(52322),a=t(2784),c=t(75289),l=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,a.forwardRef)(function(e,n){var t=e.label,a=e.Icon,d=e.type,f=e.form,p=e.isLoading,m=void 0!==p&&p,y=e.disabled,h=e.onClick,v=e.sx,x=e.iconSize,g=void 0===x?16:x,b=e.iconFill,Z=e.variant,j=void 0===Z?"primary":Z,S=(0,i.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(c.zx,(0,o.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,o.Z)((0,r.Z)({},void 0===v?{}:v),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==y&&y||m,onClick:m?void 0:h,variant:j},S),{children:m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.$j,{size:g,color:u(j),"data-testid":l(S["data-testid"],"spinner")}),a&&t]}):(0,s.jsxs)(s.Fragment,{children:[a&&(0,s.jsx)(a,{size:g,fill:b,"data-testid":l(S["data-testid"],"icon")}),t]})}))})},44570:function(e,n,t){"use strict";t.d(n,{W:function(){return a}});var r=t(62230),o=t(52322),i=t(63397);t(2784);var s=t(75289),a=function(e){var n=e.name,t=e.label,a=e.placeholder,c=e.error,l=e.testId,u=e.onChange;return(0,o.jsxs)(s.xu,{mb:3,children:[(0,o.jsx)(s.__,{htmlFor:n,mb:2,children:t}),(0,o.jsx)(i.gN,(0,r.Z)({name:n,type:"text",placeholder:a,as:s.II,autoComplete:"off"},u?{onChange:u}:null,l?{"data-testid":l}:null)),c?(0,o.jsx)(s.xv,{"data-testid":l?"".concat(l,"-error"):"input-error",sx:{color:"error",mt:1},children:c}):null]})}},4995:function(e,n,t){"use strict";var r=t(62230),o=t(85244),i=t(52322),s=t(63397),a=t(37149),c=t.n(a),l=t(75289),u=t(61107),d=t(28199),f=t(2978);n.Z=function(e){var n=e.children,t=e.close,a=e.isOpen,p=e.formId,m=e.validate,y=e.onSubmit,h=e.widthInPx,v=e.initialValues,x=e.content.title,g=e.cardProps,b=e.omitFooter,Z=void 0!==b&&b,j=e.isLoading,S=void 0!==j&&j,I=e.buttonLabel,_=void 0===I?"Save":I,T=e.testId,C=e.actionMessage;return c().setAppElement("#__next"),(0,i.jsx)(d.Z,{isOpen:a,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:x,style:{content:{width:null!=h?h:"900px"}},children:(0,i.jsx)(s.J9,{initialValues:v,validate:function(e){return m?m(e):void 0},onSubmit:function(e){y(e)},children:function(e){var a=e.isValid,c=e.isSubmitting,d=e.values,m=e.errors,y=e.touched,h=e.setFieldValue,v=e.setValues;return(0,i.jsx)(s.l0,(0,o.Z)((0,r.Z)({id:p},null!=T?{"data-testid":T}:null),{children:(0,i.jsx)(f.Z,(0,o.Z)((0,r.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},g),{Header:function(e){var n=e.radius;return(0,i.jsxs)(l.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,i.jsx)(l.X6,{sx:{fontSize:"20px"},children:x}),(0,i.jsx)(l.x8,{type:"button",onClick:t})]})},Footer:Z?null:(0,i.jsxs)(l.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(l.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof C?C(e):C}),(0,i.jsxs)(l.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(l.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:c||S,children:"Cancel"}),(0,i.jsx)(u.z,{label:_,form:p,type:"submit",disabled:!a||c||S,isLoading:c||S,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:a,isSubmitting:c,values:d,errors:m,touched:y,setFieldValue:h,setValues:v})}))}))}})})}},98484:function(e){e.exports={column:"BlankSlate_column__ysDb2",root:"BlankSlate_root__DJ7wC BlankSlate_column__ysDb2",fadeIn:"BlankSlate_fadeIn__KMuKu",withBackground:"BlankSlate_withBackground___V5y5",image:"BlankSlate_image__rOe9w BlankSlate_column__ysDb2",content:"BlankSlate_content__wmOAI BlankSlate_column__ysDb2",title:"BlankSlate_title__5oTre",desc:"BlankSlate_desc__f6ZWf",actions:"BlankSlate_actions__6zYZr"}}}]);