@prismicio/editor-fields 0.4.52-jp-onboarding-guide-triggers.1 → 0.4.52

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.
@@ -47,14 +47,14 @@ type IntegrationFields = {
47
47
  integrationFieldsApiBaseUrl: URL;
48
48
  repository: string;
49
49
  };
50
- type LayoutConfig = {
51
- /**
50
+ interface LayoutConfig {
51
+ /**
52
52
  * Teaches fields about their containing scrolling element.
53
53
  */
54
54
  scrollOffsetTop?: number;
55
55
  }
56
- type OnAnalyticsEvent = {
57
- (event: "Media Library Search", args: {
56
+ interface OnAnalyticsEvent {
57
+ (event: "Media Library Search", args: {
58
58
  assetType: MediaAssetType;
59
59
  mode: "browse" | "select";
60
60
  searchQuery: string;
@@ -62,7 +62,7 @@ type OnAnalyticsEvent = {
62
62
  numberOfResults: string;
63
63
  timeToGetResults: string;
64
64
  tags: string;
65
- }): void;
65
+ }): void;
66
66
  (event: "Media Added To Page", args: {
67
67
  assetType: MediaAssetType;
68
68
  searchQuery: string;
@@ -73,13 +73,19 @@ type OnAnalyticsEvent = {
73
73
  timeToAddMediaToPage: string;
74
74
  tags: string;
75
75
  }): void;
76
+ (event: "Generic Link Added", args: {
77
+ type: "web" | "media" | "document";
78
+ isInSlice: string;
79
+ isInGroup: string;
80
+ customTypeFormat: "page" | "custom";
81
+ }): void;
76
82
  (event: "Unsplash Image Searched" | "Unsplash Image Added"): void;
77
83
  }
78
- type Analytics = {
79
- onAnalyticsEvent?: OnAnalyticsEvent;
84
+ interface Analytics {
85
+ onAnalyticsEvent?: OnAnalyticsEvent;
80
86
  }
81
- type ErrorTracking = {
82
- /** Asks the editor to track this Error in its Error monitoring solution. */
87
+ interface ErrorTracking {
88
+ /** Asks the editor to track this Error in its Error monitoring solution. */
83
89
  onTrackError?: (error: Error) => void;
84
90
  }
85
91
  export type AuthStrategy = "cookie" | "token";
@@ -0,0 +1,27 @@
1
+ import type { CustomType } from "@prismicio/types-internal/lib/customtypes";
2
+ import { type PropsWithChildren, type ReactNode } from "react";
3
+ type CustomTypeFormat = CustomType["format"];
4
+ interface FieldContextValue {
5
+ customTypeFormat: CustomTypeFormat;
6
+ isInSlice: boolean;
7
+ isInGroup: boolean;
8
+ }
9
+ interface RootFieldContextProviderProps {
10
+ customTypeFormat: CustomTypeFormat;
11
+ children: ReactNode;
12
+ }
13
+ /**
14
+ * Provides extra context to the fields below.
15
+ * Use it only once at the root of the fields tree.
16
+ */
17
+ export declare function RootFieldContextProvider(props: RootFieldContextProviderProps): JSX.Element;
18
+ /**
19
+ * Overrides the field context to indicate that the field is in a slice.
20
+ */
21
+ export declare function FieldInSliceContextProvider(props: PropsWithChildren): JSX.Element;
22
+ /**
23
+ * Overrides the field context to indicate that the field is in a group.
24
+ */
25
+ export declare function FieldInGroupContextProvider(props: PropsWithChildren): JSX.Element;
26
+ export declare function useFieldContext(): FieldContextValue | undefined;
27
+ export {};
@@ -4,3 +4,8 @@ export declare const frameworkLabels: {
4
4
  readonly sveltekit: "SvelteKit";
5
5
  readonly other: "Other";
6
6
  };
7
+ export declare const frameworkCreateProjectCodeSnippet: {
8
+ readonly next: "npx create-next-app@latest";
9
+ readonly nuxt: "npx nuxi@latest init";
10
+ readonly sveltekit: "npx sv create";
11
+ };
@@ -54,6 +54,9 @@ export declare const mediaAssetType: z.ZodObject<{
54
54
  count?: number | undefined;
55
55
  }>, "many">;
56
56
  }, "strip", z.ZodTypeAny, {
57
+ id: string;
58
+ url: string;
59
+ size: number;
57
60
  tags: {
58
61
  id: string;
59
62
  name: string;
@@ -62,11 +65,8 @@ export declare const mediaAssetType: z.ZodObject<{
62
65
  count: number;
63
66
  uploader_id?: string | undefined;
64
67
  }[];
65
- id: string;
66
- url: string;
67
- size: number;
68
- kind: string;
69
68
  last_modified: number;
69
+ kind: string;
70
70
  filename: string;
71
71
  extension?: string | undefined;
72
72
  width?: number | undefined;
@@ -82,6 +82,9 @@ export declare const mediaAssetType: z.ZodObject<{
82
82
  credits?: string | undefined;
83
83
  } | undefined;
84
84
  }, {
85
+ id: string;
86
+ url: string;
87
+ size: number;
85
88
  tags: {
86
89
  id: string;
87
90
  name: string;
@@ -90,11 +93,8 @@ export declare const mediaAssetType: z.ZodObject<{
90
93
  uploader_id?: string | undefined;
91
94
  count?: number | undefined;
92
95
  }[];
93
- id: string;
94
- url: string;
95
- size: number;
96
- kind: string;
97
96
  last_modified: number;
97
+ kind: string;
98
98
  filename: string;
99
99
  extension?: string | undefined;
100
100
  width?: number | undefined;
@@ -169,6 +169,9 @@ export declare const mediaSearchResponse: z.ZodObject<{
169
169
  count?: number | undefined;
170
170
  }>, "many">;
171
171
  }, "strip", z.ZodTypeAny, {
172
+ id: string;
173
+ url: string;
174
+ size: number;
172
175
  tags: {
173
176
  id: string;
174
177
  name: string;
@@ -177,11 +180,8 @@ export declare const mediaSearchResponse: z.ZodObject<{
177
180
  count: number;
178
181
  uploader_id?: string | undefined;
179
182
  }[];
180
- id: string;
181
- url: string;
182
- size: number;
183
- kind: string;
184
183
  last_modified: number;
184
+ kind: string;
185
185
  filename: string;
186
186
  extension?: string | undefined;
187
187
  width?: number | undefined;
@@ -197,6 +197,9 @@ export declare const mediaSearchResponse: z.ZodObject<{
197
197
  credits?: string | undefined;
198
198
  } | undefined;
199
199
  }, {
200
+ id: string;
201
+ url: string;
202
+ size: number;
200
203
  tags: {
201
204
  id: string;
202
205
  name: string;
@@ -205,11 +208,8 @@ export declare const mediaSearchResponse: z.ZodObject<{
205
208
  uploader_id?: string | undefined;
206
209
  count?: number | undefined;
207
210
  }[];
208
- id: string;
209
- url: string;
210
- size: number;
211
- kind: string;
212
211
  last_modified: number;
212
+ kind: string;
213
213
  filename: string;
214
214
  extension?: string | undefined;
215
215
  width?: number | undefined;
@@ -228,6 +228,9 @@ export declare const mediaSearchResponse: z.ZodObject<{
228
228
  }, "strip", z.ZodTypeAny, {
229
229
  total: number;
230
230
  items: {
231
+ id: string;
232
+ url: string;
233
+ size: number;
231
234
  tags: {
232
235
  id: string;
233
236
  name: string;
@@ -236,11 +239,8 @@ export declare const mediaSearchResponse: z.ZodObject<{
236
239
  count: number;
237
240
  uploader_id?: string | undefined;
238
241
  }[];
239
- id: string;
240
- url: string;
241
- size: number;
242
- kind: string;
243
242
  last_modified: number;
243
+ kind: string;
244
244
  filename: string;
245
245
  extension?: string | undefined;
246
246
  width?: number | undefined;
@@ -260,6 +260,9 @@ export declare const mediaSearchResponse: z.ZodObject<{
260
260
  }, {
261
261
  total: number;
262
262
  items: {
263
+ id: string;
264
+ url: string;
265
+ size: number;
263
266
  tags: {
264
267
  id: string;
265
268
  name: string;
@@ -268,11 +271,8 @@ export declare const mediaSearchResponse: z.ZodObject<{
268
271
  uploader_id?: string | undefined;
269
272
  count?: number | undefined;
270
273
  }[];
271
- id: string;
272
- url: string;
273
- size: number;
274
- kind: string;
275
274
  last_modified: number;
275
+ kind: string;
276
276
  filename: string;
277
277
  extension?: string | undefined;
278
278
  width?: number | undefined;
@@ -308,6 +308,9 @@ export declare function searchMedia(baseUrl: URL | undefined, repository: string
308
308
  page: number;
309
309
  total: number;
310
310
  items: {
311
+ id: string;
312
+ url: string;
313
+ size: number;
311
314
  tags: {
312
315
  id: string;
313
316
  name: string;
@@ -316,11 +319,8 @@ export declare function searchMedia(baseUrl: URL | undefined, repository: string
316
319
  count: number;
317
320
  uploader_id?: string | undefined;
318
321
  }[];
319
- id: string;
320
- url: string;
321
- size: number;
322
- kind: string;
323
322
  last_modified: number;
323
+ kind: string;
324
324
  filename: string;
325
325
  extension?: string | undefined;
326
326
  width?: number | undefined;
@@ -357,6 +357,9 @@ export declare function useMediaSearch(args: UseMediaLibrarySearchArgs): {
357
357
  setFilters: (filters: Partial<MediaLibraryFilters>) => void;
358
358
  resetFilters: () => void;
359
359
  media: {
360
+ id: string;
361
+ url: string;
362
+ size: number;
360
363
  tags: {
361
364
  id: string;
362
365
  name: string;
@@ -365,11 +368,8 @@ export declare function useMediaSearch(args: UseMediaLibrarySearchArgs): {
365
368
  count: number;
366
369
  uploader_id?: string | undefined;
367
370
  }[];
368
- id: string;
369
- url: string;
370
- size: number;
371
- kind: string;
372
371
  last_modified: number;
372
+ kind: string;
373
373
  filename: string;
374
374
  extension?: string | undefined;
375
375
  width?: number | undefined;
@@ -407,6 +407,9 @@ declare function deleteMedia(mediaIds: string[]): void;
407
407
  declare function deleteSearchData(args: MediaLibraryFilters): void;
408
408
  type MediaPage = Awaited<ReturnType<typeof searchMedia>>;
409
409
  export declare function getMedia(allPages: MediaPage[], keyword: string, assetType: MediaAssetType, uploaderId: string | undefined, tags: string): {
410
+ id: string;
411
+ url: string;
412
+ size: number;
410
413
  tags: {
411
414
  id: string;
412
415
  name: string;
@@ -415,11 +418,8 @@ export declare function getMedia(allPages: MediaPage[], keyword: string, assetTy
415
418
  count: number;
416
419
  uploader_id?: string | undefined;
417
420
  }[];
418
- id: string;
419
- url: string;
420
- size: number;
421
- kind: string;
422
421
  last_modified: number;
422
+ kind: string;
423
423
  filename: string;
424
424
  extension?: string | undefined;
425
425
  width?: number | undefined;
@@ -1,4 +1,7 @@
1
1
  export declare function useSelectedMedia(): {
2
+ id: string;
3
+ url: string;
4
+ size: number;
2
5
  tags: {
3
6
  id: string;
4
7
  name: string;
@@ -7,11 +10,8 @@ export declare function useSelectedMedia(): {
7
10
  count: number;
8
11
  uploader_id?: string | undefined;
9
12
  }[];
10
- id: string;
11
- url: string;
12
- size: number;
13
- kind: string;
14
13
  last_modified: number;
14
+ kind: string;
15
15
  filename: string;
16
16
  extension?: string | undefined;
17
17
  width?: number | undefined;
@@ -1,13 +1,14 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { OnboardingState, OnboardingStepId, OnboardingTracking } from "../service";
3
- interface OnboardingGuideProps {
3
+ export interface OnboardingGuideProps {
4
4
  onboardingState: OnboardingState;
5
5
  tracking: OnboardingTracking;
6
6
  onToggleStep: (stepId: OnboardingStepId) => Promise<string[]>;
7
7
  onToggleGuide: () => Promise<void>;
8
8
  fallback?: ReactNode;
9
9
  /** This allows consumers of the onboarding to do something else for certain steps other than opening the modal. */
10
- stepContentOverride?: Partial<Record<OnboardingStepId, ReactNode>>;
10
+ stepOverrides?: Partial<Record<OnboardingStepId, () => void>>;
11
+ repositoryName?: string;
12
+ projectName?: string;
11
13
  }
12
14
  export declare function OnboardingGuide(props: OnboardingGuideProps): JSX.Element | null;
13
- export {};
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ /// <reference types="react" />
2
2
  import type { OnboardingStep, OnboardingStepId, OnboardingTracking } from "../../service";
3
3
  interface OnboardingCardProps {
4
4
  steps: OnboardingStep[];
@@ -7,7 +7,7 @@ interface OnboardingCardProps {
7
7
  tracking: OnboardingTracking;
8
8
  onToggleStep: (step: OnboardingStep) => Promise<void>;
9
9
  onClose?: () => void;
10
- stepContentOverride?: Partial<Record<OnboardingStepId, ReactNode>>;
10
+ stepOverrides?: Partial<Record<OnboardingStepId, () => void>>;
11
11
  }
12
12
  export declare function OnboardingCard(props: OnboardingCardProps): JSX.Element;
13
13
  export {};
@@ -1,11 +1,11 @@
1
- import { type ReactNode } from "react";
1
+ /// <reference types="react" />
2
2
  import type { OnboardingStep, OnboardingStepId, OnboardingTracking } from "../../service";
3
3
  interface OnboardingProgressStepperProps {
4
4
  steps: OnboardingStep[];
5
5
  completedSteps: string[];
6
6
  onToggleStep: (step: OnboardingStep) => Promise<void>;
7
7
  tracking: OnboardingTracking;
8
- stepContentOverride?: Partial<Record<OnboardingStepId, ReactNode>>;
8
+ stepOverrides?: Partial<Record<OnboardingStepId, () => void>>;
9
9
  }
10
10
  export declare function OnboardingProgressStepper(props: OnboardingProgressStepperProps): JSX.Element | null;
11
11
  export {};
@@ -1,13 +1,13 @@
1
- import { type ReactNode } from "react";
2
- import type { OnboardingStep, OnboardingStepId } from "../../service";
1
+ import { type RefObject } from "react";
2
+ import type { OnboardingStep } from "../../service";
3
3
  interface OnboardingStepDialogProps {
4
4
  isOpen: boolean;
5
5
  step: OnboardingStep;
6
6
  stepIndex: number;
7
7
  isStepComplete: boolean;
8
- onActionClick: () => Promise<void>;
8
+ onActionClick: (isUndo?: boolean) => Promise<void>;
9
9
  onClose: () => void;
10
- stepContentOverride?: Partial<Record<OnboardingStepId, ReactNode>>;
10
+ contentRef: RefObject<HTMLDivElement>;
11
11
  }
12
12
  export declare function OnboardingStepDialog(props: OnboardingStepDialogProps): JSX.Element;
13
13
  export {};
@@ -1,6 +1,13 @@
1
1
  import type { OnboardingFramework, OnboardingStep } from "../service/onboarding";
2
- export declare function getOnboardingContent(framework?: OnboardingFramework, starter?: string | null): {
2
+ type Context = {
3
+ framework?: OnboardingFramework;
4
+ starter?: string | null;
5
+ repositoryName?: string;
6
+ projectName?: string;
7
+ };
8
+ export declare function getOnboardingContent(context: Context): {
3
9
  steps: OnboardingStep[];
4
10
  defaultCompletedStepIds: ("createPrismicProject" | "chooseLocale" | "createProject" | "setupSliceMachine" | "createPageType" | "codePage" | "createSlice" | "reviewAndPush" | "createContent" | "renderPage")[];
5
11
  tutorialLink: string | undefined;
6
12
  };
13
+ export {};
@@ -1 +1 @@
1
- export { OnboardingGuide } from "./OnboardingGuide";
1
+ export { OnboardingGuide, type OnboardingGuideProps } from "./OnboardingGuide";
@@ -6,20 +6,20 @@ declare const customTypeResponse: z.ZodObject<{
6
6
  repeatable: z.ZodBoolean;
7
7
  status: z.ZodBoolean;
8
8
  }, "strip", z.ZodTypeAny, {
9
- label: string;
10
9
  id: string;
10
+ label: string;
11
11
  status: boolean;
12
12
  repeatable: boolean;
13
13
  }, {
14
- label: string;
15
14
  id: string;
15
+ label: string;
16
16
  status: boolean;
17
17
  repeatable: boolean;
18
18
  }>;
19
19
  export type CustomTypeResponse = z.TypeOf<typeof customTypeResponse>;
20
20
  export declare function getRepositoryCustomTypes(baseUrl: URL, repository: string, authStrategy: AuthStrategy): Promise<{
21
- label: string;
22
21
  id: string;
22
+ label: string;
23
23
  status: boolean;
24
24
  repeatable: boolean;
25
25
  }[]>;