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

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.
@@ -6,7 +6,7 @@ export type EditorConfig = {
6
6
  unsplashApiBaseUrl: URL;
7
7
  authStrategy: AuthStrategy;
8
8
  } & OptionalConfigs;
9
- type OptionalConfigs = SearchDocuments & MediaLibrary & UIDField & Analytics & ErrorTracking & IntegrationFields & LayoutConfig & RepositoryConfig & UserService;
9
+ type OptionalConfigs = SearchDocuments & MediaLibrary & UIDField & Analytics & ErrorTracking & IntegrationFields & LayoutConfig & UserService;
10
10
  type UserService = {
11
11
  userServiceBaseUrl?: URL;
12
12
  };
@@ -53,12 +53,6 @@ interface LayoutConfig {
53
53
  */
54
54
  scrollOffsetTop?: number;
55
55
  }
56
- type RepositoryConfig = {
57
- repositoryBaseUrl?: never;
58
- } | {
59
- repository: string;
60
- repositoryBaseUrl: URL;
61
- };
62
56
  interface OnAnalyticsEvent {
63
57
  (event: "Media Library Search", args: {
64
58
  assetType: MediaAssetType;
@@ -1,22 +1,22 @@
1
1
  /// <reference types="react" />
2
- import { type ConfettiConfig } from "dom-confetti";
3
- import type { OnboardingState, OnboardingStepId, OnboardingTracking } from "../service";
2
+ import type { OnboardingCardVariant, OnboardingTrackingFn } from "./types";
4
3
  interface OnboardingGuideProps {
5
- onboardingState: OnboardingState;
6
- tracking: OnboardingTracking;
7
- onToggleStep: (stepId: OnboardingStepId) => Promise<OnboardingStepId[]>;
8
- onToggleGuide: () => Promise<void>;
4
+ /**
5
+ * Whether the whole guide (including 'Get started' button) should be visible
6
+ *
7
+ * Example usage: we hide it on small screens in SM
8
+ * @default true
9
+ */
10
+ isOnboardingVisible?: boolean;
11
+ /**
12
+ * A/B test onboarding card visibility experiment variant
13
+ * @default "default"
14
+ */
15
+ variant?: OnboardingCardVariant;
16
+ /** Link to the video tutorials */
17
+ tutorialLink?: string;
18
+ /** Function to track onboarding events */
19
+ trackingFn: OnboardingTrackingFn;
9
20
  }
10
21
  export declare function OnboardingGuide(props: OnboardingGuideProps): JSX.Element;
11
- export declare function useConfetti(confettiConfig: ConfettiConfig): {
12
- throwConfetti: () => void;
13
- confettiCannonRef: import("react").RefObject<HTMLDivElement>;
14
- confettiContainerRef: import("react").RefObject<HTMLDivElement>;
15
- };
16
- export declare function useFadeOut(closeGuide: () => void, startDelay: number, endDelay: number): {
17
- isFadedOut: boolean;
18
- isFading: boolean;
19
- fadeOut: () => void;
20
- resetFadeOut: () => void;
21
- };
22
22
  export {};
@@ -1,11 +1,8 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingStep, OnboardingStepId, OnboardingTracking } from "../../service";
2
+ import type { OnboardingCardVariant } from "../types";
3
3
  interface OnboardingCardProps {
4
- steps: OnboardingStep[];
5
- completedSteps: OnboardingStepId[];
4
+ variant: OnboardingCardVariant;
6
5
  tutorialLink?: string;
7
- tracking: OnboardingTracking;
8
- onToggleStep: (step: OnboardingStep) => Promise<void>;
9
6
  onClose?: () => void;
10
7
  }
11
8
  export declare function OnboardingCard(props: OnboardingCardProps): JSX.Element;
@@ -1,11 +1,7 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingStep, OnboardingStepId, OnboardingTracking } from "../../service";
2
+ import type { OnboardingCardVariant } from "../types";
3
3
  interface OnboardingProgressStepperProps {
4
- steps: OnboardingStep[];
5
- completedSteps: OnboardingStepId[];
6
- completedStepsCount: number;
7
- onToggleStep: (step: OnboardingStep) => Promise<void>;
8
- tracking: OnboardingTracking;
4
+ variant: OnboardingCardVariant;
9
5
  }
10
6
  export declare function OnboardingProgressStepper(props: OnboardingProgressStepperProps): JSX.Element | null;
11
7
  export {};
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ import { type OnboardingCardVariant, type OnboardingStep, type OnboardingStepId, type OnboardingTrackingFn } from "../types";
3
+ interface OnboardingContext {
4
+ steps: OnboardingStep[];
5
+ completedStepCount: number;
6
+ toggleStepComplete: (step: OnboardingStep) => void;
7
+ getStepIndex: (step: OnboardingStepId) => number;
8
+ isStepComplete: (step: OnboardingStep) => boolean;
9
+ trackingFn: OnboardingTrackingFn;
10
+ }
11
+ 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
+ export declare const useOnboardingContext: () => OnboardingContext;
20
+ export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingStep } from "../../service";
2
+ import type { OnboardingStep } from "../types";
3
3
  interface OnboardingStepDialogProps {
4
4
  isOpen: boolean;
5
5
  step: OnboardingStep;
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import type { OnboardingCardVariant } from "../types";
2
3
  interface OnboardingTutorialProps {
3
4
  href: string;
5
+ variant?: OnboardingCardVariant;
4
6
  }
5
7
  export declare function OnboardingTutorial(props: OnboardingTutorialProps): JSX.Element;
6
8
  export {};
@@ -1,6 +1,3 @@
1
- import type { OnboardingFramework, OnboardingStep } from "../service/onboarding";
2
- export declare function getOnboardingContent(framework?: OnboardingFramework, starter?: string): {
3
- steps: OnboardingStep[];
4
- defaultCompletedStepIds: ("createPrismicProject" | "chooseLocale" | "createProject" | "setupSliceMachine" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
5
- tutorialLink: string;
6
- };
1
+ import type { OnboardingStep } from "./types";
2
+ export declare const onboardingSteps: OnboardingStep[];
3
+ export declare const onboardingExperimentSteps: OnboardingStep[];
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
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;
30
+ export interface OnboardingStep {
31
+ id: OnboardingStepId;
32
+ title: string;
33
+ description: string;
34
+ content?: JSX.Element;
35
+ videoUrl?: string;
36
+ defaultCompleted?: boolean;
37
+ }
38
+ export type OnboardingCardVariant = "default" | "light" | "dark";
39
+ export type OnboardingTrackingFn = (args: Record<string, string>) => void;
@@ -1,5 +1,4 @@
1
1
  export * from "./customType";
2
2
  export * from "./document";
3
- export * from "./onboarding";
4
3
  export * from "./repository";
5
4
  export * from "./user";
@@ -99,7 +99,6 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
99
99
  lastname?: string | undefined;
100
100
  uploadedAvatar?: string | undefined;
101
101
  }[];
102
- framework: "next" | "nuxt" | "sveltekit" | "other";
103
102
  languages: {
104
103
  id: string;
105
104
  name: string;
@@ -108,6 +107,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
108
107
  quotas: {
109
108
  slicemachineEnabled: boolean;
110
109
  };
110
+ framework: "next" | "nuxt" | "sveltekit" | "other";
111
111
  storageVersion: {
112
112
  major: number;
113
113
  minor: number;