@pitcher/js-api 1.28.0 → 1.30.0

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 (90) hide show
  1. package/js-api.esm.js +477 -44
  2. package/js-api.esm.js.map +1 -1
  3. package/js-api.umd.min.js +32 -11
  4. package/js-api.umd.min.js.map +1 -1
  5. package/lib/ai-tasks/__tests__/weekly-focus.spec.d.ts +1 -0
  6. package/lib/ai-tasks/weekly-focus.d.ts +241 -0
  7. package/lib/apps/browser/appTypes.d.ts +28 -0
  8. package/lib/apps/browser/stores/api.d.ts +6 -1
  9. package/lib/apps/browser/stores/app.d.ts +5 -0
  10. package/lib/apps/browser/stores/app.selectionPruneScope.test.d.ts +1 -0
  11. package/lib/apps/browser/stores/upload.d.ts +26 -1
  12. package/lib/apps/browser/stores/upload.types.d.ts +9 -0
  13. package/lib/apps/browser/util/lifecycle.d.ts +57 -0
  14. package/lib/apps/browser/util/lifecycle.test.d.ts +1 -0
  15. package/lib/apps/canvas-builder/components/ui/DynamicContent/useDynamicContent.d.ts +2 -0
  16. package/lib/apps/canvas-builder/components/ui/Multimedia/Multimedia.ldAsset.spec.d.ts +1 -0
  17. package/lib/apps/canvas-builder/composables/useCanvas.d.ts +203 -1
  18. package/lib/apps/canvas-builder/composables/useCanvas.saveEcho.spec.d.ts +1 -0
  19. package/lib/apps/canvas-builder/composables/useCanvasBlocks.d.ts +36 -0
  20. package/lib/apps/canvas-builder/composables/useCanvasExit.d.ts +1 -0
  21. package/lib/apps/canvas-builder/composables/useCanvasHistory.d.ts +36 -0
  22. package/lib/apps/canvas-builder/composables/useCanvasTheme.d.ts +20 -18
  23. package/lib/apps/canvas-builder/composables/useContentSelector.d.ts +8 -1
  24. package/lib/apps/canvas-builder/composables/useInstalledEmbeddables.d.ts +1 -1
  25. package/lib/apps/canvas-builder/composables/useNavigatorDrawer.d.ts +2 -0
  26. package/lib/apps/canvas-builder/composables/usePopupApps.d.ts +2 -0
  27. package/lib/apps/canvas-builder/types/canvas.d.ts +53 -3
  28. package/lib/apps/canvas-builder/util/canvas.util.d.ts +8 -0
  29. package/lib/apps/canvas-builder/util/completionWizard.util.d.ts +107 -0
  30. package/lib/apps/canvas-builder/util/completionWizard.util.test.d.ts +1 -0
  31. package/lib/apps/canvas-builder/util/fullscreenMode.util.d.ts +7 -0
  32. package/lib/apps/canvas-builder/util/fullscreenMode.util.test.d.ts +1 -0
  33. package/lib/apps/canvas-builder/util/lazySections.util.d.ts +35 -0
  34. package/lib/apps/canvas-builder/util/lazySections.util.test.d.ts +1 -0
  35. package/lib/apps/collection-player/composables/collection-navigation.util.d.ts +27 -0
  36. package/lib/apps/collection-player/composables/collection-navigation.util.spec.d.ts +1 -0
  37. package/lib/apps/collection-player/stores/app.store.d.ts +3 -0
  38. package/lib/apps/content-selector/components/Assets.uploaderRefresh.spec.d.ts +1 -0
  39. package/lib/apps/content-selector/stores/app.d.ts +1 -1
  40. package/lib/components/CFileViewer/pdf/CFileViewer.pdf.annotations.use.d.ts +5 -1
  41. package/lib/components/CFileViewer/pdf/CFileViewer.pdf.formFields.use.d.ts +8 -0
  42. package/lib/components/CFileViewer/pdf/CFileViewer.pdf.link.use.d.ts +1 -1
  43. package/lib/components/CFileViewer/pdf/CFileViewer.pdf.overlayItems.use.d.ts +1 -1
  44. package/lib/components/CFileViewer/pdf/CFileViewer.pdf.use.d.ts +4 -9
  45. package/lib/components/CFileViewer/pdf/CFileViewer.pdf.util.d.ts +1 -1
  46. package/lib/components/CFileViewer/pdf/CFileViewerFullscreen.pdf.use.d.ts +1 -1
  47. package/lib/components/CFileViewer/pdf/__tests__/CFileViewer.pdf.annotations.text.test.d.ts +1 -0
  48. package/lib/components/savedCanvases/CSavedCanvasesManagement.use.d.ts +1 -0
  49. package/lib/composables/useCourseOnlyApps.d.ts +1 -1
  50. package/lib/composables/usePdfInterpolation.d.ts +2 -2
  51. package/lib/composables/useWindowEvents.d.ts +1 -1
  52. package/lib/constants/cdp.const.d.ts +1 -0
  53. package/lib/constants/translationLanguages.const.d.ts +72 -0
  54. package/lib/main.lib.d.ts +2 -0
  55. package/lib/sdk/api/HighLevelApi.d.ts +26 -9
  56. package/lib/sdk/api/modules/admin/types.admin.d.ts +1 -0
  57. package/lib/sdk/api/modules/ai.d.ts +43 -1
  58. package/lib/sdk/api/modules/ai.spec.d.ts +1 -0
  59. package/lib/sdk/api/modules/canvas.d.ts +8 -0
  60. package/lib/sdk/api/modules/index.d.ts +2 -1
  61. package/lib/sdk/api/modules/stt.d.ts +65 -0
  62. package/lib/sdk/api/modules/stt.spec.d.ts +1 -0
  63. package/lib/sdk/api/modules/tts.d.ts +41 -0
  64. package/lib/sdk/api/modules/tts.spec.d.ts +1 -0
  65. package/lib/sdk/api/modules/ui/types.ui.d.ts +7 -0
  66. package/lib/sdk/interfaces.d.ts +26 -1
  67. package/lib/sdk/main.d.ts +35 -6
  68. package/lib/sdk/payload.types.d.ts +284 -0
  69. package/lib/types/ai-tasks.const.d.ts +39 -1
  70. package/lib/types/call.d.ts +14 -0
  71. package/lib/types/canvases.d.ts +0 -3
  72. package/lib/types/launchDarkly.types.d.ts +1 -3
  73. package/lib/types/organizationSettings.types.d.ts +10 -0
  74. package/lib/types/sfdc.d.ts +15 -0
  75. package/lib/util/soql.util.d.ts +36 -0
  76. package/lib/util/user.d.ts +18 -0
  77. package/lib/util/user.test.d.ts +1 -0
  78. package/package.json +1 -1
  79. package/types/openapi/index.d.ts +0 -1
  80. package/types/openapi/models/DeletedEnvironment.d.ts +0 -1
  81. package/types/openapi/models/Environment.d.ts +0 -1
  82. package/types/openapi/models/EnvironmentRequest.d.ts +0 -1
  83. package/types/openapi/models/File.d.ts +2 -0
  84. package/types/openapi/models/FileRetrieve.d.ts +2 -0
  85. package/types/openapi/models/PatchedEnvironmentRequest.d.ts +0 -1
  86. package/types/openapi/models/PatchedUserRequest.d.ts +1 -2
  87. package/types/openapi/models/User.d.ts +1 -2
  88. package/types/openapi/models/UserRequest.d.ts +1 -2
  89. package/lib/sdk/api/modules/languages.d.ts +0 -8
  90. package/types/openapi/models/LanguageEnum.d.ts +0 -12
@@ -10,6 +10,7 @@ import { ActionCallback, default as useKeyboardBindings } from '../composables/k
10
10
  import { default as useSlideDirection } from '../composables/slide-direction.use';
11
11
  import { useCacheNavigation } from '../composables/navigation-cache.use';
12
12
  import { useAnnotationLayer } from '../composables/annotation-layer.use';
13
+ import { FlatSlidePosition } from '../composables/collection-navigation.util';
13
14
  export type RenderPageAsImage = (payload: {
14
15
  fileId: File['id'];
15
16
  documentId?: File['id'];
@@ -61,7 +62,9 @@ type StoreData = {
61
62
  hasManyGroups: ComputedRef<boolean>;
62
63
  activeSlide: Ref<CollectionSlide | null>;
63
64
  activeGroup: Ref<CollectionGroup | null>;
65
+ slidePosition: ComputedRef<FlatSlidePosition>;
64
66
  setActiveSlide: (group?: CollectionGroup, slide?: CollectionSlide) => void;
67
+ setActiveFlatPage: (page: number) => void;
65
68
  onSlideChange: (customEvent: CustomEvent<[swiper: Swiper]>) => void;
66
69
  activatePreviousGroup: () => void;
67
70
  activateNextGroup: () => void;
@@ -2,7 +2,7 @@ import { Ref, ComputedRef, UnwrapNestedRefs } from 'vue';
2
2
  import { FolderRetrieve, FolderFile, FileRetrieve, File, FolderFolder, FileContentTypeEnum } from '../../../../types/openapi';
3
3
  import { ApiStore } from './api';
4
4
  export type AppName = 'admin' | 'impact';
5
- export type SelectorType = 'content' | 'assets' | 'external_links' | 'ai_images' | 'pexels_images' | 'theme' | `multimedia-selector-${string}`;
5
+ export type SelectorType = 'content' | 'assets' | 'external_links' | 'pexels_images' | 'theme' | `multimedia-selector-${string}`;
6
6
  export type SortOption = 'nameAsc' | 'nameDesc' | 'modifiedAsc' | 'modifiedDesc';
7
7
  export type SelectedPage = {
8
8
  id: string;
@@ -1,7 +1,11 @@
1
1
  import { Ref, ComputedRef } from 'vue';
2
- import { Instance, AnnotationsUnion } from 'pspdfkit';
2
+ import { Instance, AnnotationsUnion } from '@nutrient-sdk/viewer';
3
3
  import { CLIENT_TYPE } from '../../../constants/cdp.const';
4
4
  import { File } from '../../../../types/openapi';
5
+ export declare function stripSdkWrapper(text: string): string;
6
+ export declare function stripCorruption(text: string): string;
7
+ export declare function normalizeText(text: string): string;
8
+ export declare function needsCorruptionRepair(text: string): boolean;
5
9
  interface UseAnnotationsReturnType {
6
10
  annotations: Ref<AnnotationsUnion[]>;
7
11
  areAnnotationsModified: Ref<boolean>;
@@ -0,0 +1,8 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ import { Instance } from '@nutrient-sdk/viewer';
3
+ interface UseFormFieldsReturnType {
4
+ areFormFieldValuesModified: ComputedRef<boolean>;
5
+ resetFormFieldChanges: () => void;
6
+ }
7
+ export declare function useFormFields(instance: Ref<Instance | undefined>): UseFormFieldsReturnType;
8
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { Ref, ComputedRef } from 'vue';
2
- import { Instance, AnnotationsUnion, List } from 'pspdfkit';
2
+ import { Instance, AnnotationsUnion, List } from '@nutrient-sdk/viewer';
3
3
  import { SaveLinkAnnotationPayload } from './CFileViewer.pdf.link.types';
4
4
  interface UseLinkAnnotationPayload {
5
5
  instance: Ref<Instance | undefined>;
@@ -1,5 +1,5 @@
1
1
  import { Ref } from 'vue';
2
- import { Instance } from 'pspdfkit';
2
+ import { Instance } from '@nutrient-sdk/viewer';
3
3
  import { FileRetrieve } from '../../../../types/openapi';
4
4
  interface UseOverlayItemsReturnType {
5
5
  setOverlayItemsForEmbeddedVideos: (currentPageIndex: number) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { Ref, ComputedRef } from 'vue';
2
2
  import { I18n } from 'vue-i18n';
3
- import { Instance, AnnotationsUnion } from 'pspdfkit';
3
+ import { Instance, AnnotationsUnion } from '@nutrient-sdk/viewer';
4
4
  import { AnnotationType } from '../CFileViewer.types';
5
5
  import { PitcherFile } from '../../../types/file.types';
6
6
  import { MiniPage, File, FileRetrieve } from '../../../../types/openapi';
@@ -27,6 +27,7 @@ interface FileViewerPdfReturnType {
27
27
  updateFileViewerSettings: (settings: Partial<typeof fileViewerSettings.value>) => void;
28
28
  cleanupPspdfKit: () => void;
29
29
  resetAnnotationChanges: () => void;
30
+ resetFormFieldChanges: () => void;
30
31
  isSearchOpen: Ref<boolean>;
31
32
  isThumbnailsOpen: Ref<boolean>;
32
33
  isTextAnnotationOpen: Ref<boolean>;
@@ -34,6 +35,7 @@ interface FileViewerPdfReturnType {
34
35
  currentPageIndex: Ref<number>;
35
36
  isAnnotationOpen: Ref<boolean>;
36
37
  areAnnotationsModified: Ref<boolean>;
38
+ areFormFieldValuesModified: ComputedRef<boolean>;
37
39
  selectedAnnotationType: Ref<Exclude<AnnotationType, 'text'>>;
38
40
  isSwitchingInteractionMode: Ref<boolean>;
39
41
  fileViewerSettings: typeof fileViewerSettings;
@@ -45,7 +47,7 @@ interface FileViewerPdfReturnType {
45
47
  onSaveLinkAnnotation: (data: SaveLinkAnnotationPayload) => void;
46
48
  hasHotspotsOnCurrentPage: Ref<boolean>;
47
49
  }
48
- declare const _default: ({ pdfViewerEl, bottomBarRef, i18n, appLocale, actions, assetsPrefix, clientType, context, pitcherSettings, launchDarkly, emit, fileId, fetchFileById, fetchDocumentInfo, }: {
50
+ declare const _default: ({ pdfViewerEl, bottomBarRef, i18n, appLocale, actions, assetsPrefix, clientType, context, pitcherSettings, launchDarkly, emit, fileId, fetchFileById, }: {
49
51
  pdfViewerEl: Ref<HTMLElement | null>;
50
52
  bottomBarRef: Ref<InstanceType<typeof CFileViewerBottomPdf> | null>;
51
53
  i18n: I18n;
@@ -59,12 +61,5 @@ declare const _default: ({ pdfViewerEl, bottomBarRef, i18n, appLocale, actions,
59
61
  fileId: ComputedRef<File["id"] | undefined>;
60
62
  emit: (name: string, ...args: any[]) => void;
61
63
  fetchFileById?: (id: FileRetrieve["id"]) => Promise<FileRetrieve>;
62
- fetchDocumentInfo?: (id: File["id"]) => Promise<{
63
- pageCount: number;
64
- pages?: Array<{
65
- width: number;
66
- height: number;
67
- }>;
68
- }>;
69
64
  }) => FileViewerPdfReturnType;
70
65
  export default _default;
@@ -1,4 +1,4 @@
1
- import { default as PSPDFKitType } from 'pspdfkit';
1
+ import { default as PSPDFKitType } from '@nutrient-sdk/viewer';
2
2
  /**
3
3
  * Tear down a PSPDFKit instance for a container without ever throwing.
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { MaybeRef } from '@vueuse/core';
3
- import { Instance } from 'pspdfkit';
3
+ import { Instance } from '@nutrient-sdk/viewer';
4
4
  import { default as CFileViewerBottomPdf } from './CFileViewerBottom.pdf.vue';
5
5
  declare const _default: ({ pdfViewerEl, bottomBarRef, instance, isThumbnailsOpen, isSearchOpen, }: {
6
6
  pdfViewerEl: MaybeRef<HTMLElement | null>;
@@ -4,6 +4,7 @@ export type FreezeStatus = 'active' | 'expired' | null;
4
4
  export declare function getFreezeStatus(canvas: Pick<CanvasRetrieve, 'metadata'>): FreezeStatus;
5
5
  export declare const SYSTEM_EXCLUDED_TAGS: readonly ["home", "share", "sharebox"];
6
6
  export declare function hasHidingTag(tags?: string[], dynamicTags?: string[]): boolean;
7
+ export declare function isTemplateHiddenFromReps(canvas: Pick<CanvasRetrieve, 'tags' | 'template'>, rendererExcludedTags?: string[]): boolean;
7
8
  export declare function useCSavedCanvasesManagement(): {
8
9
  statusOptions: {
9
10
  label: string;
@@ -7,5 +7,5 @@ import { AppFile } from '../types/app';
7
7
  */
8
8
  export declare function useCourseOnlyApps(): {
9
9
  allowCourseOnlyApps: boolean;
10
- isAppAllowed: (app: AppFile) => boolean;
10
+ isAppAllowedInHost: (app: AppFile) => boolean;
11
11
  };
@@ -1,7 +1,7 @@
1
- import { default as PSPDFKitType, ServerConfiguration } from 'pspdfkit';
1
+ import { default as PSPDFKitType, Configuration } from '@nutrient-sdk/viewer';
2
2
  declare function annotationsInterpolation({ PSPDFKit, config, data, }: {
3
3
  PSPDFKit: typeof PSPDFKitType;
4
- config: ServerConfiguration;
4
+ config: Configuration;
5
5
  data: Record<string, string>;
6
6
  }): Promise<void>;
7
7
  export default function usePdfInterpolation(strategy?: 'annotations' | 'text'): typeof annotationsInterpolation;
@@ -9,7 +9,7 @@ export type InactiveEventPayload = {
9
9
  file_id?: string;
10
10
  [key: string]: any;
11
11
  };
12
- export default function (track: (eventName: string, payload: any) => void, pitcherApi?: ReturnType<typeof usePitcherApi>, flushTrack?: (eventName: string, payload: any) => void): {
12
+ export default function (track: (eventName: string, payload: any) => void, pitcherApi?: ReturnType<typeof usePitcherApi>, flushTrack?: (eventName: string, payload: any) => void, heartbeatIntervalMs?: number): {
13
13
  registerInactiveEvent: ({ id, payload, enterEvent, exitEvent, type, }: {
14
14
  id: string;
15
15
  payload: InactiveEventPayload | ((type?: EventLifecycle) => InactiveEventPayload);
@@ -10,6 +10,7 @@ export declare const CDP_EVENT_TYPE: {
10
10
  readonly appExited: "App Exited";
11
11
  readonly canvasEntered: "Canvas Entered";
12
12
  readonly canvasExited: "Canvas Exited";
13
+ readonly canvasHeartbeat: "Canvas Heartbeat";
13
14
  readonly wizardEntered: "Wizard Entered";
14
15
  readonly wizardExited: "Wizard Exited";
15
16
  readonly canvasShared: "Canvas Shared";
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Target languages offered by the content-translation feature.
3
+ *
4
+ * ⚠️ MIRROR — the single source of truth is
5
+ * `packages/next-core/src/services/translation/languages.ts`
6
+ * (`TRANSLATION_LANGUAGES`). next-core cannot be imported from canvas-ui or the
7
+ * admin client, so the list is duplicated here for the UI pickers only. Keep the
8
+ * `locale` values byte-identical with that file: the backend resolves the DeepL
9
+ * target code and the English language name from the locale we post, so a locale
10
+ * that exists here and not there is rejected by the route.
11
+ *
12
+ * The admin client imports this from `@pitcher/canvas-ui` rather than keeping a
13
+ * third copy, so there are exactly two lists to reconcile, never more.
14
+ *
15
+ * `label` is intentionally NOT an i18n key: language names are shown in their own
16
+ * language (the endonym), which is what every locale picker in the product does,
17
+ * and it keeps the list free of the dynamic-key lookups the i18n extractor strips.
18
+ */
19
+ export interface TranslationLanguageOption {
20
+ /** Platform locale, matching the locale JSON filenames. Posted to the backend. */
21
+ locale: string;
22
+ /** Endonym shown in the picker. */
23
+ label: string;
24
+ /** Uppercase suffix the backend appends to a translated record's name. */
25
+ suffix: string;
26
+ }
27
+ export declare const TRANSLATION_LANGUAGES: readonly TranslationLanguageOption[];
28
+ /**
29
+ * Uppercase language suffix of a TRANSLATED record, read from the provenance stamp
30
+ * `metadata.pitcher.translation.language` that the duplicate-translate route writes.
31
+ * Returns undefined for an untranslated record or an unrecognised locale, so a caller
32
+ * can use the result directly as the "show a badge" condition.
33
+ */
34
+ export declare function translatedLanguageSuffix(metadata: unknown): string | undefined;
35
+ /**
36
+ * File extensions the row action and the upload picker offer.
37
+ *
38
+ * ⚠️ MIRROR — the source of truth is `DEEPL_SUPPORTED_EXTENSIONS` in
39
+ * `packages/next-core/src/services/deepl.service.ts`, which is what the
40
+ * `files/translate` route actually validates against. Every entry here MUST exist
41
+ * there, or the UI offers a translation the route answers with
42
+ * `400 invalid_request`.
43
+ *
44
+ * Legacy `.doc` and `.ppt` are deliberately absent: DeepL rejects the legacy
45
+ * binary formats, so offering them only produced that 400. The DeepL list is a
46
+ * superset (it also accepts `xlf`, `xliff`, `srt`); those stay out of the UI until
47
+ * there is a reason to surface localisation-interchange formats to admins, and a
48
+ * subset is safe in a way a superset is not.
49
+ */
50
+ export declare const TRANSLATABLE_FILE_EXTENSIONS: readonly string[];
51
+ export declare function isTranslatableFileExtension(extension?: string | null): boolean;
52
+ /**
53
+ * Extension of a file record, resolved the way the route resolves it.
54
+ *
55
+ * ⚠️ MIRROR of `resolveExtension` in
56
+ * `packages/next-core/src/app/api/protected/files/translate/route.ts`: prefer the
57
+ * explicit extension field, fall back to parsing the name. A UI gate that only
58
+ * read the explicit field hid the action on records whose extension column is
59
+ * empty even though the route would have accepted them. The API field is called
60
+ * `extension` on the detail serializer and `original_extension` on the compact
61
+ * one the browser list uses, so both are accepted here.
62
+ */
63
+ export declare function resolveFileExtension(file?: {
64
+ name?: string | null;
65
+ extension?: string | null;
66
+ original_extension?: string | null;
67
+ } | null): string;
68
+ /** Naive UI / CSelect option shape for the language pickers. */
69
+ export declare function translationLanguageOptions(): {
70
+ label: string;
71
+ value: string;
72
+ }[];
package/lib/main.lib.d.ts CHANGED
@@ -178,6 +178,7 @@ export { usePolling } from './composables/usePolling';
178
178
  export { default as useBroadcastRouteChange } from './composables/useBroadcastRouteChange';
179
179
  export * from './plugins/vueQuery';
180
180
  export * from './apps/canvas-builder/util/canvas.util';
181
+ export * from './apps/canvas-builder/util/completionWizard.util';
181
182
  export * from './apps/canvas-builder/util/tree';
182
183
  export * from './apps/canvas-builder/util/print.util';
183
184
  export * from './components/filters/filter.util';
@@ -267,6 +268,7 @@ export * from './constants/conventions.const';
267
268
  export * from './constants/config.const';
268
269
  export * from './constants/pitcherSettings.const';
269
270
  export * from './constants/appsDb.const';
271
+ export * from './constants/translationLanguages.const';
270
272
  export * from './apps/canvas-builder/constants/theme.const';
271
273
  export * from './constants/roles.const';
272
274
  export type { RolePermissions } from './constants/roles.const';
@@ -1,6 +1,5 @@
1
1
  import { LowLevelApi } from './LowLevelApi';
2
2
  import { PitcherEvent, ApiOptions } from '../interfaces';
3
- import * as modules from './modules';
4
3
  /**
5
4
  * Creates a high-level API instance and caches it. Reterns a new instance only if new options are provided.
6
5
  */
@@ -123,9 +122,11 @@ export declare function createHighLevelApi(options?: ApiOptions): {
123
122
  * @returns {Promise<void>}
124
123
  */
125
124
  unsubscribe: () => Promise<any>;
125
+ postJsonWithTimeout<T>(url: string, body: unknown, accessToken: string, timeoutMs: number, label: string): Promise<T>;
126
126
  aiGetCapabilities(): Promise<import('../payload.types').AIRuntimeCapabilities>;
127
127
  aiComplete(payload: import('../payload.types').AICompletePayload): Promise<import('../payload.types').AICompleteResult>;
128
128
  piaSearchAnswer(payload: import('../payload.types').PiaSearchAnswerPayload): Promise<import('../payload.types').PiaSearchAnswerResult>;
129
+ weeklyFocusRank(payload: import('../payload.types').WeeklyFocusRankPayload): Promise<import('../payload.types').WeeklyFocusRankResult>;
129
130
  appsDbGetEntries(payload: import('../payload.types').AppsDbGetEntriesPayload): Promise<import('../payload.types').AppsDbEntriesResult>;
130
131
  appsDbUpsertEntry(payload: import('../payload.types').AppsDbUpsertEntryPayload): Promise<import('../payload.types').AppsDbEntry>;
131
132
  appsDbDeleteEntry(payload: import('../payload.types').AppsDbDeleteEntryPayload): Promise<void>;
@@ -134,10 +135,9 @@ export declare function createHighLevelApi(options?: ApiOptions): {
134
135
  openExternalUrl(payload: import('../payload.types').OpenExternalUrlRequestPayload): Promise<void>;
135
136
  getEnv(): Promise<import('../interfaces').PitcherEnv>;
136
137
  updateMyUser(payload: {
137
- language?: import('../../main.lib').LanguageEnum | undefined;
138
+ language?: string | undefined;
138
139
  }): Promise<import('../../main.lib').User>;
139
140
  isOffline(): Promise<boolean>;
140
- getLanguages(): Promise<modules.Language[]>;
141
141
  getCanvases(payload: import('../../main.lib').GetCanvasesParams & {
142
142
  filters?: Record<string, any>;
143
143
  fields?: string;
@@ -149,7 +149,20 @@ export declare function createHighLevelApi(options?: ApiOptions): {
149
149
  updateCanvas(payload: import('../../main.lib').PatchedCanvasUpdateRequest & {
150
150
  id: import('../../main.lib').CanvasRetrieve["id"];
151
151
  instance_id?: import('../../main.lib').Instance["id"];
152
- fields?: string;
152
+ fields
153
+ /**
154
+ * Make the entire CatalogIQ fullscreen.
155
+ *
156
+ * @example
157
+ * usePitcherApi().enterFullscreen()
158
+ */
159
+ ? /**
160
+ * Make the entire CatalogIQ fullscreen.
161
+ *
162
+ * @example
163
+ * usePitcherApi().enterFullscreen()
164
+ */: string;
165
+ lazy_sections?: boolean;
153
166
  }): Promise<import('../../main.lib').CanvasRetrieve>;
154
167
  updateCanvasIndicators(payload: {
155
168
  indicators: Record<string, import('../../main.lib').CanvasIndicator>;
@@ -159,11 +172,7 @@ export declare function createHighLevelApi(options?: ApiOptions): {
159
172
  getCanvas(payload: {
160
173
  id: import('../../main.lib').CanvasRetrieve["id"];
161
174
  fields?: string;
162
- lazy_sections? /**
163
- * Subscribe to updates.
164
- *
165
- * @returns {Promise<void>}
166
- */: boolean;
175
+ lazy_sections?: boolean;
167
176
  }): Promise<import('../../main.lib').CanvasRetrieve>;
168
177
  getSectionsByIds(payload: {
169
178
  canvas_id: import('../../main.lib').CanvasRetrieve["id"];
@@ -305,5 +314,13 @@ export declare function createHighLevelApi(options?: ApiOptions): {
305
314
  canvas_id: import('../../main.lib').CanvasRetrieve["id"];
306
315
  theme_id: import('../../main.lib').CanvasThemeRetrieve["id"];
307
316
  }>;
317
+ sttStart(payload: import('../payload.types').SttStartPayload): Promise<void>;
318
+ sttAvailability(): Promise<import('../payload.types').SttAvailabilityResult>;
319
+ sttWarmup(): Promise<void>;
320
+ sttStop(payload: import('../payload.types').SttStopPayload): Promise<import('../payload.types').SttStopResult>;
321
+ sttErrorCode(error: unknown): import('../payload.types').SttErrorCode | undefined;
322
+ ttsSpeak(payload: import('../payload.types').TtsSpeakPayload): Promise<import('../payload.types').TtsSpeakResult>;
323
+ ttsStop(): Promise<void>;
324
+ ttsErrorCode(error: unknown): import('../payload.types').TtsErrorCode | undefined;
308
325
  API: LowLevelApi;
309
326
  };
@@ -254,6 +254,7 @@ export type AdminEnv = {
254
254
  mode?: PitcherEnv['mode'];
255
255
  pitcher: PitcherEnv['pitcher'];
256
256
  launch_darkly?: LaunchDarklyEnv;
257
+ ui_locale?: PitcherEnv['ui_locale'];
257
258
  client_type?: (typeof CLIENT_TYPE)[keyof typeof CLIENT_TYPE];
258
259
  crm_shape?: Record<string, any>;
259
260
  state?: PitcherEnv['state'];
@@ -1,4 +1,17 @@
1
- import { AICompletePayload, AICompleteResult, AIRuntimeCapabilities, PiaSearchAnswerPayload, PiaSearchAnswerResult } from '../../payload.types';
1
+ import { AICompletePayload, AICompleteResult, AIRuntimeCapabilities, PiaSearchAnswerPayload, PiaSearchAnswerResult, WeeklyFocusRankPayload, WeeklyFocusRankResult } from '../../payload.types';
2
+ /**
3
+ * POST JSON to a next-core route with a hard deadline, returning the parsed body.
4
+ * The shared scaffold behind the SDK's online AI calls (`piaSearchAnswer`,
5
+ * `weeklyFocusRank`).
6
+ *
7
+ * Bounds the WHOLE request including the body read: `fetch()` resolves on headers
8
+ * alone, so reading `.json()` INSIDE the timed window (and letting the abort
9
+ * cancel that read too — hence `clearTimeout` in `finally`) is what stops a
10
+ * response that stalls mid-body from hanging unbounded. `label` names the route
11
+ * in BOTH the non-2xx error (`<label> <status>`) and the timeout error, so each
12
+ * caller keeps its exact error strings.
13
+ */
14
+ export declare function postJsonWithTimeout<T>(url: string, body: unknown, accessToken: string, timeoutMs: number, label: string): Promise<T>;
2
15
  /**
3
16
  * Capabilities of the AI completion runtime on the current platform.
4
17
  *
@@ -50,3 +63,32 @@ export declare function aiComplete(payload: AICompletePayload): Promise<AIComple
50
63
  * console.log(result.answer, result.cited_file_ids, result.source)
51
64
  */
52
65
  export declare function piaSearchAnswer(payload: PiaSearchAnswerPayload): Promise<PiaSearchAnswerResult>;
66
+ /**
67
+ * Rank the rep's next-7-days meetings by how much preparation they need — the
68
+ * ONE high-level Weekly Focus call (PIT-7257), the `weekly_focus` AITask.
69
+ *
70
+ * The on-device path runs the prompt, window, parser and ordinal resolver from
71
+ * `@lib/ai-tasks/weekly-focus`; the online route runs next-core's parallel copy
72
+ * of the same logic. The two are kept in lockstep by matching test suites, not a
73
+ * shared import (see that module's header / ADR-002), so the two paths produce
74
+ * the same shape:
75
+ *
76
+ * - iOS with an available local model → `aiComplete` over the caller-supplied
77
+ * meetings + account context. Unavailable models / unusable output fall through.
78
+ * - Otherwise → POST to the next-core Bedrock route.
79
+ *
80
+ * The model picks meetings by ORDINAL and the resolver maps them back to
81
+ * event_ids, dropping out-of-range ones — so a returned id can only come from
82
+ * the `meetings` passed in.
83
+ *
84
+ * This does NOT cache, lock or prewarm: an app that generates on a schedule (as
85
+ * pre-call-brief does) owns those mechanics and calls this underneath.
86
+ *
87
+ * @param {WeeklyFocusRankPayload} payload - The meetings + optional account context.
88
+ * @returns {Promise<WeeklyFocusRankResult>} - Ranking with the serving `source`.
89
+ *
90
+ * @example
91
+ * const focus = await api.weeklyFocusRank({ meetings, context })
92
+ * console.log(focus.hero, focus.top, focus.collapsed_count)
93
+ */
94
+ export declare function weeklyFocusRank(payload: WeeklyFocusRankPayload): Promise<WeeklyFocusRankResult>;
@@ -0,0 +1 @@
1
+ export {};
@@ -44,6 +44,14 @@ export declare function updateCanvas(payload: PatchedCanvasUpdateRequest & {
44
44
  id: CanvasRetrieve['id'];
45
45
  instance_id?: Instance['id'];
46
46
  fields?: string;
47
+ /**
48
+ * Request the lazy "shell" on the PATCH response (section stubs +
49
+ * `section_ids` instead of expanded bodies). No-op unless the instance's
50
+ * `lazy_load_sections` setting is on (server-side double-gate). With a
51
+ * `fields` list that excludes `sections`, the response is byte-identical —
52
+ * only the server-side cost drops (PIT-7073).
53
+ */
54
+ lazy_sections?: boolean;
47
55
  }): Promise<CanvasRetrieve>;
48
56
  /**
49
57
  * Updates canvas indicators by canvas ID. It merges the passed object into existing canvas indicators adding new keys if they were empty and overriding pre-existing keys.
@@ -2,7 +2,6 @@ export * from './ai';
2
2
  export * from './appsDb';
3
3
  export * from './open';
4
4
  export * from './env';
5
- export * from './languages';
6
5
  export * from './canvas';
7
6
  export * from './files';
8
7
  export * from './filesRevisions';
@@ -21,3 +20,5 @@ export * from './feedback';
21
20
  export * from './webView';
22
21
  export * from './share';
23
22
  export * from './theme';
23
+ export * from './stt';
24
+ export * from './tts';
@@ -0,0 +1,65 @@
1
+ import { SttAvailabilityResult, SttErrorCode, SttStartPayload, SttStopPayload, SttStopResult } from '../../payload.types';
2
+ export declare function sttStart(payload: SttStartPayload): Promise<void>;
3
+ /**
4
+ * Check whether dictation can be offered — a side-effect-free capability probe
5
+ * to gate a mic button. Does NOT prompt for the microphone or download a model.
6
+ * Answered by the native bridge on iOS and the Impact host on web.
7
+ *
8
+ * @returns {Promise<SttAvailabilityResult>} `{ available, engine, reason? }` —
9
+ * `available` is true only when the feature is enabled AND an engine can run;
10
+ * `engine` is what would answer {@link sttStart} (`"webspeech"` sends audio
11
+ * off-device); `reason` is `"disabled"` or `"unsupported"` when not available.
12
+ *
13
+ * @example
14
+ * const { available, engine } = await api.sttAvailability()
15
+ * if (available) showMicButton({ warnCloud: engine === 'webspeech' })
16
+ */
17
+ export declare function sttAvailability(): Promise<SttAvailabilityResult>;
18
+ /**
19
+ * Pre-load the on-device dictation model so a later {@link sttStart} resolves
20
+ * instantly (and the mic-permission prompt appears immediately instead of after
21
+ * a download). **Web only** — on iOS the native side manages its own model
22
+ * lifecycle, so the bridge has no `stt.warmup` type and calling it there rejects
23
+ * `requestTypeDoesNotExists`.
24
+ *
25
+ * Fire-and-forget: don't block your UI on it and ignore rejections. It is
26
+ * idempotent (repeated / concurrent calls collapse to a single download) and a
27
+ * no-op when the feature is disabled or the engine has nothing to warm (Web
28
+ * Speech fallback). Call it right after {@link sttAvailability} reports
29
+ * `available` with `engine === 'whisper'`.
30
+ *
31
+ * @returns {Promise<void>} Resolves once the model is ready (or immediately when
32
+ * there's nothing to warm).
33
+ *
34
+ * @example
35
+ * const { available, engine } = await api.sttAvailability()
36
+ * if (available) {
37
+ * showMicButton()
38
+ * if (engine === 'whisper') api.sttWarmup().catch(() => {}) // background, non-blocking
39
+ * }
40
+ */
41
+ export declare function sttWarmup(): Promise<void>;
42
+ /**
43
+ * Finalize a dictation session. Resolves with the final full transcript;
44
+ * rejects with `STT_NOT_RECORDING` if the session isn't active.
45
+ *
46
+ * @param {SttStopPayload} payload
47
+ * @param {string} payload.session_id - The id passed to the matching {@link sttStart}.
48
+ * @returns {Promise<SttStopResult>} The final `{ transcript }`.
49
+ *
50
+ * @example
51
+ * const { transcript } = await api.sttStop({ session_id: 'notes-1' })
52
+ */
53
+ export declare function sttStop(payload: SttStopPayload): Promise<SttStopResult>;
54
+ /**
55
+ * Extract the {@link SttErrorCode} from a rejected `sttStart` / `sttStop`,
56
+ * normalizing across hosts: the iOS bridge rejection (`error_code` /
57
+ * `errorCode`) and Impact web's `{ reason }` / error `message` string. Returns
58
+ * `undefined` if no known code is present.
59
+ *
60
+ * @example
61
+ * try { await api.sttStart({ session_id }) } catch (err) {
62
+ * if (api.sttErrorCode(err) === 'STT_BUSY') showMicInUseHint()
63
+ * }
64
+ */
65
+ export declare function sttErrorCode(error: unknown): SttErrorCode | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import { TtsErrorCode, TtsSpeakPayload, TtsSpeakResult } from '../../payload.types';
2
+ /**
3
+ * Speak text on the device speaker. Resolves when the utterance FINISHES;
4
+ * rejects with a {@link TtsErrorCode}.
5
+ *
6
+ * @param {TtsSpeakPayload} payload
7
+ * @param {string} payload.text - Text to speak. Empty/whitespace rejects with `TTS_EMPTY_TEXT`.
8
+ * @param {string} [payload.language] - BCP-47/ISO tag (e.g. `"en-US"`); requires
9
+ * an installed offline voice, else rejects with `TTS_VOICE_UNAVAILABLE`. Omit
10
+ * for the system voice.
11
+ * @param {number} [payload.rate] - Speech rate; clamped to the platform min…max.
12
+ * @param {number} [payload.pitch] - Speech pitch; clamped `0.5`…`2.0` (`1.0` = normal).
13
+ * @returns {Promise<TtsSpeakResult>} `{ completed }` — `true` if it finished
14
+ * naturally, `false` if stopped or replaced by a newer `ttsSpeak`.
15
+ *
16
+ * @example
17
+ * const { completed } = await api.ttsSpeak({ text: 'Meeting summary saved.', language: 'en-US' })
18
+ */
19
+ export declare function ttsSpeak(payload: TtsSpeakPayload): Promise<TtsSpeakResult>;
20
+ /**
21
+ * Stop any in-flight speech. The in-flight {@link ttsSpeak} resolves with
22
+ * `{ completed: false }`.
23
+ *
24
+ * @returns {Promise<void>}
25
+ *
26
+ * @example
27
+ * await api.ttsStop()
28
+ */
29
+ export declare function ttsStop(): Promise<void>;
30
+ /**
31
+ * Extract the {@link TtsErrorCode} from a rejected {@link ttsSpeak}, normalizing
32
+ * across hosts: the iOS bridge APIError (`code` / `error_code` / `errorCode`)
33
+ * and a host `{ reason }` / error `message` string. Returns `undefined` if no
34
+ * known code is present.
35
+ *
36
+ * @example
37
+ * try { await api.ttsSpeak({ text, language }) } catch (err) {
38
+ * if (api.ttsErrorCode(err) === 'TTS_VOICE_UNAVAILABLE') promptVoiceDownload()
39
+ * }
40
+ */
41
+ export declare function ttsErrorCode(error: unknown): TtsErrorCode | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -58,6 +58,13 @@ export declare const UI_MESSAGE_TYPES: {
58
58
  export declare const UI_NATIVE_MESSAGE_TYPES: readonly ["ui_app_set_data", "ui_app_update_data", "ui_canvas_updated"];
59
59
  export type UiBroadcastRequest = Record<string, any>;
60
60
  export type UiSelectContentRequest = {
61
+ /**
62
+ * Named sub-embedding of the content selector, forwarded verbatim to the selector app's
63
+ * `window.initialize` payload so ONE selector app can present itself differently per
64
+ * caller (PIT-7510: `ng-wizard` for the pitchdeck wizard). `embed_location` itself is set
65
+ * by the HOST and always wins, so a caller-specific context needs its own field.
66
+ */
67
+ embed_variant?: string;
61
68
  /** Array of selections */
62
69
  selections?: Selection[];
63
70
  content_type?: 'file' | 'slide' | 'content';
@@ -5,6 +5,7 @@ import { PitcherInstance } from '../types/instance.types';
5
5
  import { LaunchDarklyEnv } from '../types/launchDarkly.types';
6
6
  import { CDP_EVENT_TYPE, CLIENT_TYPE } from '../constants/cdp.const';
7
7
  import { PeerConnectivityEvent } from './peer-connectivity';
8
+ import { SttPartialEvent, SttInterruptedEvent } from './payload.types';
8
9
  export declare const PITCHER_EVENT: "PITCHER_EVENT";
9
10
  export declare enum PitcherMessageType {
10
11
  REQUEST = "PITCHER_REQUEST",
@@ -71,6 +72,10 @@ export interface PitcherEnv {
71
72
  active_canvas_id?: CanvasRetrieve['id'];
72
73
  canvas_correlation_id?: string;
73
74
  };
75
+ /** Locale the user picked in the Pitcher shell. Web only — iOS has no picker
76
+ * and reports `device_locale` instead. Apps should prefer this and fall back:
77
+ * `ui_locale || device_locale`. */
78
+ ui_locale?: string;
74
79
  device_locale?: string;
75
80
  sync_badge_value?: number;
76
81
  }
@@ -113,6 +118,12 @@ export interface StartCallPitcherEvent {
113
118
  * instead of "Unscheduled".
114
119
  */
115
120
  meeting_id?: string;
121
+ /**
122
+ * PIT-7462: start and immediately stop the call, opening the postcall form.
123
+ * The host seeds the call's eventDate from the scheduled meeting record
124
+ * (StartDateTime/EndDateTime) so the form never shows a 0-second duration.
125
+ */
126
+ jump_to_postcall?: boolean;
116
127
  canvas_id?: string;
117
128
  edit_mode?: 'true' | 'false';
118
129
  post_action?: string;
@@ -166,7 +177,9 @@ export declare enum PitcherEventName {
166
177
  ITEM_SHAREBOX_ADD_COMPLETED = "item_sharebox_add_completed",
167
178
  SYNC_BADGE_VALUE_REPORTED = "sync_badge_value_reported",
168
179
  SYNC_BOX_RESOLVE_ERROR_TAPPED = "sync_box_resolve_error_tapped",
169
- PEER_CONNECTIVITY_EVENT = "peer_connectivity_event"
180
+ PEER_CONNECTIVITY_EVENT = "peer_connectivity_event",
181
+ STT_PARTIAL = "stt.partial",
182
+ STT_INTERRUPTED = "stt.interrupted"
170
183
  }
171
184
  export declare enum PitcherBroadcastedEventName {
172
185
  UI_SHOW_MODAL = "ui:show-modal",
@@ -487,6 +500,18 @@ export interface PitcherEventMap {
487
500
  last_error: string;
488
501
  };
489
502
  [PitcherEventName.PEER_CONNECTIVITY_EVENT]: PeerConnectivityEvent;
503
+ /**
504
+ * Speech-to-text dictation partial (PITCHER_REQUEST `stt.start` session).
505
+ * Cross-platform (iOS bridge and the web host engine). `text` is the FULL
506
+ * transcript so far — replace, don't append.
507
+ */
508
+ [PitcherEventName.STT_PARTIAL]: SttPartialEvent;
509
+ /**
510
+ * Speech-to-text dictation session ended WITHOUT a `stt.stop` (e.g. a call
511
+ * recording preempted the mic on iOS, or a fatal capture error on web). Stop
512
+ * waiting for partials and reset the field. Cross-platform.
513
+ */
514
+ [PitcherEventName.STT_INTERRUPTED]: SttInterruptedEvent;
490
515
  [PitcherBroadcastedEventName.UI_SHOW_MODAL]: void;
491
516
  [PitcherBroadcastedEventName.UI_HIDE_MODAL]: void;
492
517
  [PitcherBroadcastedEventName.FILE_DOWNLOAD]: {