@pitcher/js-api 1.22.0-alpha.6 → 1.22.0-beta.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.
Files changed (188) hide show
  1. package/README.md +4 -2
  2. package/js-api.esm.js +472 -139
  3. package/js-api.esm.js.map +1 -1
  4. package/js-api.umd.min.js +10 -10
  5. package/js-api.umd.min.js.map +1 -1
  6. package/lib/api/canvases/canvases.queries.d.ts +5 -5
  7. package/lib/apps/browser/stores/api.d.ts +215 -84
  8. package/lib/apps/browser/stores/app.d.ts +7 -26
  9. package/lib/apps/browser/stores/upload.d.ts +34 -24
  10. package/lib/apps/browser/util/file.d.ts +2 -2
  11. package/lib/apps/canvas-builder/composables/useCanvas.d.ts +550 -460
  12. package/lib/apps/canvas-builder/composables/useCanvasExit.d.ts +3 -0
  13. package/lib/apps/canvas-builder/composables/useCanvasHistory.d.ts +86 -74
  14. package/lib/apps/canvas-builder/composables/useCanvasHooks.d.ts +4 -4
  15. package/lib/apps/canvas-builder/composables/useCanvasPages.d.ts +3 -3
  16. package/lib/apps/canvas-builder/composables/useCanvasSectionOverrides.d.ts +3 -3
  17. package/lib/apps/canvas-builder/composables/useCanvasTheme.d.ts +24 -17
  18. package/lib/apps/canvas-builder/composables/useCanvasVisibility.d.ts +2 -2
  19. package/lib/apps/canvas-builder/composables/useCollapsibles.d.ts +3 -3
  20. package/lib/apps/canvas-builder/composables/useComponentPermissions.d.ts +2 -2
  21. package/lib/apps/canvas-builder/composables/useContentSelector.d.ts +6 -4
  22. package/lib/apps/canvas-builder/composables/useInstalledEmbeddables.d.ts +15 -0
  23. package/lib/apps/canvas-builder/composables/useRecommendations.d.ts +5 -5
  24. package/lib/apps/canvas-builder/composables/useSectionPopularity.d.ts +2 -2
  25. package/lib/apps/canvas-builder/types/canvas.d.ts +19 -18
  26. package/lib/apps/canvas-builder/types/recommendations.types.d.ts +3 -3
  27. package/lib/apps/canvas-builder/util/canvas.util.d.ts +5 -4
  28. package/lib/apps/canvas-selector/appTypes.d.ts +13 -0
  29. package/lib/apps/canvas-selector/constants/index.d.ts +3 -0
  30. package/lib/apps/canvas-selector/stores/app.d.ts +415 -0
  31. package/lib/apps/content-selector/appTypes.d.ts +1 -0
  32. package/lib/apps/content-selector/stores/app.d.ts +8 -1
  33. package/lib/components/CFileViewer/CFileViewer.use.d.ts +2 -4
  34. package/lib/components/CFileViewer/CFileViewerFullScreen.use.d.ts +1 -1
  35. package/lib/components/canvases/CanvasesManagementBulk.use.d.ts +5 -5
  36. package/lib/components/filters/filter.util.d.ts +1 -1
  37. package/lib/components/savedCanvases/CSavedCanvasesManagementShareCanvas.use.d.ts +5 -3
  38. package/lib/composables/instanceTagsActions.use.d.ts +14 -0
  39. package/lib/composables/recentFiles.use.d.ts +1 -1
  40. package/lib/composables/suggestedTags.use.d.ts +3 -0
  41. package/lib/composables/tableColumnsSettings.use.d.ts +25 -0
  42. package/lib/composables/useCanvasOverlay.d.ts +20 -0
  43. package/lib/composables/useCanvasTablesPagination.d.ts +13 -0
  44. package/lib/composables/useConfirmation.d.ts +1 -0
  45. package/lib/composables/useElementHeightResize.d.ts +5 -0
  46. package/lib/composables/useFiles.d.ts +11 -0
  47. package/lib/constants/pitcherSettings.const.d.ts +4 -0
  48. package/lib/main.lib.d.ts +32 -21
  49. package/lib/sdk/api/HighLevelApi.d.ts +112 -14
  50. package/lib/sdk/api/modules/admin/canvas.admin.d.ts +53 -15
  51. package/lib/sdk/api/modules/admin/env.admin.d.ts +3 -2
  52. package/lib/sdk/api/modules/admin/files.admin.d.ts +43 -4
  53. package/lib/sdk/api/modules/admin/index.d.ts +53 -5
  54. package/lib/sdk/api/modules/admin/metadataTemplates.admin.d.ts +1 -2
  55. package/lib/sdk/api/modules/admin/types.admin.d.ts +131 -3
  56. package/lib/sdk/api/modules/canvas.d.ts +12 -14
  57. package/lib/sdk/api/modules/dsr/env.dsr.d.ts +4 -3
  58. package/lib/sdk/api/modules/dsr/index.d.ts +14 -3
  59. package/lib/sdk/api/modules/dsr/loading.dsr.d.ts +7 -1
  60. package/lib/sdk/api/modules/env.d.ts +16 -0
  61. package/lib/sdk/api/modules/favorites.d.ts +9 -0
  62. package/lib/sdk/api/modules/feedback.d.ts +3 -0
  63. package/lib/sdk/api/modules/files.d.ts +7 -4
  64. package/lib/sdk/api/modules/folders.d.ts +29 -0
  65. package/lib/sdk/api/modules/open.d.ts +6 -0
  66. package/lib/sdk/api/modules/sync.d.ts +1 -2
  67. package/lib/sdk/api/modules/ui/app-errors.ui.d.ts +13 -1
  68. package/lib/sdk/api/modules/ui/canvas.ui.d.ts +102 -8
  69. package/lib/sdk/api/modules/ui/content.ui.d.ts +52 -2
  70. package/lib/sdk/api/modules/ui/index.d.ts +150 -13
  71. package/lib/sdk/api/modules/ui/loading.ui.d.ts +9 -1
  72. package/lib/sdk/api/modules/ui/location.ui.d.ts +18 -1
  73. package/lib/sdk/api/modules/ui/post-call.ui.d.ts +35 -4
  74. package/lib/sdk/api/modules/ui/types.ui.d.ts +85 -8
  75. package/lib/sdk/api/modules/users.d.ts +6 -1
  76. package/lib/sdk/interfaces.d.ts +122 -3
  77. package/lib/sdk/main.d.ts +297 -151
  78. package/lib/sdk/payload.types.d.ts +134 -2
  79. package/lib/sdk/utils/httpFetch.d.ts +1 -1
  80. package/lib/sdk/utils/object.d.ts +1 -0
  81. package/lib/sdk/utils/object.spec.d.ts +1 -0
  82. package/lib/theme/light.d.ts +12 -0
  83. package/lib/types/app.d.ts +11 -0
  84. package/lib/types/call.d.ts +4 -3
  85. package/lib/types/files.d.ts +27 -1
  86. package/lib/types/filter.d.ts +5 -0
  87. package/lib/types/instance.types.d.ts +18 -0
  88. package/lib/types/{instanceSettings.d.ts → instanceSettings.types.d.ts} +10 -2
  89. package/lib/types/launchDarkly.types.d.ts +4 -4
  90. package/lib/types/organization.types.d.ts +2 -2
  91. package/lib/types/organizationSettings.types.d.ts +4 -0
  92. package/lib/types/recentFiles.types.d.ts +4 -1
  93. package/lib/types/users.d.ts +13 -0
  94. package/lib/util/fullscreen.util.d.ts +1 -1
  95. package/lib/util/string.d.ts +1 -0
  96. package/package.json +1 -1
  97. package/types/openapi/index.d.ts +23 -17
  98. package/types/openapi/models/AccessTypeEnum.d.ts +3 -1
  99. package/types/openapi/models/App.d.ts +1 -0
  100. package/types/openapi/models/AppRelease.d.ts +1 -0
  101. package/types/openapi/models/AppsDBEntry.d.ts +4 -0
  102. package/types/openapi/models/AppsDBEntryRequest.d.ts +3 -0
  103. package/types/openapi/models/Canvas.d.ts +10 -15
  104. package/types/openapi/models/CanvasCreate.d.ts +14 -12
  105. package/types/openapi/models/CanvasCreateRequest.d.ts +6 -5
  106. package/types/openapi/models/CanvasRecommendedFile.d.ts +6 -0
  107. package/types/openapi/models/CanvasRetrieve.d.ts +15 -13
  108. package/types/openapi/models/CanvasSection.d.ts +5 -2
  109. package/types/openapi/models/CanvasUpdate.d.ts +14 -12
  110. package/types/openapi/models/CanvasUpdateRequest.d.ts +5 -4
  111. package/types/openapi/models/CollaborationRoleEnum.d.ts +0 -4
  112. package/types/openapi/models/ContentDistributionGroupCreate.d.ts +1 -0
  113. package/types/openapi/models/DeletedApp.d.ts +1 -0
  114. package/types/openapi/models/{CanvasList.d.ts → DeletedCanvas.d.ts} +13 -9
  115. package/types/openapi/models/DeletedContentDistributionGroup.d.ts +1 -0
  116. package/types/openapi/models/DeletedEnvironment.d.ts +1 -0
  117. package/types/openapi/models/DeletedFavorite.d.ts +1 -0
  118. package/types/openapi/models/DeletedFile.d.ts +6 -0
  119. package/types/openapi/models/DeletedFolder.d.ts +4 -3
  120. package/types/openapi/models/DeletedInstance.d.ts +1 -0
  121. package/types/openapi/models/DeletedInstanceAssignmentGroup.d.ts +1 -0
  122. package/types/openapi/models/DeletedMetadataTemplate.d.ts +1 -0
  123. package/types/openapi/models/DeletedRegion.d.ts +1 -0
  124. package/types/openapi/models/Environment.d.ts +1 -0
  125. package/types/openapi/models/Favorite.d.ts +1 -0
  126. package/types/openapi/models/File.d.ts +6 -0
  127. package/types/openapi/models/FileCreate.d.ts +8 -0
  128. package/types/openapi/models/FileCreateRequest.d.ts +3 -0
  129. package/types/openapi/models/FilePermission.d.ts +4 -0
  130. package/types/openapi/models/FilePermissionRequest.d.ts +4 -0
  131. package/types/openapi/models/FileRetrieve.d.ts +8 -0
  132. package/types/openapi/models/FileRevision.d.ts +8 -0
  133. package/types/openapi/models/FileRevisionRequest.d.ts +3 -0
  134. package/types/openapi/models/FileUpdate.d.ts +8 -0
  135. package/types/openapi/models/FileUpdateRequest.d.ts +3 -0
  136. package/types/openapi/models/FileVersion.d.ts +5 -0
  137. package/types/openapi/models/Folder.d.ts +4 -3
  138. package/types/openapi/models/FolderCanvas.d.ts +11 -0
  139. package/types/openapi/models/FolderCreate.d.ts +8 -7
  140. package/types/openapi/models/FolderCreateRequest.d.ts +4 -2
  141. package/types/openapi/models/FolderFile.d.ts +3 -0
  142. package/types/openapi/models/FolderFolder.d.ts +5 -1
  143. package/types/openapi/models/FolderRetrieve.d.ts +8 -8
  144. package/types/openapi/models/FolderRule.d.ts +7 -0
  145. package/types/openapi/models/FolderRuleRequest.d.ts +7 -0
  146. package/types/openapi/models/FolderUpdate.d.ts +8 -8
  147. package/types/openapi/models/FolderUpdateRequest.d.ts +3 -0
  148. package/types/openapi/models/Instance.d.ts +1 -0
  149. package/types/openapi/models/InstanceUpdate.d.ts +1 -0
  150. package/types/openapi/models/MetadataTemplate.d.ts +1 -0
  151. package/types/openapi/models/OfflineSyncFolder.d.ts +17 -0
  152. package/types/openapi/models/OperatorEnum.d.ts +64 -0
  153. package/types/openapi/models/PaginatedCanvasList.d.ts +8 -0
  154. package/types/openapi/models/PaginatedFileRevisionList.d.ts +8 -0
  155. package/types/openapi/models/PaginatedOfflineSyncFolderList.d.ts +8 -0
  156. package/types/openapi/models/PatchedCanvasUpdateRequest.d.ts +5 -4
  157. package/types/openapi/models/PatchedFileRequest.d.ts +3 -0
  158. package/types/openapi/models/PatchedFileRevisionRequest.d.ts +3 -0
  159. package/types/openapi/models/PatchedFileUpdateRequest.d.ts +3 -0
  160. package/types/openapi/models/PatchedFolderUpdateRequest.d.ts +3 -0
  161. package/types/openapi/models/Region.d.ts +1 -0
  162. package/types/openapi/models/SearchFile.d.ts +3 -0
  163. package/types/openapi/models/SharedLink.d.ts +6 -5
  164. package/types/openapi/models/SharedLinkCanvas.d.ts +11 -0
  165. package/types/openapi/models/SharedLinkCanvasRequest.d.ts +8 -0
  166. package/types/openapi/models/SharedLinkCreate.d.ts +6 -5
  167. package/types/openapi/models/{SharedLinkInstanceSerialzier.d.ts → SharedLinkInstance.d.ts} +1 -1
  168. package/types/openapi/models/SharedLinkInstanceRequest.d.ts +5 -0
  169. package/types/openapi/models/{SharedLinkOrganizationSerialzier.d.ts → SharedLinkOrganization.d.ts} +1 -1
  170. package/types/openapi/models/SharedLinkOrganizationRequest.d.ts +6 -0
  171. package/lib/apps/canvas-builder/util/tsUtils.d.ts +0 -3
  172. package/lib/composables/useDetailsView.d.ts +0 -19
  173. package/lib/types/templateActions.d.ts +0 -10
  174. package/lib/util/gesture.util.d.ts +0 -6
  175. package/types/openapi/models/AppsDBGlobalEntry.d.ts +0 -8
  176. package/types/openapi/models/AppsDBGlobalEntryRequest.d.ts +0 -3
  177. package/types/openapi/models/AppsDBUserEntry.d.ts +0 -9
  178. package/types/openapi/models/AppsDBUserEntryRequest.d.ts +0 -3
  179. package/types/openapi/models/CanvasSectionRetrieve.d.ts +0 -7
  180. package/types/openapi/models/CanvasSectionRetrieveRequest.d.ts +0 -5
  181. package/types/openapi/models/FileRequest.d.ts +0 -13
  182. package/types/openapi/models/InstanceStorageCredentials.d.ts +0 -6
  183. package/types/openapi/models/MiniAccount.d.ts +0 -4
  184. package/types/openapi/models/PSPDFKitAuthPayload.d.ts +0 -3
  185. package/types/openapi/models/PSPDFKitAuthPayloadRequest.d.ts +0 -3
  186. package/types/openapi/models/PSPDFKitToken.d.ts +0 -7
  187. package/types/openapi/models/PSPDFKitTokenRequest.d.ts +0 -3
  188. package/types/openapi/models/PaginatedCanvasListList.d.ts +0 -8
@@ -1,6 +1,54 @@
1
- import { ADMIN_MESSAGE_TYPES, AdminMessagePayloads } from './types.admin';
1
+ import { AdminToastRequest, ADMIN_MESSAGE_TYPES, AdminMessagePayloads } from './types.admin';
2
2
 
3
- export declare function on(type: (typeof ADMIN_MESSAGE_TYPES)[keyof typeof ADMIN_MESSAGE_TYPES], handler: (data: AdminMessagePayloads[typeof type]) => Promise<void>): Promise<() => void>;
4
- export * from './env.admin';
5
- export * from './canvas.admin';
6
- export * from './metadataTemplates.admin';
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
+ */
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
+ */
17
+ declare function toast(payload: AdminToastRequest): Promise<void>;
18
+ declare const _default: {
19
+ getAppConfig(payload: {
20
+ app_name: string;
21
+ }): Promise<Record<string, any>>;
22
+ getFile(payload: {
23
+ id: import('../../../../main.lib').File["id"];
24
+ }): Promise<import('../../../../main.lib').File>;
25
+ getFiles(payload: Record<string, any>): Promise<import('../../../../main.lib').PaginatedFileList>;
26
+ selectContent(payload: import('./types.admin').AdminSelectContentRequest): Promise<import('./types.admin').AdminSelectContentResponse>;
27
+ getInstanceMetadataTemplates(payload?: import('../../../payload.types').GetInstanceMetadataTemplatesPayload): Promise<import('../../../../main.lib').PaginatedMetadataTemplateList>;
28
+ createCanvas(payload: import('../../../../main.lib').CanvasCreateRequest): Promise<import('../../../../main.lib').CanvasRetrieve>;
29
+ getCanvases(payload: import('../../../../main.lib').GetCanvasesParams & {
30
+ filters?: Record<string, any>;
31
+ fields?: string;
32
+ }): Promise<import('../../../../main.lib').PaginatedData<import('../../../../main.lib').CanvasRetrieve>>;
33
+ getCanvas(payload: {
34
+ id: import('../../../../main.lib').CanvasRetrieve["id"];
35
+ fields?: string;
36
+ }): Promise<import('../../../../main.lib').CanvasRetrieve>;
37
+ updateCanvas(payload: import('../../../../main.lib').PatchedCanvasUpdateRequest & {
38
+ id: import('../../../../main.lib').CanvasRetrieve["id"];
39
+ instance_id?: import('../../../../main.lib').Instance["id"];
40
+ fields?: string;
41
+ }): Promise<import('../../../../main.lib').CanvasRetrieve>;
42
+ openCanvasOverlay(payload: {
43
+ id: import('../../../../main.lib').CanvasRetrieve["id"];
44
+ edit_mode?: boolean;
45
+ fullscreen?: boolean;
46
+ component_id?: string;
47
+ section_id?: string;
48
+ }): Promise<void>;
49
+ selectCanvases(payload?: import('./types.admin').AdminSelectCanvasesRequest): Promise<import('./types.admin').AdminSelectCanvasesResponse>;
50
+ getEnv(): Promise<import('./types.admin').AdminEnv>;
51
+ on: typeof on;
52
+ toast: typeof toast;
53
+ };
54
+ export default _default;
@@ -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>;
@@ -1,4 +1,7 @@
1
1
  import { PitcherEnv } from '../../../interfaces';
2
+ import { SelectedPage as ContentSelectorSelectedPage, SelectedFile as ContentSelectorSelectedFile } from '@content-selector/stores/app';
3
+ import { Canvas } from '../../../../../types/openapi';
4
+ import { CanvasSelection } from '@canvas-selector/appTypes';
2
5
 
3
6
  export declare const ADMIN_MESSAGE: "ADMIN_MESSAGE";
4
7
  export declare const ADMIN_MESSAGE_TYPES: {
@@ -10,37 +13,162 @@ export declare const ADMIN_API_TYPES: {
10
13
  };
11
14
  export declare const ADMIN_API_METHOD_TYPES: {
12
15
  readonly CREATE_CANVAS: "admin_create_canvas";
13
- readonly GET_ENV: "admin_get_env";
16
+ readonly GET_APP_CONFIG: "admin_get_app_config";
14
17
  readonly GET_CANVAS: "admin_get_canvas";
15
18
  readonly GET_CANVASES: "admin_get_canvases";
16
- readonly UPDATE_CANVAS: "admin_update_canvas";
19
+ readonly OPEN_CANVAS_OVERLAY: "admin_open_canvas_overlay";
20
+ readonly GET_ENV: "admin_get_env";
21
+ readonly GET_FILE: "admin_get_file";
22
+ readonly GET_FILES: "admin_get_files";
17
23
  readonly GET_INSTANCE_METADATA_TEMPLATES: "admin_get_instance_metadata_templates";
18
- readonly GET_APP_CONFIG: "admin_get_app_config";
24
+ readonly TOAST: "admin_toast";
25
+ readonly UPDATE_CANVAS: "admin_update_canvas";
26
+ readonly SELECT_CONTENT: "admin_select_content";
27
+ readonly SELECT_CANVASES: "admin_select_canvases";
19
28
  };
20
29
  export type AdminMessagePayloads = {
21
30
  [ADMIN_MESSAGE_TYPES.ENV_CHANGED]: AdminEnv;
22
31
  };
32
+ /**
33
+ * Represents an admin request with a specific payload.
34
+ * @template Payload - The type of the payload data.
35
+ */
23
36
  export type AdminRequest<Payload = any> = {
37
+ /**
38
+ * Unique identifier for the request.
39
+ */
24
40
  id: string;
41
+ /**
42
+ * Type of the admin API request.
43
+ */
25
44
  type: (typeof ADMIN_API_TYPES)['ADMIN_REQUEST'];
45
+ /**
46
+ * Body of the request containing the method type and payload data.
47
+ */
26
48
  body: {
49
+ /**
50
+ * Type of the admin API method.
51
+ */
27
52
  type: (typeof ADMIN_API_METHOD_TYPES)[keyof typeof ADMIN_API_METHOD_TYPES];
53
+ /**
54
+ * Payload data for the request.
55
+ */
28
56
  data: Payload;
29
57
  };
30
58
  };
59
+ /**
60
+ * Represents a request to show a toast notification.
61
+ */
62
+ export interface AdminToastRequest {
63
+ /**
64
+ * Type of the toast notification.
65
+ */
66
+ type: 'info' | 'error' | 'warning' | 'success' | 'loading';
67
+ /**
68
+ * Message to be displayed in the toast.
69
+ */
70
+ message: string;
71
+ /**
72
+ * Duration for which the toast should be displayed (optional).
73
+ */
74
+ duration?: number;
75
+ /**
76
+ * Indicates if the toast can be closed manually (optional).
77
+ */
78
+ closable?: boolean;
79
+ /**
80
+ * Indicates if the toast should remain visible when hovered over (optional).
81
+ */
82
+ keepAliveOnHover?: boolean;
83
+ /**
84
+ * Indicates if an icon should be shown in the toast (optional).
85
+ */
86
+ showIcon?: boolean;
87
+ }
88
+ /**
89
+ * Represents a request to select content.
90
+ */
91
+ export type AdminSelectContentRequest = {
92
+ /**
93
+ * List of selections to be made (optional).
94
+ */
95
+ selections?: Selection[];
96
+ };
97
+ /**
98
+ * Represents a response to a content selection request.
99
+ */
100
+ export type AdminSelectContentResponse = {
101
+ /**
102
+ * Action taken by the user.
103
+ */
104
+ user_action: 'cancelled' | 'selected';
105
+ /**
106
+ * Selected content, if any.
107
+ */
108
+ content?: (ContentSelectorSelectedFile | ContentSelectorSelectedPage)[];
109
+ };
110
+ export type AdminSelectCanvasesRequest = {
111
+ /** Array of selections */
112
+ selections?: CanvasSelection[];
113
+ allowed_types?: ('canvas' | 'canvas-template' | 'section' | 'section-template')[];
114
+ };
115
+ export type AdminSelectCanvasesResponse = {
116
+ /** User action result */
117
+ user_action: 'cancelled' | 'selected';
118
+ /** Selected canvases */
119
+ canvases?: Canvas[];
120
+ };
121
+ /**
122
+ * Represents an admin response with a specific payload.
123
+ * @template Response - The type of the response data.
124
+ */
31
125
  export type AdminResponse<Response = any> = {
126
+ /**
127
+ * Unique identifier for the response.
128
+ */
32
129
  id: string;
130
+ /**
131
+ * Type of the admin API response.
132
+ */
33
133
  type: (typeof ADMIN_API_TYPES)['ADMIN_RESPONSE'];
134
+ /**
135
+ * Body of the response containing the response data.
136
+ */
34
137
  body: Response;
35
138
  };
139
+ /**
140
+ * Represents an admin message with a specific payload.
141
+ * @template Payload - The type of the message data.
142
+ */
36
143
  export type AdminMessage<Payload = any> = {
144
+ /**
145
+ * Unique identifier for the message.
146
+ */
37
147
  id: string;
148
+ /**
149
+ * Type of the admin message.
150
+ */
38
151
  type: typeof ADMIN_MESSAGE;
152
+ /**
153
+ * Body of the message containing the message type and payload data.
154
+ */
39
155
  body: {
156
+ /**
157
+ * Type of the admin message.
158
+ */
40
159
  type: (typeof ADMIN_MESSAGE_TYPES)[keyof typeof ADMIN_MESSAGE_TYPES];
160
+ /**
161
+ * Payload data for the message.
162
+ */
41
163
  data: Payload;
42
164
  };
43
165
  };
166
+ /**
167
+ * Represents the admin environment.
168
+ */
44
169
  export type AdminEnv = {
170
+ /**
171
+ * Pitcher environment settings.
172
+ */
45
173
  pitcher: PitcherEnv['pitcher'];
46
174
  };
@@ -1,11 +1,11 @@
1
- import { Canvas, CanvasCreateRequest, PatchedCanvasUpdateRequest, SharedLink, Instance } from '../../../../types/openapi';
1
+ import { CanvasRetrieve, CanvasCreateRequest, PatchedCanvasUpdateRequest, SharedLink, Instance } from '../../../../types/openapi';
2
2
  import { GetCanvasesParams } from '../../../types/canvases';
3
3
  import { PaginatedData } from '../../../types/paginatedData';
4
4
 
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,20 +16,19 @@ 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>;
23
22
  fields?: string;
24
- }): Promise<PaginatedData<Canvas>>;
25
- export declare function createCanvas(payload: Omit<CanvasCreateRequest, 'instance_id'>): Promise<Canvas>;
23
+ }): Promise<PaginatedData<CanvasRetrieve>>;
24
+ export declare function createCanvas(payload: Omit<CanvasCreateRequest, 'instance_id'>): Promise<CanvasRetrieve>;
26
25
  export declare function deleteCanvas(payload: {
27
- id: Canvas['id'];
28
- }): Promise<Canvas>;
26
+ id: CanvasRetrieve['id'];
27
+ }): Promise<CanvasRetrieve>;
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,17 +39,16 @@ 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
- id: Canvas['id'];
44
+ id: CanvasRetrieve['id'];
47
45
  instance_id?: Instance['id'];
48
46
  fields?: string;
49
- }): Promise<Canvas>;
47
+ }): Promise<CanvasRetrieve>;
50
48
  export declare function getCanvas(payload: {
51
- id: Canvas['id'];
49
+ id: CanvasRetrieve['id'];
52
50
  fields?: string;
53
- }): Promise<Canvas>;
51
+ }): Promise<CanvasRetrieve>;
54
52
  export declare function shareCanvas(payload: {
55
- id: Canvas['id'];
53
+ id: CanvasRetrieve['id'];
56
54
  }): Promise<SharedLink>;
@@ -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. LaunchDarkly flags are omitted for now as they are not yet used.
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,16 @@
1
1
  import { DSR_MESSAGE_TYPES, DsrMessagePayloads } from './types.dsr';
2
2
 
3
- export declare function on(type: (typeof DSR_MESSAGE_TYPES)[keyof typeof DSR_MESSAGE_TYPES], handler: (data: DsrMessagePayloads[typeof type]) => Promise<void>): Promise<() => void>;
4
- export * from './env.dsr';
5
- export * from './loading.dsr';
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
+ */
10
+ declare function on(type: (typeof DSR_MESSAGE_TYPES)[keyof typeof DSR_MESSAGE_TYPES], handler: (data: DsrMessagePayloads[typeof type]) => Promise<void>): Promise<() => void>;
11
+ declare const _default: {
12
+ embeddableReady(): Promise<void>;
13
+ getEnv(): Promise<import('./types.dsr').DsrEnv>;
14
+ on: typeof on;
15
+ };
16
+ export default _default;
@@ -1 +1,7 @@
1
- export declare function embeddable_ready(): Promise<void>;
1
+ /**
2
+ * Signal to DSR that the app is ready to be shown.
3
+ *
4
+ * @example
5
+ * useDsr().embeddableReady()
6
+ */
7
+ export declare function embeddableReady(): 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>;
@@ -1,3 +1,6 @@
1
1
  import { SubmitUserFeedbackPayload } from '../../payload.types';
2
2
 
3
+ /**
4
+ * Submit user feedback
5
+ */
3
6
  export declare function submitUserFeedback(payload: SubmitUserFeedbackPayload): Promise<any>;
@@ -2,7 +2,10 @@ import { File, FileRetrieve, PaginatedFileList, FileUpdateRequest } from '../../
2
2
  import { GetRecentFilesPayload, ListFilesPayload } from '../../payload.types';
3
3
  import { AllFileCreateRequest, DeviceFile } from '../../../types/files';
4
4
 
5
- export declare function getFiles(payload: ListFilesPayload): Promise<PaginatedFileList>;
5
+ export declare function getFiles(payload: ListFilesPayload & {
6
+ filters?: Record<string, any>;
7
+ fields?: string;
8
+ }): Promise<PaginatedFileList>;
6
9
  export declare function getRecentFiles(payload?: GetRecentFilesPayload): Promise<File[]>;
7
10
  export declare function downloadFile(payload: {
8
11
  file_id: File['id'];
@@ -11,7 +14,8 @@ export declare function getAppConfig(payload: {
11
14
  app_name: string;
12
15
  }): Promise<Record<string, any>>;
13
16
  export declare function getFile(payload: {
14
- file_id: FileRetrieve['id'];
17
+ id?: FileRetrieve['id'];
18
+ file_id?: FileRetrieve['id'];
15
19
  }): Promise<FileRetrieve>;
16
20
  export declare function updateFile(payload: FileUpdateRequest & {
17
21
  id: File['id'];
@@ -23,9 +27,8 @@ export declare function createFile(payload: Omit<AllFileCreateRequest, 'instance
23
27
  /**
24
28
  * Dispatches iOS native file selector and returns the selected file.
25
29
  *
26
- * ```
30
+ * @example
27
31
  * // iOS only method to select a file from the device.
28
32
  * api.selectDeviceFile()
29
- * ```
30
33
  */
31
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: {
@@ -1,4 +1,10 @@
1
1
  import { OpenExternalUrlRequestPayload, OpenRequestPayload } from '../../payload.types';
2
2
 
3
+ /**
4
+ * Open a file in the CatalogIQ instance.
5
+ */
3
6
  export declare function open(payload?: OpenRequestPayload): Promise<string>;
7
+ /**
8
+ * Open external URL in a new tab. Works on both web and mobile.
9
+ */
4
10
  export declare function openExternalUrl(payload: OpenExternalUrlRequestPayload): Promise<void>;
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * Dispatches iOS only sync method for non-files.
3
3
  *
4
- * ```
4
+ * @example
5
5
  * // iOS only method to sync non-files from the server.
6
6
  * api.triggerNonFilesSync()
7
- * ```
8
7
  */
9
8
  export declare function triggerNonFilesSync(): Promise<void>;
@@ -1,3 +1,15 @@
1
1
  import { UiCaptureAppErrorRequest } from './types.ui';
2
2
 
3
- export declare function capture_app_error(payload: UiCaptureAppErrorRequest): Promise<void>;
3
+ /**
4
+ * Send an app error to Pitcher sentry instance.
5
+ *
6
+ * @example
7
+ * try {
8
+ * throw new Error('This is an error')
9
+ * } catch (error) {
10
+ * useUi().captureAppError(error)
11
+ * }
12
+ *
13
+ * @param payload error object to send to Pitcher sentry instance
14
+ */
15
+ export declare function captureAppError(payload: UiCaptureAppErrorRequest): Promise<void>;
@@ -1,9 +1,103 @@
1
- import { Canvas } from '../../../../../types/openapi';
2
- import { UiAppResizeRequest, UiCanvasNavigatePageReuqest, UiUpdateCanvasRequest } from './types.ui';
1
+ import { CanvasRetrieve } from '../../../../../types/openapi';
2
+ import { UiAppResizeRequest, UiCanvasNavigatePageRequest, UiUpdateCanvasRequest, UiSelectCanvasesRequest, UiSelectCanvasesResponse } from './types.ui';
3
3
 
4
- export declare function update_canvas(payload: UiUpdateCanvasRequest): Promise<Canvas>;
5
- export declare function app_loaded(): Promise<void>;
6
- export declare function app_resize(payload: UiAppResizeRequest): Promise<void>;
7
- export declare function canvas_navigate_next_page(): Promise<void>;
8
- export declare function canvas_navigate_previous_page(): Promise<void>;
9
- export declare function canvas_navigate_page(payload: UiCanvasNavigatePageReuqest): Promise<void>;
4
+ /**
5
+ * Modify the currently loaded canvas. On the web it sends
6
+ * an [update_canvas](https://pitcher.readme.io/reference/update_canvas) request to the server.
7
+ *
8
+ * @param payload parts of the canvas object to update with fields to return
9
+ */
10
+ export declare function updateCanvas(payload: UiUpdateCanvasRequest): Promise<CanvasRetrieve>;
11
+ /**
12
+ * Notify the CatalogIQ instance that the app is loaded and ready to get the data. Triggering this method will trigger
13
+ * the `on_app_set_data` event.
14
+ *
15
+ * @example
16
+ * @example
17
+ * useUi().appLoaded()
18
+ */
19
+ export declare function appLoaded(): Promise<void>;
20
+ /**
21
+ * Resize the app iframe to a given height.
22
+ *
23
+ * Note that initial iframe height comes from the `app.json` manifest file. It can also be adjusted by the user when adding
24
+ * app component to the canvas. In case when the app must be temporarily resized to show larger ui elements it can read the
25
+ * user-set height from the [on_app_set_data](#on-app-set-data) event.
26
+ * @param payload object containing requested height of the iframe as the number of pixels
27
+ */
28
+ export declare function appResize(payload: UiAppResizeRequest): Promise<void>;
29
+ /**
30
+ * Navigate to the next page in the current canvas. Noop if the current page is the last one.
31
+ *
32
+ * @example
33
+ * useUi().canvasNavigateNextPage()
34
+ */
35
+ export declare function canvasNavigateNextPage(): Promise<void>;
36
+ /**
37
+ * Navigate to the previous page in the current canvas. Noop if the current page is the first one.
38
+ *
39
+ * @example
40
+ * useUi().canvasNavigatePreviousPage()
41
+ */
42
+ export declare function canvasNavigatePreviousPage(): Promise<void>;
43
+ /**
44
+ * Navigate to a specific canvas place in the current canvas. Despite the event and parameter name, it takes the component
45
+ * id that we want to put in view.
46
+ *
47
+ * @example
48
+ * const uiApi = useUi() // our useApi()
49
+ *
50
+ * let activeCanvas = null
51
+ * const unsubscribe = uiApi.on_app_set_data((data) => {
52
+ * activeCanvas = data?.canvas
53
+ * })
54
+ *
55
+ * document.getElementById('my-button').addEventListener('click', () => {
56
+ * const target = activeCanvas?.content?.data?.find((i: any) => i.data.app_name === 'my-target-app-id') || null
57
+ * if (target) {
58
+ * uiApi.canvasNavigatePage({ page: target.id })
59
+ * }
60
+ * })
61
+ */
62
+ export declare function canvasNavigatePage(payload: UiCanvasNavigatePageRequest): Promise<void>;
63
+ /**
64
+ * Opens a modal to view a canvas by ID.
65
+ *
66
+ * ```
67
+ * onMounted(() => {
68
+ * uiApi.openCanvasOverlay({
69
+ * id: '01HH4RCBH631K4JDHWAQB0RPR6',
70
+ * edit_mode: false,
71
+ * fullscreen: true,
72
+ * })
73
+ * })
74
+ * ```
75
+ */
76
+ export declare function openCanvasOverlay(payload: {
77
+ id: CanvasRetrieve['id'];
78
+ edit_mode?: boolean;
79
+ fullscreen?: boolean;
80
+ component_id?: string;
81
+ section_id?: string;
82
+ }): Promise<void>;
83
+ /**
84
+ * Allows the user to select (and preselect) canvases from the instance.
85
+ *
86
+ * This method allows you to prompt the user to select canvases from the CatalogIQ
87
+ * instance and use that canvas selection in your application.
88
+ *
89
+ * @example
90
+ * const api = useApi() // or useUi() if you know that you 're in UI context
91
+ * api
92
+ * .selectCanvases({
93
+ * allowed_types: ['canvas','canvas-template','section','section-template'] // default ['canvas']
94
+ * selections: [
95
+ * { id: "01HCZ623YYRFJQ0F7B69VWE510" },
96
+ * { id: "02HCZ623YYRFJQ0F7B69VWE510" },
97
+ * ], // default []
98
+ * })
99
+ *
100
+ * @param payload optional payload to preselect specific canvases
101
+ * @returns Promise with the user action and selected canvases
102
+ */
103
+ export declare function selectCanvases(payload?: UiSelectCanvasesRequest): Promise<UiSelectCanvasesResponse>;