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

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 (28) hide show
  1. package/dist/EditorConfig.d.ts +4 -3
  2. package/dist/core/MediaLibrary/hooks/uploadersData.d.ts +11 -16
  3. package/dist/core/OnboardingGuide/OnboardingGuide.d.ts +4 -4
  4. package/dist/core/OnboardingGuide/components/OnboardingCard.d.ts +5 -3
  5. package/dist/core/OnboardingGuide/components/OnboardingProgressStepper.d.ts +5 -3
  6. package/dist/core/OnboardingGuide/components/OnboardingStepDialog.d.ts +1 -1
  7. package/dist/core/OnboardingGuide/content.d.ts +1 -1
  8. package/dist/core/OnboardingGuide/index.d.ts +0 -1
  9. package/dist/core/service/document.d.ts +528 -256
  10. package/dist/core/service/onboarding.d.ts +73 -8
  11. package/dist/core/service/repository.d.ts +6 -0
  12. package/dist/core/service/user.d.ts +13 -1
  13. package/dist/fields/LinkField/Documents/documentsData.d.ts +2 -0
  14. package/dist/fields/LinkField/LinkDescriptionCard.d.ts +14 -0
  15. package/dist/fields/LinkField/LinkField.d.ts +19 -2
  16. package/dist/fields/LinkField/LinkFieldActions.d.ts +7 -4
  17. package/dist/fields/LinkField/LinkImageCard.d.ts +9 -0
  18. package/dist/fields/LinkField/WebLinks/WebLinkModal.d.ts +11 -0
  19. package/dist/fields/LinkField/index.d.ts +3 -1
  20. package/dist/fields/LinkField/useLinkField.d.ts +11 -9
  21. package/dist/fields/RichTextField/coreExtensions/ListItem.d.ts +8 -12
  22. package/dist/index.cjs.js +39 -39
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.es.js +17427 -16995
  25. package/dist/slices/utils.d.ts +46 -23
  26. package/package.json +2 -2
  27. package/dist/core/OnboardingGuide/types.d.ts +0 -79
  28. package/dist/fields/externalLinks.d.ts +0 -2
@@ -1,18 +1,83 @@
1
+ /// <reference types="react" />
2
+ import { z } from "zod";
1
3
  import { type AuthStrategy } from "../../EditorConfig";
2
- import { type OnboardingState, type OnboardingStepId, type OnboardingToggleResult, type OnboardingToggleStepResult, type OnboardingTracking } from "../OnboardingGuide/types";
3
- export declare function useOnboarding(fetcher: () => Promise<OnboardingState>): {
4
- steps: import("../OnboardingGuide/types").OnboardingStep[];
4
+ declare const onboardingStepIds: readonly ["createPrismicProject", "chooseLocale", "createProject", "setupSliceMachine", "createPageType", "codePage", "createSlice", "reviewAndPush", "createContent", "renderPage"];
5
+ export declare const onboardingStepIdSchema: z.ZodEnum<["createPrismicProject", "chooseLocale", "createProject", "setupSliceMachine", "createPageType", "codePage", "createSlice", "reviewAndPush", "createContent", "renderPage"]>;
6
+ export type OnboardingStepId = typeof onboardingStepIds[number];
7
+ export interface OnboardingStep {
8
+ id: OnboardingStepId;
9
+ title: string;
10
+ description: string;
11
+ content?: JSX.Element;
12
+ videoUrl?: string;
13
+ }
14
+ declare const onboardingFrameworks: readonly ["next", "nuxt", "sveltekit", "other"];
15
+ export type OnboardingFramework = typeof onboardingFrameworks[number];
16
+ export declare const onboardingStateSchema: z.ZodObject<{
17
+ completedSteps: z.ZodArray<z.ZodEnum<["createPrismicProject", "chooseLocale", "createProject", "setupSliceMachine", "createPageType", "codePage", "createSlice", "reviewAndPush", "createContent", "renderPage"]>, "many">;
18
+ isDismissed: z.ZodBoolean;
19
+ context: z.ZodObject<{
20
+ framework: z.ZodEnum<["next", "nuxt", "sveltekit", "other"]>;
21
+ starterId: z.ZodNullable<z.ZodString>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ framework: "next" | "nuxt" | "sveltekit" | "other";
24
+ starterId: string | null;
25
+ }, {
26
+ framework: "next" | "nuxt" | "sveltekit" | "other";
27
+ starterId: string | null;
28
+ }>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ completedSteps: ("createPrismicProject" | "chooseLocale" | "createProject" | "setupSliceMachine" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
31
+ isDismissed: boolean;
5
32
  context: {
6
33
  framework: "next" | "nuxt" | "sveltekit" | "other";
7
34
  starterId: string | null;
8
35
  };
36
+ }, {
9
37
  completedSteps: ("createPrismicProject" | "chooseLocale" | "createProject" | "setupSliceMachine" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
10
- completedStepsCount: number;
11
- isOnboardingCompleted: boolean;
12
38
  isDismissed: boolean;
13
- };
14
- export declare function useToggleOnboardingStep(fetcher: () => Promise<OnboardingState>, stepToggler: (stepId: OnboardingStepId) => Promise<OnboardingToggleStepResult>): (stepId: OnboardingStepId, tracking: OnboardingTracking) => Promise<void>;
15
- export declare function useToggleOnboarding(fetcher: () => Promise<OnboardingState>, guideToggler: () => Promise<OnboardingToggleResult>): () => Promise<void>;
39
+ context: {
40
+ framework: "next" | "nuxt" | "sveltekit" | "other";
41
+ starterId: string | null;
42
+ };
43
+ }>;
44
+ export type OnboardingState = z.infer<typeof onboardingStateSchema>;
45
+ export declare const onboardingToggleStepResultSchema: z.ZodObject<{
46
+ completedSteps: z.ZodArray<z.ZodEnum<["createPrismicProject", "chooseLocale", "createProject", "setupSliceMachine", "createPageType", "codePage", "createSlice", "reviewAndPush", "createContent", "renderPage"]>, "many">;
47
+ }, "strip", z.ZodTypeAny, {
48
+ completedSteps: ("createPrismicProject" | "chooseLocale" | "createProject" | "setupSliceMachine" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
49
+ }, {
50
+ completedSteps: ("createPrismicProject" | "chooseLocale" | "createProject" | "setupSliceMachine" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
51
+ }>;
52
+ export type OnboardingToggleStepResult = z.infer<typeof onboardingToggleStepResultSchema>;
53
+ export declare const onboardingToggleResultSchema: z.ZodObject<{
54
+ isDismissed: z.ZodBoolean;
55
+ }, "strip", z.ZodTypeAny, {
56
+ isDismissed: boolean;
57
+ }, {
58
+ isDismissed: boolean;
59
+ }>;
60
+ export type OnboardingToggleResult = z.infer<typeof onboardingToggleResultSchema>;
16
61
  export declare function getOnboarding(baseUrl: URL, repository: string, authStrategy: AuthStrategy): Promise<OnboardingState>;
17
62
  export declare function toggleOnboardingStep(stepId: OnboardingStepId, baseUrl: URL, repository: string, authStrategy: AuthStrategy): Promise<OnboardingToggleStepResult>;
18
63
  export declare function toggleOnboarding(baseUrl: URL, repository: string, authStrategy: AuthStrategy): Promise<OnboardingToggleResult>;
64
+ export type OnboardingTrackSource = "PageBuilder" | "SliceMachine";
65
+ export type OnboardingTrackEvent = {
66
+ event: "onboarding:step-completed";
67
+ stepId: OnboardingStepId;
68
+ stepTitle: string;
69
+ source: OnboardingTrackSource;
70
+ } | {
71
+ event: "onboarding:step-opened";
72
+ stepId: OnboardingStepId;
73
+ stepTitle: string;
74
+ source: OnboardingTrackSource;
75
+ } | {
76
+ event: "onboarding:completed";
77
+ source: OnboardingTrackSource;
78
+ };
79
+ export interface OnboardingTracking {
80
+ track: (args: OnboardingTrackEvent) => void;
81
+ source: OnboardingTrackSource;
82
+ }
83
+ export {};
@@ -80,6 +80,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
80
80
  slicemachineEnabled: boolean;
81
81
  }>>>;
82
82
  framework: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodEnum<["next", "nuxt", "sveltekit", "other"]>, "next" | "nuxt" | "sveltekit" | "other", unknown>>>;
83
+ starterId: z.ZodOptional<z.ZodString>;
83
84
  storageVersion: z.ZodObject<{
84
85
  major: z.ZodNumber;
85
86
  minor: z.ZodNumber;
@@ -112,6 +113,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
112
113
  minor: number;
113
114
  };
114
115
  simulator_url?: string | null | undefined;
116
+ starterId?: string | undefined;
115
117
  }, {
116
118
  languages: {
117
119
  id: string;
@@ -134,7 +136,9 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
134
136
  slicemachineEnabled: boolean;
135
137
  } | undefined;
136
138
  framework?: unknown;
139
+ starterId?: string | undefined;
137
140
  }>, {
141
+ framework: "next" | "nuxt" | "sveltekit" | "other";
138
142
  simulatorUrl: string | undefined;
139
143
  isSupportedFramework: boolean;
140
144
  authors: {
@@ -156,6 +160,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
156
160
  major: number;
157
161
  minor: number;
158
162
  };
163
+ starterId?: string | undefined;
159
164
  }, {
160
165
  languages: {
161
166
  id: string;
@@ -178,6 +183,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
178
183
  slicemachineEnabled: boolean;
179
184
  } | undefined;
180
185
  framework?: unknown;
186
+ starterId?: string | undefined;
181
187
  }>;
182
188
  export type Repository = z.TypeOf<typeof repositorySchema>;
183
189
  export declare function getRepository(baseUrl: URL, authStrategy: AuthStrategy): Promise<Repository>;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { AuthStrategy } from "../../EditorConfig";
2
+ import { type AuthStrategy } from "../../EditorConfig";
3
3
  declare const repositoryRole: z.ZodUnion<[z.ZodEnum<["Owner", "Administrator", "Writer", "Manager", "Readonly"]>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodEnum<["Owner", "Administrator", "Writer", "Manager", "Readonly"]>>>]>;
4
4
  export declare const roleMap: {
5
5
  readonly SuperUser: "SuperUser";
@@ -53,4 +53,16 @@ export declare const profileResponse: z.ZodObject<{
53
53
  }>;
54
54
  export type Profile = z.infer<typeof profileResponse>;
55
55
  export declare function getProfile(userServiceBaseUrl: URL, authStrategy: AuthStrategy): Promise<Profile>;
56
+ export declare function useProfile(): {
57
+ email: string;
58
+ shortId: string;
59
+ intercomHash: string;
60
+ firstName: string;
61
+ lastName: string;
62
+ superPower: boolean;
63
+ repositories: {
64
+ domain: string;
65
+ role: ("Owner" | "Administrator" | "Writer" | "Manager" | "Readonly" | Record<string, "Owner" | "Administrator" | "Writer" | "Manager" | "Readonly" | undefined>) & ("Owner" | "Administrator" | "Writer" | "Manager" | "Readonly" | Record<string, "Owner" | "Administrator" | "Writer" | "Manager" | "Readonly" | undefined> | undefined);
66
+ }[];
67
+ };
56
68
  export {};
@@ -30,6 +30,7 @@ export declare function useDocuments(params: {
30
30
  first_name?: string | undefined;
31
31
  last_name?: string | undefined;
32
32
  email?: string | undefined;
33
+ uploadedAvatar?: string | undefined;
33
34
  };
34
35
  version_id: string;
35
36
  custom_type_label: string;
@@ -56,6 +57,7 @@ export declare function useDocuments(params: {
56
57
  first_name?: string | undefined;
57
58
  last_name?: string | undefined;
58
59
  email?: string | undefined;
60
+ uploadedAvatar?: string | undefined;
59
61
  };
60
62
  version_id: string;
61
63
  custom_type_label: string;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { type IconName } from "@prismicio/editor-ui";
3
+ export interface LinkDescriptionCardProps {
4
+ url?: URL | string;
5
+ title?: string;
6
+ subTitle?: string;
7
+ description?: string;
8
+ largeIconName?: IconName;
9
+ loading?: boolean;
10
+ error?: boolean;
11
+ onEdit?: () => void;
12
+ onUnlink?: () => void;
13
+ }
14
+ export declare function LinkDescriptionCard(props: LinkDescriptionCardProps): JSX.Element;
@@ -1,13 +1,30 @@
1
1
  /// <reference types="react" />
2
- import type { LinkContent } from "@prismicio/types-internal/lib/content";
2
+ import { FilledLinkContent, type LinkContent } from "@prismicio/types-internal/lib/content";
3
3
  import type { Link } from "@prismicio/types-internal/lib/customtypes";
4
+ import { type FieldSelectType } from "./LinkFieldActions";
4
5
  interface LinkFieldProps {
5
6
  id?: string;
6
7
  field: Link;
7
- readOnly?: boolean;
8
8
  content: LinkContent | undefined;
9
9
  condensedButtons?: boolean;
10
10
  onContentChange: (content: LinkContent | undefined) => void;
11
11
  }
12
12
  export declare function LinkField(props: LinkFieldProps): JSX.Element;
13
+ interface GetFieldIconArgs {
14
+ selectType?: FieldSelectType;
15
+ displayTextEnabled?: boolean;
16
+ }
17
+ export declare function getFieldIcon(args: GetFieldIconArgs): "image" | "description" | "link" | "notes" | "public";
18
+ interface FilledLinkFieldProps {
19
+ id?: string;
20
+ condensedButtons?: boolean;
21
+ field: Link & {
22
+ config?: {
23
+ allowText?: false;
24
+ };
25
+ };
26
+ content: FilledLinkContent | undefined;
27
+ onContentChange: (content: FilledLinkContent | undefined) => void;
28
+ }
29
+ export declare function FilledLinkField(props: FilledLinkFieldProps): JSX.Element;
13
30
  export {};
@@ -1,14 +1,17 @@
1
1
  /// <reference types="react" />
2
- export type FieldSelectTypes = "web" | "document" | "media";
2
+ export type FieldSelectType = "web" | "document" | "media" | "any";
3
3
  interface Props {
4
4
  hasLink: boolean;
5
5
  onUnlink: () => void;
6
- selectedType?: FieldSelectTypes;
6
+ selectedType?: FieldSelectType;
7
7
  selectEnabled: boolean;
8
- onValueChange: (newValue: FieldSelectTypes) => void;
8
+ value: string;
9
+ onOpenLinkModal: () => void;
10
+ onValueChange: (newValue: FieldSelectType) => void;
9
11
  openInNewTab?: boolean;
10
12
  condensedButtons?: boolean;
11
- setOpenInNewTab?: (open: boolean) => void;
13
+ showNewTabButton?: boolean;
14
+ displayTextEnabled: boolean;
12
15
  }
13
16
  export declare function LinkFieldActions(props: Props): JSX.Element;
14
17
  export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export interface LinkImageCardProps {
3
+ url: string;
4
+ title: string;
5
+ subTitle: string;
6
+ onEdit?: () => void;
7
+ onUnlink?: () => void;
8
+ }
9
+ export declare function LinkImageCard(props: LinkImageCardProps): JSX.Element;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ interface WebLinkModalProps {
3
+ open: boolean;
4
+ setOpen: (open: boolean) => void;
5
+ url: string;
6
+ openInNewTab: boolean;
7
+ showNewTabButton: boolean;
8
+ onUpdate: (newUrl: string, newTab: boolean) => void;
9
+ }
10
+ export declare function WebLinkModal(props: WebLinkModalProps): JSX.Element;
11
+ export {};
@@ -1,3 +1,5 @@
1
- export { LinkField } from "./LinkField";
1
+ export { LinkDescriptionCard } from "./LinkDescriptionCard";
2
+ export { FilledLinkField, LinkField } from "./LinkField";
2
3
  export { LinkFieldActions } from "./LinkFieldActions";
4
+ export { LinkImageCard } from "./LinkImageCard";
3
5
  export { mapMediaToLinkContent } from "./useLinkField";
@@ -1,28 +1,30 @@
1
1
  /// <reference types="react" />
2
2
  import type { ErrorBoundary } from "@prismicio/editor-ui";
3
- import type { LinkContent } from "@prismicio/types-internal/lib/content";
3
+ import { type LinkContent } from "@prismicio/types-internal/lib/content";
4
4
  import type { Link } from "@prismicio/types-internal/lib/customtypes";
5
5
  import type { MediaAssetOrExternalImage } from "../../core/MediaLibrary/hooks/mediaLibraryData";
6
- import type { FieldSelectTypes } from "./LinkFieldActions";
6
+ import type { FieldSelectType } from "./LinkFieldActions";
7
7
  interface useLinkFieldParams {
8
8
  field: Link;
9
9
  content: LinkContent | undefined;
10
10
  onContentChange: (content: LinkContent | undefined) => void;
11
11
  }
12
12
  export declare function useLinkField(params: useLinkFieldParams): {
13
- contentType: "ImageLink" | "FileLink" | "DocumentLink" | "ExternalLink" | undefined;
14
- selectType: "document" | "media" | "web" | undefined;
13
+ contentType: "DocumentLink" | "ImageLink" | "FileLink" | "ExternalLink" | "MediaLink" | "AnyLink" | undefined;
14
+ selectType: "document" | "media" | "web" | "any" | undefined;
15
15
  fieldValue: string;
16
- onValueChange: (value: string) => void;
17
- onTypeChange: (newValue: FieldSelectTypes) => void;
16
+ onDisplayTextChange: (displayText: string) => void;
17
+ onValueChange: (value: string, newTab?: boolean) => void;
18
+ onTypeChange: (newValue?: FieldSelectType) => void;
18
19
  placeholder: string;
19
20
  isTypeSelectEnabled: boolean;
20
21
  onDocumentSelected: (documentId: string) => void;
21
22
  onError: () => void;
22
23
  errorBoundaryRef: import("react").RefObject<ErrorBoundary>;
23
24
  isTargetNewTab: boolean;
24
- updateWebLinkTarget: (newTab: boolean) => void;
25
- onMediaSelected: (media: MediaAssetOrExternalImage) => void;
25
+ onMediaSelected: (newMedia: MediaAssetOrExternalImage) => void;
26
+ displayTextEnabled: boolean;
27
+ displayText: string;
26
28
  };
27
29
  export declare function useDocumentTitle(id: string): string;
28
30
  interface MapMediaToLinkContentArgs {
@@ -60,7 +62,7 @@ export declare function mapMediaToLinkContent(args: MapMediaToLinkContentArgs):
60
62
  __TYPE__: "ImageLink";
61
63
  id: string;
62
64
  name: string;
63
- kind: string;
65
+ kind: "image";
64
66
  url: string;
65
67
  size: string;
66
68
  height: string;
@@ -11,27 +11,25 @@ declare const _default: {
11
11
  data: ({
12
12
  __TYPE__: "ImageLink";
13
13
  } & {
14
+ kind: string;
14
15
  id: string;
15
16
  url: string;
16
17
  height: string;
17
18
  width: string;
18
19
  size: string;
19
20
  name: string;
20
- kind: string;
21
21
  } & {
22
22
  date?: string | null | undefined;
23
23
  }) | ({
24
+ __TYPE__: "FileLink";
25
+ } & {
26
+ kind: string;
24
27
  id: string;
25
28
  url: string;
26
29
  name: string;
27
- kind: string;
28
30
  size: string;
29
31
  } & {
30
32
  date?: string | null | undefined;
31
- } & {
32
- __TYPE__: "FileLink";
33
- } & {
34
- size?: string | undefined;
35
33
  }) | ({
36
34
  __TYPE__: "DocumentLink";
37
35
  } & {
@@ -74,27 +72,25 @@ declare const _default: {
74
72
  data: ({
75
73
  __TYPE__: "ImageLink";
76
74
  } & {
75
+ kind: string;
77
76
  id: string;
78
77
  url: string;
79
78
  height: string;
80
79
  width: string;
81
80
  size: string;
82
81
  name: string;
83
- kind: string;
84
82
  } & {
85
83
  date?: string | null | undefined;
86
84
  }) | ({
85
+ __TYPE__: "FileLink";
86
+ } & {
87
+ kind: string;
87
88
  id: string;
88
89
  url: string;
89
90
  name: string;
90
- kind: string;
91
91
  size: string;
92
92
  } & {
93
93
  date?: string | null | undefined;
94
- } & {
95
- __TYPE__: "FileLink";
96
- } & {
97
- size?: string | undefined;
98
94
  }) | ({
99
95
  __TYPE__: "DocumentLink";
100
96
  } & {