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

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 (35) hide show
  1. package/dist/EditorConfig.d.ts +3 -0
  2. package/dist/SectionEditor.d.ts +2 -2
  3. package/dist/SliceSelection.d.ts +25 -0
  4. package/dist/core/EditorErrorBoundary.d.ts +5 -0
  5. package/dist/core/MediaLibrary/components/MediaLibraryContext.d.ts +1 -0
  6. package/dist/core/MediaLibrary/components/{MediaLibraryAssetCount.d.ts → Toolbar/AssetCount.d.ts} +1 -1
  7. package/dist/core/MediaLibrary/components/Toolbar/Toolbar.d.ts +2 -0
  8. package/dist/core/MediaLibrary/components/Toolbar/filters/AssetTypeFilter.d.ts +2 -0
  9. package/dist/core/MediaLibrary/components/Toolbar/filters/TagsFilter.d.ts +2 -0
  10. package/dist/core/MediaLibrary/components/Toolbar/filters/UploaderFilter.d.ts +2 -0
  11. package/dist/core/MediaLibrary/components/Toolbar/filters/index.d.ts +3 -0
  12. package/dist/core/MediaLibrary/components/Toolbar/index.d.ts +1 -0
  13. package/dist/core/MediaLibrary/hooks/mediaLibraryData.d.ts +21 -5
  14. package/dist/core/MediaLibrary/hooks/uploadersData.d.ts +30 -0
  15. package/dist/core/MediaLibrary/hooks/useMediaLibraryCacheInvalidation.d.ts +1 -0
  16. package/dist/core/MediaLibrary/hooks/useSelectedMedia.d.ts +1 -0
  17. package/dist/core/OnboardingGuide/OnboardingGuide.d.ts +7 -36
  18. package/dist/core/OnboardingGuide/components/OnboardingCard.d.ts +3 -0
  19. package/dist/core/OnboardingGuide/components/OnboardingProvider.d.ts +10 -16
  20. package/dist/core/OnboardingGuide/content.d.ts +1 -2
  21. package/dist/core/OnboardingGuide/index.d.ts +0 -1
  22. package/dist/core/OnboardingGuide/types.d.ts +6 -12
  23. package/dist/core/SelectionManager/SelectionManagerTypes.d.ts +13 -10
  24. package/dist/core/service/document.d.ts +37 -6
  25. package/dist/core/service/index.d.ts +1 -0
  26. package/dist/core/service/repository.d.ts +10 -0
  27. package/dist/core/service/user.d.ts +56 -0
  28. package/dist/fields/ImageField/CropperDialog/croppedImage.d.ts +1 -1
  29. package/dist/index.cjs.js +35 -35
  30. package/dist/index.d.ts +3 -2
  31. package/dist/index.es.js +16205 -15911
  32. package/package.json +4 -5
  33. package/dist/Selection.d.ts +0 -28
  34. package/dist/core/MediaLibrary/components/MediaLibraryToolbar.d.ts +0 -2
  35. package/dist/core/OnboardingGuide/components/OnboardingGuideUI.d.ts +0 -10
@@ -13,6 +13,9 @@ type MediaLibrary = {
13
13
  mediaLibrary: true;
14
14
  assetsApiBaseUrl: URL;
15
15
  repository: string;
16
+ coreApiBaseUrl: URL;
17
+ userServiceBaseUrl: URL;
18
+ mediaLibraryUploadersEnabled: boolean;
16
19
  };
17
20
  type UIDField = {
18
21
  uidField?: never;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { type Document } from "@prismicio/types-internal/lib/content";
3
3
  import type { StaticSection } from "@prismicio/types-internal/lib/customtypes";
4
- import type { Selection } from "./Selection";
4
+ import type { SliceSelection } from "./SliceSelection";
5
5
  interface Props {
6
6
  id: string;
7
7
  readOnly: boolean;
8
- selection?: Selection;
8
+ selection?: SliceSelection;
9
9
  section: StaticSection;
10
10
  content: Document;
11
11
  onContentChange: (content: Document) => void;
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ export interface SliceSelection {
3
+ /**
4
+ * The keys of the slices that are currently selected.
5
+ */
6
+ ids: string[];
7
+ isSelected: (id: string) => boolean;
8
+ /**
9
+ * Update the current selection.
10
+ * @param args.requestedFrom Which Area of the app is requesting the change.
11
+ * This is useful to know how/whether to scroll to the matching selection in the other area.
12
+ */
13
+ update: (args: SliceSelectionUpdateArgs) => void;
14
+ }
15
+ export interface SliceSelectionUpdateArgs {
16
+ id: string;
17
+ requestedFrom: "all" | SliceSelectionArea;
18
+ shiftKey?: boolean;
19
+ metaKey?: boolean;
20
+ ids?: string[];
21
+ }
22
+ export type SliceSelectionArea = "sliceTable" | "sliceFieldSet";
23
+ export declare function getSliceSelectionDOMId(area: SliceSelectionArea, id: string): string;
24
+ export declare const SliceSelectionContext: import("react").Context<SliceSelection>;
25
+ export declare function useSliceSelection(): SliceSelection;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { type ErrorBoundaryProps } from "@prismicio/editor-ui";
3
+ type EditorErrorBoundaryProps = Omit<ErrorBoundaryProps, "onReset">;
4
+ export declare function EditorErrorBoundary(props: EditorErrorBoundaryProps): JSX.Element;
5
+ export {};
@@ -32,6 +32,7 @@ interface MediaLibraryContextValue {
32
32
  * Possible to change using an `assetType` prop in MediaLibrary
33
33
  */
34
34
  initialAssetType: MediaAssetType;
35
+ uploaderId?: string;
35
36
  tagIds: string[];
36
37
  onFilterChange: (filters: Partial<MediaLibraryFilters>) => void;
37
38
  isSearchingMedia: boolean;
@@ -2,5 +2,5 @@
2
2
  interface Props {
3
3
  count: number;
4
4
  }
5
- export declare function MediaLibraryAssetCount(props: Props): JSX.Element;
5
+ export declare function AssetCount(props: Props): JSX.Element;
6
6
  export {};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function Toolbar(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function AssetTypeFilter(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function TagsFilter(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function UploaderFilter(): JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { AssetTypeFilter } from "./AssetTypeFilter";
2
+ export { TagsFilter } from "./TagsFilter";
3
+ export { UploaderFilter } from "./UploaderFilter";
@@ -0,0 +1 @@
1
+ export { Toolbar } from "./Toolbar";
@@ -11,6 +11,7 @@ export declare const mediaAssetType: z.ZodObject<{
11
11
  last_modified: z.ZodNumber;
12
12
  url: z.ZodString;
13
13
  alt: z.ZodOptional<z.ZodString>;
14
+ uploader_id: z.ZodOptional<z.ZodString>;
14
15
  size: z.ZodNumber;
15
16
  notes: z.ZodOptional<z.ZodString>;
16
17
  credits: z.ZodOptional<z.ZodString>;
@@ -71,6 +72,7 @@ export declare const mediaAssetType: z.ZodObject<{
71
72
  width?: number | undefined;
72
73
  height?: number | undefined;
73
74
  alt?: string | undefined;
75
+ uploader_id?: string | undefined;
74
76
  notes?: string | undefined;
75
77
  credits?: string | undefined;
76
78
  search_highlight?: {
@@ -98,6 +100,7 @@ export declare const mediaAssetType: z.ZodObject<{
98
100
  width?: number | undefined;
99
101
  height?: number | undefined;
100
102
  alt?: string | undefined;
103
+ uploader_id?: string | undefined;
101
104
  notes?: string | undefined;
102
105
  credits?: string | undefined;
103
106
  search_highlight?: {
@@ -123,6 +126,7 @@ export declare const mediaSearchResponse: z.ZodObject<{
123
126
  last_modified: z.ZodNumber;
124
127
  url: z.ZodString;
125
128
  alt: z.ZodOptional<z.ZodString>;
129
+ uploader_id: z.ZodOptional<z.ZodString>;
126
130
  size: z.ZodNumber;
127
131
  notes: z.ZodOptional<z.ZodString>;
128
132
  credits: z.ZodOptional<z.ZodString>;
@@ -183,6 +187,7 @@ export declare const mediaSearchResponse: z.ZodObject<{
183
187
  width?: number | undefined;
184
188
  height?: number | undefined;
185
189
  alt?: string | undefined;
190
+ uploader_id?: string | undefined;
186
191
  notes?: string | undefined;
187
192
  credits?: string | undefined;
188
193
  search_highlight?: {
@@ -210,6 +215,7 @@ export declare const mediaSearchResponse: z.ZodObject<{
210
215
  width?: number | undefined;
211
216
  height?: number | undefined;
212
217
  alt?: string | undefined;
218
+ uploader_id?: string | undefined;
213
219
  notes?: string | undefined;
214
220
  credits?: string | undefined;
215
221
  search_highlight?: {
@@ -240,6 +246,7 @@ export declare const mediaSearchResponse: z.ZodObject<{
240
246
  width?: number | undefined;
241
247
  height?: number | undefined;
242
248
  alt?: string | undefined;
249
+ uploader_id?: string | undefined;
243
250
  notes?: string | undefined;
244
251
  credits?: string | undefined;
245
252
  search_highlight?: {
@@ -271,6 +278,7 @@ export declare const mediaSearchResponse: z.ZodObject<{
271
278
  width?: number | undefined;
272
279
  height?: number | undefined;
273
280
  alt?: string | undefined;
281
+ uploader_id?: string | undefined;
274
282
  notes?: string | undefined;
275
283
  credits?: string | undefined;
276
284
  search_highlight?: {
@@ -291,12 +299,13 @@ export interface ExternalImage {
291
299
  alt?: string;
292
300
  }
293
301
  export type MediaAssetOrExternalImage = MediaAsset | ExternalImage;
294
- export declare function searchMedia(baseUrl: URL | undefined, repository: string, authStrategy: AuthStrategy, assetType: MediaAssetType, keyword: string, tags: string, page: number, cursor?: string): Promise<{
302
+ export declare function searchMedia(baseUrl: URL | undefined, repository: string, authStrategy: AuthStrategy, keyword: string, assetType: MediaAssetType, uploaderId: string | undefined, tags: string, page: number, cursor?: string): Promise<{
295
303
  time: string;
296
- assetType: MediaAssetType;
297
304
  keyword: string;
298
- page: number;
305
+ assetType: MediaAssetType;
306
+ uploaderId: string | undefined;
299
307
  tags: string;
308
+ page: number;
300
309
  total: number;
301
310
  items: {
302
311
  tags: {
@@ -317,6 +326,7 @@ export declare function searchMedia(baseUrl: URL | undefined, repository: string
317
326
  width?: number | undefined;
318
327
  height?: number | undefined;
319
328
  alt?: string | undefined;
329
+ uploader_id?: string | undefined;
320
330
  notes?: string | undefined;
321
331
  credits?: string | undefined;
322
332
  search_highlight?: {
@@ -335,12 +345,14 @@ interface UseMediaLibrarySearchArgs {
335
345
  export interface MediaLibraryFilters {
336
346
  keyword: string;
337
347
  assetType: MediaAssetType;
348
+ uploaderId?: string;
338
349
  tagIds: string[];
339
350
  }
340
351
  export declare const defaultMediaLibraryFilters: MediaLibraryFilters;
341
352
  export declare function useMediaSearch(args: UseMediaLibrarySearchArgs): {
342
353
  keyword: string;
343
354
  assetType: MediaAssetType;
355
+ uploaderId: string | undefined;
344
356
  tagIds: string[];
345
357
  setFilters: (filters: Partial<MediaLibraryFilters>) => void;
346
358
  resetFilters: () => void;
@@ -363,6 +375,7 @@ export declare function useMediaSearch(args: UseMediaLibrarySearchArgs): {
363
375
  width?: number | undefined;
364
376
  height?: number | undefined;
365
377
  alt?: string | undefined;
378
+ uploader_id?: string | undefined;
366
379
  notes?: string | undefined;
367
380
  credits?: string | undefined;
368
381
  search_highlight?: {
@@ -393,7 +406,7 @@ declare function updateMedia(newFiles: {
393
406
  declare function deleteMedia(mediaIds: string[]): void;
394
407
  declare function deleteSearchData(args: MediaLibraryFilters): void;
395
408
  type MediaPage = Awaited<ReturnType<typeof searchMedia>>;
396
- export declare function getMedia(allPages: MediaPage[], assetType: MediaAssetType, keyword: string, tags: string): {
409
+ export declare function getMedia(allPages: MediaPage[], keyword: string, assetType: MediaAssetType, uploaderId: string | undefined, tags: string): {
397
410
  tags: {
398
411
  id: string;
399
412
  name: string;
@@ -412,6 +425,7 @@ export declare function getMedia(allPages: MediaPage[], assetType: MediaAssetTyp
412
425
  width?: number | undefined;
413
426
  height?: number | undefined;
414
427
  alt?: string | undefined;
428
+ uploader_id?: string | undefined;
415
429
  notes?: string | undefined;
416
430
  credits?: string | undefined;
417
431
  search_highlight?: {
@@ -432,6 +446,7 @@ interface RevalidateFirstPageArgs {
432
446
  config: EditorConfig;
433
447
  keyword?: string;
434
448
  assetType?: MediaAssetType;
449
+ uploaderId?: string;
435
450
  tagIds?: string[];
436
451
  }
437
452
  /**
@@ -453,8 +468,9 @@ export interface SearchMediaArgs {
453
468
  assetsApiBaseUrl: URL | undefined;
454
469
  repository: string;
455
470
  authStrategy: AuthStrategy;
456
- assetType: MediaAssetType;
457
471
  keyword: string;
472
+ assetType: MediaAssetType;
473
+ uploaderId?: string;
458
474
  tagIds: string[];
459
475
  page: number;
460
476
  cursor?: string;
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ export declare function useUploaders(): {
3
+ uploaders: {
4
+ id: string;
5
+ name: string;
6
+ firstName: string;
7
+ lastName: string;
8
+ email: string;
9
+ uploadedAvatar: string | undefined;
10
+ }[];
11
+ uploadersById: Map<string, {
12
+ id: string;
13
+ name: string;
14
+ firstName: string;
15
+ lastName: string;
16
+ email: string;
17
+ uploadedAvatar: string | undefined;
18
+ }>;
19
+ };
20
+ export declare const uploaderSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ id: string;
24
+ }, {
25
+ id: string;
26
+ }>;
27
+ export type Uploader = z.TypeOf<typeof uploaderSchema>;
28
+ type UpdateUploadersFunction = (currentItems: Uploader[]) => Uploader[] | undefined;
29
+ export declare function updateUploadersCache(updateFunction: UpdateUploadersFunction): void;
30
+ export {};
@@ -6,6 +6,7 @@ interface UseMediaLibraryCacheInvalidationArgs {
6
6
  config: EditorConfig;
7
7
  keyword: string;
8
8
  assetType: MediaAssetType;
9
+ uploaderId?: string;
9
10
  tagIds: string[];
10
11
  }
11
12
  export declare function useMediaLibraryCacheInvalidation(args: UseMediaLibraryCacheInvalidationArgs): {
@@ -17,6 +17,7 @@ export declare function useSelectedMedia(): {
17
17
  width?: number | undefined;
18
18
  height?: number | undefined;
19
19
  alt?: string | undefined;
20
+ uploader_id?: string | undefined;
20
21
  notes?: string | undefined;
21
22
  credits?: string | undefined;
22
23
  search_highlight?: {
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
- import type { OnboardingCardVariant, OnboardingFramework, OnboardingState, OnboardingStepId, OnboardingTrackFn } from "./types";
2
+ import { type EditorConfig } from "../../EditorConfig";
3
+ import type { OnboardingCardVariant, OnboardingTrackingFn } from "./types";
3
4
  interface OnboardingGuideProps {
5
+ config: EditorConfig;
4
6
  /**
5
7
  * Whether the whole guide (including 'Get started' button) should be visible
6
8
  *
@@ -13,41 +15,10 @@ interface OnboardingGuideProps {
13
15
  * @default "default"
14
16
  */
15
17
  variant?: OnboardingCardVariant;
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
- }>;
18
+ /** Link to the video tutorials */
19
+ tutorialLink?: string;
20
+ /** Function to track onboarding events */
21
+ trackingFn: OnboardingTrackingFn;
51
22
  }
52
23
  export declare function OnboardingGuide(props: OnboardingGuideProps): JSX.Element;
53
24
  export {};
@@ -1,5 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import type { OnboardingCardVariant } from "../types";
2
3
  interface OnboardingCardProps {
4
+ variant: OnboardingCardVariant;
5
+ tutorialLink?: string;
3
6
  onClose?: () => void;
4
7
  }
5
8
  export declare function OnboardingCard(props: OnboardingCardProps): JSX.Element;
@@ -1,26 +1,20 @@
1
1
  import { type ReactNode } from "react";
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;
2
+ import { type OnboardingCardVariant, type OnboardingStep, type OnboardingStepId, type OnboardingTrackingFn } from "../types";
13
3
  interface OnboardingContext {
14
4
  steps: OnboardingStep[];
15
- completedStepsCount: number;
16
- variant: OnboardingCardVariant;
17
- tutorialLink?: string;
18
- isResolved?: boolean;
5
+ completedStepCount: number;
19
6
  toggleStepComplete: (step: OnboardingStep) => void;
20
7
  getStepIndex: (step: OnboardingStepId) => number;
21
8
  isStepComplete: (step: OnboardingStep) => boolean;
22
- track: OnboardingTrackFn;
9
+ trackingFn: OnboardingTrackingFn;
23
10
  }
24
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;
25
19
  export declare const useOnboardingContext: () => OnboardingContext;
26
20
  export {};
@@ -1,4 +1,3 @@
1
- import type { OnboardingFramework, OnboardingStep } from "./types";
1
+ import type { 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,2 +1 @@
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
- declare const onboardingStepStatusesSchema: z.ZodObject<{
4
- createProject: z.ZodBoolean;
3
+ export declare const onboardingStepStatusesSchema: z.ZodObject<{
4
+ createProject: z.ZodLiteral<true>;
5
5
  createPageType: z.ZodBoolean;
6
6
  codePage: z.ZodBoolean;
7
7
  createSlice: z.ZodBoolean;
@@ -9,7 +9,7 @@ declare const onboardingStepStatusesSchema: z.ZodObject<{
9
9
  createContent: z.ZodBoolean;
10
10
  renderPage: z.ZodBoolean;
11
11
  }, "strip", z.ZodTypeAny, {
12
- createProject: boolean;
12
+ createProject: true;
13
13
  createPageType: boolean;
14
14
  codePage: boolean;
15
15
  createSlice: boolean;
@@ -17,7 +17,7 @@ declare const onboardingStepStatusesSchema: z.ZodObject<{
17
17
  createContent: boolean;
18
18
  renderPage: boolean;
19
19
  }, {
20
- createProject: boolean;
20
+ createProject: true;
21
21
  createPageType: boolean;
22
22
  codePage: boolean;
23
23
  createSlice: boolean;
@@ -25,7 +25,7 @@ declare const onboardingStepStatusesSchema: z.ZodObject<{
25
25
  createContent: boolean;
26
26
  renderPage: boolean;
27
27
  }>;
28
- type OnboardingStepStatuses = z.infer<typeof onboardingStepStatusesSchema>;
28
+ export type OnboardingStepStatuses = z.infer<typeof onboardingStepStatusesSchema>;
29
29
  export type OnboardingStepId = keyof OnboardingStepStatuses;
30
30
  export interface OnboardingStep {
31
31
  id: OnboardingStepId;
@@ -35,11 +35,5 @@ export interface OnboardingStep {
35
35
  videoUrl?: string;
36
36
  defaultCompleted?: boolean;
37
37
  }
38
- export type OnboardingState = {
39
- completedSteps: OnboardingStepId[];
40
- isResolved: boolean;
41
- };
42
38
  export type OnboardingCardVariant = "default" | "light" | "dark";
43
- export type OnboardingFramework = "next" | "nuxt" | "sveltekit" | "other";
44
- export type OnboardingTrackFn = (args: Record<string, string>) => void;
45
- export {};
39
+ export type OnboardingTrackingFn = (args: Record<string, string>) => void;
@@ -57,21 +57,22 @@ export type SelectionManager = {
57
57
  * Gets the current selection state. This is used when performing any action with the selection.
58
58
  * @returns The selection state object.
59
59
  */
60
- getSelectionState: () => {
61
- selectedIds: ID[];
62
- excludedIds: ID[];
63
- isAllSelected: boolean;
64
- selectedCount: number;
65
- };
60
+ getSelectionState: () => SelectionState;
66
61
  /**
67
62
  * Count of selected items.
68
63
  */
69
64
  selectedCount: number;
70
65
  totalItemCount: number;
71
66
  isSelectAllEnabled: boolean;
72
- state: CoreSelectionState;
67
+ state: SelectionManagerState;
73
68
  };
74
- export interface CoreSelectionState {
69
+ interface SelectionState {
70
+ selectedIds: ID[];
71
+ excludedIds: ID[];
72
+ isAllSelected: boolean;
73
+ selectedCount: number;
74
+ }
75
+ export interface SelectionManagerState {
75
76
  /**
76
77
  * Set of selected IDs.
77
78
  */
@@ -86,8 +87,10 @@ export interface CoreSelectionState {
86
87
  isAllSelected: boolean;
87
88
  }
88
89
  export interface SelectionManagerProviderProps extends PropsWithChildren {
90
+ initialState?: Partial<SelectionManagerState>;
89
91
  initialTotalItemCount?: number;
90
92
  isSelectAllEnabled?: boolean;
91
93
  }
92
- export type UseSelectionManager = Omit<SelectionManager, "registerListener" | "setTotalItemCount" | "totalItemCount" | "state"> & Pick<CoreSelectionState, "isAllSelected">;
93
- export type SelectionStateListener = (state: ReturnType<SelectionManager["getSelectionState"]>) => void;
94
+ export type UseSelectionManager = Omit<SelectionManager, "setTotalItemCount" | "totalItemCount" | "state"> & Pick<SelectionManagerState, "isAllSelected">;
95
+ export type SelectionStateListener = (state: SelectionState) => void;
96
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { QueryClient } from "@tanstack/react-query";
1
2
  import { z } from "zod";
2
3
  import type { AuthStrategy } from "../../EditorConfig";
3
4
  export declare const languageOkType: z.ZodObject<{
@@ -248,7 +249,7 @@ export declare const documentMetaOkType: z.ZodObject<{
248
249
  })[];
249
250
  title?: string | null | undefined;
250
251
  }>;
251
- declare const documentsSearchAPISchemaOkType: z.ZodObject<{
252
+ declare const getDocumentListSchema: z.ZodObject<{
252
253
  total: z.ZodNumber;
253
254
  cursor: z.ZodOptional<z.ZodString>;
254
255
  results: z.ZodArray<z.ZodObject<{
@@ -519,12 +520,28 @@ declare const documentsFullTextSearchAPISchemaOkType: z.ZodObject<{
519
520
  }, z.ZodTypeAny, "passthrough">[];
520
521
  }>;
521
522
  export type Language = z.TypeOf<typeof languageOkType>;
522
- export type GetsDocumentApi = z.TypeOf<typeof documentsSearchAPISchemaOkType>;
523
+ export type GetDocumentListSchema = z.TypeOf<typeof getDocumentListSchema>;
523
524
  export type DocumentFullTextSearchApi = z.TypeOf<typeof documentsFullTextSearchAPISchemaOkType>;
524
525
  export type DocumentMeta = z.TypeOf<typeof documentMetaOkType>;
525
526
  export type DocumentVersion = z.TypeOf<typeof documentVersionOkType>;
526
527
  export type DocumentStatus = DocumentVersion["status"];
527
- export declare function getDocuments(baseUrl: URL, authStrategy: AuthStrategy, queryString: string, limit?: number, cursor?: string): Promise<GetsDocumentApi>;
528
+ export declare function getDocuments(baseUrl: URL, authStrategy: AuthStrategy, queryString: string, limit?: number, cursor?: string): Promise<GetDocumentListSchema>;
529
+ export interface GetDocumentListArgs {
530
+ baseUrl: URL;
531
+ authStrategy: AuthStrategy;
532
+ signal?: AbortSignal | null | undefined;
533
+ limit?: number;
534
+ cursor?: string;
535
+ status?: string[];
536
+ authors?: string[];
537
+ language?: string;
538
+ group_lang_id?: string;
539
+ document_id?: string[];
540
+ customTypes?: string[];
541
+ tags?: string[];
542
+ term?: string;
543
+ }
544
+ export declare function getDocumentList(args: GetDocumentListArgs): Promise<GetDocumentListSchema>;
528
545
  export declare function searchFullTextDocuments(baseUrl: URL, authStrategy: AuthStrategy, queryString: string, options?: Pick<RequestInit, "signal">): Promise<DocumentFullTextSearchApi>;
529
546
  export declare function makeSearchFullTextDocumentsQueryString(args: {
530
547
  repository: string;
@@ -539,10 +556,9 @@ export type SearchDocumentParams = {
539
556
  };
540
557
  export declare function createSearchParams<T extends string>(params: {
541
558
  name: T;
542
- values: string[];
559
+ values: (string | undefined)[];
543
560
  }[]): [string, string][];
544
561
  export declare function getDocumentByDocumentId(baseUrl: URL, authStrategy: AuthStrategy, id: string): Promise<DocumentMeta>;
545
- export declare function getDocumentsById(baseUrl: URL, authStrategy: AuthStrategy, ids: string[]): Promise<GetsDocumentApi>;
546
562
  export declare const documentSchema: z.ZodEffects<z.ZodType<unknown, z.ZodTypeDef, unknown>, {
547
563
  [x: string]: import("@prismicio/types-internal/lib/content").GroupContent | {
548
564
  type: string;
@@ -2650,7 +2666,9 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
2650
2666
  } & {
2651
2667
  date?: string | null | undefined;
2652
2668
  }) | ({
2653
- id: string;
2669
+ id: string; /**
2670
+ * Returns updated document or undefined if document should be removed
2671
+ */
2654
2672
  url: string;
2655
2673
  name: string;
2656
2674
  kind: string;
@@ -4035,4 +4053,17 @@ export declare const sliceItemContentSchema: z.ZodEffects<z.ZodUnknown, {
4035
4053
  __TYPE__: "SeparatorContent";
4036
4054
  };
4037
4055
  }, unknown>;
4056
+ export declare const documentKeys: {
4057
+ all: () => readonly ["documents"];
4058
+ lists: () => readonly ["documents", "list"];
4059
+ list: (args: GetDocumentListArgs) => readonly ["documents", "list", GetDocumentListArgs];
4060
+ infiniteLists: () => readonly ["documents", "list:infinite"];
4061
+ infiniteList: (args: GetDocumentListArgs) => readonly ["documents", "list:infinite", GetDocumentListArgs];
4062
+ };
4063
+ /**
4064
+ * Returns updated document or undefined if document should be removed
4065
+ */
4066
+ type UpdateDocumentFunction = (document: DocumentMeta, page: GetDocumentListSchema) => DocumentMeta | undefined;
4067
+ export declare function updateDocumentListData(queryClient: QueryClient, updateFunction: UpdateDocumentFunction): void;
4068
+ export declare function invalidateDocumentListData(queryClient: QueryClient): Promise<void>;
4038
4069
  export {};
@@ -1,3 +1,4 @@
1
1
  export * from "./customType";
2
2
  export * from "./document";
3
3
  export * from "./repository";
4
+ export * from "./user";
@@ -5,16 +5,19 @@ declare const repositoryAuthor: z.ZodObject<{
5
5
  firstname: z.ZodOptional<z.ZodString>;
6
6
  lastname: z.ZodOptional<z.ZodString>;
7
7
  email: z.ZodString;
8
+ uploadedAvatar: z.ZodOptional<z.ZodString>;
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  id: string;
10
11
  email: string;
11
12
  firstname?: string | undefined;
12
13
  lastname?: string | undefined;
14
+ uploadedAvatar?: string | undefined;
13
15
  }, {
14
16
  id: string;
15
17
  email: string;
16
18
  firstname?: string | undefined;
17
19
  lastname?: string | undefined;
20
+ uploadedAvatar?: string | undefined;
18
21
  }>;
19
22
  export type RepositoryAuthor = z.TypeOf<typeof repositoryAuthor>;
20
23
  declare const repositoryQuotas: z.ZodObject<{
@@ -55,16 +58,19 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
55
58
  firstname: z.ZodOptional<z.ZodString>;
56
59
  lastname: z.ZodOptional<z.ZodString>;
57
60
  email: z.ZodString;
61
+ uploadedAvatar: z.ZodOptional<z.ZodString>;
58
62
  }, "strip", z.ZodTypeAny, {
59
63
  id: string;
60
64
  email: string;
61
65
  firstname?: string | undefined;
62
66
  lastname?: string | undefined;
67
+ uploadedAvatar?: string | undefined;
63
68
  }, {
64
69
  id: string;
65
70
  email: string;
66
71
  firstname?: string | undefined;
67
72
  lastname?: string | undefined;
73
+ uploadedAvatar?: string | undefined;
68
74
  }>, "many">>>;
69
75
  quotas: z.ZodDefault<z.ZodOptional<z.ZodObject<{
70
76
  slicemachineEnabled: z.ZodBoolean;
@@ -90,6 +96,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
90
96
  email: string;
91
97
  firstname?: string | undefined;
92
98
  lastname?: string | undefined;
99
+ uploadedAvatar?: string | undefined;
93
100
  }[];
94
101
  languages: {
95
102
  id: string;
@@ -121,6 +128,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
121
128
  email: string;
122
129
  firstname?: string | undefined;
123
130
  lastname?: string | undefined;
131
+ uploadedAvatar?: string | undefined;
124
132
  }[] | undefined;
125
133
  quotas?: {
126
134
  slicemachineEnabled: boolean;
@@ -134,6 +142,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
134
142
  email: string;
135
143
  firstname?: string | undefined;
136
144
  lastname?: string | undefined;
145
+ uploadedAvatar?: string | undefined;
137
146
  }[];
138
147
  languages: {
139
148
  id: string;
@@ -163,6 +172,7 @@ declare const repositorySchema: z.ZodEffects<z.ZodObject<{
163
172
  email: string;
164
173
  firstname?: string | undefined;
165
174
  lastname?: string | undefined;
175
+ uploadedAvatar?: string | undefined;
166
176
  }[] | undefined;
167
177
  quotas?: {
168
178
  slicemachineEnabled: boolean;