@pitcher/js-api 1.21.0-beta.14 → 1.21.0-beta.15
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.js +101 -8
- package/js-api.esm.js.map +1 -1
- package/js-api.umd.min.js +10 -10
- package/js-api.umd.min.js.map +1 -1
- package/lib/apps/browser/stores/api.d.ts +164 -104
- package/lib/apps/browser/stores/app.d.ts +6 -1
- package/lib/apps/browser/stores/upload.d.ts +30 -30
- package/lib/apps/canvas-builder/composables/useCanvas.d.ts +508 -421
- package/lib/apps/canvas-builder/composables/useCanvasHistory.d.ts +86 -74
- package/lib/apps/canvas-builder/composables/useCanvasTheme.d.ts +18 -20
- package/lib/apps/canvas-builder/composables/useContentSelector.d.ts +5 -5
- package/lib/apps/canvas-builder/composables/useInstalledEmbeddables.d.ts +4 -1
- package/lib/apps/canvas-builder/types/canvas.d.ts +1 -0
- package/lib/apps/canvas-builder/util/canvas.util.d.ts +1 -0
- package/lib/apps/content-selector/stores/app.d.ts +8 -1
- package/lib/components/CFileViewer/CFileViewer.use.d.ts +2 -4
- package/lib/components/CFileViewer/CFileViewerFullScreen.use.d.ts +1 -1
- package/lib/components/filters/filter.util.d.ts +1 -1
- package/lib/composables/instanceTagsActions.use.d.ts +14 -0
- package/lib/composables/recentFiles.use.d.ts +1 -1
- package/lib/composables/suggestedTags.use.d.ts +3 -0
- package/lib/composables/tableColumnsSettings.use.d.ts +25 -0
- package/lib/composables/useCanvasOverlay.d.ts +4 -4
- package/lib/composables/useConfirmation.d.ts +1 -0
- package/lib/composables/useElementHeightResize.d.ts +5 -0
- package/lib/composables/useFiles.d.ts +11 -0
- package/lib/constants/pitcherSettings.const.d.ts +4 -0
- package/lib/main.lib.d.ts +23 -20
- package/lib/sdk/api/HighLevelApi.d.ts +95 -2
- package/lib/sdk/api/modules/admin/canvas.admin.d.ts +4 -8
- package/lib/sdk/api/modules/admin/env.admin.d.ts +3 -2
- package/lib/sdk/api/modules/admin/files.admin.d.ts +10 -10
- package/lib/sdk/api/modules/admin/index.d.ts +13 -0
- package/lib/sdk/api/modules/admin/metadataTemplates.admin.d.ts +1 -2
- package/lib/sdk/api/modules/admin/types.admin.d.ts +93 -0
- package/lib/sdk/api/modules/canvas.d.ts +2 -4
- package/lib/sdk/api/modules/dsr/env.dsr.d.ts +4 -3
- package/lib/sdk/api/modules/dsr/index.d.ts +7 -0
- package/lib/sdk/api/modules/dsr/loading.dsr.d.ts +6 -0
- package/lib/sdk/api/modules/env.d.ts +16 -0
- package/lib/sdk/api/modules/favorites.d.ts +9 -0
- package/lib/sdk/api/modules/feedback.d.ts +3 -0
- package/lib/sdk/api/modules/files.d.ts +1 -2
- package/lib/sdk/api/modules/folders.d.ts +29 -0
- package/lib/sdk/api/modules/open.d.ts +6 -0
- package/lib/sdk/api/modules/sync.d.ts +1 -2
- package/lib/sdk/api/modules/ui/app-errors.ui.d.ts +12 -0
- package/lib/sdk/api/modules/ui/canvas.ui.d.ts +53 -0
- package/lib/sdk/api/modules/ui/content.ui.d.ts +36 -3
- package/lib/sdk/api/modules/ui/index.d.ts +107 -0
- package/lib/sdk/api/modules/ui/loading.ui.d.ts +15 -0
- package/lib/sdk/api/modules/ui/location.ui.d.ts +17 -0
- package/lib/sdk/api/modules/ui/post-call.ui.d.ts +25 -0
- package/lib/sdk/api/modules/ui/types.ui.d.ts +59 -0
- package/lib/sdk/api/modules/users.d.ts +4 -0
- package/lib/sdk/interfaces.d.ts +117 -0
- package/lib/sdk/main.d.ts +67 -6
- package/lib/sdk/payload.types.d.ts +132 -0
- package/lib/types/app.d.ts +11 -0
- package/lib/types/filter.d.ts +5 -0
- package/lib/types/instanceSettings.types.d.ts +8 -2
- package/lib/types/launchDarkly.types.d.ts +4 -4
- package/lib/types/organizationSettings.types.d.ts +4 -0
- package/lib/types/recentFiles.types.d.ts +4 -1
- package/lib/types/users.d.ts +13 -0
- package/lib/util/fullscreen.util.d.ts +1 -1
- package/lib/util/string.d.ts +1 -0
- package/package.json +1 -1
- package/types/openapi/index.d.ts +4 -5
- package/types/openapi/models/AccessTypeEnum.d.ts +3 -1
- package/types/openapi/models/Canvas.d.ts +1 -0
- package/types/openapi/models/CanvasCreate.d.ts +1 -0
- package/types/openapi/models/CanvasCreateRequest.d.ts +1 -0
- package/types/openapi/models/CanvasRetrieve.d.ts +1 -0
- package/types/openapi/models/CanvasUpdate.d.ts +1 -0
- package/types/openapi/models/CanvasUpdateRequest.d.ts +1 -0
- package/types/openapi/models/DeletedCanvas.d.ts +1 -0
- package/types/openapi/models/DeletedFolder.d.ts +3 -3
- package/types/openapi/models/Folder.d.ts +3 -3
- package/types/openapi/models/FolderCanvas.d.ts +11 -0
- package/types/openapi/models/FolderCreate.d.ts +7 -7
- package/types/openapi/models/FolderCreateRequest.d.ts +3 -2
- package/types/openapi/models/FolderFile.d.ts +2 -0
- package/types/openapi/models/FolderFolder.d.ts +4 -2
- package/types/openapi/models/FolderRetrieve.d.ts +7 -8
- package/types/openapi/models/FolderRule.d.ts +7 -0
- package/types/openapi/models/FolderRuleRequest.d.ts +7 -0
- package/types/openapi/models/FolderUpdate.d.ts +7 -8
- package/types/openapi/models/FolderUpdateRequest.d.ts +2 -0
- package/types/openapi/models/OperatorEnum.d.ts +64 -0
- package/types/openapi/models/PatchedCanvasUpdateRequest.d.ts +1 -0
- package/types/openapi/models/PatchedFolderUpdateRequest.d.ts +2 -0
- package/lib/composables/useDetailsView.d.ts +0 -19
- package/types/openapi/models/FileRequest.d.ts +0 -16
- package/types/openapi/models/PSPDFKitAuthPayload.d.ts +0 -3
- package/types/openapi/models/PSPDFKitAuthPayloadRequest.d.ts +0 -3
- package/types/openapi/models/PSPDFKitToken.d.ts +0 -7
- package/types/openapi/models/PSPDFKitTokenRequest.d.ts +0 -3
package/lib/main.lib.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { default as CDrawer } from './components/CDrawer/CDrawer.vue';
|
|
|
18
18
|
export { default as CDrawerContent } from './components/CDrawerContent/CDrawerContent.vue';
|
|
19
19
|
export { default as CDropdown } from './components/CDropdown/CDropdown.vue';
|
|
20
20
|
export { default as CErrorFullScreen } from './components/CError/CErrorFullScreen.vue';
|
|
21
|
+
export { default as CFileThumbnail } from './components/CFileThumbnail/CFileThumbnail.vue';
|
|
21
22
|
export { default as CIcon, type Props as CIconProps } from './components/CIcon/CIcon.vue';
|
|
22
23
|
export { default as CImage } from './components/CImage/CImage.vue';
|
|
23
24
|
export { default as CInput } from './components/CInput/CInput.vue';
|
|
@@ -104,42 +105,43 @@ export { default as useBindValidation } from './composables/useBindValidation';
|
|
|
104
105
|
export { default as useCanvasOverlay } from './composables/useCanvasOverlay';
|
|
105
106
|
export { default as useInfiniteScroll } from './composables/useInfiniteScroll';
|
|
106
107
|
export { default as useWindowEvents } from './composables/useWindowEvents';
|
|
107
|
-
export { default as useDetailsView } from './composables/useDetailsView';
|
|
108
108
|
export { default as useConfirmation } from './composables/useConfirmation';
|
|
109
109
|
export { default as useLocation } from './composables/useLocation';
|
|
110
110
|
export { default as useRecentFiles } from './composables/recentFiles.use';
|
|
111
111
|
export { default as useToast } from './composables/useToast';
|
|
112
|
+
export { default as useSuggestedTags } from './composables/suggestedTags.use';
|
|
112
113
|
export * from './plugins/vueQuery';
|
|
114
|
+
export * from './apps/canvas-builder/util/canvas.util';
|
|
115
|
+
export * from './apps/canvas-builder/util/tree';
|
|
116
|
+
export * from './components/filters/filter.util';
|
|
117
|
+
export * from './util/anchor';
|
|
113
118
|
export * from './util/array';
|
|
114
|
-
export * from './util/object';
|
|
115
|
-
export * from './util/userAgents';
|
|
116
|
-
export * from './util/image';
|
|
117
119
|
export * from './util/casing';
|
|
118
|
-
export * from './util/query';
|
|
119
|
-
export * from './util/reactive';
|
|
120
|
-
export * from './util/date';
|
|
121
|
-
export * from './util/number';
|
|
122
|
-
export * from './util/network';
|
|
123
|
-
export * from './util/tsHelpers';
|
|
124
120
|
export * from './util/color';
|
|
125
|
-
export * from './util/
|
|
121
|
+
export * from './util/date';
|
|
122
|
+
export * from './util/dev.util';
|
|
126
123
|
export * from './util/dom';
|
|
127
|
-
export * from './util/anchor';
|
|
128
|
-
export * from './util/translations';
|
|
129
|
-
export * from './util/message-event';
|
|
130
124
|
export * from './util/font.util';
|
|
131
|
-
export * from './util/timer';
|
|
132
|
-
export * from './components/filters/filter.util';
|
|
133
|
-
export * from './apps/canvas-builder/util/tree';
|
|
134
|
-
export * from './apps/canvas-builder/util/canvas.util';
|
|
135
|
-
export * from './util/navigation.util';
|
|
136
125
|
export * from './util/fullscreen.util';
|
|
126
|
+
export * from './util/image';
|
|
137
127
|
export * from './util/location.util';
|
|
138
|
-
export * from './util/
|
|
128
|
+
export * from './util/message-event';
|
|
129
|
+
export * from './util/navigation.util';
|
|
130
|
+
export * from './util/network';
|
|
131
|
+
export * from './util/number';
|
|
132
|
+
export * from './util/object';
|
|
133
|
+
export * from './util/query';
|
|
134
|
+
export * from './util/reactive';
|
|
135
|
+
export * from './util/timer';
|
|
136
|
+
export * from './util/translations';
|
|
137
|
+
export * from './util/tsHelpers';
|
|
138
|
+
export * from './util/user';
|
|
139
|
+
export * from './util/userAgents';
|
|
139
140
|
export * from './sdk/main';
|
|
140
141
|
export * from '../types/openapi';
|
|
141
142
|
export * from './components/CGlobalSearch/CGlobalSearch.types';
|
|
142
143
|
export * from './types/dataTable';
|
|
144
|
+
export * from './types/filter';
|
|
143
145
|
export * from './types/sfdc';
|
|
144
146
|
export * from './types/ts';
|
|
145
147
|
export * from './types/paginatedData';
|
|
@@ -170,6 +172,7 @@ export * from './constants/timers.const';
|
|
|
170
172
|
export * from './constants/url.const';
|
|
171
173
|
export * from './constants/conventions.const';
|
|
172
174
|
export * from './constants/config.const';
|
|
175
|
+
export * from './constants/pitcherSettings.const';
|
|
173
176
|
export * from './api/events/events.queries';
|
|
174
177
|
export * from './api/users/users.queries';
|
|
175
178
|
export * from './api/canvases/canvases.queries';
|
|
@@ -1,23 +1,116 @@
|
|
|
1
1
|
import { LowLevelApi } from './LowLevelApi';
|
|
2
2
|
import { PitcherEvent, ApiOptions } from '../interfaces';
|
|
3
3
|
import * as modules from '@sdk/api/modules';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a high-level API instance and caches it. Reterns a new instance only if new options are provided.
|
|
6
|
+
*/
|
|
4
7
|
export declare function createHighLevelApi(options?: ApiOptions): {
|
|
8
|
+
/**
|
|
9
|
+
* Subscribe to a given event type by its key.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} type - The event type to subscribe to.
|
|
12
|
+
* @param {(payload: PitcherEvent) => void} callback - The callback function to handle the event.
|
|
13
|
+
* @returns A Promise resolving to a cleanup function to unsubscribe from the event. * @example
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const unsubscribeFromSectionListUpdate = usePitcherApi().on('entered_fullscreen', (event: object) => {
|
|
17
|
+
* // handle event
|
|
18
|
+
* })
|
|
19
|
+
* // later
|
|
20
|
+
* unsubscribeFromSectionListUpdate()
|
|
21
|
+
*/
|
|
5
22
|
on: (type: string, callback: (payload: PitcherEvent) => void) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Unsubscribe from a given event type by its key and the attached callback reference.
|
|
25
|
+
* @param {string} type - The event type to unsubscribe from.
|
|
26
|
+
* @param {(payload: PitcherEvent) => void} callback - The callback function reference to remove.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const callback = (event: object) => {
|
|
30
|
+
* // handle event
|
|
31
|
+
* }
|
|
32
|
+
* usePitcherApi().on('entered_fullscreen', callback)
|
|
33
|
+
* // later
|
|
34
|
+
* usePitcherApi().off('entered_fullscreen', callback)
|
|
35
|
+
*/
|
|
6
36
|
off: (type: string, callback: (payload: PitcherEvent) => void) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Make the entire CatalogIQ fullscreen.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* usePitcherApi().enterFullscreen()
|
|
42
|
+
*/
|
|
7
43
|
enterFullscreen: () => Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Exit fullscreen mode.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* usePitcherApi().exitFullscreen()
|
|
49
|
+
*/
|
|
8
50
|
exitFullscreen: () => Promise<any>;
|
|
51
|
+
/**
|
|
52
|
+
* Return is CatalogIQ in fullscreen.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* usePitcherApi().isFullscreen()
|
|
56
|
+
*/
|
|
57
|
+
isFullscreen: () => Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Log out the current user.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* usePitcherApi().logout()
|
|
63
|
+
*/
|
|
9
64
|
logout: () => Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* Quit the current instance and go to the instance selection screen.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* usePitcherApi().quitInstance()
|
|
70
|
+
*/
|
|
10
71
|
quitInstance: () => Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* Get the request types.
|
|
74
|
+
*
|
|
75
|
+
* @returns {Promise<any>}
|
|
76
|
+
*/
|
|
11
77
|
getRequestTypes: () => Promise<any>;
|
|
78
|
+
/**
|
|
79
|
+
* Broadcast an event to CatalogIQ.
|
|
80
|
+
* @param {PitcherEvent} event - The event to broadcast.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* usePitcherApi()
|
|
84
|
+
* .broadcast({
|
|
85
|
+
* type: "canvas_updated",
|
|
86
|
+
* body: { context: { myContextProperty: 'test' } },
|
|
87
|
+
* })
|
|
88
|
+
* .then(function (result) {
|
|
89
|
+
* useUi().toast({
|
|
90
|
+
* message: "Canvas Populated.",
|
|
91
|
+
* type: "info",
|
|
92
|
+
* })
|
|
93
|
+
* })
|
|
94
|
+
*/
|
|
12
95
|
broadcast: (event: PitcherEvent) => Promise<any>;
|
|
96
|
+
/**
|
|
97
|
+
* Subscribe to updates.
|
|
98
|
+
*
|
|
99
|
+
* @returns {Promise<void>}
|
|
100
|
+
*/
|
|
13
101
|
subscribe: () => Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Unsubscribe from updates.
|
|
104
|
+
*
|
|
105
|
+
* @returns {Promise<void>}
|
|
106
|
+
*/
|
|
14
107
|
unsubscribe: () => Promise<any>;
|
|
15
108
|
open(payload?: import('../payload.types').OpenRequestPayload): Promise<string>;
|
|
16
109
|
openExternalUrl(payload: import('../payload.types').OpenExternalUrlRequestPayload): Promise<void>;
|
|
17
110
|
getEnv(): Promise<import('../interfaces').PitcherEnv>;
|
|
18
111
|
updateMyUser(payload: {
|
|
19
|
-
language?: import('../../main.lib').LanguageEnum;
|
|
20
|
-
dark_mode?: boolean;
|
|
112
|
+
language?: import('../../main.lib').LanguageEnum | undefined;
|
|
113
|
+
dark_mode?: boolean | undefined;
|
|
21
114
|
}): Promise<import('../../main.lib').User>;
|
|
22
115
|
getLanguages(): Promise<modules.Language[]>;
|
|
23
116
|
getEvents(payload: Partial<import('../../main.lib').EventRequest>): Promise<import('../../main.lib').PaginatedData<import('../../main.lib').Event>>;
|
|
@@ -5,17 +5,16 @@ import { PaginatedData } from '../../../../types/paginatedData';
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates a new canvas.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* @example
|
|
9
9
|
* adminApi.createCanvas({
|
|
10
10
|
* name: 'my new canvas';
|
|
11
11
|
* })
|
|
12
|
-
* ```
|
|
13
12
|
*/
|
|
14
13
|
export declare function createCanvas(payload: CanvasCreateRequest): Promise<CanvasRetrieve>;
|
|
15
14
|
/**
|
|
16
15
|
* Fetches a list of canvases to use in your app.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
17
|
+
* @example
|
|
19
18
|
* // The `filters` object is a reserved payload key to transfer the metadata dict over the wire.
|
|
20
19
|
* adminApi.getCanvases({
|
|
21
20
|
* search: 'my search query',
|
|
@@ -26,7 +25,6 @@ export declare function createCanvas(payload: CanvasCreateRequest): Promise<Canv
|
|
|
26
25
|
* },
|
|
27
26
|
* fields: 'id,name,metadata',
|
|
28
27
|
* })
|
|
29
|
-
* ```
|
|
30
28
|
*/
|
|
31
29
|
export declare function getCanvases(payload: GetCanvasesParams & {
|
|
32
30
|
filters?: Record<string, any>;
|
|
@@ -35,12 +33,11 @@ export declare function getCanvases(payload: GetCanvasesParams & {
|
|
|
35
33
|
/**
|
|
36
34
|
* Fetches a canvas by id with the defined fields or all of them.
|
|
37
35
|
*
|
|
38
|
-
*
|
|
36
|
+
* @example
|
|
39
37
|
* // The `filters` object is a reserved payload key to transfer the metadata dict over the wire.
|
|
40
38
|
* adminApi.getCanvas({
|
|
41
39
|
* fields: 'id,name,metadata',
|
|
42
40
|
* })
|
|
43
|
-
* ```
|
|
44
41
|
*/
|
|
45
42
|
export declare function getCanvas(payload: {
|
|
46
43
|
id: CanvasRetrieve['id'];
|
|
@@ -49,7 +46,7 @@ export declare function getCanvas(payload: {
|
|
|
49
46
|
/**
|
|
50
47
|
* Updates a canvas by ID and returns the defined fields or all of them.
|
|
51
48
|
*
|
|
52
|
-
*
|
|
49
|
+
* @example
|
|
53
50
|
* // The fields param is appended to the URL as a query param.
|
|
54
51
|
* onMounted(() => {
|
|
55
52
|
* adminApi.updateCanvas({
|
|
@@ -60,7 +57,6 @@ export declare function getCanvas(payload: {
|
|
|
60
57
|
* console.log(res) // logs: { id: '01HH4RCBH631K4JDHWAQB0RPR6', name: 'To 3!' }
|
|
61
58
|
* })
|
|
62
59
|
* })
|
|
63
|
-
* ```
|
|
64
60
|
*/
|
|
65
61
|
export declare function updateCanvas(payload: PatchedCanvasUpdateRequest & {
|
|
66
62
|
id: CanvasRetrieve['id'];
|
|
@@ -3,8 +3,9 @@ import { AdminEnv } from './types.admin';
|
|
|
3
3
|
/**
|
|
4
4
|
* Fetches the necessary info for the app to know where it is embedded.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Check out [usePitcherApi().getEnv()](../internal/functions/createHighLevelApi.md#getenv) for more information.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
7
9
|
* adminApi.getEnv()
|
|
8
|
-
* ```
|
|
9
10
|
*/
|
|
10
11
|
export declare function getEnv(): Promise<AdminEnv>;
|
|
@@ -2,11 +2,13 @@ import { AdminSelectContentRequest, AdminSelectContentResponse } from './types.a
|
|
|
2
2
|
import { File, PaginatedFileList } from '../../../../../types/openapi';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Get the metadata object of an app with a given name.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* @param {object} payload - The payload object.
|
|
8
|
+
* @param {string} payload.app_name - `name` value from `app.json` of the app you want to get the metadata of.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* useAdmin().getAppConfig({ app_name: 'my-app' })
|
|
10
12
|
*/
|
|
11
13
|
export declare function getAppConfig(payload: {
|
|
12
14
|
app_name: string;
|
|
@@ -14,9 +16,8 @@ export declare function getAppConfig(payload: {
|
|
|
14
16
|
/**
|
|
15
17
|
* Fetches a file by ID.
|
|
16
18
|
*
|
|
17
|
-
*
|
|
19
|
+
* @example
|
|
18
20
|
* adminApi.getFile({ id: 'my-file-id' })
|
|
19
|
-
* ```
|
|
20
21
|
*/
|
|
21
22
|
export declare function getFile(payload: {
|
|
22
23
|
id: File['id'];
|
|
@@ -24,14 +25,14 @@ export declare function getFile(payload: {
|
|
|
24
25
|
/**
|
|
25
26
|
* Lists available files.
|
|
26
27
|
*
|
|
27
|
-
*
|
|
28
|
+
* @example
|
|
28
29
|
* adminApi.getFiles()
|
|
29
|
-
* ```
|
|
30
30
|
*/
|
|
31
31
|
export declare function getFiles(payload: Record<string, any>): Promise<PaginatedFileList>;
|
|
32
32
|
/**
|
|
33
33
|
* Opens a selector that allows you to select (and preselect) from your Pitcher uploaded content.
|
|
34
|
-
*
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
35
36
|
* const api = useApi() // or useAdmin() if you know that you 're in Admin app context
|
|
36
37
|
* api
|
|
37
38
|
* .select_content({
|
|
@@ -44,6 +45,5 @@ export declare function getFiles(payload: Record<string, any>): Promise<Paginate
|
|
|
44
45
|
* },
|
|
45
46
|
* ],
|
|
46
47
|
* })
|
|
47
|
-
* ```
|
|
48
48
|
*/
|
|
49
49
|
export declare function selectContent(payload: AdminSelectContentRequest): Promise<AdminSelectContentResponse>;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { AdminToastRequest, ADMIN_MESSAGE_TYPES, AdminMessagePayloads } from './types.admin';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Subscribe to a given event type by its key.
|
|
5
|
+
*
|
|
6
|
+
* @param type The event type/key to subscribe to.
|
|
7
|
+
* @param handler The handler function to call when the event is emitted.
|
|
8
|
+
* @returns A Promise resolving to a cleanup function to unsubscribe from the event.
|
|
9
|
+
*/
|
|
3
10
|
declare function on(type: (typeof ADMIN_MESSAGE_TYPES)[keyof typeof ADMIN_MESSAGE_TYPES], handler: (data: AdminMessagePayloads[typeof type]) => Promise<void>): Promise<() => void>;
|
|
11
|
+
/**
|
|
12
|
+
* Show a toast message to the user. Compatible with the UI API version of this method.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* useAdmin().toast({ type: 'info', message: 'Hello, world!' })
|
|
16
|
+
*/
|
|
4
17
|
declare function toast(payload: AdminToastRequest): Promise<void>;
|
|
5
18
|
declare const _default: {
|
|
6
19
|
getAppConfig(payload: {
|
|
@@ -4,8 +4,7 @@ import { GetInstanceMetadataTemplatesPayload } from '../../../payload.types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Fetches a list of metadata templates to use in your app. Instance is auto-injected by admin app if in instance scope.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* @example
|
|
8
8
|
* adminApi.getInstanceMetadataTemplates()
|
|
9
|
-
* ```
|
|
10
9
|
**/
|
|
11
10
|
export declare function getInstanceMetadataTemplates(payload?: GetInstanceMetadataTemplatesPayload): Promise<PaginatedMetadataTemplateList>;
|
|
@@ -26,42 +26,135 @@ export declare const ADMIN_API_METHOD_TYPES: {
|
|
|
26
26
|
export type AdminMessagePayloads = {
|
|
27
27
|
[ADMIN_MESSAGE_TYPES.ENV_CHANGED]: AdminEnv;
|
|
28
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Represents an admin request with a specific payload.
|
|
31
|
+
* @template Payload - The type of the payload data.
|
|
32
|
+
*/
|
|
29
33
|
export type AdminRequest<Payload = any> = {
|
|
34
|
+
/**
|
|
35
|
+
* Unique identifier for the request.
|
|
36
|
+
*/
|
|
30
37
|
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Type of the admin API request.
|
|
40
|
+
*/
|
|
31
41
|
type: (typeof ADMIN_API_TYPES)['ADMIN_REQUEST'];
|
|
42
|
+
/**
|
|
43
|
+
* Body of the request containing the method type and payload data.
|
|
44
|
+
*/
|
|
32
45
|
body: {
|
|
46
|
+
/**
|
|
47
|
+
* Type of the admin API method.
|
|
48
|
+
*/
|
|
33
49
|
type: (typeof ADMIN_API_METHOD_TYPES)[keyof typeof ADMIN_API_METHOD_TYPES];
|
|
50
|
+
/**
|
|
51
|
+
* Payload data for the request.
|
|
52
|
+
*/
|
|
34
53
|
data: Payload;
|
|
35
54
|
};
|
|
36
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Represents a request to show a toast notification.
|
|
58
|
+
*/
|
|
37
59
|
export interface AdminToastRequest {
|
|
60
|
+
/**
|
|
61
|
+
* Type of the toast notification.
|
|
62
|
+
*/
|
|
38
63
|
type: 'info' | 'error' | 'warning' | 'success' | 'loading';
|
|
64
|
+
/**
|
|
65
|
+
* Message to be displayed in the toast.
|
|
66
|
+
*/
|
|
39
67
|
message: string;
|
|
68
|
+
/**
|
|
69
|
+
* Duration for which the toast should be displayed (optional).
|
|
70
|
+
*/
|
|
40
71
|
duration?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates if the toast can be closed manually (optional).
|
|
74
|
+
*/
|
|
41
75
|
closable?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Indicates if the toast should remain visible when hovered over (optional).
|
|
78
|
+
*/
|
|
42
79
|
keepAliveOnHover?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Indicates if an icon should be shown in the toast (optional).
|
|
82
|
+
*/
|
|
43
83
|
showIcon?: boolean;
|
|
44
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Represents a request to select content.
|
|
87
|
+
*/
|
|
45
88
|
export type AdminSelectContentRequest = {
|
|
89
|
+
/**
|
|
90
|
+
* List of selections to be made (optional).
|
|
91
|
+
*/
|
|
46
92
|
selections?: Selection[];
|
|
47
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Represents a response to a content selection request.
|
|
96
|
+
*/
|
|
48
97
|
export type AdminSelectContentResponse = {
|
|
98
|
+
/**
|
|
99
|
+
* Action taken by the user.
|
|
100
|
+
*/
|
|
49
101
|
user_action: 'cancelled' | 'selected';
|
|
102
|
+
/**
|
|
103
|
+
* Selected content, if any.
|
|
104
|
+
*/
|
|
50
105
|
content?: (ContentSelectorSelectedFile | ContentSelectorSelectedPage)[];
|
|
51
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Represents an admin response with a specific payload.
|
|
109
|
+
* @template Response - The type of the response data.
|
|
110
|
+
*/
|
|
52
111
|
export type AdminResponse<Response = any> = {
|
|
112
|
+
/**
|
|
113
|
+
* Unique identifier for the response.
|
|
114
|
+
*/
|
|
53
115
|
id: string;
|
|
116
|
+
/**
|
|
117
|
+
* Type of the admin API response.
|
|
118
|
+
*/
|
|
54
119
|
type: (typeof ADMIN_API_TYPES)['ADMIN_RESPONSE'];
|
|
120
|
+
/**
|
|
121
|
+
* Body of the response containing the response data.
|
|
122
|
+
*/
|
|
55
123
|
body: Response;
|
|
56
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Represents an admin message with a specific payload.
|
|
127
|
+
* @template Payload - The type of the message data.
|
|
128
|
+
*/
|
|
57
129
|
export type AdminMessage<Payload = any> = {
|
|
130
|
+
/**
|
|
131
|
+
* Unique identifier for the message.
|
|
132
|
+
*/
|
|
58
133
|
id: string;
|
|
134
|
+
/**
|
|
135
|
+
* Type of the admin message.
|
|
136
|
+
*/
|
|
59
137
|
type: typeof ADMIN_MESSAGE;
|
|
138
|
+
/**
|
|
139
|
+
* Body of the message containing the message type and payload data.
|
|
140
|
+
*/
|
|
60
141
|
body: {
|
|
142
|
+
/**
|
|
143
|
+
* Type of the admin message.
|
|
144
|
+
*/
|
|
61
145
|
type: (typeof ADMIN_MESSAGE_TYPES)[keyof typeof ADMIN_MESSAGE_TYPES];
|
|
146
|
+
/**
|
|
147
|
+
* Payload data for the message.
|
|
148
|
+
*/
|
|
62
149
|
data: Payload;
|
|
63
150
|
};
|
|
64
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* Represents the admin environment.
|
|
154
|
+
*/
|
|
65
155
|
export type AdminEnv = {
|
|
156
|
+
/**
|
|
157
|
+
* Pitcher environment settings.
|
|
158
|
+
*/
|
|
66
159
|
pitcher: PitcherEnv['pitcher'];
|
|
67
160
|
};
|
|
@@ -5,7 +5,7 @@ import { PaginatedData } from '../../../types/paginatedData';
|
|
|
5
5
|
/**
|
|
6
6
|
* Fetches a list of canvases to use in your app.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* @example
|
|
9
9
|
* // The `filters` object is a reserved payload key to transfer the metadata dict over the wire.
|
|
10
10
|
* api.getCanvases({
|
|
11
11
|
* search: 'my search query',
|
|
@@ -16,7 +16,6 @@ import { PaginatedData } from '../../../types/paginatedData';
|
|
|
16
16
|
* },
|
|
17
17
|
* fields: 'id,name,metadata',
|
|
18
18
|
* })
|
|
19
|
-
* ```
|
|
20
19
|
*/
|
|
21
20
|
export declare function getCanvases(payload: GetCanvasesParams & {
|
|
22
21
|
filters?: Record<string, any>;
|
|
@@ -29,7 +28,7 @@ export declare function deleteCanvas(payload: {
|
|
|
29
28
|
/**
|
|
30
29
|
* Updates a canvas by ID
|
|
31
30
|
*
|
|
32
|
-
*
|
|
31
|
+
* @example
|
|
33
32
|
* // The fields param is appended to the URL as a query param.
|
|
34
33
|
* onMounted(() => {
|
|
35
34
|
* PitcherAPI.updateCanvas({
|
|
@@ -40,7 +39,6 @@ export declare function deleteCanvas(payload: {
|
|
|
40
39
|
* console.log(res) // logs: { id: '01HH4RCBH631K4JDHWAQB0RPR6', name: 'To 3!' }
|
|
41
40
|
* })
|
|
42
41
|
* })
|
|
43
|
-
* ```
|
|
44
42
|
*/
|
|
45
43
|
export declare function updateCanvas(payload: PatchedCanvasUpdateRequest & {
|
|
46
44
|
id: CanvasRetrieve['id'];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DsrEnv } from './types.dsr';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Fetches the necessary info for the app to know where it is embedded.
|
|
4
|
+
* Fetches the necessary info for the app to know where it is embedded.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Check out [usePitcherApi().getEnv()](../internal/functions/createHighLevelApi.md#getenv) for more information.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
7
9
|
* useDsr().getEnv()
|
|
8
|
-
* ```
|
|
9
10
|
*/
|
|
10
11
|
export declare function getEnv(): Promise<DsrEnv>;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { DSR_MESSAGE_TYPES, DsrMessagePayloads } from './types.dsr';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Subscribe to a given event type by its key.
|
|
5
|
+
*
|
|
6
|
+
* @param type The event type/key to subscribe to.
|
|
7
|
+
* @param handler The handler function to call when the event is emitted.
|
|
8
|
+
* @returns A Promise resolving to a cleanup function to unsubscribe from the event.
|
|
9
|
+
*/
|
|
3
10
|
declare function on(type: (typeof DSR_MESSAGE_TYPES)[keyof typeof DSR_MESSAGE_TYPES], handler: (data: DsrMessagePayloads[typeof type]) => Promise<void>): Promise<() => void>;
|
|
4
11
|
declare const _default: {
|
|
5
12
|
embeddable_ready(): Promise<void>;
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { PitcherEnv } from '../../interfaces';
|
|
2
2
|
import { User } from '../../../../types/openapi';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Fetches the necessary info for the app to know where it is embedded.
|
|
6
|
+
*
|
|
7
|
+
* It contains information about:
|
|
8
|
+
* - user
|
|
9
|
+
* - instance
|
|
10
|
+
* - organization
|
|
11
|
+
* - security token to query Pitcher REST API
|
|
12
|
+
* - Salesforce connection information (if connected) including security token to query Salesforce REST API
|
|
13
|
+
* - Auth0 token information
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const env = usePitcherApi().getEnv().then((env) => {
|
|
17
|
+
* console.log(env.pitcher.user.name)
|
|
18
|
+
* })
|
|
19
|
+
*/
|
|
4
20
|
export declare function getEnv(): Promise<PitcherEnv>;
|
|
5
21
|
type UpdateEnvParams = Pick<User, 'language' | 'dark_mode'>;
|
|
6
22
|
export declare function updateMyUser(payload: UpdateEnvParams): Promise<User>;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { Favorite, FavoriteCreateRequest, PaginatedFavoriteList } from '../../../../types/openapi';
|
|
2
2
|
import { GetFavoritesParams } from '../../../types/favorites';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Get a list of favorites
|
|
6
|
+
*/
|
|
4
7
|
export declare function getFavorites(payload?: GetFavoritesParams): Promise<PaginatedFavoriteList>;
|
|
8
|
+
/**
|
|
9
|
+
* Create a favorite
|
|
10
|
+
*/
|
|
5
11
|
export declare function createFavorite(payload: FavoriteCreateRequest): Promise<Favorite>;
|
|
12
|
+
/**
|
|
13
|
+
* Delete a favorite
|
|
14
|
+
*/
|
|
6
15
|
export declare function deleteFavorite(payload: {
|
|
7
16
|
favorite_id: Favorite['id'];
|
|
8
17
|
}): Promise<void>;
|
|
@@ -27,9 +27,8 @@ export declare function createFile(payload: Omit<AllFileCreateRequest, 'instance
|
|
|
27
27
|
/**
|
|
28
28
|
* Dispatches iOS native file selector and returns the selected file.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
30
|
+
* @example
|
|
31
31
|
* // iOS only method to select a file from the device.
|
|
32
32
|
* api.selectDeviceFile()
|
|
33
|
-
* ```
|
|
34
33
|
*/
|
|
35
34
|
export declare function selectDeviceFile(): Promise<DeviceFile>;
|
|
@@ -1,16 +1,45 @@
|
|
|
1
1
|
import { File, Folder, FolderRetrieve, FolderCreateRequest, FolderUpdateRequest } from '../../../../types/openapi';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves a folder by its ID.
|
|
5
|
+
* @param payload - An object containing the folder ID.
|
|
6
|
+
* @param payload.id - The ID of the folder to retrieve. Defaults to 'root'.
|
|
7
|
+
* @returns A promise that resolves to the retrieved folder.
|
|
8
|
+
*/
|
|
3
9
|
export declare function getFolder(payload?: {
|
|
4
10
|
id: FolderRetrieve['id'];
|
|
5
11
|
}): Promise<FolderRetrieve>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new folder.
|
|
14
|
+
* @param payload - The folder creation request payload, excluding the instance_id.
|
|
15
|
+
* @returns A promise that resolves to the created folder.
|
|
16
|
+
*/
|
|
6
17
|
export declare function createFolder(payload: Omit<FolderCreateRequest, 'instance_id'>): Promise<FolderRetrieve>;
|
|
7
18
|
type UpdateFolderPayload = FolderUpdateRequest & {
|
|
8
19
|
id: Folder['id'];
|
|
9
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Updates an existing folder.
|
|
23
|
+
* @param payload - The folder update payload, including the folder ID and update data.
|
|
24
|
+
* @returns A promise that resolves to the updated folder.
|
|
25
|
+
*/
|
|
10
26
|
export declare function updateFolder(payload: UpdateFolderPayload): Promise<FolderRetrieve>;
|
|
27
|
+
/**
|
|
28
|
+
* Deletes a folder.
|
|
29
|
+
* @param payload - An object containing the ID of the folder to delete.
|
|
30
|
+
* @param payload.folder_id - The ID of the folder to delete.
|
|
31
|
+
* @returns A promise that resolves when the folder is deleted.
|
|
32
|
+
*/
|
|
11
33
|
export declare function deleteFolder(payload: {
|
|
12
34
|
folder_id: FolderRetrieve['id'];
|
|
13
35
|
}): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Moves items (files or folders) to a target folder.
|
|
38
|
+
* @param payload - The payload containing the target folder ID and items to move.
|
|
39
|
+
* @param payload.target_folder_id - The ID of the target folder.
|
|
40
|
+
* @param payload.items - An array of items to move, each with an ID and type.
|
|
41
|
+
* @returns A promise that resolves to the updated target folder.
|
|
42
|
+
*/
|
|
14
43
|
export declare function moveFolderItems(payload: {
|
|
15
44
|
target_folder_id: Folder['id'];
|
|
16
45
|
items: {
|