@prismicio/editor-fields 0.4.49-alpha.feat-onboarding-guide.5 → 0.4.49-alpha.feat-onboarding-guide.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,19 @@
1
1
  /// <reference types="react" />
2
- import { type EditorConfig } from "../../EditorConfig";
3
- import type { OnboardingCardVariant, OnboardingTrackingFn } from "./types";
2
+ import { type ConfettiConfig } from "dom-confetti";
3
+ import type { OnboardingTracking } from "./types";
4
4
  interface OnboardingGuideProps {
5
- config: EditorConfig;
6
- /**
7
- * Whether the whole guide (including 'Get started' button) should be visible
8
- *
9
- * Example usage: we hide it on small screens in SM
10
- * @default true
11
- */
12
- isOnboardingVisible?: boolean;
13
- /**
14
- * A/B test onboarding card visibility experiment variant
15
- * @default "default"
16
- */
17
- variant?: OnboardingCardVariant;
18
- /** Link to the video tutorials */
19
- tutorialLink?: string;
20
- /** Function to track onboarding events */
21
- trackingFn: OnboardingTrackingFn;
5
+ tracking: OnboardingTracking;
22
6
  }
23
7
  export declare function OnboardingGuide(props: OnboardingGuideProps): JSX.Element;
8
+ export declare function useConfetti(confettiConfig: ConfettiConfig): {
9
+ throwConfetti: () => void;
10
+ confettiCannonRef: import("react").RefObject<HTMLDivElement>;
11
+ confettiContainerRef: import("react").RefObject<HTMLDivElement>;
12
+ };
13
+ export declare function useFadeOut(closeGuide: () => void, startDelay: number, endDelay: number): {
14
+ isFadedOut: boolean;
15
+ isFading: boolean;
16
+ fadeOut: () => void;
17
+ resetFadeOut: () => void;
18
+ };
24
19
  export {};
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingCardVariant } from "../types";
2
+ import type { OnboardingTracking } from "../types";
3
3
  interface OnboardingCardProps {
4
- variant: OnboardingCardVariant;
5
- tutorialLink?: string;
4
+ tracking: OnboardingTracking;
6
5
  onClose?: () => void;
7
6
  }
8
7
  export declare function OnboardingCard(props: OnboardingCardProps): JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingCardVariant } from "../types";
2
+ import type { OnboardingTracking } from "../types";
3
3
  interface OnboardingProgressStepperProps {
4
- variant: OnboardingCardVariant;
4
+ tracking: OnboardingTracking;
5
5
  }
6
6
  export declare function OnboardingProgressStepper(props: OnboardingProgressStepperProps): JSX.Element | null;
7
7
  export {};
@@ -1,8 +1,6 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingCardVariant } from "../types";
3
2
  interface OnboardingTutorialProps {
4
3
  href: string;
5
- variant?: OnboardingCardVariant;
6
4
  }
7
5
  export declare function OnboardingTutorial(props: OnboardingTutorialProps): JSX.Element;
8
6
  export {};
@@ -1,3 +1,6 @@
1
- import type { OnboardingStep } from "./types";
2
- export declare const onboardingSteps: OnboardingStep[];
3
- export declare const onboardingExperimentSteps: OnboardingStep[];
1
+ import type { OnboardingFramework, OnboardingStep } from "./types";
2
+ export declare function getOnboardingContent(framework?: OnboardingFramework): {
3
+ steps: OnboardingStep[];
4
+ defaultCompletedStepIds: ("createProject" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
5
+ tutorialLink: string;
6
+ };
@@ -1 +1,2 @@
1
1
  export { OnboardingGuide } from "./OnboardingGuide";
2
+ export type { OnboardingStepId, OnboardingTracking } from "./types";
@@ -1,32 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { z } from "zod";
3
- export declare const onboardingStepStatusesSchema: z.ZodObject<{
4
- createProject: z.ZodLiteral<true>;
5
- createPageType: z.ZodBoolean;
6
- codePage: z.ZodBoolean;
7
- createSlice: z.ZodBoolean;
8
- reviewAndPush: z.ZodBoolean;
9
- createContent: z.ZodBoolean;
10
- renderPage: z.ZodBoolean;
11
- }, "strip", z.ZodTypeAny, {
12
- createProject: true;
13
- createPageType: boolean;
14
- codePage: boolean;
15
- createSlice: boolean;
16
- reviewAndPush: boolean;
17
- createContent: boolean;
18
- renderPage: boolean;
19
- }, {
20
- createProject: true;
21
- createPageType: boolean;
22
- codePage: boolean;
23
- createSlice: boolean;
24
- reviewAndPush: boolean;
25
- createContent: boolean;
26
- renderPage: boolean;
27
- }>;
28
- export type OnboardingStepStatuses = z.infer<typeof onboardingStepStatusesSchema>;
29
- export type OnboardingStepId = keyof OnboardingStepStatuses;
3
+ declare const onboardingStepIds: readonly ["createProject", "createPageType", "codePage", "createSlice", "reviewAndPush", "createContent", "renderPage"];
4
+ export declare const onboardingStepIdSchema: z.ZodEnum<["createProject", "createPageType", "codePage", "createSlice", "reviewAndPush", "createContent", "renderPage"]>;
5
+ export type OnboardingStepId = typeof onboardingStepIds[number];
30
6
  export interface OnboardingStep {
31
7
  id: OnboardingStepId;
32
8
  title: string;
@@ -35,5 +11,61 @@ export interface OnboardingStep {
35
11
  videoUrl?: string;
36
12
  defaultCompleted?: boolean;
37
13
  }
38
- export type OnboardingCardVariant = "default" | "light" | "dark";
39
- export type OnboardingTrackingFn = (args: Record<string, string>) => void;
14
+ export type OnboardingState = {
15
+ completedSteps: OnboardingStepId[];
16
+ isDismissed: boolean;
17
+ context?: {
18
+ framework: OnboardingFramework;
19
+ starterId?: string;
20
+ };
21
+ };
22
+ declare const onboardingFrameworks: readonly ["next", "nuxt", "sveltekit", "other"];
23
+ export type OnboardingFramework = typeof onboardingFrameworks[number];
24
+ export declare const onboardingStateSchema: z.ZodObject<{
25
+ completedSteps: z.ZodArray<z.ZodEnum<["createProject", "createPageType", "codePage", "createSlice", "reviewAndPush", "createContent", "renderPage"]>, "many">;
26
+ isDismissed: z.ZodBoolean;
27
+ context: z.ZodOptional<z.ZodObject<{
28
+ framework: z.ZodEnum<["next", "nuxt", "sveltekit", "other"]>;
29
+ starterId: z.ZodOptional<z.ZodString>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ framework: "next" | "nuxt" | "sveltekit" | "other";
32
+ starterId?: string | undefined;
33
+ }, {
34
+ framework: "next" | "nuxt" | "sveltekit" | "other";
35
+ starterId?: string | undefined;
36
+ }>>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ completedSteps: ("createProject" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
39
+ isDismissed: boolean;
40
+ context?: {
41
+ framework: "next" | "nuxt" | "sveltekit" | "other";
42
+ starterId?: string | undefined;
43
+ } | undefined;
44
+ }, {
45
+ completedSteps: ("createProject" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
46
+ isDismissed: boolean;
47
+ context?: {
48
+ framework: "next" | "nuxt" | "sveltekit" | "other";
49
+ starterId?: string | undefined;
50
+ } | undefined;
51
+ }>;
52
+ export type OnboardingTrackSource = "PageBuilder" | "SliceMachine";
53
+ export type OnboardingTrackEvent = {
54
+ event: "onboarding:step-completed";
55
+ stepId: OnboardingStepId;
56
+ stepTitle: string;
57
+ source: OnboardingTrackSource;
58
+ } | {
59
+ event: "onboarding:step-opened";
60
+ stepId: OnboardingStepId;
61
+ stepTitle: string;
62
+ source: OnboardingTrackSource;
63
+ } | {
64
+ event: "onboarding:completed";
65
+ source: OnboardingTrackSource;
66
+ };
67
+ export interface OnboardingTracking {
68
+ track: (args: OnboardingTrackEvent) => void;
69
+ source: OnboardingTrackSource;
70
+ }
71
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from "./customType";
2
2
  export * from "./document";
3
+ export * from "./onboarding";
3
4
  export * from "./repository";
4
5
  export * from "./user";
@@ -0,0 +1,14 @@
1
+ import { type OnboardingStepId, type OnboardingTracking } from "../OnboardingGuide/types";
2
+ export declare function useOnboarding(): {
3
+ steps: import("../OnboardingGuide/types").OnboardingStep[];
4
+ context: {
5
+ framework: "next" | "nuxt" | "sveltekit" | "other";
6
+ starterId?: string | undefined;
7
+ } | undefined;
8
+ completedSteps: ("createProject" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
9
+ completedStepsCount: number;
10
+ isOnboardingCompleted: boolean;
11
+ isDismissed: boolean;
12
+ };
13
+ export declare function useToggleStep(): (stepId: OnboardingStepId, tracking: OnboardingTracking) => Promise<void>;
14
+ export declare function useToggleOnboarding(): () => Promise<void>;
@@ -98,6 +98,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
98
98
  lastname?: string | undefined;
99
99
  uploadedAvatar?: string | undefined;
100
100
  }[];
101
+ framework: "next" | "nuxt" | "sveltekit" | "other";
101
102
  languages: {
102
103
  id: string;
103
104
  name: string;
@@ -106,7 +107,6 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
106
107
  quotas: {
107
108
  slicemachineEnabled: boolean;
108
109
  };
109
- framework: "next" | "nuxt" | "sveltekit" | "other";
110
110
  storageVersion: {
111
111
  major: number;
112
112
  minor: number;