@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.
Files changed (98) hide show
  1. package/js-api.esm.js +101 -8
  2. package/js-api.esm.js.map +1 -1
  3. package/js-api.umd.min.js +10 -10
  4. package/js-api.umd.min.js.map +1 -1
  5. package/lib/apps/browser/stores/api.d.ts +164 -104
  6. package/lib/apps/browser/stores/app.d.ts +6 -1
  7. package/lib/apps/browser/stores/upload.d.ts +30 -30
  8. package/lib/apps/canvas-builder/composables/useCanvas.d.ts +508 -421
  9. package/lib/apps/canvas-builder/composables/useCanvasHistory.d.ts +86 -74
  10. package/lib/apps/canvas-builder/composables/useCanvasTheme.d.ts +18 -20
  11. package/lib/apps/canvas-builder/composables/useContentSelector.d.ts +5 -5
  12. package/lib/apps/canvas-builder/composables/useInstalledEmbeddables.d.ts +4 -1
  13. package/lib/apps/canvas-builder/types/canvas.d.ts +1 -0
  14. package/lib/apps/canvas-builder/util/canvas.util.d.ts +1 -0
  15. package/lib/apps/content-selector/stores/app.d.ts +8 -1
  16. package/lib/components/CFileViewer/CFileViewer.use.d.ts +2 -4
  17. package/lib/components/CFileViewer/CFileViewerFullScreen.use.d.ts +1 -1
  18. package/lib/components/filters/filter.util.d.ts +1 -1
  19. package/lib/composables/instanceTagsActions.use.d.ts +14 -0
  20. package/lib/composables/recentFiles.use.d.ts +1 -1
  21. package/lib/composables/suggestedTags.use.d.ts +3 -0
  22. package/lib/composables/tableColumnsSettings.use.d.ts +25 -0
  23. package/lib/composables/useCanvasOverlay.d.ts +4 -4
  24. package/lib/composables/useConfirmation.d.ts +1 -0
  25. package/lib/composables/useElementHeightResize.d.ts +5 -0
  26. package/lib/composables/useFiles.d.ts +11 -0
  27. package/lib/constants/pitcherSettings.const.d.ts +4 -0
  28. package/lib/main.lib.d.ts +23 -20
  29. package/lib/sdk/api/HighLevelApi.d.ts +95 -2
  30. package/lib/sdk/api/modules/admin/canvas.admin.d.ts +4 -8
  31. package/lib/sdk/api/modules/admin/env.admin.d.ts +3 -2
  32. package/lib/sdk/api/modules/admin/files.admin.d.ts +10 -10
  33. package/lib/sdk/api/modules/admin/index.d.ts +13 -0
  34. package/lib/sdk/api/modules/admin/metadataTemplates.admin.d.ts +1 -2
  35. package/lib/sdk/api/modules/admin/types.admin.d.ts +93 -0
  36. package/lib/sdk/api/modules/canvas.d.ts +2 -4
  37. package/lib/sdk/api/modules/dsr/env.dsr.d.ts +4 -3
  38. package/lib/sdk/api/modules/dsr/index.d.ts +7 -0
  39. package/lib/sdk/api/modules/dsr/loading.dsr.d.ts +6 -0
  40. package/lib/sdk/api/modules/env.d.ts +16 -0
  41. package/lib/sdk/api/modules/favorites.d.ts +9 -0
  42. package/lib/sdk/api/modules/feedback.d.ts +3 -0
  43. package/lib/sdk/api/modules/files.d.ts +1 -2
  44. package/lib/sdk/api/modules/folders.d.ts +29 -0
  45. package/lib/sdk/api/modules/open.d.ts +6 -0
  46. package/lib/sdk/api/modules/sync.d.ts +1 -2
  47. package/lib/sdk/api/modules/ui/app-errors.ui.d.ts +12 -0
  48. package/lib/sdk/api/modules/ui/canvas.ui.d.ts +53 -0
  49. package/lib/sdk/api/modules/ui/content.ui.d.ts +36 -3
  50. package/lib/sdk/api/modules/ui/index.d.ts +107 -0
  51. package/lib/sdk/api/modules/ui/loading.ui.d.ts +15 -0
  52. package/lib/sdk/api/modules/ui/location.ui.d.ts +17 -0
  53. package/lib/sdk/api/modules/ui/post-call.ui.d.ts +25 -0
  54. package/lib/sdk/api/modules/ui/types.ui.d.ts +59 -0
  55. package/lib/sdk/api/modules/users.d.ts +4 -0
  56. package/lib/sdk/interfaces.d.ts +117 -0
  57. package/lib/sdk/main.d.ts +67 -6
  58. package/lib/sdk/payload.types.d.ts +132 -0
  59. package/lib/types/app.d.ts +11 -0
  60. package/lib/types/filter.d.ts +5 -0
  61. package/lib/types/instanceSettings.types.d.ts +8 -2
  62. package/lib/types/launchDarkly.types.d.ts +4 -4
  63. package/lib/types/organizationSettings.types.d.ts +4 -0
  64. package/lib/types/recentFiles.types.d.ts +4 -1
  65. package/lib/types/users.d.ts +13 -0
  66. package/lib/util/fullscreen.util.d.ts +1 -1
  67. package/lib/util/string.d.ts +1 -0
  68. package/package.json +1 -1
  69. package/types/openapi/index.d.ts +4 -5
  70. package/types/openapi/models/AccessTypeEnum.d.ts +3 -1
  71. package/types/openapi/models/Canvas.d.ts +1 -0
  72. package/types/openapi/models/CanvasCreate.d.ts +1 -0
  73. package/types/openapi/models/CanvasCreateRequest.d.ts +1 -0
  74. package/types/openapi/models/CanvasRetrieve.d.ts +1 -0
  75. package/types/openapi/models/CanvasUpdate.d.ts +1 -0
  76. package/types/openapi/models/CanvasUpdateRequest.d.ts +1 -0
  77. package/types/openapi/models/DeletedCanvas.d.ts +1 -0
  78. package/types/openapi/models/DeletedFolder.d.ts +3 -3
  79. package/types/openapi/models/Folder.d.ts +3 -3
  80. package/types/openapi/models/FolderCanvas.d.ts +11 -0
  81. package/types/openapi/models/FolderCreate.d.ts +7 -7
  82. package/types/openapi/models/FolderCreateRequest.d.ts +3 -2
  83. package/types/openapi/models/FolderFile.d.ts +2 -0
  84. package/types/openapi/models/FolderFolder.d.ts +4 -2
  85. package/types/openapi/models/FolderRetrieve.d.ts +7 -8
  86. package/types/openapi/models/FolderRule.d.ts +7 -0
  87. package/types/openapi/models/FolderRuleRequest.d.ts +7 -0
  88. package/types/openapi/models/FolderUpdate.d.ts +7 -8
  89. package/types/openapi/models/FolderUpdateRequest.d.ts +2 -0
  90. package/types/openapi/models/OperatorEnum.d.ts +64 -0
  91. package/types/openapi/models/PatchedCanvasUpdateRequest.d.ts +1 -0
  92. package/types/openapi/models/PatchedFolderUpdateRequest.d.ts +2 -0
  93. package/lib/composables/useDetailsView.d.ts +0 -19
  94. package/types/openapi/models/FileRequest.d.ts +0 -16
  95. package/types/openapi/models/PSPDFKitAuthPayload.d.ts +0 -3
  96. package/types/openapi/models/PSPDFKitAuthPayloadRequest.d.ts +0 -3
  97. package/types/openapi/models/PSPDFKitToken.d.ts +0 -7
  98. package/types/openapi/models/PSPDFKitTokenRequest.d.ts +0 -3
@@ -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
+ /**
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().capture_app_error(error)
11
+ * }
12
+ *
13
+ * @param payload error object to send to Pitcher sentry instance
14
+ */
3
15
  export declare function capture_app_error(payload: UiCaptureAppErrorRequest): Promise<void>;
@@ -1,11 +1,64 @@
1
1
  import { CanvasRetrieve } from '../../../../../types/openapi';
2
2
  import { UiAppResizeRequest, UiCanvasNavigatePageReuqest, UiUpdateCanvasRequest } from './types.ui';
3
3
 
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
+ */
4
10
  export declare function update_canvas(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().app_loaded()
18
+ */
5
19
  export declare function app_loaded(): 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
+ */
6
28
  export declare function app_resize(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().canvas_navigate_next_page()
34
+ */
7
35
  export declare function canvas_navigate_next_page(): 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().canvas_navigate_previous_page()
41
+ */
8
42
  export declare function canvas_navigate_previous_page(): 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.canvas_navigate_page({ page: target.id })
59
+ * }
60
+ * })
61
+ */
9
62
  export declare function canvas_navigate_page(payload: UiCanvasNavigatePageReuqest): Promise<void>;
10
63
  /**
11
64
  * Opens a modal to view a canvas by ID.
@@ -1,9 +1,17 @@
1
1
  import { UiSelectContentRequest, UiSelectContentResponse, UiOpenRequest, UiToastRequest, UiPreselectSfdcMeetingIdRequest, UiPreselectSfdcMeetingIdResponse } from './types.ui';
2
2
 
3
+ /**
4
+ * @hidden
5
+ * @deprecated
6
+ */
3
7
  export declare function ui_select_content(payload?: UiSelectContentRequest): Promise<UiSelectContentResponse>;
4
8
  /**
5
- * Allows you to select (and preselect) content from your Pitcher content.
6
- * ```
9
+ * Allows the user to select (and preselect) content from the instance.
10
+ *
11
+ * Opens the content selector dialog to allow the user to select content and handle the outcome. This method allows you to
12
+ * prompt the user to select content from the CatalogIQ instance and use that content in your application.
13
+ *
14
+ * @example
7
15
  * const api = useApi() // or useUi() if you know that you 're in UI context
8
16
  * api
9
17
  * .select_content({
@@ -16,9 +24,34 @@ export declare function ui_select_content(payload?: UiSelectContentRequest): Pro
16
24
  * },
17
25
  * ],
18
26
  * })
19
- * ```
27
+ *
28
+ * @param payload optional payload to preselect speciffic content
29
+ * @returns Promise with the user action and selected content
20
30
  */
21
31
  export declare function select_content(payload?: UiSelectContentRequest): Promise<UiSelectContentResponse>;
32
+ /**
33
+ * Open a file in the CatalogIQ instance.
34
+ */
22
35
  export declare function open(payload: UiOpenRequest): Promise<void>;
36
+ /**
37
+ * Show a toast message to the user.
38
+ *
39
+ * @example
40
+ * useUi().toast({ type: 'info', message: 'Hello, world!' })
41
+ */
23
42
  export declare function toast(payload: UiToastRequest): Promise<void>;
43
+ /**
44
+ * Preselect a meeting in the top meeting bar by Salesforce Meeting ID. From there, the user can easily start the meeting
45
+ * with a single click.
46
+ *
47
+ * @example
48
+ * const objectFetchedFromSalesforce = {
49
+ * // fetch dynamiccaly from Salesforce or provide in another way
50
+ * EventId: '00U1r00000D1J1zEAF',
51
+ * }
52
+ * ui.preselect_sfdc_meeting_id({ eventId: objectFetchedFromSalesforce.EventId }).then((response) => {
53
+ * // e.g. display advanced meeting details inside your app
54
+ * console.log(response.event)
55
+ * })
56
+ */
24
57
  export declare function preselect_sfdc_meeting_id(payload: UiPreselectSfdcMeetingIdRequest): Promise<UiPreselectSfdcMeetingIdResponse>;
@@ -1,14 +1,121 @@
1
1
  import { UiMeetingCanceledPayload, UiCanvasUpdatedPayload, UiSectionListUpdatedPayload, UiAppSetDataPayload, UiAppUpdateDataPayload, UiBroadcastRequest, UiMessagePayloads } from './types.ui';
2
2
 
3
+ /**
4
+ * Subscribe to a given event type by its key.
5
+ *
6
+ * @example
7
+ * const unsubscribeFromSectionListUpdate = useUi().on('ui_section_list_updated', (event: object) => {
8
+ * // handle event
9
+ * })
10
+ *
11
+ * // later
12
+ * unsubscribeFromSectionListUpdate.then(unsubscribe => unsubscribe())
13
+ *
14
+ * @param type The event type/key to subscribe to.
15
+ * @param handler The handler function to call when the event is emitted.
16
+ * @returns A Promise resolving to a cleanup function to unsubscribe from the event.
17
+ */
3
18
  declare function on<T extends keyof UiMessagePayloads>(type: T, handler: (data: UiMessagePayloads[T]) => Promise<void>): Promise<() => void>;
19
+ /**
20
+ * Subscribe to the meeting canceled event.
21
+ *
22
+ * @example
23
+ * const unsubscribeFromMeetingCanceled = useUi().on_meeting_canceled((event: {
24
+ * accountId?: string;
25
+ * eventId?: string;
26
+ * }) => {
27
+ * // handle event
28
+ * })
29
+ *
30
+ * // later
31
+ * unsubscribeFromMeetingCanceled.then(cancel => cancel())
32
+ *
33
+ * @param handler
34
+ * @returns A Promise resolving to a cleanup function to unsubscribe from the event.
35
+ */
4
36
  declare function on_meeting_canceled(handler: (data: UiMeetingCanceledPayload) => Promise<void>): Promise<() => void>;
37
+ /**
38
+ * Subscribe to the canvas updated event. It is triggered when the current canvas of the app is updated.
39
+ *
40
+ * @example
41
+ * const unsubscribePromise = useUi().on_canvas_updated((event: { canvas }) => {
42
+ * // handle event
43
+ * })
44
+ *
45
+ * // later
46
+ * unsubscribePromise.then(unsubscribe => unsubscribe())
47
+ *
48
+ * @returns A Promise resolving to a cleanup function to unsubscribe from the event.
49
+ */
5
50
  declare function on_canvas_updated(handler: (data: UiCanvasUpdatedPayload) => Promise<void>): Promise<() => void>;
51
+ /**
52
+ * Subscribe to the section list updated event. It is triggered when the list of sections (products) in the current canvas
53
+ * is updated.
54
+ *
55
+ * @example
56
+ * const unsubscribePromise = useUi().on_section_list_updated((event: { canvas }) => {
57
+ * // handle event
58
+ * })
59
+ *
60
+ * // later
61
+ * unsubscribePromise.then(unsubscribe => unsubscribe())
62
+ *
63
+ * @returns A Promise resolving to a cleanup function to unsubscribe from the event.
64
+ */
6
65
  declare function on_section_list_updated(handler: (data: UiSectionListUpdatedPayload) => Promise<void>): Promise<() => void>;
66
+ /**
67
+ * Subscribe to the app set data event. It is triggered when the app data is set. This event is triggered when the app is
68
+ * loaded and in certain other cases after loading.
69
+ *
70
+ * This is the main event for the canvas app to receive data from the CatalogIQ instance and know about its environment.
71
+ *
72
+ * @example
73
+ * let user = null
74
+ * let isEditMode = null
75
+ * let activeCanvas = null
76
+ * let isPrintMode = false
77
+ * const unsubscribePromise = useUi().on_app_set_data((data) => {
78
+ * user = data?.user
79
+ * isEditMode = data?.is_edit_mode
80
+ * activeCanvas = data?.canvas
81
+ * isPrintMode = data?.display_mode === 'print' || data?.client === 'dsr'
82
+ * // ...mode logic...
83
+ * })
84
+ *
85
+ * // later
86
+ * unsubscribePromise.then(unsubscribe => unsubscribe())
87
+ *
88
+ * @returns A Promise resolving to a cleanup function to unsubscribe from the event.
89
+ */
7
90
  declare function on_app_set_data(handler: (data: UiAppSetDataPayload) => Promise<void>): Promise<() => void>;
91
+ /**
92
+ * Subscribe to the app update data event. It is triggered when the user changes from edit mode to view mode or vice versa
93
+ * and when the call is started or ended.
94
+ *
95
+ * @example
96
+ * let inCall = false
97
+ * let isEditMode = false
98
+ * const unsubscribePromise = useUi().on_app_update_data((data) => {
99
+ * isEditMode = data?.is_edit_mode
100
+ * inCall = data?.in_call
101
+ * // ...mode logic...
102
+ * })
103
+ *
104
+ * // later
105
+ * unsubscribePromise.then(unsubscribe => unsubscribe())
106
+ *
107
+ * @returns A Promise resolving to a cleanup function to unsubscribe from the event.
108
+ */
8
109
  declare function on_app_update_data(handler: (data: UiAppUpdateDataPayload) => Promise<void>): Promise<() => void>;
110
+ /**
111
+ * Broadcast event to the UI. Hidden from the documentation.
112
+ *
113
+ * @hidden
114
+ */
9
115
  declare function ui_broadcast(payload: UiBroadcastRequest): Promise<void>;
10
116
  declare const _default: {
11
117
  complete_postcall(payload: import('../../../../main.lib').UiCompletePostcallRequest): Promise<void>;
118
+ stop_meeting(): Promise<void>;
12
119
  enable_postcall_submit(): Promise<void>;
13
120
  disable_postcall_submit(): Promise<void>;
14
121
  set_postcall_style(payload: import('../../../../main.lib').UiSetPostcallStyleRequest): Promise<void>;
@@ -1 +1,16 @@
1
+ /**
2
+ * Notify the CatalogIQ instance that the app is loaded. This method should be called when the app is fully loaded and
3
+ * ready to be displayed.
4
+ *
5
+ * ::: warning
6
+ * This method is deprecated. If you find yourself needing it, contact the Pitcher team.
7
+ * :::
8
+ *
9
+ * [//]: # 'TODO: Is this even needed today? We should probably remove it'
10
+ *
11
+ * @example
12
+ * useUi().embeddable_ready()
13
+ *
14
+ * @deprecated
15
+ */
1
16
  export declare function embeddable_ready(): Promise<void>;
@@ -1,3 +1,20 @@
1
1
  import { UpdateLocationPitcherEvent } from '../../../interfaces';
2
2
 
3
+ /**
4
+ * Navigate to another page in the CatalogIQ instance.
5
+ *
6
+ * [//]: # 'TODO: This is a very powerful event, we need to expand documentation here'
7
+ *
8
+ * @example
9
+ * const canvasId = '1234567890abcdef12345678' // obtain target canvasId
10
+ * useUi().update_location({
11
+ * action: 'restore',
12
+ * routes: {
13
+ * 'slotty-ui': {
14
+ * path: '/canvases/saved-canvases/' + canvasId + '/build/present',
15
+ * query: {},
16
+ * },
17
+ * },
18
+ * })
19
+ */
3
20
  export declare function update_location(payload: UpdateLocationPitcherEvent): Promise<any>;
@@ -1,6 +1,31 @@
1
1
  import { UiCompletePostcallRequest, UiSetPostcallStyleRequest } from './types.ui';
2
2
 
3
3
  export declare function complete_postcall(payload: UiCompletePostcallRequest): Promise<void>;
4
+ /**
5
+ * Ends current meeting and shows postcall form.
6
+ *
7
+ * @example
8
+ * useUi().stop_meeting()
9
+ */
10
+ export declare function stop_meeting(): Promise<void>;
11
+ /**
12
+ * Mark the postcall form as possible to submit by the user.
13
+ *
14
+ * @example
15
+ * useUi().enable_postcall_submit()
16
+ */
4
17
  export declare function enable_postcall_submit(): Promise<void>;
18
+ /**
19
+ * Mark the postcall form as **not** possible to submit by the user. Useful while processing the form data.
20
+ *
21
+ * @example
22
+ * useUi().disable_postcall_submit()
23
+ */
5
24
  export declare function disable_postcall_submit(): Promise<void>;
25
+ /**
26
+ * Change the height of the postcall form.
27
+ *
28
+ * @example
29
+ * useUi().set_postcall_style({ height: 100 })
30
+ */
6
31
  export declare function set_postcall_style(payload: UiSetPostcallStyleRequest): Promise<void>;
@@ -21,6 +21,7 @@ export declare const UI_API_METHOD_TYPES: {
21
21
  readonly UI_ENABLE_POSTCALL_SUBMIT: "ui_enable_postcall_submit";
22
22
  readonly UI_DISABLE_POSTCALL_SUBMIT: "ui_disable_postcall_submit";
23
23
  readonly UI_COMPLETE_POSTCALL: "ui_complete_postcall";
24
+ readonly UI_STOP_MEETING: "ui_stop_meeting";
24
25
  readonly UI_CANVAS_NAVIGATE_NEXT_PAGE: "ui_canvas_navigate_next_page";
25
26
  readonly UI_CANVAS_NAVIGATE_PREVIOUS_PAGE: "ui_canvas_navigate_previous_page";
26
27
  readonly UI_CANVAS_NAVIGATE_PAGE: "ui_canvas_navigate_page";
@@ -37,39 +38,75 @@ export declare const UI_MESSAGE_TYPES: {
37
38
  export declare const UI_NATIVE_MESSAGE_TYPES: readonly ["ui_app_set_data", "ui_app_update_data", "ui_canvas_updated"];
38
39
  export type UiBroadcastRequest = Record<string, any>;
39
40
  export type UiSelectContentRequest = {
41
+ /** Array of selections */
40
42
  selections?: Selection[];
41
43
  };
42
44
  export type UiSelectContentResponse = {
45
+ /** User action result */
43
46
  user_action: 'cancelled' | 'selected';
47
+ /** Selected content */
44
48
  content?: (ContentSelectorSelectedFile | ContentSelectorSelectedPage)[];
45
49
  };
50
+ /**
51
+ * Error object to send to Pitcher sentry instance
52
+ */
46
53
  export type UiCaptureAppErrorRequest = Record<string, any>;
47
54
  export type UiUpdateCanvasRequest = Mutable<CanvasRetrieve> & {
55
+ /** Comma-separated list of field keys to return from the server */
48
56
  fields?: string;
49
57
  };
50
58
  export type UiOpenRequest = OpenRequestPayload;
51
59
  export type UiCompletePostcallRequest = {
60
+ /** Indicates if the postcall was successfully submitted */
52
61
  was_successfully_submitted?: boolean;
53
62
  };
54
63
  export type UiSetPostcallStyleRequest = Record<string, any>;
55
64
  export type UiAppResizeRequest = {
65
+ /** Requested height as the number of pixels */
56
66
  height: number;
57
67
  };
58
68
  export type UiCanvasNavigatePageReuqest = {
69
+ /** The id of the component we want to navigate to */
59
70
  page: ComponentNode['id'];
60
71
  };
61
72
  export interface UiToastRequest {
73
+ /**
74
+ * Type of the toast, influences the default icon
75
+ * @defaultValue **REQUIRED**
76
+ */
62
77
  type: 'info' | 'error' | 'warning' | 'success' | 'loading';
78
+ /**
79
+ * Text to show inside the toast
80
+ * @defaultValue **REQUIRED**
81
+ */
63
82
  message: string;
83
+ /**
84
+ * Optional, value in milliseconds
85
+ * @defaultValue 3500
86
+ */
64
87
  duration?: number;
88
+ /**
89
+ * Visibility of the close button, default is true
90
+ * @defaultValue true
91
+ */
65
92
  closable?: boolean;
93
+ /**
94
+ * Toast won't be hidden as long as it is hovered
95
+ * @defaultValue true
96
+ */
66
97
  keepAliveOnHover?: boolean;
98
+ /**
99
+ * Set to `false` to hide the icon
100
+ * @defaultValue true
101
+ */
67
102
  showIcon?: boolean;
68
103
  }
69
104
  export interface UiPreselectSfdcMeetingIdRequest {
105
+ /** Salesforce Meeting ID */
70
106
  eventId: string;
71
107
  }
72
108
  export interface UiPreselectSfdcMeetingIdResponse {
109
+ /** Salesforce Event */
73
110
  event: SfEvent | null;
74
111
  }
75
112
  export type UiMessagePayloads = {
@@ -80,36 +117,58 @@ export type UiMessagePayloads = {
80
117
  [UI_MESSAGE_TYPES.UI_SECTION_LIST_UPDATED]: UiSectionListUpdatedPayload;
81
118
  };
82
119
  export type UiMessageEnvelope<T extends (typeof UI_MESSAGE_TYPES)[keyof typeof UI_MESSAGE_TYPES] = (typeof UI_MESSAGE_TYPES)[keyof typeof UI_MESSAGE_TYPES]> = {
120
+ /** Message type */
83
121
  type: T;
122
+ /** Message body */
84
123
  body: UiMessagePayloads[T];
85
124
  };
86
125
  export type UiMeetingCanceledPayload = {
126
+ /** Account ID */
87
127
  accountId?: string;
128
+ /** Event ID */
88
129
  eventId?: string;
89
130
  };
90
131
  export type UiAppSetDataPayload = {
132
+ /** Client name */
91
133
  client: string | null;
134
+ /** Platform name */
92
135
  platform: string | undefined;
136
+ /** User information */
93
137
  user: User | null;
138
+ /** Edit mode status */
94
139
  is_edit_mode: boolean;
140
+ /** Call status */
95
141
  in_call: boolean;
142
+ /** Canvas data */
96
143
  canvas: CanvasRetrieve;
144
+ /** Section used in canvas */
97
145
  used_in_section: CanvasSection | null;
146
+ /** Component ID */
98
147
  component_id: string;
148
+ /** Embeddable settings */
99
149
  settings: EmbeddableProps['settings'] | null;
150
+ /** Width of the canvas */
100
151
  width: string | undefined;
152
+ /** Height of the canvas */
101
153
  height: string | undefined;
154
+ /** Display mode */
102
155
  display_mode: string | undefined;
103
156
  };
104
157
  export type UiAppUpdateDataPayload = {
158
+ /** Call status */
105
159
  in_call: boolean;
160
+ /** Edit mode status */
106
161
  is_edit_mode: boolean;
107
162
  };
108
163
  export type UiCanvasUpdatedPayload = {
164
+ /** Canvas data */
109
165
  canvas: CanvasRetrieve;
110
166
  };
111
167
  export type UiSectionListUpdatedPayload = {
168
+ /** List of section IDs */
112
169
  section_list_ids: string[];
170
+ /** Section list component ID */
113
171
  section_list_component_id: string;
172
+ /** Canvas data */
114
173
  canvas: CanvasRetrieve | null;
115
174
  };
@@ -3,5 +3,9 @@ import { PaginatedData } from '../../../types/paginatedData';
3
3
  import { User } from '../../../../types/openapi';
4
4
 
5
5
  export declare function getUsers(payload?: GetUsersParams): Promise<PaginatedData<User>>;
6
+ /**
7
+ * Ask for a refreshed Salesforce token. In case the token hasn't expired yet, this method will return the same token as the current one found in the (`getEnv`)[#getenv] result.
8
+ * @returns Promise resolving to an object containing the token
9
+ */
6
10
  export declare function refreshServiceToken(payload?: RefreshServiceTokenRequest): Promise<RefreshServiceTokenResponse>;
7
11
  export declare function refreshAccessToken(): any;
@@ -111,54 +111,171 @@ export declare enum PitcherExternalEventName {
111
111
  OPEN_CANVAS = "open_canvas",
112
112
  START_CALL = "start_call"
113
113
  }
114
+ /**
115
+ * Base interface for update location actions.
116
+ */
114
117
  interface UpdateLocation {
118
+ /**
119
+ * The action to be performed.
120
+ */
115
121
  action: string;
116
122
  }
123
+ /**
124
+ * Represents a route in the location.
125
+ */
117
126
  export interface LocationRoute {
127
+ /**
128
+ * The path of the route.
129
+ */
118
130
  path: string;
131
+ /**
132
+ * The query parameters of the route.
133
+ */
119
134
  query: Record<string, any>;
135
+ /**
136
+ * Indicates if the route is being restored.
137
+ */
120
138
  is_restoring: boolean;
139
+ /**
140
+ * Indicates if the route is mounted.
141
+ */
121
142
  is_mounted: boolean;
122
143
  }
144
+ /**
145
+ * A record of location routes.
146
+ */
123
147
  export type LocationRoutes = Record<string, LocationRoute>;
148
+ /**
149
+ * Interface for the 'register' update location action.
150
+ */
124
151
  export interface UpdateLocationOnRegister extends UpdateLocation {
152
+ /**
153
+ * The action type.
154
+ */
125
155
  action: 'register';
156
+ /**
157
+ * The child application identifier.
158
+ */
126
159
  child_app: string;
160
+ /**
161
+ * The parent application identifier (optional).
162
+ */
127
163
  parent_app?: string;
164
+ /**
165
+ * The path of the route (optional).
166
+ */
128
167
  path?: string;
168
+ /**
169
+ * The query parameters of the route (optional).
170
+ */
129
171
  query?: Record<string, any>;
130
172
  }
173
+ /**
174
+ * Interface for the 'unregister' update location action.
175
+ */
131
176
  export interface UpdateLocationOnUnregister extends UpdateLocation {
177
+ /**
178
+ * The action type.
179
+ */
132
180
  action: 'unregister';
181
+ /**
182
+ * The application identifier.
183
+ */
133
184
  app: string;
134
185
  }
186
+ /**
187
+ * Interface for the 'update' update location action.
188
+ */
135
189
  export interface UpdateLocationOnUpdate extends UpdateLocation {
190
+ /**
191
+ * The action type.
192
+ */
136
193
  action: 'update';
194
+ /**
195
+ * The routes to be updated.
196
+ */
137
197
  routes: Record<string, Omit<LocationRoute, 'is_restoring' | 'is_mounted'>>;
138
198
  }
199
+ /**
200
+ * Interface for the 'mounted' update location action.
201
+ */
139
202
  export interface UpdateLocationOnMounted extends UpdateLocation {
203
+ /**
204
+ * The action type.
205
+ */
140
206
  action: 'mounted';
207
+ /**
208
+ * The application identifier.
209
+ */
141
210
  app: string;
142
211
  }
212
+ /**
213
+ * Interface for the 'restore' update location action.
214
+ */
143
215
  export interface UpdateLocationOnRestore extends UpdateLocation {
216
+ /**
217
+ * The action type.
218
+ */
144
219
  action: 'restore';
220
+ /**
221
+ * The routes to be restored.
222
+ */
145
223
  routes: Record<string, Omit<LocationRoute, 'is_mounted'>>;
146
224
  }
225
+ /**
226
+ * Interface for the 'restore_completed' update location action.
227
+ */
147
228
  export interface UpdateLocationOnRestoreCompleted extends UpdateLocation {
229
+ /**
230
+ * The action type.
231
+ */
148
232
  action: 'restore_completed';
233
+ /**
234
+ * The application identifier.
235
+ */
149
236
  app: string;
237
+ /**
238
+ * The path of the route.
239
+ */
150
240
  path: string;
241
+ /**
242
+ * The query parameters of the route.
243
+ */
151
244
  query: Record<string, any>;
152
245
  }
246
+ /**
247
+ * Interface for the 'get_routes_request' update location action.
248
+ */
153
249
  export interface UpdateLocationOnGetRoutesRequest extends UpdateLocation {
250
+ /**
251
+ * The action type.
252
+ */
154
253
  action: 'get_routes_request';
254
+ /**
255
+ * The application identifier.
256
+ */
155
257
  app: string;
156
258
  }
259
+ /**
260
+ * Interface for the 'get_routes_response' update location action.
261
+ */
157
262
  export interface UpdateLocationOnGetRoutesResponse extends UpdateLocation {
263
+ /**
264
+ * The action type.
265
+ */
158
266
  action: 'get_routes_response';
267
+ /**
268
+ * The application identifier.
269
+ */
159
270
  app: string;
271
+ /**
272
+ * The routes in the response.
273
+ */
160
274
  routes: LocationRoutes;
161
275
  }
276
+ /**
277
+ * Union type for all update location pitcher events.
278
+ */
162
279
  export type UpdateLocationPitcherEvent = UpdateLocationOnUnregister | UpdateLocationOnRestore | UpdateLocationOnUpdate | UpdateLocationOnRegister | UpdateLocationOnRestoreCompleted | UpdateLocationOnMounted | UpdateLocationOnGetRoutesRequest | UpdateLocationOnGetRoutesResponse;
163
280
  export interface PitcherEventMap {
164
281
  [PitcherEventName.ENV_CHANGED]: PitcherEnv;