@prismicio/editor-fields 0.4.49-alpha.feat-onboarding-guide.0 → 0.4.49-alpha.feat-onboarding-guide.2

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.
@@ -9,7 +9,7 @@ export declare function useTagSearch(): {
9
9
  uploader_id?: string | undefined;
10
10
  }[];
11
11
  };
12
- export declare const minTagNameLength = 3;
12
+ export declare const minTagNameLength = 1;
13
13
  export declare const maxTagNameLength = 20;
14
14
  export declare const tagNameSchema: z.ZodString;
15
15
  export declare const tagSchema: z.ZodObject<{
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingCardVariant, OnboardingTrackingFn } from "./types";
2
+ import type { OnboardingCardVariant, OnboardingFramework, OnboardingState, OnboardingStepId, OnboardingTrackFn } from "./types";
3
3
  interface OnboardingGuideProps {
4
4
  /**
5
5
  * Whether the whole guide (including 'Get started' button) should be visible
@@ -13,10 +13,41 @@ interface OnboardingGuideProps {
13
13
  * @default "default"
14
14
  */
15
15
  variant?: OnboardingCardVariant;
16
- /** Link to the video tutorials */
17
- tutorialLink?: string;
18
- /** Function to track onboarding events */
19
- trackingFn: OnboardingTrackingFn;
16
+ /**
17
+ * The framework the user is using
18
+ *
19
+ * Used to display a link to the appropriate tutorial
20
+ * @default "other"
21
+ */
22
+ framework?: OnboardingFramework;
23
+ /**
24
+ * Function to track onboarding events
25
+ *
26
+ * - onboarding:step-completed,
27
+ * - onboarding:step-opened,
28
+ * - onboarding:guide-completed
29
+ * */
30
+ track: OnboardingTrackFn;
31
+ /**
32
+ * Fetches the current onboarding state
33
+ *
34
+ * @returns {OnboardingState}
35
+ */
36
+ fetchState: () => Promise<OnboardingState>;
37
+ /**
38
+ * Updates the onboarding steps progress state
39
+ *
40
+ * @param {OnboardingStepId[]} stepId
41
+ */
42
+ toggleStep: (stepId: OnboardingStepId) => Promise<OnboardingStepId[]>;
43
+ /**
44
+ * Updates the onboarding guide state to completed
45
+ *
46
+ * @returns {boolean}
47
+ */
48
+ resolveGuide: () => Promise<{
49
+ isResolved: boolean;
50
+ }>;
20
51
  }
21
52
  export declare function OnboardingGuide(props: OnboardingGuideProps): JSX.Element;
22
53
  export {};
@@ -1,8 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingCardVariant } from "../types";
3
2
  interface OnboardingCardProps {
4
- variant: OnboardingCardVariant;
5
- tutorialLink?: string;
6
3
  onClose?: () => void;
7
4
  }
8
5
  export declare function OnboardingCard(props: OnboardingCardProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ interface OnboardingGuideUIProps {
3
+ isOnboardingVisible: boolean;
4
+ isFadedOut: boolean;
5
+ resolveGuide: () => Promise<{
6
+ isResolved: boolean;
7
+ }>;
8
+ }
9
+ export declare function OnboardingGuideUI(props: OnboardingGuideUIProps): JSX.Element;
10
+ export {};
@@ -1,20 +1,26 @@
1
1
  import { type ReactNode } from "react";
2
- import { type OnboardingCardVariant, type OnboardingStep, type OnboardingStepId, type OnboardingTrackingFn } from "../types";
2
+ import { type OnboardingCardVariant, type OnboardingFramework, type OnboardingState, type OnboardingStep, type OnboardingStepId, type OnboardingTrackFn } from "../types";
3
+ interface OnboardingProviderProps {
4
+ children: ReactNode;
5
+ variant: OnboardingCardVariant;
6
+ framework: OnboardingFramework;
7
+ onComplete?: () => void;
8
+ track: OnboardingTrackFn;
9
+ fetchState: () => Promise<OnboardingState>;
10
+ toggleStep: (stepId: OnboardingStepId) => Promise<OnboardingStepId[]>;
11
+ }
12
+ export declare function OnboardingProvider(props: OnboardingProviderProps): JSX.Element;
3
13
  interface OnboardingContext {
4
14
  steps: OnboardingStep[];
5
- completedStepCount: number;
15
+ completedStepsCount: number;
16
+ variant: OnboardingCardVariant;
17
+ tutorialLink?: string;
18
+ isResolved?: boolean;
6
19
  toggleStepComplete: (step: OnboardingStep) => void;
7
20
  getStepIndex: (step: OnboardingStepId) => number;
8
21
  isStepComplete: (step: OnboardingStep) => boolean;
9
- trackingFn: OnboardingTrackingFn;
22
+ track: OnboardingTrackFn;
10
23
  }
11
24
  declare const OnboardingContext: import("react").Context<OnboardingContext | undefined>;
12
- interface OnboardingProviderProps {
13
- children: ReactNode;
14
- variant: OnboardingCardVariant;
15
- onComplete?: () => void;
16
- trackingFn: OnboardingTrackingFn;
17
- }
18
- export declare function OnboardingProvider(props: OnboardingProviderProps): JSX.Element;
19
25
  export declare const useOnboardingContext: () => OnboardingContext;
20
26
  export {};
@@ -1,3 +1,4 @@
1
- import type { OnboardingStep } from "./types";
1
+ import type { OnboardingFramework, OnboardingStep } from "./types";
2
2
  export declare const onboardingSteps: OnboardingStep[];
3
3
  export declare const onboardingExperimentSteps: OnboardingStep[];
4
+ export declare const tutorialLinks: Record<OnboardingFramework, string>;
@@ -1 +1,2 @@
1
1
  export { OnboardingGuide } from "./OnboardingGuide";
2
+ export type { OnboardingState, OnboardingStepId } from "./types";
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { z } from "zod";
3
- export declare const onboardingStepStatusesSchema: z.ZodObject<{
4
- createProject: z.ZodLiteral<true>;
3
+ declare const onboardingStepStatusesSchema: z.ZodObject<{
4
+ createProject: z.ZodBoolean;
5
5
  createPageType: z.ZodBoolean;
6
6
  codePage: z.ZodBoolean;
7
7
  createSlice: z.ZodBoolean;
@@ -9,7 +9,7 @@ export declare const onboardingStepStatusesSchema: z.ZodObject<{
9
9
  createContent: z.ZodBoolean;
10
10
  renderPage: z.ZodBoolean;
11
11
  }, "strip", z.ZodTypeAny, {
12
- createProject: true;
12
+ createProject: boolean;
13
13
  createPageType: boolean;
14
14
  codePage: boolean;
15
15
  createSlice: boolean;
@@ -17,7 +17,7 @@ export declare const onboardingStepStatusesSchema: z.ZodObject<{
17
17
  createContent: boolean;
18
18
  renderPage: boolean;
19
19
  }, {
20
- createProject: true;
20
+ createProject: boolean;
21
21
  createPageType: boolean;
22
22
  codePage: boolean;
23
23
  createSlice: boolean;
@@ -25,7 +25,7 @@ export declare const onboardingStepStatusesSchema: z.ZodObject<{
25
25
  createContent: boolean;
26
26
  renderPage: boolean;
27
27
  }>;
28
- export type OnboardingStepStatuses = z.infer<typeof onboardingStepStatusesSchema>;
28
+ type OnboardingStepStatuses = z.infer<typeof onboardingStepStatusesSchema>;
29
29
  export type OnboardingStepId = keyof OnboardingStepStatuses;
30
30
  export interface OnboardingStep {
31
31
  id: OnboardingStepId;
@@ -35,5 +35,11 @@ export interface OnboardingStep {
35
35
  videoUrl?: string;
36
36
  defaultCompleted?: boolean;
37
37
  }
38
+ export type OnboardingState = {
39
+ completedSteps: OnboardingStepId[];
40
+ isResolved: boolean;
41
+ };
38
42
  export type OnboardingCardVariant = "default" | "light" | "dark";
39
- export type OnboardingTrackingFn = (args: Record<string, string>) => void;
43
+ export type OnboardingFramework = "next" | "nuxt" | "sveltekit" | "other";
44
+ export type OnboardingTrackFn = (args: Record<string, string>) => void;
45
+ export {};