slice-machine-ui 2.11.1-beta.3 → 2.11.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.
Files changed (61) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/DOTU5E3jlof3w29PM-wsH/_buildManifest.js +1 -0
  3. package/out/_next/static/chunks/150-902bd1ee3468dd05.js +1 -0
  4. package/out/_next/static/chunks/{372-299eb158f6414913.js → 372-718a5541f567e738.js} +1 -1
  5. package/out/_next/static/chunks/434-c7ad3ff97354e3b7.js +31 -0
  6. package/out/_next/static/chunks/574-a19734ace8217cf4.js +1 -0
  7. package/out/_next/static/chunks/764-14490100bc2b60a8.js +1 -0
  8. package/out/_next/static/chunks/pages/{_app-ad314ac731271d0d.js → _app-5af46a852a825cc3.js} +67 -67
  9. package/out/_next/static/chunks/pages/changelog-fd749acf98af82da.js +1 -0
  10. package/out/_next/static/chunks/pages/changes-abdcde22a1d96331.js +1 -0
  11. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-2eb64c9ea82fcd0a.js → [customTypeId]-d064c8b72874c0ba.js} +1 -1
  12. package/out/_next/static/chunks/pages/labs-41db727cff0af1a9.js +1 -0
  13. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-e5a5e6b345081e0a.js → [pageTypeId]-5bb8851689eb84cb.js} +1 -1
  14. package/out/_next/static/chunks/pages/{settings-88c3d839c41b306d.js → settings-4efa7c64dc4f2468.js} +1 -1
  15. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-d44e3fd7658f7587.js → simulator-252ec274cf2c422e.js} +1 -1
  16. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-5757936335b0f206.js +1 -0
  17. package/out/_next/static/chunks/pages/slices-f42c28ddc74a5b2b.js +1 -0
  18. package/out/_next/static/css/{8c9771ac3b3b0fa3.css → e3fef77c99e43ec1.css} +1 -1
  19. package/out/changelog.html +1 -1
  20. package/out/changes.html +1 -1
  21. package/out/custom-types/[customTypeId].html +1 -1
  22. package/out/custom-types.html +1 -1
  23. package/out/index.html +1 -1
  24. package/out/labs.html +1 -1
  25. package/out/page-types/[pageTypeId].html +1 -1
  26. package/out/settings.html +1 -1
  27. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  28. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  29. package/out/slices.html +1 -1
  30. package/package.json +4 -5
  31. package/src/features/customTypes/EditDropdown.tsx +1 -1
  32. package/src/features/onboarding/OnboardingGuide.tsx +3 -7
  33. package/src/features/onboarding/useSharedOnboardingExperiment.ts +1 -1
  34. package/src/legacy/components/ReviewModal/ReviewModal.tsx +0 -7
  35. package/src/pages/_app.tsx +5 -14
  36. package/out/_next/static/GFsaHCt3aSVCYk_oL77Fo/_buildManifest.js +0 -1
  37. package/out/_next/static/chunks/150-c34c5188f5824717.js +0 -1
  38. package/out/_next/static/chunks/349-6ad3cca7ea294292.js +0 -31
  39. package/out/_next/static/chunks/764-56074baae7e8fe3b.js +0 -1
  40. package/out/_next/static/chunks/882-567b4220cf2aade1.js +0 -1
  41. package/out/_next/static/chunks/pages/changelog-b2494ca2d17f3afe.js +0 -1
  42. package/out/_next/static/chunks/pages/changes-f78e766881db10ec.js +0 -1
  43. package/out/_next/static/chunks/pages/labs-b2e68f81bf4c9dae.js +0 -1
  44. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-39b77d9eff3edf0e.js +0 -1
  45. package/out/_next/static/chunks/pages/slices-d03df2b864fe5aa1.js +0 -1
  46. package/src/features/inAppGuide/InAppGuideContext.tsx +0 -51
  47. package/src/features/inAppGuide/InAppGuideDialog.tsx +0 -94
  48. package/src/features/inAppGuide/inAppGuideContent.tsx +0 -65
  49. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingGuide.module.css +0 -21
  50. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingGuide.module.css.d.ts +0 -8
  51. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingProgressStepper.tsx +0 -98
  52. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingProvider.tsx +0 -127
  53. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingStepDialog/OnboardingStepDialog.tsx +0 -65
  54. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingStepDialog/OnboardingStepDialogContent.tsx +0 -34
  55. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingStepDialog/index.ts +0 -1
  56. package/src/features/onboarding/SliceMachineOnboardingGuide/OnboardingTutorial/OnboardingTutorial.tsx +0 -25
  57. package/src/features/onboarding/SliceMachineOnboardingGuide/SliceMachineOnboardingGuide.tsx +0 -74
  58. package/src/features/onboarding/SliceMachineOnboardingGuide/content.tsx +0 -94
  59. package/src/features/onboarding/SliceMachineOnboardingGuide/types.ts +0 -26
  60. package/src/features/onboarding/useOnboardingExperiment.ts +0 -6
  61. /package/out/_next/static/{GFsaHCt3aSVCYk_oL77Fo → DOTU5E3jlof3w29PM-wsH}/_ssgManifest.js +0 -0
@@ -1,127 +0,0 @@
1
- import { createContext, ReactNode, useContext } from "react";
2
-
3
- import { telemetry } from "@/apiClient";
4
- import { onboardingSteps } from "@/features/onboarding/SliceMachineOnboardingGuide/content";
5
- import {
6
- type OnboardingStep,
7
- type OnboardingStepId,
8
- type OnboardingStepStatuses,
9
- onboardingStepStatusesSchema,
10
- } from "@/features/onboarding/SliceMachineOnboardingGuide/types";
11
- import { usePersistedState } from "@/hooks/usePersistedState";
12
-
13
- type OnboardingContext = {
14
- steps: OnboardingStep[];
15
- completedStepCount: number;
16
- toggleStepComplete: (step: OnboardingStep) => void;
17
- getStepIndex: (step: OnboardingStepId) => number;
18
- isStepComplete: (step: OnboardingStep) => boolean;
19
- isComplete: boolean;
20
- };
21
-
22
- export const OnboardingContext = createContext<OnboardingContext | undefined>(
23
- undefined,
24
- );
25
-
26
- const getInitialState = (steps: OnboardingStep[]): OnboardingStepStatuses => {
27
- // if the old guide was dismissed, all steps start as complete
28
- const wasOldGuideDismissed =
29
- localStorage.getItem("slice-machine_isInAppGuideOpen") === "false";
30
-
31
- return Object.fromEntries(
32
- steps.map((step) => [
33
- step.id,
34
- step.defaultCompleted ?? wasOldGuideDismissed,
35
- ]),
36
- ) as OnboardingStepStatuses;
37
- };
38
-
39
- type OnboardingProviderProps = {
40
- children: ReactNode;
41
- onComplete?: () => void;
42
- };
43
-
44
- export const OnboardingProvider = ({
45
- children,
46
- onComplete,
47
- }: OnboardingProviderProps) => {
48
- const steps = onboardingSteps;
49
- const [stepStatus, setStepStatus] = useStepStatus();
50
-
51
- const toggleStepComplete = (step: OnboardingStep) => {
52
- const newCompleteState = !isStepComplete(step);
53
- const nextState = { ...stepStatus, [step.id]: newCompleteState };
54
- setStepStatus(nextState);
55
-
56
- if (newCompleteState) {
57
- void telemetry.track({
58
- event: "onboarding:step-completed",
59
- stepId: step.id,
60
- stepTitle: step.title,
61
- });
62
- }
63
- if (Object.values(nextState).every(Boolean)) {
64
- onComplete?.();
65
- void telemetry.track({
66
- event: "onboarding:completed",
67
- });
68
- }
69
- };
70
-
71
- const getStepIndex = (stepId: OnboardingStepId) => {
72
- return steps.findIndex(({ id }) => id === stepId);
73
- };
74
-
75
- const isStepComplete = (step: OnboardingStep) => {
76
- return Boolean(stepStatus[step.id]) || Boolean(step.defaultCompleted);
77
- };
78
-
79
- const completedStepCount = steps.filter((step) =>
80
- isStepComplete(step),
81
- ).length;
82
-
83
- return (
84
- <OnboardingContext.Provider
85
- value={{
86
- steps,
87
- toggleStepComplete,
88
- isStepComplete,
89
- getStepIndex,
90
- completedStepCount,
91
- isComplete: completedStepCount === steps.length,
92
- }}
93
- >
94
- {children}
95
- </OnboardingContext.Provider>
96
- );
97
- };
98
-
99
- function useStepStatus() {
100
- return usePersistedState(
101
- "onboardingSteps",
102
- getInitialState(onboardingSteps),
103
- { schema: onboardingStepStatusesSchema },
104
- );
105
- }
106
-
107
- export function useIsOnboardingCompleted() {
108
- const [stepStatus] = useStepStatus();
109
-
110
- const completedStepCount = onboardingSteps.filter(
111
- (step) => Boolean(stepStatus[step.id]) || Boolean(step.defaultCompleted),
112
- ).length;
113
-
114
- return completedStepCount === onboardingSteps.length;
115
- }
116
-
117
- export const useOnboardingContext = () => {
118
- const context = useContext(OnboardingContext);
119
-
120
- if (context == null) {
121
- throw new Error(
122
- "useOnboardingContext must be used within an OnboardingProvider",
123
- );
124
- }
125
-
126
- return context;
127
- };
@@ -1,65 +0,0 @@
1
- import {
2
- Dialog,
3
- DialogActionButton,
4
- DialogActions,
5
- DialogCancelButton,
6
- DialogContent,
7
- DialogHeader,
8
- } from "@prismicio/editor-ui";
9
- import { useState } from "react";
10
-
11
- import { useOnboardingContext } from "@/features/onboarding/SliceMachineOnboardingGuide/OnboardingProvider";
12
- import type { OnboardingStep } from "@/features/onboarding/SliceMachineOnboardingGuide/types";
13
-
14
- import { OnboardingStepDialogContent } from "./OnboardingStepDialogContent";
15
-
16
- type OnboardingStepDialogProps = {
17
- step: OnboardingStep;
18
- isOpen: boolean;
19
- onClose: () => void;
20
- };
21
-
22
- export const OnboardingStepDialog = ({
23
- step,
24
- isOpen,
25
- onClose,
26
- }: OnboardingStepDialogProps) => {
27
- const { toggleStepComplete, isStepComplete } = useOnboardingContext();
28
- const [ctaOkText, setCtaOkText] = useState(getCtaOkText);
29
-
30
- function getCtaOkText() {
31
- return isStepComplete(step) ? "Undo step" : "Mark as done";
32
- }
33
-
34
- const markAsDone = () => {
35
- if (!isOpen) return;
36
- toggleStepComplete(step);
37
- onClose();
38
- };
39
-
40
- const updateCtaOkText = () => {
41
- if (!isOpen) return;
42
- setCtaOkText(getCtaOkText());
43
- };
44
-
45
- return (
46
- <Dialog
47
- open={isOpen}
48
- onOpenChange={onClose}
49
- onAnimationEnd={updateCtaOkText}
50
- onAnimationStart={updateCtaOkText}
51
- size="small"
52
- >
53
- <DialogHeader title="Onboarding" />
54
- <DialogContent>
55
- <OnboardingStepDialogContent step={step} />
56
- <DialogActions>
57
- <DialogCancelButton size="medium">Close</DialogCancelButton>
58
- <DialogActionButton size="medium" onClick={markAsDone}>
59
- {ctaOkText}
60
- </DialogActionButton>
61
- </DialogActions>
62
- </DialogContent>
63
- </Dialog>
64
- );
65
- };
@@ -1,34 +0,0 @@
1
- import { Box, ScrollArea, Text, Video } from "@prismicio/editor-ui";
2
-
3
- import { useOnboardingContext } from "@/features/onboarding/SliceMachineOnboardingGuide/OnboardingProvider";
4
- import { OnboardingStep } from "@/features/onboarding/SliceMachineOnboardingGuide/types";
5
-
6
- type OnboardingStepDialogContentProps = {
7
- step: OnboardingStep;
8
- };
9
-
10
- export function OnboardingStepDialogContent(
11
- props: OnboardingStepDialogContentProps,
12
- ) {
13
- const { step } = props;
14
- const { getStepIndex } = useOnboardingContext();
15
-
16
- const { content: Content, videoUrl, title = step.title } = step;
17
-
18
- return (
19
- <ScrollArea>
20
- <Box as="article" flexDirection="column" padding={16} gap={16}>
21
- <section>
22
- <Text sx={{ marginBottom: 4 }} color="purple9" variant="bold">
23
- Step {getStepIndex(step.id) + 1}
24
- </Text>
25
- <Text variant="h3">{title}</Text>
26
- {Content && <Content />}
27
- </section>
28
- {typeof videoUrl == "string" && (
29
- <Video src={videoUrl} sizing="contain" autoPlay loop />
30
- )}
31
- </Box>
32
- </ScrollArea>
33
- );
34
- }
@@ -1 +0,0 @@
1
- export { OnboardingStepDialog } from "./OnboardingStepDialog";
@@ -1,25 +0,0 @@
1
- import { Box, Icon, Text } from "@prismicio/editor-ui";
2
-
3
- import { useMarketingContent } from "@/hooks/useMarketingContent";
4
-
5
- export function OnboardingTutorial() {
6
- const { tutorial } = useMarketingContent();
7
-
8
- const url = tutorial?.url;
9
-
10
- if (url === undefined) return null;
11
-
12
- return (
13
- <Box justifyContent="center" padding={{ block: 6 }}>
14
- <Text href={url} variant="smallBold" color="grey11">
15
- Or watch our full course
16
- <Icon
17
- name="playCircle"
18
- color="grey11"
19
- size="small"
20
- sx={{ marginLeft: 4 }}
21
- />
22
- </Text>
23
- </Box>
24
- );
25
- }
@@ -1,74 +0,0 @@
1
- import { useConfetti } from "@prismicio/editor-support/Animation";
2
- import {
3
- Card,
4
- CardContent,
5
- ProgressBar,
6
- Text,
7
- useMediaQuery,
8
- } from "@prismicio/editor-ui";
9
- import { useState } from "react";
10
-
11
- import styles from "./OnboardingGuide.module.css";
12
- import { OnboardingProgressStepper } from "./OnboardingProgressStepper";
13
- import {
14
- OnboardingProvider,
15
- useIsOnboardingCompleted,
16
- useOnboardingContext,
17
- } from "./OnboardingProvider";
18
- import { OnboardingTutorial } from "./OnboardingTutorial/OnboardingTutorial";
19
-
20
- export function SliceMachineOnboardingGuide() {
21
- const isComplete = useIsOnboardingCompleted();
22
- const [isVisible, setVisible] = useState(!isComplete);
23
- const confetti = useConfetti({ onAnimationEnd: () => setVisible(false) });
24
-
25
- if (!isVisible) return null;
26
-
27
- return (
28
- <OnboardingProvider onComplete={confetti.throwConfetti}>
29
- <div ref={confetti.confettiContainerRef} className={styles.container}>
30
- <OnboardingGuideCard />
31
- <div
32
- ref={confetti.confettiCannonRef}
33
- className={styles.confettiCannon}
34
- />
35
- </div>
36
- </OnboardingProvider>
37
- );
38
- }
39
-
40
- function OnboardingGuideCard() {
41
- const { steps, completedStepCount, isComplete } = useOnboardingContext();
42
- const isMediumScreen = useMediaQuery({ min: "medium" });
43
-
44
- if (!isMediumScreen) return null;
45
-
46
- return (
47
- <div
48
- className={isComplete ? styles.invisible : styles.visible}
49
- // 1px padding to avoid cliping of animated card while it scales up
50
- style={{ padding: 1 }}
51
- >
52
- <Card variant="animated-light" paddingBlock={16}>
53
- <CardContent>
54
- <div>
55
- <Text variant="bold" color="grey12">
56
- {`Build your first Prismic Page in ${steps.length.toString()} simple steps`}
57
- </Text>
58
- <Text color="grey11">
59
- Render a live page with content coming from Prismic in 5 mins
60
- </Text>
61
- </div>
62
- <ProgressBar
63
- value={completedStepCount}
64
- max={steps.length}
65
- displayLabel
66
- getValueLabel={(value, max) => `${value}/${max}`}
67
- />
68
- <OnboardingProgressStepper buttonSize="large" />
69
- <OnboardingTutorial />
70
- </CardContent>
71
- </Card>
72
- </div>
73
- );
74
- }
@@ -1,94 +0,0 @@
1
- import { Text } from "@prismicio/editor-ui";
2
-
3
- import type { OnboardingStep } from "./types";
4
-
5
- export const onboardingSteps: OnboardingStep[] = [
6
- {
7
- id: "createProject",
8
- title: "Create your Prismic website",
9
- description: "Create and set up your project",
10
- defaultCompleted: true,
11
- },
12
- {
13
- id: "createPageType",
14
- title: "Create your first Page Type",
15
- description: "Build the structure of your page",
16
- videoUrl:
17
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/Create_page_type_xdn13j.mp4",
18
- content: () => (
19
- <Text>
20
- A page type is a base content structure editors will use to create pages
21
- in the Page Builder (Prismic's content creation UI). A page type can be
22
- reusable (e.g., for multiple blog posts) or single (e.g., for a one-time
23
- page like the homepage).
24
- </Text>
25
- ),
26
- },
27
- {
28
- id: "codePage",
29
- title: "Code your Page",
30
- description: "Prepare code to fetch content",
31
- videoUrl:
32
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/Step2_code_your_page_jatiur.mp4",
33
- content: () => (
34
- <Text>Prepare your code to query the content from the Prismic API.</Text>
35
- ),
36
- },
37
- {
38
- id: "createSlice",
39
- title: "Create your first Slice",
40
- description: "Build a reusable section",
41
- videoUrl:
42
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918322/DEV_TOOLS/ONBOARDING_GUIDE/Step3_add_slice_qzmvxf.mp4",
43
- content: () => (
44
- <Text>
45
- Slices are website sections that can be reused on different pages with
46
- different content. Each slice has a code component automatically
47
- generated by Slice Machine. Start with a template and look at your code
48
- to see how it's structured.
49
- </Text>
50
- ),
51
- },
52
- {
53
- id: "reviewAndPush",
54
- title: "Review & push changes",
55
- description: "Enable editors to create content",
56
- videoUrl:
57
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/DevTools_Squad_push_changes_ovvmul.mp4",
58
- content: () => (
59
- <Text>
60
- Your page types and slices currently exist only in your local project.
61
- Push them to your repository to make them available for your content
62
- editors.
63
- </Text>
64
- ),
65
- },
66
- {
67
- id: "createContent",
68
- title: "Create content for your page",
69
- description: "Publish your page to the API",
70
- videoUrl:
71
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918324/DEV_TOOLS/ONBOARDING_GUIDE/Cre%CC%81er_contenu_e%CC%81tape_4_z9vlzt.mp4",
72
- content: () => (
73
- <Text>
74
- In Prismic, content creation takes place in the Prismic Page Builder UI.
75
- Open the Page Builder and start creating your first page.
76
- </Text>
77
- ),
78
- },
79
- {
80
- id: "renderPage",
81
- title: "Preview your page",
82
- description: "View your page in the browser",
83
- videoUrl:
84
- "https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918321/DEV_TOOLS/ONBOARDING_GUIDE/Step_6_Render_Page_tnauh9.mp4",
85
- content: () => (
86
- <Text>
87
- Now that your content is published, you can run your project in your
88
- terminal and visit the page on your local server (e.g.,{" "}
89
- <Text component="code">localhost:3000/example-page</Text>). Your content
90
- should now be visible!
91
- </Text>
92
- ),
93
- },
94
- ];
@@ -1,26 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const onboardingStepStatusesSchema = z.object({
4
- createProject: z.boolean().optional(),
5
- createPageType: z.boolean(),
6
- codePage: z.boolean(),
7
- createSlice: z.boolean(),
8
- reviewAndPush: z.boolean(),
9
- createContent: z.boolean(),
10
- renderPage: z.boolean(),
11
- });
12
-
13
- export type OnboardingStepStatuses = z.infer<
14
- typeof onboardingStepStatusesSchema
15
- >;
16
-
17
- export type OnboardingStepId = keyof OnboardingStepStatuses;
18
-
19
- export interface OnboardingStep {
20
- id: OnboardingStepId;
21
- title: string;
22
- description: string;
23
- content?: () => JSX.Element;
24
- videoUrl?: string;
25
- defaultCompleted?: boolean;
26
- }
@@ -1,6 +0,0 @@
1
- import { useExperimentVariant } from "@/hooks/useExperimentVariant";
2
-
3
- export const useOnboardingExperiment = () => {
4
- const variant = useExperimentVariant("slicemachine-onboarding");
5
- return { eligible: variant?.value === "on" };
6
- };