@pitcher/js-api 1.26.1 → 1.27.1
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.
- package/js-api.esm.d.ts +0 -1
- package/js-api.esm.js +141 -0
- package/js-api.esm.js.map +1 -1
- package/js-api.umd.min.js +17 -10
- package/js-api.umd.min.js.map +1 -1
- package/lib/apps/browser/appTypes.d.ts +2 -1
- package/lib/apps/browser/stores/api.d.ts +22 -2
- package/lib/apps/browser/stores/app.d.ts +6 -1
- package/lib/apps/browser/util/sortOrder.d.ts +36 -0
- package/lib/apps/browser/util/sortOrder.test.d.ts +1 -0
- package/lib/apps/canvas-builder/components/ui/DataCharts/types.d.ts +7 -1
- package/lib/apps/canvas-builder/components/ui/DataCharts/types.spec.d.ts +1 -0
- package/lib/apps/canvas-builder/components/ui/DynamicContent/useDynamicContent.d.ts +11 -1
- package/lib/apps/canvas-builder/composables/lazySections.d.ts +53 -0
- package/lib/apps/canvas-builder/composables/lazySections.spec.d.ts +1 -0
- package/lib/apps/canvas-builder/composables/useCanvas.d.ts +108 -14
- package/lib/apps/canvas-builder/composables/useCanvasBlocks.d.ts +4 -0
- package/lib/apps/canvas-builder/composables/useHtmlUserPropertyFields.d.ts +4 -0
- package/lib/apps/canvas-builder/courseMode.spec.d.ts +1 -0
- package/lib/apps/canvas-builder/types/canvas.d.ts +77 -2
- package/lib/apps/canvas-selector/stores/app.d.ts +14 -0
- package/lib/apps/collection-player/stores/app.store.d.ts +1 -0
- package/lib/components/savedCanvases/CSavedCanvasesManagement.use.d.ts +2 -0
- package/lib/components/savedCanvases/smartFolders/SmartFolders.use.d.ts +8 -0
- package/lib/composables/useCanvasRendererExcludedTags.d.ts +15 -0
- package/lib/composables/useCanvasRendererExcludedTags.spec.d.ts +1 -0
- package/lib/composables/useThemeVars.d.ts +2 -0
- package/lib/constants/cdp.const.d.ts +1 -0
- package/lib/main.lib.d.ts +5 -1
- package/lib/sdk/api/HighLevelApi.d.ts +17 -0
- package/lib/sdk/api/modules/ai.d.ts +52 -0
- package/lib/sdk/api/modules/canvas.d.ts +42 -1
- package/lib/sdk/api/modules/index.d.ts +1 -0
- package/lib/sdk/interfaces.d.ts +13 -1
- package/lib/sdk/main.d.ts +39 -0
- package/lib/sdk/payload.types.d.ts +121 -0
- package/lib/theme/light.d.ts +2 -0
- package/lib/theme/theme.types.d.ts +1 -0
- package/lib/types/ai-tasks.const.d.ts +80 -0
- package/lib/types/instanceSettings.types.d.ts +2 -0
- package/lib/types/launchDarkly.types.d.ts +16 -7
- package/lib/types/organizationSettings.types.d.ts +18 -0
- package/lib/util/fullscreen.util.d.ts +12 -1
- package/lib/util/handlebars.d.ts +19 -0
- package/lib/util/network.d.ts +21 -0
- package/lib/util/network.test.d.ts +1 -0
- package/lib/util/string.d.ts +13 -0
- package/package.json +1 -1
- package/types/openapi/index.d.ts +1 -0
- package/types/openapi/models/Canvas.d.ts +2 -2
- package/types/openapi/models/CanvasCreate.d.ts +2 -2
- package/types/openapi/models/CanvasRetrieve.d.ts +10 -2
- package/types/openapi/models/CanvasUpdate.d.ts +2 -2
- package/types/openapi/models/DeletedCanvas.d.ts +2 -2
- package/types/openapi/models/FolderFolder.d.ts +4 -0
- package/types/openapi/models/FolderRetrieve.d.ts +1 -0
- package/types/openapi/models/MetadataTemplateFieldTypeEnum.d.ts +3 -1
- package/types/openapi/models/MiniCanvasWithTags.d.ts +5 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MetadataTemplateFieldTypeEnum } from '../../../types/openapi';
|
|
2
2
|
import { AppName } from './stores/app';
|
|
3
|
-
import { FolderItemsFetcher, FolderCreator, FolderUpdater, FolderDeleter, FileCreator, FileUpdater, FileOpener, FileFetcher, FileListFetcher, ItemsMover, ItemsCopier, FileCopier, SelectDeviceFile, FileDeleter, FolderLister, DistributionGroupsFetcher, DistributionGroupsAssigner } from './stores/api';
|
|
3
|
+
import { FolderItemsFetcher, FolderCreator, FolderUpdater, FolderDeleter, FileCreator, FileUpdater, FileOpener, FileFetcher, FileListFetcher, ItemsMover, ItemsReorder, ItemsCopier, FileCopier, SelectDeviceFile, FileDeleter, FolderLister, DistributionGroupsFetcher, DistributionGroupsAssigner } from './stores/api';
|
|
4
4
|
export interface BrowserCustomFilterComponent {
|
|
5
5
|
type: MetadataTemplateFieldTypeEnum;
|
|
6
6
|
name: string;
|
|
@@ -23,6 +23,7 @@ export interface BrowserAppProps {
|
|
|
23
23
|
onFileFetch: FileFetcher;
|
|
24
24
|
onFilesList: FileListFetcher;
|
|
25
25
|
onItemsMove?: ItemsMover;
|
|
26
|
+
onItemsReorder?: ItemsReorder;
|
|
26
27
|
onItemsCopy?: ItemsCopier;
|
|
27
28
|
/**
|
|
28
29
|
* Per-upload fan-out: after the initial upload creates a new file in
|
|
@@ -46,6 +46,11 @@ type ItemsMoverItem = {
|
|
|
46
46
|
type: 'file' | 'folder';
|
|
47
47
|
};
|
|
48
48
|
type ItemsMover = (folderId: Folder['id'], items: ItemsMoverItem[]) => Promise<FolderRetrieve>;
|
|
49
|
+
type ItemsReorderItem = {
|
|
50
|
+
id: File['id'] | Folder['id'];
|
|
51
|
+
type: 'file' | 'folder';
|
|
52
|
+
};
|
|
53
|
+
type ItemsReorder = (folderId: Folder['id'], items: ItemsReorderItem[]) => Promise<void>;
|
|
49
54
|
type ItemsCopierItem = {
|
|
50
55
|
id: File['id'];
|
|
51
56
|
type: 'file';
|
|
@@ -71,7 +76,7 @@ declare function setSearchMetadataFilters(filters: Record<string, any>): void;
|
|
|
71
76
|
declare function setFilteredItems(items: FolderFileWithFolder[]): void;
|
|
72
77
|
declare function onUpsertFolder(name: string, initialName?: string): Promise<void>;
|
|
73
78
|
declare function clearTimeouts(): void;
|
|
74
|
-
declare function init({ onFolderFetch, onFolderCreate, onFolderUpdate, onFolderDelete, onFoldersDelete, onFileCreate, onFileUpdate, onFileOpen, onFileDelete, onFilesDelete, onFileFetch, onFilesList, onItemsMove, onItemsCopy, onFileCopy, onSelectDeviceFile, onFolderList, onFetchDistributionGroups, onAssignDistributionGroups, distributionGroupsManageUrl, }: {
|
|
79
|
+
declare function init({ onFolderFetch, onFolderCreate, onFolderUpdate, onFolderDelete, onFoldersDelete, onFileCreate, onFileUpdate, onFileOpen, onFileDelete, onFilesDelete, onFileFetch, onFilesList, onItemsMove, onItemsReorder, onItemsCopy, onFileCopy, onSelectDeviceFile, onFolderList, onFetchDistributionGroups, onAssignDistributionGroups, distributionGroupsManageUrl, }: {
|
|
75
80
|
onFolderFetch: FolderItemsFetcher;
|
|
76
81
|
onFolderCreate?: FolderCreator;
|
|
77
82
|
onFolderUpdate?: FolderUpdater;
|
|
@@ -85,6 +90,7 @@ declare function init({ onFolderFetch, onFolderCreate, onFolderUpdate, onFolderD
|
|
|
85
90
|
onFileFetch: FileFetcher;
|
|
86
91
|
onFilesList: FileListFetcher;
|
|
87
92
|
onItemsMove?: ItemsMover;
|
|
93
|
+
onItemsReorder?: ItemsReorder;
|
|
88
94
|
onItemsCopy?: ItemsCopier;
|
|
89
95
|
onFileCopy?: FileCopier;
|
|
90
96
|
onSelectDeviceFile?: SelectDeviceFile;
|
|
@@ -93,7 +99,7 @@ declare function init({ onFolderFetch, onFolderCreate, onFolderUpdate, onFolderD
|
|
|
93
99
|
onAssignDistributionGroups?: DistributionGroupsAssigner;
|
|
94
100
|
distributionGroupsManageUrl?: string;
|
|
95
101
|
}): void;
|
|
96
|
-
export type { FolderItemsFetcher, FolderCreator, FolderUpdater, FolderDeleter, FoldersDeleter, FileCreator, FileUpdater, FileOpener, FileDeleter, FilesDeleter, FileFetcher, FileListFetcher, ItemsMoverItem, ItemsMover, ItemsCopierItem, ItemsCopier, FileCopier, CompactFile, CompactFolder, SelectDeviceFile, FolderLister, DistributionGroupsFetcher, DistributionGroupsAssigner, };
|
|
102
|
+
export type { FolderItemsFetcher, FolderCreator, FolderUpdater, FolderDeleter, FoldersDeleter, FileCreator, FileUpdater, FileOpener, FileDeleter, FilesDeleter, FileFetcher, FileListFetcher, ItemsMoverItem, ItemsMover, ItemsReorderItem, ItemsReorder, ItemsCopierItem, ItemsCopier, FileCopier, CompactFile, CompactFolder, SelectDeviceFile, FolderLister, DistributionGroupsFetcher, DistributionGroupsAssigner, };
|
|
97
103
|
declare const _default: () => {
|
|
98
104
|
state: {
|
|
99
105
|
readonly fileOpener: FileOpener | null;
|
|
@@ -112,6 +118,7 @@ declare const _default: () => {
|
|
|
112
118
|
readonly filesFoldersDeleter: FilesFoldersDeleter | null;
|
|
113
119
|
readonly selectDeviceFile?: (SelectDeviceFile | null) | undefined;
|
|
114
120
|
readonly itemsMover: ItemsMover | null;
|
|
121
|
+
readonly itemsReorder: ItemsReorder | null;
|
|
115
122
|
readonly itemsCopier: ItemsCopier | null;
|
|
116
123
|
readonly fileCopier: FileCopier | null;
|
|
117
124
|
readonly folderLister: FolderLister | null;
|
|
@@ -138,6 +145,7 @@ declare const _default: () => {
|
|
|
138
145
|
readonly id: string;
|
|
139
146
|
readonly name: string;
|
|
140
147
|
readonly thumbnail_url: string | null;
|
|
148
|
+
readonly order?: number | null | undefined;
|
|
141
149
|
readonly folders_count: number;
|
|
142
150
|
readonly files_count: number;
|
|
143
151
|
readonly available_files_count: number;
|
|
@@ -252,6 +260,7 @@ declare const _default: () => {
|
|
|
252
260
|
readonly selectedFolder: {
|
|
253
261
|
readonly id: string;
|
|
254
262
|
readonly name: string;
|
|
263
|
+
readonly instance_id: string;
|
|
255
264
|
readonly content_type: string;
|
|
256
265
|
readonly access_type?: import('../../../../types/openapi').AccessTypeEnum | undefined;
|
|
257
266
|
readonly rules?: readonly {
|
|
@@ -270,6 +279,7 @@ declare const _default: () => {
|
|
|
270
279
|
readonly id: string;
|
|
271
280
|
readonly name: string;
|
|
272
281
|
readonly thumbnail_url: string | null;
|
|
282
|
+
readonly order?: number | null | undefined;
|
|
273
283
|
readonly folders_count: number;
|
|
274
284
|
readonly files_count: number;
|
|
275
285
|
readonly available_files_count: number;
|
|
@@ -283,6 +293,7 @@ declare const _default: () => {
|
|
|
283
293
|
readonly id: string;
|
|
284
294
|
readonly name: string;
|
|
285
295
|
readonly thumbnail_url: string | null;
|
|
296
|
+
readonly order?: number | null | undefined;
|
|
286
297
|
readonly folders_count: number;
|
|
287
298
|
readonly files_count: number;
|
|
288
299
|
readonly available_files_count: number;
|
|
@@ -358,6 +369,7 @@ declare const _default: () => {
|
|
|
358
369
|
readonly id: string;
|
|
359
370
|
readonly name: string;
|
|
360
371
|
readonly thumbnail_url: string | null;
|
|
372
|
+
readonly order?: number | null | undefined;
|
|
361
373
|
readonly folders_count: number;
|
|
362
374
|
readonly files_count: number;
|
|
363
375
|
readonly available_files_count: number;
|
|
@@ -475,6 +487,7 @@ declare const _default: () => {
|
|
|
475
487
|
fileListFetcher: null;
|
|
476
488
|
filesFoldersDeleter: null;
|
|
477
489
|
itemsMover: null;
|
|
490
|
+
itemsReorder: null;
|
|
478
491
|
itemsCopier: null;
|
|
479
492
|
fileCopier: null;
|
|
480
493
|
folderLister: null;
|
|
@@ -526,6 +539,7 @@ declare const _default: () => {
|
|
|
526
539
|
filesFoldersDeleter: FilesFoldersDeleter | null;
|
|
527
540
|
selectDeviceFile?: (SelectDeviceFile | null) | undefined;
|
|
528
541
|
itemsMover: ItemsMover | null;
|
|
542
|
+
itemsReorder: ItemsReorder | null;
|
|
529
543
|
itemsCopier: ItemsCopier | null;
|
|
530
544
|
fileCopier: FileCopier | null;
|
|
531
545
|
folderLister: FolderLister | null;
|
|
@@ -552,6 +566,7 @@ declare const _default: () => {
|
|
|
552
566
|
id: string;
|
|
553
567
|
name: string;
|
|
554
568
|
thumbnail_url: string | null;
|
|
569
|
+
order?: number | null | undefined;
|
|
555
570
|
folders_count: number;
|
|
556
571
|
files_count: number;
|
|
557
572
|
available_files_count: number;
|
|
@@ -658,6 +673,7 @@ declare const _default: () => {
|
|
|
658
673
|
selectedFolder: {
|
|
659
674
|
readonly id: string;
|
|
660
675
|
name: string;
|
|
676
|
+
readonly instance_id: string;
|
|
661
677
|
readonly content_type: string;
|
|
662
678
|
access_type?: import('../../../../types/openapi').AccessTypeEnum | undefined;
|
|
663
679
|
rules?: {
|
|
@@ -676,6 +692,7 @@ declare const _default: () => {
|
|
|
676
692
|
readonly id: string;
|
|
677
693
|
name: string;
|
|
678
694
|
readonly thumbnail_url: string | null;
|
|
695
|
+
order?: number | null | undefined;
|
|
679
696
|
readonly folders_count: number;
|
|
680
697
|
readonly files_count: number;
|
|
681
698
|
readonly available_files_count: number;
|
|
@@ -689,6 +706,7 @@ declare const _default: () => {
|
|
|
689
706
|
readonly id: string;
|
|
690
707
|
name: string;
|
|
691
708
|
readonly thumbnail_url: string | null;
|
|
709
|
+
order?: number | null | undefined;
|
|
692
710
|
readonly folders_count: number;
|
|
693
711
|
readonly files_count: number;
|
|
694
712
|
readonly available_files_count: number;
|
|
@@ -762,6 +780,7 @@ declare const _default: () => {
|
|
|
762
780
|
readonly id: string;
|
|
763
781
|
name: string;
|
|
764
782
|
readonly thumbnail_url: string | null;
|
|
783
|
+
order?: number | null | undefined;
|
|
765
784
|
readonly folders_count: number;
|
|
766
785
|
readonly files_count: number;
|
|
767
786
|
readonly available_files_count: number;
|
|
@@ -835,6 +854,7 @@ declare const _default: () => {
|
|
|
835
854
|
fileListFetcher: null;
|
|
836
855
|
filesFoldersDeleter: null;
|
|
837
856
|
itemsMover: null;
|
|
857
|
+
itemsReorder: null;
|
|
838
858
|
itemsCopier: null;
|
|
839
859
|
fileCopier: null;
|
|
840
860
|
folderLister: null;
|
|
@@ -6,7 +6,7 @@ import { InstanceSettings } from '../../../types/instanceSettings.types';
|
|
|
6
6
|
export type AppName = 'admin' | 'impact';
|
|
7
7
|
export type AppCurrentState = 'browse' | 'create-folder' | 'upload-files' | 'update-folder' | 'update-file' | 'batch-move' | 'batch-copy';
|
|
8
8
|
export type BrowserSectionType = 'all' | 'trash' | 'rep-uploads';
|
|
9
|
-
export type SortOption = 'nameAsc' | 'nameDesc' | 'modifiedAsc' | 'modifiedDesc';
|
|
9
|
+
export type SortOption = 'nameAsc' | 'nameDesc' | 'modifiedAsc' | 'modifiedDesc' | 'custom';
|
|
10
10
|
export type StateSelectedItem = Partial<File | Folder> & {
|
|
11
11
|
type: string | null | undefined;
|
|
12
12
|
thumbnail_url: string | null | undefined;
|
|
@@ -34,12 +34,17 @@ export default function (): {
|
|
|
34
34
|
selectAndOpenContentPanel(item: ViewCompactFileFolder): void;
|
|
35
35
|
setCurrentState(stateName: AppCurrentState, itemId?: Folder["id"] | File["id"]): void;
|
|
36
36
|
clearInlineEditingItem(): void;
|
|
37
|
+
clearManualSortOverride(): void;
|
|
37
38
|
appName: Ref<AppName | "">;
|
|
38
39
|
currentState: Ref<AppCurrentState>;
|
|
39
40
|
selectedItemIds: Ref<SelectedItemId[]>;
|
|
40
41
|
selectedSection: Ref<BrowserSectionType>;
|
|
41
42
|
selectedView: Ref<View>;
|
|
42
43
|
selectedSortOption: Ref<SortOption>;
|
|
44
|
+
manualSortOverride: Ref<SortOption | null>;
|
|
45
|
+
customOrderEnabled: ComputedRef<boolean>;
|
|
46
|
+
folderHasCustomOrder: ComputedRef<boolean>;
|
|
47
|
+
effectiveSortOption: ComputedRef<SortOption>;
|
|
43
48
|
search: Ref<string>;
|
|
44
49
|
displayedFiles: ComputedRef<ViewCompactFile[]>;
|
|
45
50
|
displayedFolders: ComputedRef<ViewCompactFolder[]>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ViewCompactFileFolder } from '../../../types/files';
|
|
2
|
+
export type ReorderItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: 'file' | 'folder';
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the sort actually applied in the browser: an explicit per-visit choice
|
|
8
|
+
* wins; otherwise a folder with a custom order defaults to it; otherwise the
|
|
9
|
+
* user's saved sort. Kept pure (string in/out) so it's unit-testable and free of
|
|
10
|
+
* a dependency on the store's SortOption type.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveSortOption(manualOverride: string | null, folderHasCustomOrder: boolean, savedDefault: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* The manual custom-sort position of a browser item, if one has been set.
|
|
15
|
+
* Folders carry it on `order`; files under `metadata.pitcher.order`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getItemOrder(item: ViewCompactFileFolder): number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Order a mixed list of files and folders by their custom position, falling back
|
|
20
|
+
* to alphabetical for items without one (and to break ties).
|
|
21
|
+
*/
|
|
22
|
+
export declare function sortByCustomOrder<T extends ViewCompactFileFolder>(items: T[]): T[];
|
|
23
|
+
/**
|
|
24
|
+
* Move every selected item to the top or bottom of the list, consolidating a
|
|
25
|
+
* non-contiguous selection into a single contiguous block while preserving the
|
|
26
|
+
* items' relative order (matches the "Send to top / Send to bottom" spec).
|
|
27
|
+
*/
|
|
28
|
+
export declare function moveSelectedTo<T extends ViewCompactFileFolder>(items: T[], selectedIds: ReadonlyArray<string | number>, position: 'top' | 'bottom'): T[];
|
|
29
|
+
/**
|
|
30
|
+
* Move a single dragged item directly above or below a target item (single-item
|
|
31
|
+
* drag-and-drop reorder). Returns the input unchanged when the drag is a no-op
|
|
32
|
+
* or references an item that is not in the list.
|
|
33
|
+
*/
|
|
34
|
+
export declare function moveItemRelativeTo<T extends ViewCompactFileFolder>(items: T[], draggedId: string | number, targetId: string | number, position: 'above' | 'below'): T[];
|
|
35
|
+
/** Project a displayed list into the `{ id, type }` payload the reorder API expects. */
|
|
36
|
+
export declare function toReorderItems(items: ViewCompactFileFolder[]): ReorderItem[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -119,19 +119,25 @@ export interface BulkDataMapping {
|
|
|
119
119
|
source_path: string;
|
|
120
120
|
label_field: string;
|
|
121
121
|
value_field?: string;
|
|
122
|
+
min_field?: string;
|
|
123
|
+
max_field?: string;
|
|
122
124
|
x_field?: string;
|
|
123
125
|
y_field?: string;
|
|
124
126
|
r_field?: string;
|
|
125
127
|
}
|
|
126
128
|
export type BulkDataResult = {
|
|
127
129
|
labels: string[];
|
|
128
|
-
values: (number | {
|
|
130
|
+
values: (number | [number, number] | {
|
|
129
131
|
x: number;
|
|
130
132
|
y: number;
|
|
131
133
|
r?: number;
|
|
132
134
|
originalR?: number;
|
|
133
135
|
})[];
|
|
134
136
|
};
|
|
137
|
+
export declare function isFloatingBarMapping(mapping?: BulkDataMapping | null): boolean;
|
|
138
|
+
export declare function floatingBarDatasetOptions(): {
|
|
139
|
+
grouped: false;
|
|
140
|
+
};
|
|
135
141
|
export declare function normalizeRValues(values: Array<{
|
|
136
142
|
x: number;
|
|
137
143
|
y: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -40,6 +40,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
40
40
|
readonly template: {
|
|
41
41
|
readonly id: string;
|
|
42
42
|
name: string;
|
|
43
|
+
readonly tags?: Array<string> | undefined;
|
|
43
44
|
};
|
|
44
45
|
readonly sections: {
|
|
45
46
|
readonly id: string;
|
|
@@ -49,6 +50,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
49
50
|
metadata?: Record<string, any> | undefined;
|
|
50
51
|
is_draft: boolean;
|
|
51
52
|
}[];
|
|
53
|
+
readonly section_ids?: Array<string> | undefined;
|
|
52
54
|
readonly shared_link: {
|
|
53
55
|
readonly url: string;
|
|
54
56
|
short_url?: string | null | undefined;
|
|
@@ -106,6 +108,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
106
108
|
readonly template: {
|
|
107
109
|
readonly id: string;
|
|
108
110
|
name: string;
|
|
111
|
+
readonly tags?: Array<string> | undefined;
|
|
109
112
|
};
|
|
110
113
|
readonly sections: {
|
|
111
114
|
readonly id: string;
|
|
@@ -115,6 +118,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
115
118
|
metadata?: Record<string, any> | undefined;
|
|
116
119
|
is_draft: boolean;
|
|
117
120
|
}[];
|
|
121
|
+
readonly section_ids?: Array<string> | undefined;
|
|
118
122
|
readonly shared_link: {
|
|
119
123
|
readonly url: string;
|
|
120
124
|
short_url?: string | null | undefined;
|
|
@@ -325,6 +329,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
325
329
|
readonly template: {
|
|
326
330
|
readonly id: string;
|
|
327
331
|
name: string;
|
|
332
|
+
readonly tags?: Array<string> | undefined;
|
|
328
333
|
};
|
|
329
334
|
readonly sections: {
|
|
330
335
|
readonly id: string;
|
|
@@ -334,6 +339,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
334
339
|
metadata?: Record<string, any> | undefined;
|
|
335
340
|
is_draft: boolean;
|
|
336
341
|
}[];
|
|
342
|
+
readonly section_ids?: Array<string> | undefined;
|
|
337
343
|
readonly shared_link: {
|
|
338
344
|
readonly url: string;
|
|
339
345
|
short_url?: string | null | undefined;
|
|
@@ -388,6 +394,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
388
394
|
readonly template: {
|
|
389
395
|
readonly id: string;
|
|
390
396
|
name: string;
|
|
397
|
+
readonly tags?: Array<string> | undefined;
|
|
391
398
|
};
|
|
392
399
|
readonly sections: {
|
|
393
400
|
readonly id: string;
|
|
@@ -397,6 +404,7 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
397
404
|
metadata?: Record<string, any> | undefined;
|
|
398
405
|
is_draft: boolean;
|
|
399
406
|
}[];
|
|
407
|
+
readonly section_ids?: Array<string> | undefined;
|
|
400
408
|
readonly shared_link: {
|
|
401
409
|
readonly url: string;
|
|
402
410
|
short_url?: string | null | undefined;
|
|
@@ -431,6 +439,8 @@ export declare function useDynamicContent(hasConfig?: Ref<boolean> | ComputedRef
|
|
|
431
439
|
}> & Omit<Map<string, CanvasRetrieve>, keyof Map<any, any>>)>;
|
|
432
440
|
hasSectionCached: (sectionId: string) => boolean;
|
|
433
441
|
getCachedSection: (sectionId: string) => CanvasRetrieve | undefined;
|
|
434
|
-
fetchDynamicContent: (config: DynamicContentProps
|
|
442
|
+
fetchDynamicContent: (config: DynamicContentProps, options?: {
|
|
443
|
+
silent?: boolean;
|
|
444
|
+
}) => Promise<void>;
|
|
435
445
|
fetchSectionContent: (sectionId: string) => Promise<CanvasRetrieve | null>;
|
|
436
446
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CanvasSection } from '../../../../types/openapi';
|
|
2
|
+
/**
|
|
3
|
+
* Opt-in lazy section loading — client-side hydration engine.
|
|
4
|
+
*
|
|
5
|
+
* When a canvas is fetched as a "shell" (`?lazy_sections=true` + the
|
|
6
|
+
* `lazy_load_sections` setting), it carries ordered `section_ids` instead of the
|
|
7
|
+
* heavy inline `sections`. This engine drains those IDs through the batch
|
|
8
|
+
* endpoint progressively (bounded batches, capped concurrency) and feeds the
|
|
9
|
+
* hydrated bodies back so the renderer fills in as they arrive.
|
|
10
|
+
*
|
|
11
|
+
* It is a PURE async queue — no Vue, no network knowledge — so it is unit
|
|
12
|
+
* testable in isolation and reused unchanged by `useCanvas`. It is completely
|
|
13
|
+
* dormant unless `start()` is called with a non-empty ID list, which only
|
|
14
|
+
* happens for a shell canvas; the legacy fully-expanded path never touches it.
|
|
15
|
+
*/
|
|
16
|
+
/** Server-side `MAX_BATCH` in Django `sections_by_ids` / next-core by-ids route. */
|
|
17
|
+
export declare const MAX_SECTIONS_PER_BATCH = 100;
|
|
18
|
+
export interface LazySectionLoaderOptions {
|
|
19
|
+
/** Fetch the bodies for a slice of section IDs (≤ MAX_SECTIONS_PER_BATCH). */
|
|
20
|
+
fetchBatch: (sectionIds: string[]) => Promise<CanvasSection[]>;
|
|
21
|
+
/** Called with each hydrated batch as it resolves (append into the canvas). */
|
|
22
|
+
onSections: (sections: CanvasSection[]) => void;
|
|
23
|
+
/** Per-batch error sink. A failed batch is isolated; the drain continues. */
|
|
24
|
+
onError?: (error: unknown, sectionIds: string[]) => void;
|
|
25
|
+
/** Sections per request. Clamped to [1, MAX_SECTIONS_PER_BATCH]. Default 50. */
|
|
26
|
+
batchSize?: number;
|
|
27
|
+
/** Max in-flight batches. Default 2. */
|
|
28
|
+
concurrency?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface LazySectionLoader {
|
|
31
|
+
/**
|
|
32
|
+
* Begin draining `allSectionIds`, skipping any already in `loadedSectionIds`.
|
|
33
|
+
* Order is preserved (content order = reading order, top-down). Idempotent
|
|
34
|
+
* per ID — an ID already queued/in-flight/done is never enqueued twice.
|
|
35
|
+
*/
|
|
36
|
+
start(allSectionIds: string[], loadedSectionIds?: Iterable<string>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Move the given IDs to the front of the remaining queue (e.g. the section a
|
|
39
|
+
* deep-link / the rep's current page points at), so they hydrate first.
|
|
40
|
+
* Unknown or already-loaded IDs are ignored. A section whose background batch
|
|
41
|
+
* previously FAILED is revived here for an on-demand retry (bounded), so
|
|
42
|
+
* navigating onto a transiently-failed section fetches it instead of leaving
|
|
43
|
+
* it blank.
|
|
44
|
+
*/
|
|
45
|
+
prioritize(sectionIds: string[]): void;
|
|
46
|
+
/** Resolves once the queue is fully drained (all batches settled). */
|
|
47
|
+
ensureAll(): Promise<void>;
|
|
48
|
+
/** Cancel everything in flight and clear the queue (new deck load). */
|
|
49
|
+
reset(): void;
|
|
50
|
+
/** Remaining queued IDs not yet hydrated. */
|
|
51
|
+
pendingCount(): number;
|
|
52
|
+
}
|
|
53
|
+
export declare function createLazySectionLoader(options: LazySectionLoaderOptions): LazySectionLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|